[PATCH] D64191: [libcxxabi] Don't process exceptions in cxa_handlers when they're disabled

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 12 12:11:18 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL365944: [libcxxabi] Don't process exceptions in cxa_handlers when they're disabled (authored by phosek, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64191?vs=209343&id=209559#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64191/new/

https://reviews.llvm.org/D64191

Files:
  libcxxabi/trunk/CMakeLists.txt
  libcxxabi/trunk/src/cxa_default_handlers.cpp
  libcxxabi/trunk/src/cxa_handlers.cpp


Index: libcxxabi/trunk/src/cxa_default_handlers.cpp
===================================================================
--- libcxxabi/trunk/src/cxa_default_handlers.cpp
+++ libcxxabi/trunk/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");
 }
Index: libcxxabi/trunk/src/cxa_handlers.cpp
===================================================================
--- libcxxabi/trunk/src/cxa_handlers.cpp
+++ libcxxabi/trunk/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/trunk/CMakeLists.txt
===================================================================
--- libcxxabi/trunk/CMakeLists.txt
+++ libcxxabi/trunk/CMakeLists.txt
@@ -43,7 +43,9 @@
 include(HandleCompilerRT)
 
 # Define options.
-option(LIBCXXABI_ENABLE_EXCEPTIONS "Use exceptions." 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)
 option(LIBCXXABI_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
 option(LIBCXXABI_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
 option(LIBCXXABI_ENABLE_PIC "Build Position-Independent Code, even in static library" ON)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64191.209559.patch
Type: text/x-patch
Size: 2001 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190712/c1bca4c5/attachment.bin>


More information about the llvm-commits mailing list