[lld] [llvm] [lld][DebugInfo/BTF] Add BTF section merging and deduplication (PR #183915)

via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 15 20:21:31 PDT 2026


yonghong-song wrote:

Thanks for `-gbtf` pull request link, I forgot it. I build a clang binary with `-gbtf` pull request and this `lld` pull request and used this build for bpf-next kernel without LTO. I got the following error:

```
  ld.lld -m elf_x86_64 --fatal-warnings -z noexecstack --btf-merge -r -o vmlinux.o   --whole-archive vmlinux.a --no-whole-archive --start-group  --end-group  ; ./tools/objtool/objtool --hacks=jump_label --hacks=noinstr --hacks=skylake --ibt --mcount --mnop --orc --retpoline --rethunk --static-call --uaccess --prefix=16 --link vmlinux.o
vmlinux.o: warning: objtool: .BTF.ext+0xa4: data relocation to !ENDBR: IS_ERR_OR_NULL+0x0
vmlinux.o: warning: objtool: .BTF.ext+0xd4: data relocation to !ENDBR: get_random_canary+0x0                            
vmlinux.o: warning: objtool: .BTF.ext+0xdc: data relocation to !ENDBR: rcu_read_unlock+0x0
...
```
There are some thing wrong for objtool.
And subsequently, I see more warnings like
```
   ./scripts/mod/modpost -M -m -b  -a      -o Module.symvers -T modules.order vmlinux.o
WARNING: modpost: vmlinux (.BTF): unexpected non-allocatable section.
Did you forget to use "ax"/"aw" in a .S file?
Note that for example <linux/init.h> contains
section definitions for use in .S files.

WARNING: modpost: vmlinux (.BTF.ext): unexpected non-allocatable section.
Did you forget to use "ax"/"aw" in a .S file?
Note that for example <linux/init.h> contains
section definitions for use in .S files.
...
```
and also this failure
```
+ ld.lld -m elf_x86_64 --fatal-warnings -z noexecstack --btf-merge -z max-page-size=0x200000 --build-id=sha1 --orphan-handling=error --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
ld.lld: error: vmlinux.o:(.BTF.ext) is being placed in '.BTF.ext'
```

Note that we have not reached pahole yet.
We should ensure end-to-end solution (i.e., including pahole/kernel part) works before merging.

https://github.com/llvm/llvm-project/pull/183915


More information about the llvm-commits mailing list