Skip to content

Commit

Permalink
perf tools: Add more weak libbpf functions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jiri Olsa authored and acmel committed Nov 13, 2021
1 parent 4924b1f commit 2a4898f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tools/perf/util/bpf-event.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,33 @@ struct btf * __weak btf__load_from_kernel_by_id(__u32 id)
return err ? ERR_PTR(err) : btf;
}

struct bpf_program * __weak
bpf_object__next_program(const struct bpf_object *obj, struct bpf_program *prev)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
return bpf_program__next(prev, obj);
#pragma GCC diagnostic pop
}

struct bpf_map * __weak
bpf_object__next_map(const struct bpf_object *obj, const struct bpf_map *prev)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
return bpf_map__next(prev, obj);
#pragma GCC diagnostic pop
}

const void * __weak
btf__raw_data(const struct btf *btf_ro, __u32 *size)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
return btf__get_raw_data(btf_ro, size);
#pragma GCC diagnostic pop
}

static int snprintf_hex(char *buf, size_t size, unsigned char *data, size_t len)
{
int ret = 0;
Expand Down

0 comments on commit 2a4898f

Please sign in to comment.