[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211109140707.1689940-3-jolsa@kernel.org>
Date: Tue, 9 Nov 2021 15:07:07 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: lkml <linux-kernel@...r.kernel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Ingo Molnar <mingo@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Michael Petlan <mpetlan@...hat.com>,
Ian Rogers <irogers@...gle.com>,
linux-perf-users@...r.kernel.org,
Andrii Nakryiko <andrii@...nel.org>
Subject: [PATCH 2/2] perf tools: Add weak variants for the deprecated libbpf functions
Adding weak functions for deprecated libbpf functions, so that
we don't get build fail with libbpf version where they are
finally removed.
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
---
tools/perf/util/bpf-event.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c
index ceb96360fd12..476427f3e804 100644
--- a/tools/perf/util/bpf-event.c
+++ b/tools/perf/util/bpf-event.c
@@ -22,6 +22,20 @@
#include "record.h"
#include "util/synthetic-events.h"
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wredundant-decls"
+int btf__get_from_id(__u32 id, struct btf **btf);
+struct bpf_program *bpf_program__next(struct bpf_program *prog,
+ const struct bpf_object *obj);
+struct bpf_map *bpf_map__next(const struct bpf_map *map, const struct bpf_object *obj);
+const void *btf__get_raw_data(const struct btf *btf, __u32 *size);
+#pragma GCC diagnostic pop
+
+int __weak btf__get_from_id(__u32 id __maybe_unused, struct btf **btf __maybe_unused)
+{
+ return -ENOTSUP;
+}
+
struct btf * __weak btf__load_from_kernel_by_id(__u32 id)
{
struct btf *btf;
@@ -33,6 +47,13 @@ struct btf * __weak btf__load_from_kernel_by_id(__u32 id)
return err ? ERR_PTR(err) : btf;
}
+struct bpf_program * __weak
+bpf_program__next(struct bpf_program *prog __maybe_unused,
+ const struct bpf_object *obj __maybe_unused)
+{
+ return NULL;
+}
+
struct bpf_program * __weak
bpf_object__next_program(const struct bpf_object *obj, struct bpf_program *prev)
{
@@ -42,6 +63,12 @@ bpf_object__next_program(const struct bpf_object *obj, struct bpf_program *prev)
#pragma GCC diagnostic pop
}
+struct bpf_map * __weak bpf_map__next(const struct bpf_map *map __maybe_unused,
+ const struct bpf_object *obj __maybe_unused)
+{
+ return NULL;
+}
+
struct bpf_map * __weak
bpf_object__next_map(const struct bpf_object *obj, const struct bpf_map *prev)
{
@@ -51,6 +78,12 @@ bpf_object__next_map(const struct bpf_object *obj, const struct bpf_map *prev)
#pragma GCC diagnostic pop
}
+const void * __weak btf__get_raw_data(const struct btf *btf __maybe_unused,
+ __u32 *size __maybe_unused)
+{
+ return NULL;
+}
+
const void * __weak
btf__raw_data(const struct btf *btf_ro, __u32 *size)
{
--
2.31.1
Powered by blists - more mailing lists