From: Andrii Nakryiko Date: Thu, 19 Dec 2019 00:28:36 +0000 (-0800) Subject: libbpf: BTF is required when externs are present X-Git-Tag: v5.10.7~3383^2~199^2~15^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=630628cb7dc39780660d8fcedc66e0298a82f9da;p=platform%2Fkernel%2Flinux-rpi.git libbpf: BTF is required when externs are present BTF is required to get type information about extern variables. Signed-off-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20191219002837.3074619-4-andriin@fb.com --- diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 7b74382..6340b81 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,