libbpf: Postpone BTF ID finding for TRACING programs to load phase
authorAndrii Nakryiko <andriin@fb.com>
Sat, 14 Dec 2019 01:43:34 +0000 (17:43 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 15 Dec 2019 23:58:05 +0000 (15:58 -0800)
commit13acb508ae203075134327551a6705e6e8f23d48
treeb5d2652e558a09630556f350f706a714088e98c7
parenteba9c5f498a11a8558e099d14692c24f2fea27e3
libbpf: Postpone BTF ID finding for TRACING programs to load phase

Move BTF ID determination for BPF_PROG_TYPE_TRACING programs to a load phase.
Performing it at open step is inconvenient, because it prevents BPF skeleton
generation on older host kernel, which doesn't contain BTF_KIND_FUNCs
information in vmlinux BTF. This is a common set up, though, when, e.g.,
selftests are compiled on older host kernel, but the test program itself is
executed in qemu VM with bleeding edge kernel. Having this BTF searching
performed at load time allows to successfully use bpf_object__open() for
codegen and inspection of BPF object file.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20191214014341.3442258-11-andriin@fb.com
tools/lib/bpf/libbpf.c