Skip to contentSkip to conversation

perf build: Make libunwind opt-in rather than opt-out

PATCH Superseded Ian Rogers 1 participant 1 message Oct 26, 2024 perf events

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Ian Rogers

author reviewer
#0 lore raw

PATCH 1/1 perf build: Make libunwind opt-in rather than opt-out

Having multiple unwinding libraries makes the perf code harder to understand and we have unused/untested code paths.

Perf made BPF support an opt-out rather than opt-in feature. As libbpf has a libelf dependency, elfutils that provides libelf will also provide libdw. When libdw is present perf will use libdw unwinding rather than libunwind unwinding even if libunwind support is compiled in.

Rather than have libunwind built into perf and never used, explicitly disable the support and make it opt-in.

---
I think, once libunwind support has been disabled over multiple releases we can look to remove the associated code. We should look to do similar for libbfd and other support that is no longer really tested.

---
 tools/perf/Makefile.config | 4 ++++
 tools/perf/Makefile.perf   | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
tools/perf/Makefile.config +4 -0
index b93ed2b7623f..707d7355ff18 100644
@@ -91,6 +91,10 @@ ifneq ($(SRCARCH),$(filter $(SRCARCH),x86 arm arm64 powerpc s390 csky riscv loon
   NO_LIBDW_DWARF_UNWIND := 1
 endif
 
+ifneq ($(LIBUNWIND),1)
+  NO_LIBUNWIND := 1
+endif
+
 ifeq ($(LIBUNWIND_LIBS),)
   NO_LIBUNWIND := 1
 endif
tools/perf/Makefile.perf +1 -1
index b4dee7c20ed1..d74241a15131 100644
@@ -52,7 +52,7 @@ include ../scripts/utilities.mak
 #
 # Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)
 #
-# Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf
+# Define LIBUNWIND if you do not want libunwind dependency for dwarf
 # backtrace post unwind.
 #
 # Define NO_BACKTRACE if you do not want stack backtrace debug feature
Signature · 1 line
2.47.0.163.g1226f6d8fa-goog