From 3b4e4efe88f615f160a6c9319a9392d8410f742c Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Fri, 10 Mar 2023 22:57:49 -0800 Subject: perf symbol: Add abi::__cxa_demangle C++ demangling support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactor C++ demangling out of symbol-elf into its own files similar to other languages. Add abi::__cxa_demangle support. As the other demanglers are not shippable with distributions, this brings back C++ demangling in a common case. It isn't perfect as the support for optionally demangling arguments and modifiers isn't present. Signed-off-by: Ian Rogers Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Andres Freund Cc: Ingo Molnar Cc: Jiri Olsa Cc: Leo Yan Cc: Mark Rutland Cc: Martin Liška Cc: Namhyung Kim Cc: Nathan Chancellor Cc: Nick Desaulniers Cc: Pavithra Gurushankar Cc: Peter Zijlstra Cc: Quentin Monnet Cc: Roberto Sassu Cc: Stephane Eranian Cc: Tiezhu Yang Cc: Tom Rix Cc: Yang Jihong Cc: llvm@lists.linux.dev Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/Makefile.config | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'tools/perf/Makefile.config') diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index c4ae70c643b9..ac8a206acf87 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -914,6 +914,7 @@ ifdef BUILD_NONDISTRO endif CFLAGS += -DHAVE_LIBBFD_SUPPORT + CXXFLAGS += -DHAVE_LIBBFD_SUPPORT ifeq ($(feature-libbfd-buildid), 1) CFLAGS += -DHAVE_LIBBFD_BUILDID_SUPPORT else @@ -921,26 +922,24 @@ ifdef BUILD_NONDISTRO endif endif -ifdef NO_DEMANGLE - CFLAGS += -DNO_DEMANGLE -else +ifndef NO_DEMANGLE + $(call feature_check,cxa-demangle) + ifeq ($(feature-cxa-demangle), 1) + EXTLIBS += -lstdc++ + CFLAGS += -DHAVE_CXA_DEMANGLE_SUPPORT + CXXFLAGS += -DHAVE_CXA_DEMANGLE_SUPPORT + endif ifdef BUILD_NONDISTRO ifeq ($(filter -liberty,$(EXTLIBS)),) - ifdef HAVE_CPLUS_DEMANGLE_SUPPORT + $(call feature_check,cplus-demangle) + ifeq ($(feature-cplus-demangle), 1) EXTLIBS += -liberty - else - $(call feature_check,cplus-demangle) - ifeq ($(feature-cplus-demangle), 1) - EXTLIBS += -liberty - endif endif endif - endif - - ifneq ($(filter -liberty,$(EXTLIBS)),) - CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT - else - CFLAGS += -DNO_DEMANGLE + ifneq ($(filter -liberty,$(EXTLIBS)),) + CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT + CXXFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT + endif endif endif -- cgit v1.2.3