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] https://github.com/llvm/llvm-project/commit/d9489fd073c0e100c6fbb1e5aef140b00cf62b81 Signed-off-by: Yonghong Song --- tools/lib/bpf/libbpf.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 5161c2b39875..34aed7904039 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -3788,6 +3788,14 @@ static bool ignore_elf_section(Elf64_Shdr *hdr, const char *name) if (is_sec_name_dwarf(name)) return true; + /* .comment section */ + if (strcmp(name, ".comment") == 0) + return true; + + /* .note.GNU-stack section */ + if (strcmp(name, ".note.GNU-stack") == 0) + return true; + if (str_has_pfx(name, ".rel")) { name += sizeof(".rel") - 1; /* DWARF section relocations */ -- 2.47.3