Skip to content

Commit 812d8bf

Browse files
alyssaisborkmann
authored andcommitted
libbpf: Skip DWARF sections in linker sanity check
clang can generate (with -g -Wa,--compress-debug-sections) 4-byte aligned DWARF sections that declare themselves to be 8-byte aligned in the section header. Since DWARF sections are dropped during linking anyway, just skip running the sanity checks on them. Reported-by: Sergei Trofimovich <slyich@gmail.com> Suggested-by: Andrii Nakryiko <andrii.nakryiko@gmail.com> Signed-off-by: Alyssa Ross <hi@alyssa.is> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Closes: https://lore.kernel.org/bpf/ZXcFRJVKbKxtEL5t@nz.home/ Link: https://lore.kernel.org/bpf/20231219110324.8989-1-hi@alyssa.is
1 parent 9299924 commit 812d8bf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tools/lib/bpf/linker.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,9 @@ static int linker_sanity_check_elf(struct src_obj *obj)
719719
return -EINVAL;
720720
}
721721

722+
if (is_dwarf_sec_name(sec->sec_name))
723+
continue;
724+
722725
if (sec->shdr->sh_addralign && !is_pow_of_2(sec->shdr->sh_addralign)) {
723726
pr_warn("ELF section #%zu alignment %llu is non pow-of-2 alignment in %s\n",
724727
sec->sec_idx, (long long unsigned)sec->shdr->sh_addralign,

0 commit comments

Comments
 (0)