bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: bpf@vger.kernel.org, Jiri Benc <jbenc@redhat.com>
Subject: Reason for libbpf rejecting SECTION symbols in 'maps' section
Date: Fri, 24 Sep 2021 18:49:10 +0200	[thread overview]
Message-ID: <87wnn5yl4p.fsf@toke.dk> (raw)

Hi Andrii

We ran into an issue with binutils[0] mangling BPF object files, which
makes libbpf sad. Specifically, binutils will create SECTION symbols for
every section in .symtab, which trips this check in
bpf_object__init_user_maps():

if (GELF_ST_TYPE(sym.st_info) == STT_SECTION
    || GELF_ST_BIND(sym.st_info) == STB_LOCAL) {
	pr_warn("map '%s' (legacy): static maps are not supported\n", map_name);
	return -ENOTSUP;
}

Given the error message I can understand why it's checking for
STB_LOCAL, but why is the check for STT_SECTION there? And is there any
reason why libbpf couldn't just skip the SECTION symbols instead of
bugging out?

Hope you can help shed some light on the history here.

-Toke


[0] This happens because rpmbuild has a script that automatically that
runs 'strip' on every object file in an rpm; and so when we package up
the kernel selftests, we end up with mangled object files. Newer
versions of binutils don't do this, but the one on RHEL does.


             reply	other threads:[~2021-09-24 16:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-24 16:49 Toke Høiland-Jørgensen [this message]
2021-09-24 23:52 ` Reason for libbpf rejecting SECTION symbols in 'maps' section Andrii Nakryiko
2021-09-25  9:19   ` Toke Høiland-Jørgensen

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=87wnn5yl4p.fsf@toke.dk \
    --to=toke@redhat.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=jbenc@redhat.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;
as well as URLs for NNTP newsgroup(s).