summaryrefslogtreecommitdiff
path: root/tools/perf/util/bpf-event.c
diff options
context:
space:
mode:
authorChristy Lee <christylee@fb.com>2022-02-12 10:30:53 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2022-02-14 21:49:34 +0300
commit710f6c38bc5f49323b2d1e80ccb683f149477e51 (patch)
tree45dc2ce65c5d9435d59d8c8b39b63365ada70360 /tools/perf/util/bpf-event.c
parentbcaf0a97858de7ab21e2bb877e5ac25a7e050525 (diff)
downloadlinux-710f6c38bc5f49323b2d1e80ccb683f149477e51.tar.xz
perf bpf: Stop using deprecated bpf_load_program() API
bpf_load_program() API is deprecated, remove perf's usage of the deprecated function. Add a __weak function declaration for libbpf version compatibility. Signed-off-by: Christy Lee <christylee@fb.com> Cc: Alexei Starovoitov <ast@kernel.org> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: Jiri Olsa <jolsa@kernel.org> Cc: bpf@vger.kernel.org Cc: kernel-team@fb.com Link: https://lore.kernel.org/bpf/20220212073054.1052880-2-andrii@kernel.org Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/bpf-event.c')
-rw-r--r--tools/perf/util/bpf-event.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c
index a517eaa51eb3..bd1bc3c86cac 100644
--- a/tools/perf/util/bpf-event.c
+++ b/tools/perf/util/bpf-event.c
@@ -33,6 +33,19 @@ struct btf * __weak btf__load_from_kernel_by_id(__u32 id)
return err ? ERR_PTR(err) : btf;
}
+int __weak bpf_prog_load(enum bpf_prog_type prog_type,
+ const char *prog_name __maybe_unused,
+ const char *license,
+ const struct bpf_insn *insns, size_t insn_cnt,
+ const struct bpf_prog_load_opts *opts)
+{
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+ return bpf_load_program(prog_type, insns, insn_cnt, license,
+ opts->kern_version, opts->log_buf, opts->log_size);
+#pragma GCC diagnostic pop
+}
+
struct bpf_program * __weak
bpf_object__next_program(const struct bpf_object *obj, struct bpf_program *prev)
{