[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230311065753.3012826-9-irogers@google.com>
Date: Fri, 10 Mar 2023 22:57:48 -0800
From: Ian Rogers <irogers@...gle.com>
To: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Tom Rix <trix@...hat.com>,
Roberto Sassu <roberto.sassu@...wei.com>,
Quentin Monnet <quentin@...valent.com>,
Andres Freund <andres@...razel.de>,
Tiezhu Yang <yangtiezhu@...ngson.cn>,
Pavithra Gurushankar <gpavithrasha@...il.com>,
Yang Jihong <yangjihong1@...wei.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Leo Yan <leo.yan@...aro.org>,
"Martin Liška" <mliska@...e.cz>,
linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
llvm@...ts.linux.dev
Cc: Stephane Eranian <eranian@...gle.com>,
Ian Rogers <irogers@...gle.com>
Subject: [PATCH v1 08/13] tools build: Add feature test for abi::__cxa_demangle
cxxabi.h is part of libsdtc++ and LLVM's libcxx, providing
abi::__cxa_demangle a portable C++ demangler. Add a feature test to
detect that the function is available.
Signed-off-by: Ian Rogers <irogers@...gle.com>
---
tools/build/Makefile.feature | 1 +
tools/build/feature/Makefile | 4 ++++
tools/build/feature/test-cxa-demangle.cpp | 17 +++++++++++++++++
3 files changed, 22 insertions(+)
create mode 100644 tools/build/feature/test-cxa-demangle.cpp
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 38f8851bd7cb..214622d7537c 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -80,6 +80,7 @@ FEATURE_TESTS_EXTRA := \
compile-32 \
compile-x32 \
cplus-demangle \
+ cxa-demangle \
gtk2 \
gtk2-infobar \
hello \
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index dc9323e01e42..0a3b9281f8b0 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -23,6 +23,7 @@ FILES= \
test-libbfd-liberty.bin \
test-libbfd-liberty-z.bin \
test-cplus-demangle.bin \
+ test-cxa-demangle.bin \
test-libcap.bin \
test-libelf.bin \
test-libelf-getphdrnum.bin \
@@ -262,6 +263,9 @@ $(OUTPUT)test-libbfd-liberty-z.bin:
$(OUTPUT)test-cplus-demangle.bin:
$(BUILD) -liberty
+$(OUTPUT)test-cxa-demangle.bin:
+ $(BUILDXX)
+
$(OUTPUT)test-backtrace.bin:
$(BUILD)
diff --git a/tools/build/feature/test-cxa-demangle.cpp b/tools/build/feature/test-cxa-demangle.cpp
new file mode 100644
index 000000000000..a3e712f65c37
--- /dev/null
+++ b/tools/build/feature/test-cxa-demangle.cpp
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <stdio.h>
+#include <stdlib.h>
+#include <cxxabi.h>
+
+int main(void)
+{
+ size_t len = 256;
+ char *output = (char*)malloc(len);
+ int status;
+
+ output = abi::__cxa_demangle("FieldName__9ClassNameFd", output, &len, &status);
+
+ printf("demangled symbol: {%s}\n", output);
+
+ return 0;
+}
--
2.40.0.rc1.284.g88254d51c5-goog
Powered by blists - more mailing lists