Skip to content

Commit 2a4898f

Browse files
Jiri Olsaacmel
Jiri Olsa
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 <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrii Nakryiko <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Michael Petlan <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 4924b1f commit 2a4898f

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

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)