summaryrefslogtreecommitdiff
path: root/tools/lib
diff options
context:
space:
mode:
authorAndrii Nakryiko <andriin@fb.com>2019-12-19 03:28:36 +0300
committerAlexei Starovoitov <ast@kernel.org>2019-12-19 04:33:36 +0300
commit630628cb7dc39780660d8fcedc66e0298a82f9da (patch)
tree3b5e3706df1729956cdd345108858418713ee117 /tools/lib
parent8601fd422148a8f7ff5f7eaf75b6703d5166332c (diff)
downloadlinux-630628cb7dc39780660d8fcedc66e0298a82f9da.tar.xz
libbpf: BTF is required when externs are present
BTF is required to get type information about extern variables. Signed-off-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20191219002837.3074619-4-andriin@fb.com
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/bpf/libbpf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 7b74382c7977..6340b81b555b 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1887,7 +1887,8 @@ static void bpf_object__sanitize_btf_ext(struct bpf_object *obj)
static bool bpf_object__is_btf_mandatory(const struct bpf_object *obj)
{
- return obj->efile.btf_maps_shndx >= 0;
+ return obj->efile.btf_maps_shndx >= 0 ||
+ obj->nr_extern > 0;
}
static int bpf_object__init_btf(struct bpf_object *obj,