]> git.baikalelectronics.ru Git - kernel.git/commit
perf bpf: Fix build with libbpf 0.7.0 by checking if bpf_program__set_insns() is...
authorArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 19 Oct 2022 12:44:17 +0000 (08:44 -0400)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 25 Oct 2022 20:40:48 +0000 (17:40 -0300)
commitb467d37183d91f482ddcfdcbd5a389aedf152ec6
treeb161f1bdc327d729c0b1b5a94f5a80cdf823b6a6
parent3100109965deea4ed77230d77e6a01270e17c085
perf bpf: Fix build with libbpf 0.7.0 by checking if bpf_program__set_insns() is available

During the transition to libbpf 1.0 some functions that perf used were
deprecated and finally removed from libbpf, so bpf_program__set_insns()
was introduced for perf to continue to use its bpf loader.

But when build with LIBBPF_DYNAMIC=1 we now need to check if that
function is available so that perf can build with older libbpf versions,
even if the end result is emitting a warning to the user that the use
of the perf BPF loader requires a newer libbpf, since bpf_program__set_insns()
touches libbpf objects internal state.

This affects only 'perf trace' when using bpf C code or pre-compiled
bytecode as an event.

Noticed on RHEL9, that has libbpf 0.7.0, where bpf_program__set_insns()
isn't available.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/build/Makefile.feature
tools/build/feature/Makefile
tools/build/feature/test-libbpf-bpf_program__set_insns.c [new file with mode: 0644]
tools/perf/Makefile.config
tools/perf/util/bpf-loader.c