[libcxxabi] r229427 - Do not add -fno-exceptions without -funwind-tables

Sergey Dmitrouk sdmitrouk at accesssoftek.com
Mon Feb 16 11:51:06 PST 2015


Author: sdmitrouk
Date: Mon Feb 16 13:51:06 2015
New Revision: 229427

URL: http://llvm.org/viewvc/llvm-project?rev=229427&view=rev
Log:
Do not add -fno-exceptions without -funwind-tables

Adding just -fno-exceptions breaks libunwind in quite mysterious way
when it's there, but exception handling doesn't work because of dummy
unwind tables.

Also as using exceptions implies references to symbols defined in
libcxx, abort build of libcxxabi as shared library if we have to keep
exceptions (when compiler supports -fno-exceptions, but not
-funwind-tables; one example would be a cross-compiler, in which case
testing for -funwind-tables flag by CMake actually requires libunwind to
be available before it's built).

Modified:
    libcxxabi/trunk/src/Unwind/CMakeLists.txt

Modified: libcxxabi/trunk/src/Unwind/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/CMakeLists.txt?rev=229427&r1=229426&r2=229427&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/CMakeLists.txt (original)
+++ libcxxabi/trunk/src/Unwind/CMakeLists.txt Mon Feb 16 13:51:06 2015
@@ -70,9 +70,16 @@ append_if(LIBCXXABI_COMPILE_FLAGS LIBCXX
 append_if(LIBCXXABI_LINK_FLAGS LIBCXXABI_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
 
 set(LIBUNWIND_COMPILE_FLAGS)
-append_if(LIBUNWIND_COMPILE_FLAGS LIBCXXABI_HAS_NO_EXCEPTIONS_FLAG -fno-exceptions)
 append_if(LIBUNWIND_COMPILE_FLAGS LIBCXXABI_HAS_NO_RTTI_FLAG -fno-rtti)
-append_if(LIBUNWIND_COMPILE_FLAGS LIBCXXABI_HAS_FUNWIND_TABLES -funwind-tables)
+if ( LIBCXXABI_HAS_NO_EXCEPTIONS_FLAG AND LIBCXXABI_HAS_FUNWIND_TABLES )
+  list(APPEND LIBUNWIND_COMPILE_FLAGS -fno-exceptions)
+  list(APPEND LIBUNWIND_COMPILE_FLAGS -funwind-tables)
+elseif( LIBUNWIND_ENABLE_SHARED )
+  message(FATAL_ERROR "Compiler doesn't support generation of unwind tables "
+                      "if exception support is disabled.  Building libunwind "
+                      "DSO with runtime dependency on libcxxabi is not "
+                      "supported.")
+endif()
 
 set(LIBCXXABI_UNWINDER_NAME "unwind")
 





More information about the cfe-commits mailing list