aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/btf.h
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2019-04-09 17:20:14 -0400
committerAlexei Starovoitov <ast@kernel.org>2019-04-09 20:05:47 -0400
commit1713d68b3bf039d029afd74653c9325f5003ccbe (patch)
tree1a075e1e49244968145a450df10005fc73df0282 /tools/lib/bpf/btf.h
parentd859900c4c56dc4f0f8894c92a01dad86917453e (diff)
bpf, libbpf: add support for BTF Var and DataSec
This adds libbpf support for BTF Var and DataSec kinds. Main point here is that libbpf needs to do some preparatory work before the whole BTF object can be loaded into the kernel, that is, fixing up of DataSec size taken from the ELF section size and non-static variable offset which needs to be taken from the ELF's string section. Upstream LLVM doesn't fix these up since at time of BTF emission it is too early in the compilation process thus this information isn't available yet, hence loader needs to take care of it. Note, deduplication handling has not been in the scope of this work and needs to be addressed in a future commit. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://reviews.llvm.org/D59441 Acked-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/lib/bpf/btf.h')
-rw-r--r--tools/lib/bpf/btf.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
index 28a1e1e59861..c7b399e81fce 100644
--- a/tools/lib/bpf/btf.h
+++ b/tools/lib/bpf/btf.h
@@ -21,6 +21,8 @@ struct btf;
21struct btf_ext; 21struct btf_ext;
22struct btf_type; 22struct btf_type;
23 23
24struct bpf_object;
25
24/* 26/*
25 * The .BTF.ext ELF section layout defined as 27 * The .BTF.ext ELF section layout defined as
26 * struct btf_ext_header 28 * struct btf_ext_header
@@ -57,6 +59,7 @@ struct btf_ext_header {
57 59
58LIBBPF_API void btf__free(struct btf *btf); 60LIBBPF_API void btf__free(struct btf *btf);
59LIBBPF_API struct btf *btf__new(__u8 *data, __u32 size); 61LIBBPF_API struct btf *btf__new(__u8 *data, __u32 size);
62LIBBPF_API int btf__finalize_data(struct bpf_object *obj, struct btf *btf);
60LIBBPF_API int btf__load(struct btf *btf); 63LIBBPF_API int btf__load(struct btf *btf);
61LIBBPF_API __s32 btf__find_by_name(const struct btf *btf, 64LIBBPF_API __s32 btf__find_by_name(const struct btf *btf,
62 const char *type_name); 65 const char *type_name);