Skip to content

Commit 2a4898f

Browse files
Jiri Olsaacmel
authored andcommitted
perf tools: Add more weak libbpf functions
We hit the window where perf uses libbpf functions, that did not make it to the official libbpf release yet and it's breaking perf build with dynamicly linked libbpf. Fixing this by providing the new interface as weak functions which calls the original libbpf functions. Fortunatelly the changes were just renames. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andrii Nakryiko <andrii@kernel.org> Cc: Ian Rogers <irogers@google.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/20211109140707.1689940-2-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 4924b1f commit 2a4898f

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

tools/perf/util/bpf-event.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,33 @@ struct btf * __weak btf__load_from_kernel_by_id(__u32 id)
3333
return err ? ERR_PTR(err) : btf;
3434
}
3535

36+
struct bpf_program * __weak
37+
bpf_object__next_program(const struct bpf_object *obj, struct bpf_program *prev)
38+
{
39+
#pragma GCC diagnostic push
40+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
41+
return bpf_program__next(prev, obj);
42+
#pragma GCC diagnostic pop
43+
}
44+
45+
struct bpf_map * __weak
46+
bpf_object__next_map(const struct bpf_object *obj, const struct bpf_map *prev)
47+
{
48+
#pragma GCC diagnostic push
49+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
50+
return bpf_map__next(prev, obj);
51+
#pragma GCC diagnostic pop
52+
}
53+
54+
const void * __weak
55+
btf__raw_data(const struct btf *btf_ro, __u32 *size)
56+
{
57+
#pragma GCC diagnostic push
58+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
59+
return btf__get_raw_data(btf_ro, size);
60+
#pragma GCC diagnostic pop
61+
}
62+
3663
static int snprintf_hex(char *buf, size_t size, unsigned char *data, size_t len)
3764
{
3865
int ret = 0;

0 commit comments

Comments
 (0)