BPF List
 help / color / mirror / Atom feed
From: Alan Maguire <alan.maguire@oracle.com>
To: andrii@kernel.org, eddyz87@gmail.com, ast@kernel.org
Cc: daniel@iogearbox.net, martin.lau@linux.dev, song@kernel.org,
	yonghong.song@linux.dev, john.fastabend@gmail.com,
	kpsingh@kernel.org, sdf@google.com, haoluo@google.com,
	jolsa@kernel.org, mcgrof@kernel.org, masahiroy@kernel.org,
	nathan@kernel.org, mykolal@fb.com, dxu@dxuuu.xyz,
	bpf@vger.kernel.org, Alan Maguire <alan.maguire@oracle.com>
Subject: [PATCH v6 bpf-next 6/9] resolve_btfids: handle presence of .BTF.base section
Date: Thu, 13 Jun 2024 10:50:11 +0100	[thread overview]
Message-ID: <20240613095014.357981-7-alan.maguire@oracle.com> (raw)
In-Reply-To: <20240613095014.357981-1-alan.maguire@oracle.com>

Now that btf_parse_elf() handles .BTF.base section presence,
we need to ensure that resolve_btfids uses .BTF.base when present
rather than the vmlinux base BTF passed in via the -B option.
Detect .BTF.base section presence and unset the base BTF path
to ensure that BTF ELF parsing will do the right thing.

Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
---
 tools/bpf/resolve_btfids/main.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
index af393c7dee1f..936ef95c3d32 100644
--- a/tools/bpf/resolve_btfids/main.c
+++ b/tools/bpf/resolve_btfids/main.c
@@ -409,6 +409,14 @@ static int elf_collect(struct object *obj)
 			obj->efile.idlist       = data;
 			obj->efile.idlist_shndx = idx;
 			obj->efile.idlist_addr  = sh.sh_addr;
+		} else if (!strcmp(name, BTF_BASE_ELF_SEC)) {
+			/* If a .BTF.base section is found, do not resolve
+			 * BTF ids relative to vmlinux; resolve relative
+			 * to the .BTF.base section instead.  btf__parse_split()
+			 * will take care of this once the base BTF it is
+			 * passed is NULL.
+			 */
+			obj->base_btf_path = NULL;
 		}
 
 		if (compressed_section_fix(elf, scn, &sh))
-- 
2.31.1


  parent reply	other threads:[~2024-06-13  9:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13  9:50 [PATCH v6 bpf-next 0/9] bpf: support resilient split BTF Alan Maguire
2024-06-13  9:50 ` [PATCH v6 bpf-next 1/9] libbpf: add btf__distill_base() creating split BTF with distilled base BTF Alan Maguire
2024-06-28 23:30   ` Andrii Nakryiko
2024-06-13  9:50 ` [PATCH v6 bpf-next 2/9] selftests/bpf: test distilled base, split BTF generation Alan Maguire
2024-06-13  9:50 ` [PATCH v6 bpf-next 3/9] libbpf: split BTF relocation Alan Maguire
2024-06-14  0:26   ` Eduard Zingerman
2024-06-17 21:50   ` Andrii Nakryiko
2024-06-18  9:47     ` Alan Maguire
2024-08-09 22:30   ` Neill Kapron
2024-08-10  9:37     ` Alan Maguire
2024-06-13  9:50 ` [PATCH v6 bpf-next 4/9] selftests/bpf: extend distilled BTF tests to cover " Alan Maguire
2024-06-14  1:13   ` Eduard Zingerman
2024-06-13  9:50 ` [PATCH v6 bpf-next 5/9] libbpf: make btf_parse_elf process .BTF.base transparently Alan Maguire
2024-06-13  9:50 ` Alan Maguire [this message]
2024-06-14  1:19   ` [PATCH v6 bpf-next 6/9] resolve_btfids: handle presence of .BTF.base section Eduard Zingerman
2024-06-13  9:50 ` [PATCH v6 bpf-next 7/9] module, bpf: store BTF base pointer in struct module Alan Maguire
2024-06-17 21:50   ` Andrii Nakryiko
2024-06-13  9:50 ` [PATCH v6 bpf-next 8/9] libbpf,bpf: share BTF relocate-related code with kernel Alan Maguire
2024-06-14 22:49   ` Eduard Zingerman
2024-06-17 13:31     ` Alan Maguire
2024-06-17 16:46       ` Eduard Zingerman
2024-06-13  9:50 ` [PATCH v6 bpf-next 9/9] kbuild,bpf: add module-specific pahole flags for distilled base BTF Alan Maguire
2024-06-17 21:50 ` [PATCH v6 bpf-next 0/9] bpf: support resilient split BTF Andrii Nakryiko
2024-06-17 22:00 ` 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=20240613095014.357981-7-alan.maguire@oracle.com \
    --to=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dxu@dxuuu.xyz \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=masahiroy@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=mykolal@fb.com \
    --cc=nathan@kernel.org \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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