[libcxx-commits] [PATCH] D64191: [libcxxabi] Don't process exceptions in cxa_handlers when they're disabled
Petr Hosek via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jul 3 19:03:17 PDT 2019
phosek created this revision.
phosek added reviewers: ldionne, EricWF.
Herald added subscribers: libcxx-commits, erik.pilkington, dexonsmith, christof, mehdi_amini.
When exceptions are disabled, avoid their processing altogether.
This avoids pulling in the depenency on demangler significantly
reducing binary size when statically linking against libc++abi
built without exception support.
Repository:
rCXXA libc++abi
https://reviews.llvm.org/D64191
Files:
libcxxabi/src/cxa_default_handlers.cpp
libcxxabi/src/cxa_handlers.cpp
Index: libcxxabi/src/cxa_handlers.cpp
===================================================================
--- libcxxabi/src/cxa_handlers.cpp
+++ libcxxabi/src/cxa_handlers.cpp
@@ -73,6 +73,7 @@
void
terminate() _NOEXCEPT
{
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
// If there might be an uncaught exception
using namespace __cxxabiv1;
__cxa_eh_globals* globals = __cxa_get_globals_fast();
@@ -87,6 +88,7 @@
__terminate(exception_header->terminateHandler);
}
}
+#endif
__terminate(get_terminate());
}
Index: libcxxabi/src/cxa_default_handlers.cpp
===================================================================
--- libcxxabi/src/cxa_default_handlers.cpp
+++ libcxxabi/src/cxa_default_handlers.cpp
@@ -25,6 +25,7 @@
__attribute__((noreturn))
static void demangling_terminate_handler()
{
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
// If there might be an uncaught exception
using namespace __cxxabiv1;
__cxa_eh_globals* globals = __cxa_get_globals_fast();
@@ -71,6 +72,7 @@
abort_message("terminating with %s foreign exception", cause);
}
}
+#endif
// Else just note that we're terminating
abort_message("terminating");
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64191.207963.patch
Type: text/x-patch
Size: 1224 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190704/bb0e66e3/attachment.bin>
More information about the libcxx-commits
mailing list