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

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.

Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Link: https://lore.kernel.org/r/20241028193619.247727-1-irogers@google.com
Closes: https://lore.kernel.org/linux-perf-users/CAP-5=fUXkp-d7gkzX4eF+nbjb2978dZsiHZ9abGHN=BN1qAcbg@mail.gmail.com/
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Ian Rogers and committed by
Namhyung Kim
13e17c9f aa5c9060

+8 -4
+4
tools/perf/Makefile.config
··· 95 95 NO_LIBDW_DWARF_UNWIND := 1 96 96 endif 97 97 98 + ifneq ($(LIBUNWIND),1) 99 + NO_LIBUNWIND := 1 100 + endif 101 + 98 102 ifeq ($(LIBUNWIND_LIBS),) 99 103 NO_LIBUNWIND := 1 100 104 endif
+1 -1
tools/perf/Makefile.perf
··· 52 52 # 53 53 # Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds) 54 54 # 55 - # Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf 55 + # Define LIBUNWIND if you do not want libunwind dependency for dwarf 56 56 # backtrace post unwind. 57 57 # 58 58 # Define NO_BACKTRACE if you do not want stack backtrace debug feature
+3 -3
tools/perf/tests/make
··· 81 81 make_no_ui := NO_SLANG=1 NO_GTK2=1 82 82 make_no_demangle := NO_DEMANGLE=1 83 83 make_no_libelf := NO_LIBELF=1 84 - make_no_libunwind := NO_LIBUNWIND=1 84 + make_libunwind := LIBUNWIND=1 85 85 make_no_libdw_dwarf_unwind := NO_LIBDW_DWARF_UNWIND=1 86 86 make_no_backtrace := NO_BACKTRACE=1 87 87 make_no_libcapstone := NO_CAPSTONE=1 ··· 121 121 122 122 # all the NO_* variable combined 123 123 make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_GTK2=1 124 - make_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 124 + make_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_BACKTRACE=1 125 125 make_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 126 126 make_minimal += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 127 127 make_minimal += NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1 NO_LIBZSTD=1 ··· 153 153 run += make_no_ui 154 154 run += make_no_demangle 155 155 run += make_no_libelf 156 - run += make_no_libunwind 156 + run += make_libunwind 157 157 run += make_no_libdw_dwarf_unwind 158 158 run += make_no_backtrace 159 159 run += make_no_libcapstone