BPF List
 help / color / mirror / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: bpf@vger.kernel.org, Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: patches@lists.linux.dev, Sergei Trofimovich <slyich@gmail.com>
Subject: [PATCH] libbpf: skip DWARF sections in linker sanity check
Date: Tue, 19 Dec 2023 12:03:24 +0100	[thread overview]
Message-ID: <20231219110324.8989-1-hi@alyssa.is> (raw)
In-Reply-To: <CAEf4BzbN7cUVQgd7nUAsmAQMmCpz7O9v+r3iyiUfa_FK6WMY-w@mail.gmail.com>

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>
Closes: https://lore.kernel.org/bpf/ZXcFRJVKbKxtEL5t@nz.home/
Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
 tools/lib/bpf/linker.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/lib/bpf/linker.c b/tools/lib/bpf/linker.c
index 52a2901e8bd0..16bca56002ab 100644
--- a/tools/lib/bpf/linker.c
+++ b/tools/lib/bpf/linker.c
@@ -719,6 +719,9 @@ static int linker_sanity_check_elf(struct src_obj *obj)
 			return -EINVAL;
 		}
 
+		if (is_dwarf_sec_name(sec->sec_name))
+			continue;
+
 		if (sec->shdr->sh_addralign && !is_pow_of_2(sec->shdr->sh_addralign)) {
 			pr_warn("ELF section #%zu alignment %llu is non pow-of-2 alignment in %s\n",
 				sec->sec_idx, (long long unsigned)sec->shdr->sh_addralign,

base-commit: 733763285acfe8dffd6e39ad2ed3d1222b32a901
-- 
2.42.0


  reply	other threads:[~2023-12-19 11:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-11 12:49 bpftool fails on 32-bit hosts when -Wa,--compress-debug-sections is used Sergei Trofimovich
2023-12-13  0:10 ` Andrii Nakryiko
2023-12-19 11:03   ` Alyssa Ross [this message]
2023-12-20 15:28     ` [PATCH] libbpf: skip DWARF sections in linker sanity check Daniel Borkmann
2023-12-20 23:40     ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231219110324.8989-1-hi@alyssa.is \
    --to=hi@alyssa.is \
    --cc=andrii.nakryiko@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=slyich@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox