Skip to content

Commit 74e89dd

Browse files
Yonghong SongKernel Patches Daemon
authored andcommitted
libbpf: Silence newly-added and unused sections
With latest llvm22, when building bpf selftest, I got the following info emitted by libbpf: ... libbpf: elf: skipping unrecognized data section(14) .comment libbpf: elf: skipping section(15) .note.GNU-stack (size 0) ... The reason is due to llvm patch [1]. Previously, bpf class BPFMCAsmInfo inherits class MCAsmInfo. With [1], BPFMCAsmInfo inherits class MCAsmInfoELF. Such a change added two more sections in the bpf binary, e.g. [Nr] Name Type Address Off Size ES Flg Lk Inf Al ... [23] .comment PROGBITS 0000000000000000 0035ac 00006d 01 MS 0 0 1 [24] .note.GNU-stack PROGBITS 0000000000000000 003619 000000 00 0 0 1 ... Adding the above two sections in elf section ignore list can avoid the above info dump during selftest build. [1] llvm/llvm-project@d9489fd Signed-off-by: Yonghong Song <[email protected]>
1 parent 1a8f119 commit 74e89dd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tools/lib/bpf/libbpf.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3788,6 +3788,14 @@ static bool ignore_elf_section(Elf64_Shdr *hdr, const char *name)
37883788
if (is_sec_name_dwarf(name))
37893789
return true;
37903790

3791+
/* .comment section */
3792+
if (strcmp(name, ".comment") == 0)
3793+
return true;
3794+
3795+
/* .note.GNU-stack section */
3796+
if (strcmp(name, ".note.GNU-stack") == 0)
3797+
return true;
3798+
37913799
if (str_has_pfx(name, ".rel")) {
37923800
name += sizeof(".rel") - 1;
37933801
/* DWARF section relocations */

0 commit comments

Comments
 (0)