|
Justin M. Forbes |
fa4c90 |
From ad1237c30d975535a669746496cbed136aa5a045 Mon Sep 17 00:00:00 2001
|
|
Justin M. Forbes |
fa4c90 |
From: Jiri Olsa <jolsa@kernel.org>
|
|
Justin M. Forbes |
fa4c90 |
Date: Sat, 8 May 2021 22:50:20 +0200
|
|
Justin M. Forbes |
fa4c90 |
Subject: perf tools: Fix dynamic libbpf link
|
|
Justin M. Forbes |
fa4c90 |
|
|
Justin M. Forbes |
fa4c90 |
Justin reported broken build with LIBBPF_DYNAMIC=1.
|
|
Justin M. Forbes |
fa4c90 |
|
|
Justin M. Forbes |
fa4c90 |
When linking libbpf dynamically we need to use perf's
|
|
Justin M. Forbes |
fa4c90 |
hashmap object, because it's not exported in libbpf.so
|
|
Justin M. Forbes |
fa4c90 |
(only in libbpf.a).
|
|
Justin M. Forbes |
fa4c90 |
|
|
Justin M. Forbes |
fa4c90 |
Following build is now passing:
|
|
Justin M. Forbes |
fa4c90 |
|
|
Justin M. Forbes |
fa4c90 |
$ make LIBBPF_DYNAMIC=1
|
|
Justin M. Forbes |
fa4c90 |
BUILD: Doing 'make -j8' parallel build
|
|
Justin M. Forbes |
fa4c90 |
...
|
|
Justin M. Forbes |
fa4c90 |
$ ldd perf | grep libbpf
|
|
Justin M. Forbes |
fa4c90 |
libbpf.so.0 => /lib64/libbpf.so.0 (0x00007fa7630db000)
|
|
Justin M. Forbes |
fa4c90 |
|
|
Justin M. Forbes |
fa4c90 |
Fixes: eee19501926d ("perf tools: Grab a copy of libbpf's hashmap")
|
|
Justin M. Forbes |
fa4c90 |
Reported-by: Justin M. Forbes <jforbes@redhat.com>
|
|
Justin M. Forbes |
fa4c90 |
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
|
|
Justin M. Forbes |
fa4c90 |
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
|
|
Justin M. Forbes |
fa4c90 |
Cc: Ian Rogers <irogers@google.com>
|
|
Justin M. Forbes |
fa4c90 |
Cc: Mark Rutland <mark.rutland@arm.com>
|
|
Justin M. Forbes |
fa4c90 |
Cc: Michael Petlan <mpetlan@redhat.com>
|
|
Justin M. Forbes |
fa4c90 |
Cc: Namhyung Kim <namhyung@kernel.org>
|
|
Justin M. Forbes |
fa4c90 |
Cc: Peter Zijlstra <peterz@infradead.org>
|
|
Justin M. Forbes |
fa4c90 |
Link: http://lore.kernel.org/lkml/20210508205020.617984-1-jolsa@kernel.org
|
|
Justin M. Forbes |
fa4c90 |
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Justin M. Forbes |
fa4c90 |
---
|
|
Justin M. Forbes |
fa4c90 |
tools/perf/Makefile.config | 1 +
|
|
Justin M. Forbes |
fa4c90 |
tools/perf/util/Build | 7 +++++++
|
|
Justin M. Forbes |
fa4c90 |
2 files changed, 8 insertions(+)
|
|
Justin M. Forbes |
fa4c90 |
|
|
Justin M. Forbes |
fa4c90 |
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
|
|
Justin M. Forbes |
fa4c90 |
index 0d6619064a838..406a9519145e5 100644
|
|
Justin M. Forbes |
fa4c90 |
--- a/tools/perf/Makefile.config
|
|
Justin M. Forbes |
fa4c90 |
+++ b/tools/perf/Makefile.config
|
|
Justin M. Forbes |
fa4c90 |
@@ -540,6 +540,7 @@ ifndef NO_LIBELF
|
|
Justin M. Forbes |
fa4c90 |
ifdef LIBBPF_DYNAMIC
|
|
Justin M. Forbes |
fa4c90 |
ifeq ($(feature-libbpf), 1)
|
|
Justin M. Forbes |
fa4c90 |
EXTLIBS += -lbpf
|
|
Justin M. Forbes |
fa4c90 |
+ $(call detected,CONFIG_LIBBPF_DYNAMIC)
|
|
Justin M. Forbes |
fa4c90 |
else
|
|
Justin M. Forbes |
fa4c90 |
dummy := $(error Error: No libbpf devel library found, please install libbpf-devel);
|
|
Justin M. Forbes |
fa4c90 |
endif
|
|
Justin M. Forbes |
fa4c90 |
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
|
|
Justin M. Forbes |
fa4c90 |
index 8c0d9f368ebcf..b64bdc1a7026d 100644
|
|
Justin M. Forbes |
fa4c90 |
--- a/tools/perf/util/Build
|
|
Justin M. Forbes |
fa4c90 |
+++ b/tools/perf/util/Build
|
|
Justin M. Forbes |
fa4c90 |
@@ -145,7 +145,14 @@ perf-$(CONFIG_LIBELF) += symbol-elf.o
|
|
Justin M. Forbes |
fa4c90 |
perf-$(CONFIG_LIBELF) += probe-file.o
|
|
Justin M. Forbes |
fa4c90 |
perf-$(CONFIG_LIBELF) += probe-event.o
|
|
Justin M. Forbes |
fa4c90 |
|
|
Justin M. Forbes |
fa4c90 |
+ifdef CONFIG_LIBBPF_DYNAMIC
|
|
Justin M. Forbes |
fa4c90 |
+ hashmap := 1
|
|
Justin M. Forbes |
fa4c90 |
+endif
|
|
Justin M. Forbes |
fa4c90 |
ifndef CONFIG_LIBBPF
|
|
Justin M. Forbes |
fa4c90 |
+ hashmap := 1
|
|
Justin M. Forbes |
fa4c90 |
+endif
|
|
Justin M. Forbes |
fa4c90 |
+
|
|
Justin M. Forbes |
fa4c90 |
+ifdef hashmap
|
|
Justin M. Forbes |
fa4c90 |
perf-y += hashmap.o
|
|
Justin M. Forbes |
fa4c90 |
endif
|
|
Justin M. Forbes |
fa4c90 |
|
|
Justin M. Forbes |
fa4c90 |
--
|
|
Justin M. Forbes |
fa4c90 |
cgit 1.2.3-1.el7
|
|
Justin M. Forbes |
fa4c90 |
|