Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
2a4898fc 4924b1f7

+27
+27
tools/perf/util/bpf-event.c
··· 33 33 return err ? ERR_PTR(err) : btf; 34 34 } 35 35 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 + 36 63 static int snprintf_hex(char *buf, size_t size, unsigned char *data, size_t len) 37 64 { 38 65 int ret = 0;