Em Wed, Sep 28, 2022 at 02:35:48PM -0700, Nick Desaulniers escreveu: > On Tue, Sep 27, 2022 at 11:56 AM Nathan Chancellor <nathan@xxxxxxxxxx> wrote: > > > > Hi Arnaldo, > > > > When building a kernel with LLVM and CONFIG_DEBUG_INFO_BTF after commit > > 32ef9e5054ec ("Makefile.debug: re-enable debug info for .S files") in > > the kernel, I see the following spew of warnings, which appear to come > > from pahole: > > > > $ clang --version > > clang version 15.0.0 (Fedora 15.0.0-3.fc38) > > Target: x86_64-redhat-linux-gnu > > Thread model: posix > > InstalledDir: /usr/bin > > > > $ pahole --version > > v1.24 > > > > $ make -skj"$(nproc)" ARCH=x86_64 LLVM=1 defconfig > > > > $ scripts/config \ > > -d DEBUG_INFO_NONE \ > > -e BPF_SYSCALL \ > > -e DEBUG_INFO_BTF \ > > -e DEBUG_INFO_DWARF5 > > > > $ make -skj"$(nproc)" ARCH=x86_64 LLVM=1 olddefconfig all > > ... > > die__process_unit: DW_TAG_label (0xa) @ <0x7b> not handled! > > die__process_unit: tag not supported 0xa (label)! > > die__process_unit: DW_TAG_label (0xa) @ <0x97> not handled! > > die__process_unit: DW_TAG_label (0xa) @ <0xbd> not handled! > > die__process_unit: DW_TAG_label (0xa) @ <0xed> not handled! > > die__process_unit: DW_TAG_label (0xa) @ <0x109> not handled! > > die__process_unit: DW_TAG_label (0xa) @ <0x12a> not handled! > > die__process_unit: DW_TAG_label (0xa) @ <0x146> not handled! > > die__process_unit: DW_TAG_label (0xa) @ <0x16f> not handled! > > Running llvm-dwarfdump on vmlinux, I see: > > ``` > $ make -skj"$(nproc)" ARCH=x86_64 LLVM=1 olddefconfig all > die__process_unit: DW_TAG_label (0xa) @ <0xbf> not handled! > die__process_unit: tag not supported 0xa (label)! > ... > $ llvm-dwarfdump vmlinux | less > ... > 0x000000bf: DW_TAG_label > DW_AT_name ("startup_64") > DW_AT_decl_file > ("/android0/kernel-all/arch/x86/kernel/head_64.S") > DW_AT_decl_line (868) > DW_AT_low_pc (0xffffffff81000000) > > 0x000000db: DW_TAG_label > DW_AT_name ("secondary_startup_64") > DW_AT_decl_file > ("/android0/kernel-all/arch/x86/kernel/head_64.S") > DW_AT_decl_line (921) > DW_AT_low_pc (0xffffffff81000060) > ... > ``` > > So these seem to be labels in assembler sources. The DW_TAGs look the > same to be for labels from C sources. Interesting, I think its just a matter of ignoring those when they appear on the DW_TAG_compile_unit then > > ... > > > > Is this a problem with LLVM or pahole? I do not see this when building > > with GCC + GNU as but that could just be a red herring. I assume that > > there could be something missing for processing debug info from > > assembly, perhaps? > > That's what I suspect. > > > If there is any further information I can provide or > > anything I can test, I am more than happy to do so. > > > > Cheers, > > Nathan > > I swear I used to be able to build pahole from sources...just moved to > a new machine and something seems off... > $ sudo apt install libdwarf-dev libdw-dev > $ git clone git://git.kernel.org/pub/scm/devel/pahole/pahole.git > $ mkdir pahole/build > $ cd !$ > $ cmake -D__LIB=lib .. > $ make > ... > [ 63%] Linking C executable codiff > /usr/bin/ld: libdwarves.so.1.0.0: undefined reference to `dwfl_module_getelf' > /usr/bin/ld: libdwarves.so.1.0.0: undefined reference to `dwfl_report_end' Strange, can you try without that -D__LIB=lib? here, fedora:37, in a toolbox: ⬢[acme@toolbox pahole]$ cd /tmp ⬢[acme@toolbox tmp]$ git clone git://git.kernel.org/pub/scm/devel/pahole/pahole.git Cloning into 'pahole'... remote: Enumerating objects: 24, done. remote: Counting objects: 100% (24/24), done. remote: Compressing objects: 100% (24/24), done. remote: Total 8346 (delta 8), reused 0 (delta 0), pack-reused 8322 Receiving objects: 100% (8346/8346), 2.14 MiB | 1.68 MiB/s, done. Resolving deltas: 100% (6008/6008), done. ⬢[acme@toolbox tmp]$ cd pahole/ ⬢[acme@toolbox pahole]$ mkdir build ⬢[acme@toolbox pahole]$ cd build ⬢[acme@toolbox build]$ cmake .. -- The C compiler identification is GNU 12.2.1 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/lib64/ccache/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Setting BUILD_SHARED_LIBS = ON -- Checking availability of DWARF and ELF development libraries -- Looking for dwfl_module_build_id in elf -- Looking for dwfl_module_build_id in elf - found -- Found dwarf.h header: /usr/include -- Found elfutils/libdw.h header: /usr/include -- Found libdw library: /usr/lib64/libdw.so -- Found libelf library: /usr/lib64/libelf.so -- Checking availability of DWARF and ELF development libraries - done -- Found ZLIB: /usr/lib64/libz.so (found version "1.2.11") -- Checking availability of argp library -- Assuming argp is in libc -- Checking availability of argp library - done -- Checking availability of obstack library -- Assuming obstack is in libc -- Checking availability of obstack library - done -- Submodule update Submodule 'lib/bpf' (https://github.com/libbpf/libbpf) registered for path 'lib/bpf' Cloning into '/tmp/pahole/lib/bpf'... Submodule path 'lib/bpf': checked out '645500dd7d2d6b5bb76e4c0375d597d4f0c4814e' -- Submodule update - done -- Performing Test HAVE_REALLOCARRAY_SUPPORT -- Performing Test HAVE_REALLOCARRAY_SUPPORT - Success -- Configuring done -- Generating done -- Build files have been written to: /tmp/pahole/build ⬢[acme@toolbox build]$ cd .. ⬢[acme@toolbox pahole]$ make -C build make: Entering directory '/tmp/pahole/build' make[1]: Entering directory '/tmp/pahole/build' make[2]: Entering directory '/tmp/pahole/build' make[2]: Leaving directory '/tmp/pahole/build' make[2]: Entering directory '/tmp/pahole/build' [ 1%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/bpf.c.o [ 3%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/bpf_prog_linfo.c.o [ 5%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/btf.c.o [ 7%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/btf_dump.c.o [ 9%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/gen_loader.c.o [ 10%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/hashmap.c.o [ 12%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/libbpf.c.o [ 14%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/libbpf_errno.c.o [ 16%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/libbpf_probes.c.o [ 18%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/linker.c.o [ 20%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/netlink.c.o [ 21%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/nlattr.c.o [ 23%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/relo_core.c.o [ 25%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/ringbuf.c.o [ 27%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/str_error.c.o [ 29%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/strset.c.o [ 30%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/usdt.c.o [ 32%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/xsk.c.o make[2]: Leaving directory '/tmp/pahole/build' [ 32%] Built target bpf make[2]: Entering directory '/tmp/pahole/build' make[2]: Leaving directory '/tmp/pahole/build' make[2]: Entering directory '/tmp/pahole/build' [ 34%] Building C object CMakeFiles/dwarves.dir/dwarves.c.o [ 36%] Building C object CMakeFiles/dwarves.dir/dwarves_fprintf.c.o [ 38%] Building C object CMakeFiles/dwarves.dir/gobuffer.c.o [ 40%] Building C object CMakeFiles/dwarves.dir/ctf_loader.c.o [ 41%] Building C object CMakeFiles/dwarves.dir/libctf.c.o [ 43%] Building C object CMakeFiles/dwarves.dir/btf_encoder.c.o [ 45%] Building C object CMakeFiles/dwarves.dir/btf_loader.c.o [ 47%] Building C object CMakeFiles/dwarves.dir/dwarf_loader.c.o [ 49%] Building C object CMakeFiles/dwarves.dir/dutil.c.o [ 50%] Building C object CMakeFiles/dwarves.dir/elf_symtab.c.o [ 52%] Building C object CMakeFiles/dwarves.dir/rbtree.c.o [ 54%] Linking C shared library libdwarves.so make[2]: Leaving directory '/tmp/pahole/build' [ 54%] Built target dwarves make[2]: Entering directory '/tmp/pahole/build' make[2]: Leaving directory '/tmp/pahole/build' make[2]: Entering directory '/tmp/pahole/build' [ 56%] Building C object CMakeFiles/dwarves_emit.dir/dwarves_emit.c.o [ 58%] Linking C shared library libdwarves_emit.so make[2]: Leaving directory '/tmp/pahole/build' [ 58%] Built target dwarves_emit make[2]: Entering directory '/tmp/pahole/build' make[2]: Leaving directory '/tmp/pahole/build' make[2]: Entering directory '/tmp/pahole/build' [ 60%] Building C object CMakeFiles/dwarves_reorganize.dir/dwarves_reorganize.c.o [ 61%] Linking C shared library libdwarves_reorganize.so make[2]: Leaving directory '/tmp/pahole/build' [ 61%] Built target dwarves_reorganize make[2]: Entering directory '/tmp/pahole/build' make[2]: Leaving directory '/tmp/pahole/build' make[2]: Entering directory '/tmp/pahole/build' [ 63%] Building C object CMakeFiles/codiff.dir/codiff.c.o [ 65%] Linking C executable codiff make[2]: Leaving directory '/tmp/pahole/build' [ 65%] Built target codiff make[2]: Entering directory '/tmp/pahole/build' make[2]: Leaving directory '/tmp/pahole/build' make[2]: Entering directory '/tmp/pahole/build' [ 67%] Building C object CMakeFiles/ctracer.dir/ctracer.c.o [ 69%] Linking C executable ctracer make[2]: Leaving directory '/tmp/pahole/build' [ 69%] Built target ctracer make[2]: Entering directory '/tmp/pahole/build' make[2]: Leaving directory '/tmp/pahole/build' make[2]: Entering directory '/tmp/pahole/build' [ 70%] Building C object CMakeFiles/dtagnames.dir/dtagnames.c.o [ 72%] Linking C executable dtagnames make[2]: Leaving directory '/tmp/pahole/build' [ 72%] Built target dtagnames make[2]: Entering directory '/tmp/pahole/build' make[2]: Leaving directory '/tmp/pahole/build' make[2]: Entering directory '/tmp/pahole/build' [ 74%] Building C object CMakeFiles/pahole.dir/pahole.c.o [ 76%] Linking C executable pahole make[2]: Leaving directory '/tmp/pahole/build' [ 76%] Built target pahole make[2]: Entering directory '/tmp/pahole/build' make[2]: Leaving directory '/tmp/pahole/build' make[2]: Entering directory '/tmp/pahole/build' [ 78%] Building C object CMakeFiles/pdwtags.dir/pdwtags.c.o [ 80%] Linking C executable pdwtags make[2]: Leaving directory '/tmp/pahole/build' [ 80%] Built target pdwtags make[2]: Entering directory '/tmp/pahole/build' make[2]: Leaving directory '/tmp/pahole/build' make[2]: Entering directory '/tmp/pahole/build' [ 81%] Building C object CMakeFiles/pglobal.dir/pglobal.c.o [ 83%] Linking C executable pglobal make[2]: Leaving directory '/tmp/pahole/build' [ 83%] Built target pglobal make[2]: Entering directory '/tmp/pahole/build' make[2]: Leaving directory '/tmp/pahole/build' make[2]: Entering directory '/tmp/pahole/build' [ 85%] Building C object CMakeFiles/pfunct.dir/pfunct.c.o [ 87%] Linking C executable pfunct make[2]: Leaving directory '/tmp/pahole/build' [ 87%] Built target pfunct make[2]: Entering directory '/tmp/pahole/build' make[2]: Leaving directory '/tmp/pahole/build' make[2]: Entering directory '/tmp/pahole/build' [ 89%] Building C object CMakeFiles/prefcnt.dir/prefcnt.c.o [ 90%] Linking C executable prefcnt make[2]: Leaving directory '/tmp/pahole/build' [ 90%] Built target prefcnt make[2]: Entering directory '/tmp/pahole/build' make[2]: Leaving directory '/tmp/pahole/build' make[2]: Entering directory '/tmp/pahole/build' [ 92%] Building C object CMakeFiles/scncopy.dir/scncopy.c.o [ 94%] Building C object CMakeFiles/scncopy.dir/elfcreator.c.o [ 96%] Linking C executable scncopy make[2]: Leaving directory '/tmp/pahole/build' [ 96%] Built target scncopy make[2]: Entering directory '/tmp/pahole/build' make[2]: Leaving directory '/tmp/pahole/build' make[2]: Entering directory '/tmp/pahole/build' [ 98%] Building C object CMakeFiles/syscse.dir/syscse.c.o [100%] Linking C executable syscse make[2]: Leaving directory '/tmp/pahole/build' [100%] Built target syscse make[1]: Leaving directory '/tmp/pahole/build' make: Leaving directory '/tmp/pahole/build' ⬢[acme@toolbox pahole]$ rpm -qa | grep elfutils elfutils-debugsource-0.186-1.fc34.x86_64 elfutils-debuginfo-0.186-1.fc34.x86_64 elfutils-libs-debuginfo-0.186-1.fc34.x86_64 elfutils-libelf-0.187-4.fc36.x86_64 elfutils-libelf-devel-0.187-4.fc36.x86_64 elfutils-default-yama-scope-0.187-4.fc36.noarch elfutils-debuginfod-client-0.187-4.fc36.x86_64 elfutils-libs-0.187-4.fc36.x86_64 elfutils-0.187-4.fc36.x86_64 elfutils-debuginfod-client-devel-0.187-4.fc36.x86_64 elfutils-devel-0.187-4.fc36.x86_64 ⬢[acme@toolbox pahole]$