On 24/04/2025 20:58, Paul Menzel wrote: > Dear Alan, > > > Thank you for looking into this. > > > Am 24.04.25 um 20:07 schrieb Alan Maguire: >> On 22/04/2025 14:33, Paul Menzel wrote: > >>> Trying to build Linux 6.12.23 with BTF and pahole 1.30, I get the build >>> failure below: >>> >>> $ more .config >>> […] >>> # >>> # Compile-time checks and compiler options >>> # >>> CONFIG_DEBUG_INFO=y >>> CONFIG_AS_HAS_NON_CONST_ULEB128=y >>> # CONFIG_DEBUG_INFO_NONE is not set >>> # CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT is not set >>> # CONFIG_DEBUG_INFO_DWARF4 is not set >>> CONFIG_DEBUG_INFO_DWARF5=y >>> # CONFIG_DEBUG_INFO_REDUCED is not set >>> CONFIG_DEBUG_INFO_COMPRESSED_NONE=y >>> # CONFIG_DEBUG_INFO_COMPRESSED_ZLIB is not set >>> # CONFIG_DEBUG_INFO_SPLIT is not set >>> CONFIG_DEBUG_INFO_BTF=y >>> CONFIG_PAHOLE_HAS_SPLIT_BTF=y >>> CONFIG_DEBUG_INFO_BTF_MODULES=y >>> # CONFIG_MODULE_ALLOW_BTF_MISMATCH is not set >>> # CONFIG_GDB_SCRIPTS is not set >>> CONFIG_FRAME_WARN=2048 >>> # CONFIG_STRIP_ASM_SYMS is not set >>> # CONFIG_READABLE_ASM is not set >>> # CONFIG_HEADERS_INSTALL is not set >>> # CONFIG_DEBUG_SECTION_MISMATCH is not set >>> CONFIG_SECTION_MISMATCH_WARN_ONLY=y >>> CONFIG_OBJTOOL=y >>> # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set >>> # end of Compile-time checks and compiler options >>> […] >>> $ make -j100 >>> […] >>> LD .tmp_vmlinux1 >>> BTF .tmp_vmlinux1.btf.o >>> die__process: DW_TAG_compile_unit, DW_TAG_type_unit, >>> DW_TAG_partial_unit or DW_TAG_skeleton_unit expected got INVALID (0x0) @ >>> 115a4a9! >>> error decoding cu >>> pahole: .tmp_vmlinux1: Invalid argument >>> NM .tmp_vmlinux1.syms >>> KSYMS .tmp_vmlinux1.kallsyms.S >>> AS .tmp_vmlinux1.kallsyms.o >>> LD .tmp_vmlinux2 >>> NM .tmp_vmlinux2.syms >>> KSYMS .tmp_vmlinux2.kallsyms.S >>> AS .tmp_vmlinux2.kallsyms.o >>> LD vmlinux >>> BTFIDS vmlinux >>> libbpf: failed to find '.BTF' ELF section in vmlinux >>> FAILED: load BTF from vmlinux: No data available >>> make[2]: *** [scripts/Makefile.vmlinux:34: vmlinux] Error 255 >>> make[2]: *** Deleting file 'vmlinux' >>> make[1]: *** [/dev/shm/linux/Makefile:1179: vmlinux] Error 2 >>> make: *** [Makefile:224: __sub-make] Error 2 >>> >>> Help how to get a successful build is much appreciated. >>> >> >> I haven't been able to reproduce this one yet with your config; >> I tried with bpf-next + gcc-14, then switched to linux stable 6.12y + >> gcc 12 as that more closely matched your situation; all works fine for >> me. I'll try more precisely matching the gcc 12 version; things worked >> fine with pahole v.130 + gcc 12.2.1; from your config looks like you >> have gcc 12.3.0. > > I also tried gcc 14.1.0, and now Linux origin/master (e72e9e6933071 > (Merge tag 'net-6.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/ > git/netdev/net)) with gcc 12.3.0. We do build GCC ourselves [1]. Maybe > there is something missing? > > I built with `make V=1` now, and here are the commands: > > ``` > $ make V=1 > […] > + ld -m elf_x86_64 -z noexecstack --no-warn-rwx-segments -z max-page- > size=0x200000 --build-id=sha1 --orphan-handling=warn --script=./arch/ > x86/kernel/vmlinux.lds -o .tmp_vmlinux1 --whole-archive > vmlinux.o .vmlinux.export.o init/version-timestamp.o --no-whole-archive > --start-group --end-group .tmp_vmlinux0.kallsyms.o > + is_enabled CONFIG_DEBUG_INFO_BTF > + grep -q '^CONFIG_DEBUG_INFO_BTF=y' include/config/auto.conf > + gen_btf .tmp_vmlinux1 > + local btf_data=.tmp_vmlinux1.btf.o > + info BTF .tmp_vmlinux1.btf.o > + printf ' %-7s %s\n' BTF .tmp_vmlinux1.btf.o > BTF .tmp_vmlinux1.btf.o > + LLVM_OBJCOPY=objcopy > + pahole -J -j -- > btf_features=encode_force,var,float,enum64,decl_tag,type_tag,optimized_func,consistent_func,decl_tag_kfuncs --lang_exclude=rust .tmp_vmlinux1 > die__process: DW_TAG_compile_unit, DW_TAG_type_unit, DW_TAG_partial_unit > or DW_TAG_skeleton_unit expected got INVALID (0x0) @ 1229728! > error decoding cu > pahole: .tmp_vmlinux1: Invalid argument > […] > ``` > > I uploaded `.tmp_vmlinux1` (295 MB) [3]. > > Copying this file to a Debian sid/unstable system with *pahole* 1.30-1, > and *llvm-19* 1:19.1.7-3, there is no error. > > $ ls -l /usr/bin/llvm-objcopy > lrwxrwxrwx 1 root root 31 Nov 11 12:42 /usr/bin/llvm-objcopy -> ../ > lib/llvm-19/bin/llvm-objcopy > $ llvm-objcopy --version > llvm-objcopy, compatible with GNU objcopy > Debian LLVM version 19.1.7 > Optimized build. > > In the problematic environment, we have LLVM 18.1.8 installed: > > $ llvm-objcopy --version > llvm-objcopy, compatible with GNU objcopy > LLVM (http://llvm.org/): > LLVM version 18.1.8 > Optimized build. > Thanks for the additional info! I tried BTF generation with the tmp_vmlinux1 you provided, and all worked okay for me. From the above it looks like pahole is using objcopy (LLVM_OBJCOPY=objcopy) rather than llvm-objcopy to copy the ELF sections around, so are there differences in objcopy version between working/failing systems perhaps? Or other library differences in the built pahole on working and failing systems revealed by "ldd $(which pahole)"? If we can track down any differences like that it might give as a clue as to the source of the issue. Thanks! Alan