When .eh_frame and .rel.eh_frame sections are present in BPF object files, libbpf produces errors like this when loading the file: libbpf: elf: skipping unrecognized data section(32) .eh_frame libbpf: elf: skipping relo section(33) .rel.eh_frame for section(32) .eh_frame It is possible to get rid of the .eh_frame section by adding -fno-asynchronous-unwind-tables to the compilation, but we have seen multiple examples of these sections appearing in BPF files in the wild, most recently in samples/bpf, fixed by: 5a0ae9872d5c ("bpf, samples: Add -fno-asynchronous-unwind-tables to BPF Clang invocation") While the errors are technically harmless, they look odd and confuse users. So let's make libbpf filter out those sections, by adding .eh_frame to the filter check in is_sec_name_dwarf(). v2: - Expand explanation in the commit message Signed-off-by: Toke Høiland-Jørgensen <toke@xxxxxxxxxx> --- tools/lib/bpf/libbpf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 88d8825fc6f6..b1dc97b95965 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -2909,7 +2909,8 @@ static Elf_Data *elf_sec_data(const struct bpf_object *obj, Elf_Scn *scn) static bool is_sec_name_dwarf(const char *name) { /* approximation, but the actual list is too long */ - return strncmp(name, ".debug_", sizeof(".debug_") - 1) == 0; + return (strncmp(name, ".debug_", sizeof(".debug_") - 1) == 0 || + strncmp(name, ".eh_frame", sizeof(".eh_frame") - 1) == 0); } static bool ignore_elf_section(GElf_Shdr *hdr, const char *name) -- 2.33.0