OSDN Git Service

libbpf: Detect minimal BTF support and skip BTF loading, if missing
authorAndrii Nakryiko <andriin@fb.com>
Tue, 18 Aug 2020 21:33:56 +0000 (14:33 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 19 Aug 2020 00:16:15 +0000 (17:16 -0700)
commit68b08647c7d56ea15114435c3023adc017d11b81
treec79294afedb4b82d2879dc690a9a4d844cfdaf43
parent70785cfb19287b4b075a266887be5e024bf1206a
libbpf: Detect minimal BTF support and skip BTF loading, if missing

Detect whether a kernel supports any BTF at all, and if not, don't even
attempt loading BTF to avoid unnecessary log messages like:

  libbpf: Error loading BTF: Invalid argument(22)
  libbpf: Error loading .BTF into kernel: -22. BTF is optional, ignoring.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200818213356.2629020-8-andriin@fb.com
tools/lib/bpf/libbpf.c