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

Asiri Rathnayake via cfe-commits cfe-commits at lists.llvm.org
Fri May 27 14:06:49 PDT 2016


rmaprath added a comment.

In http://reviews.llvm.org/D20677#442559, @EricWF wrote:

> 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.


That sounds generally OK to me. The toolchain I'm working on (ARM Compiler 6) has an elaborate mechanism (based on build attributes) to select the correct variant of libraries. In other words, if any of your objects are compiled with exceptions, you are guaranteed to no select any of the no-exceptions library variants. This avoids the problem you mentioned altogether.

But I can see that this can be a problem for any other toolchain that does not have such a functionality, and a link-time error would be more suitable.

I'll re-spin a patch soon.

Thanks.

/ Asiri


http://reviews.llvm.org/D20677





More information about the cfe-commits mailing list