[PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Fri May 27 12:07:58 PDT 2016


EricWF added a comment.

I have an issue with this change since it allows a libc++abi built without exceptions to be used in a program compiled with them. I assert that this should not be supported in any way.

My personal preference would be to remove as much of the exception API from the library when it's built without exceptions. This should cause link errors if a program contains any code that throws. If this is not done it creates bugs within code like `__terminate` as mentioned in an inline comment.

I would like to see another revision of this patch that removes as much of the exception API as possible. Looking at the symbols defined in `cxxabi.h` I would say ever symbol in sections 2.4 and 2.5 should not longer be defined in the library.


================
Comment at: src/cxa_handlers.cpp:62
@@ -61,3 +61,3 @@
 void
 __terminate(terminate_handler func) _NOEXCEPT
 {
----------------
If any part of your executable was compiled with exceptions on, and it sets a terminate handler that throws an exception this does the wrong thing.  I don't really like that although I admit that would certainly be an exceptional situation.

At minimum this requirement needs to be documented explicitly somewhere. Within the CMake option description seems fine for now.

================
Comment at: src/cxa_personality.cpp:1204
@@ -1203,2 +1203,3 @@
     }
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
     try
----------------
This is yucky. We are in exception handling code and we are saying it has been built without exceptions. I understand this "gets libc++abi to compile" without exceptions but it doesn't really make sense.


http://reviews.llvm.org/D20677





More information about the cfe-commits mailing list