All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH perf] perf: ignore deprecation warning when using libbpf's btf__get_from_id()
@ 2021-09-14 17:00 Andrii Nakryiko
  2021-09-14 18:21 ` Jiri Olsa
  0 siblings, 1 reply; 7+ messages in thread
From: Andrii Nakryiko @ 2021-09-14 17:00 UTC (permalink / raw)
  To: bpf, ast, daniel, linux-perf-users, acme; +Cc: andrii, kernel-team

Perf code re-implements libbpf's btf__load_from_kernel_by_id() API as
a weak function, presumably to dynamically link against old version of
libbpf shared library. Unfortunately this causes compilation warning
when perf is compiled against libbpf v0.6+.

For now, just ignore deprecation warning, but there might be a better
solution, depending on perf's needs.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 tools/perf/util/bpf-event.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c
index 683f6d63560e..1a7112a87736 100644
--- a/tools/perf/util/bpf-event.c
+++ b/tools/perf/util/bpf-event.c
@@ -24,7 +24,10 @@
 struct btf * __weak btf__load_from_kernel_by_id(__u32 id)
 {
        struct btf *btf;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
        int err = btf__get_from_id(id, &btf);
+#pragma GCC diagnostic pop
 
        return err ? ERR_PTR(err) : btf;
 }
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-09-15 10:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14 17:00 [PATCH perf] perf: ignore deprecation warning when using libbpf's btf__get_from_id() Andrii Nakryiko
2021-09-14 18:21 ` Jiri Olsa
2021-09-14 18:28   ` Andrii Nakryiko
2021-09-14 18:55     ` Jiri Olsa
2021-09-14 19:02     ` Arnaldo Carvalho de Melo
2021-09-14 21:38       ` Andrii Nakryiko
2021-09-15 10:55         ` Toke Høiland-Jørgensen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.