summaryrefslogtreecommitdiff
path: root/tools/lib/bpf/btf.h
diff options
context:
space:
mode:
authorEduard Zingerman <eddyz87@gmail.com>2024-06-13 12:50:10 +0300
committerAndrii Nakryiko <andrii@kernel.org>2024-06-18 00:38:31 +0300
commitc86f180ffc993975fed5907a869fc9b1555d0cfb (patch)
tree1c5545c9dc0b385fc326588e4f247f6ba830cc8f /tools/lib/bpf/btf.h
parentaffdeb50616b190c3236cc2bf116e1b931a43be2 (diff)
downloadlinux-c86f180ffc993975fed5907a869fc9b1555d0cfb.tar.xz
libbpf: Make btf_parse_elf process .BTF.base transparently
Update btf_parse_elf() to check if .BTF.base section is present. The logic is as follows: if .BTF.base section exists: distilled_base := btf_new(.BTF.base) if distilled_base: btf := btf_new(.BTF, .base_btf=distilled_base) if base_btf: btf_relocate(btf, base_btf) else: btf := btf_new(.BTF) return btf In other words: - if .BTF.base section exists, load BTF from it and use it as a base for .BTF load; - if base_btf is specified and .BTF.base section exist, relocate newly loaded .BTF against base_btf. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Alan Maguire <alan.maguire@oracle.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20240613095014.357981-6-alan.maguire@oracle.com
Diffstat (limited to 'tools/lib/bpf/btf.h')
-rw-r--r--tools/lib/bpf/btf.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
index 8a93120b7385..b68d216837a9 100644
--- a/tools/lib/bpf/btf.h
+++ b/tools/lib/bpf/btf.h
@@ -18,6 +18,7 @@ extern "C" {
#define BTF_ELF_SEC ".BTF"
#define BTF_EXT_ELF_SEC ".BTF.ext"
+#define BTF_BASE_ELF_SEC ".BTF.base"
#define MAPS_ELF_SEC ".maps"
struct btf;