[libcxx-commits] [libcxxabi] [libc++abi] Introduce LIBCXXABI_ENABLE_DEMANGLER (PR #72948)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Nov 20 19:25:44 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxxabi
Author: Michael Kenzel (michael-kenzel)
<details>
<summary>Changes</summary>
This change introduces a `LIBCXXABI_ENABLE_DEMANGLER` CMake option that allows turning off the demangler API from being included in the build. This can be useful when trying to build a minimal version of libc++abi, e.g., for a baremetal target. The demangler is quite heavy in dependencies on libraries that are not easily available on such a target, and is rarely actually used.
---
Full diff: https://github.com/llvm/llvm-project/pull/72948.diff
2 Files Affected:
- (modified) libcxxabi/CMakeLists.txt (+3)
- (modified) libcxxabi/src/CMakeLists.txt (+6-1)
``````````diff
diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index efe830bd2ad6659..cf01552ea0a5cb5 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -40,6 +40,9 @@ include(CMakeDependentOption)
include(HandleCompilerRT)
# Define options.
+option(LIBCXXABI_ENABLE_DEMANGLER
+ "Provide support for demangling in the runtime.
+ When disabled, libc++abi does not support the name demangler API." ON)
option(LIBCXXABI_ENABLE_EXCEPTIONS
"Provide support for exceptions in the runtime.
When disabled, libc++abi does not support stack unwinding and other exceptions-related features." ON)
diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index 02031b69fd9156a..4f9e7a0026bb703 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -3,7 +3,6 @@ set(LIBCXXABI_SOURCES
# C++ABI files
cxa_aux_runtime.cpp
cxa_default_handlers.cpp
- cxa_demangle.cpp
cxa_exception_storage.cpp
cxa_guard.cpp
cxa_handlers.cpp
@@ -19,6 +18,12 @@ set(LIBCXXABI_SOURCES
private_typeinfo.cpp
)
+if (LIBCXXABI_ENABLE_DEMANGLER)
+ list(APPEND LIBCXXABI_SOURCES
+ cxa_demangle.cpp
+ )
+endif()
+
if (LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS)
list(APPEND LIBCXXABI_SOURCES
stdlib_new_delete.cpp
``````````
</details>
https://github.com/llvm/llvm-project/pull/72948
More information about the libcxx-commits
mailing list