Skip to content

Commit 409fb6b

Browse files
committed
perf bpf: Fix build with libbpf 0.7.0 by adding prototype for bpf_load_program()
The bpf_load_program() prototype appeared in tools/lib/bpf/bpf.h as deprecated, but nowadays its completely removed, so add it back for building with the system libbpf when using 'make LIBBPF_DYNAMIC=1'. This is a stop gap hack till we do like tools/bpf does with bpftool, i.e. bootstrap the libbpf build and install it in the perf build directory when not using 'make LIBBPF_DYNAMIC=1'. That has to be done to all libraries in tools/lib/, so tha we can remove -Itools/lib/ from the tools/perf CFLAGS. Noticed when building with LIBBPF_DYNAMIC=1 and libbpf 0.7.0 on RHEL9. Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent b92dd11 commit 409fb6b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tools/perf/util/bpf-event.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ struct btf *btf__load_from_kernel_by_id(__u32 id)
3636
#endif
3737

3838
#ifndef HAVE_LIBBPF_BPF_PROG_LOAD
39+
LIBBPF_API int bpf_load_program(enum bpf_prog_type type,
40+
const struct bpf_insn *insns, size_t insns_cnt,
41+
const char *license, __u32 kern_version,
42+
char *log_buf, size_t log_buf_sz);
43+
3944
int bpf_prog_load(enum bpf_prog_type prog_type,
4045
const char *prog_name __maybe_unused,
4146
const char *license,

0 commit comments

Comments
 (0)