From e571e3f7a8759c8bf41ebb65c17d19e0c1c55a30 Mon Sep 17 00:00:00 2001 From: Michael Kenzel <michael.kenzel@gmail.com> Date: Tue, 21 Nov 2023 04:19:00 +0100 Subject: [PATCH] [libc++abi] Introduce LIBCXXABI_ENABLE_DEMANGLER --- libcxxabi/CMakeLists.txt | 7 ++++--- libcxxabi/src/CMakeLists.txt | 7 ++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt index 6dcfc51e55321..1c1247e165340 100644 --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt @@ -46,6 +46,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) @@ -129,8 +132,6 @@ option(LIBCXXABI_BAREMETAL "Build libc++abi for baremetal targets." OFF) # The default terminate handler attempts to demangle uncaught exceptions, which # causes extra I/O and demangling code to be pulled in. option(LIBCXXABI_SILENT_TERMINATE "Set this to make the terminate handler default to a silent alternative" OFF) -option(LIBCXXABI_NON_DEMANGLING_TERMINATE "Set this to make the terminate handler -avoid demangling" OFF) if (NOT LIBCXXABI_ENABLE_SHARED AND NOT LIBCXXABI_ENABLE_STATIC) message(FATAL_ERROR "libc++abi must be built as either a shared or static library.") @@ -431,7 +432,7 @@ if (LIBCXXABI_SILENT_TERMINATE) add_definitions(-DLIBCXXABI_SILENT_TERMINATE) endif() -if (LIBCXXABI_NON_DEMANGLING_TERMINATE) +if (NOT LIBCXXABI_ENABLE_DEMANGLER) add_definitions(-DLIBCXXABI_NON_DEMANGLING_TERMINATE) endif() diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt index 0a6fc892a4f69..4167845c9713d 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