From 123f44a2f6c3b19cf2d0f6a233fedb6da65edebd Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Fri, 6 Feb 2015 17:47:57 +0000 Subject: [PATCH] unwind: use -fno-rtti -fno-exceptions -funwind-tables RTTI and exceptions are not needed for the unwinder, the use of C++ there is for very specific cases, and does not require dynamic_cast nor does it use exceptions. This avoids unnecessary references to type information being emitted. llvm-svn: 228408 --- libcxxabi/cmake/config-ix.cmake | 2 ++ libcxxabi/src/Unwind/CMakeLists.txt | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libcxxabi/cmake/config-ix.cmake b/libcxxabi/cmake/config-ix.cmake index 2fea2cd9bf54..5405587554b5 100644 --- a/libcxxabi/cmake/config-ix.cmake +++ b/libcxxabi/cmake/config-ix.cmake @@ -5,6 +5,8 @@ include(CheckCXXCompilerFlag) # Check compiler flags check_c_compiler_flag(-funwind-tables LIBCXXABI_HAS_FUNWIND_TABLES) check_cxx_compiler_flag(-fPIC LIBCXXABI_HAS_FPIC_FLAG) +check_cxx_compiler_flag(-fno-exceptions LIBCXXABI_HAS_NO_EXCEPTIONS_FLAG) +check_cxx_compiler_flag(-fno-rtti LIBCXXABI_HAS_NO_RTTI_FLAG) check_cxx_compiler_flag(-fstrict-aliasing LIBCXXABI_HAS_FSTRICT_ALIASING_FLAG) check_cxx_compiler_flag(-nodefaultlibs LIBCXXABI_HAS_NODEFAULTLIBS_FLAG) check_cxx_compiler_flag(-nostdinc++ LIBCXXABI_HAS_NOSTDINCXX_FLAG) diff --git a/libcxxabi/src/Unwind/CMakeLists.txt b/libcxxabi/src/Unwind/CMakeLists.txt index 598a081ea3de..56c217d1788a 100644 --- a/libcxxabi/src/Unwind/CMakeLists.txt +++ b/libcxxabi/src/Unwind/CMakeLists.txt @@ -68,6 +68,11 @@ target_link_libraries(unwind ${libraries}) append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_FPIC_FLAG -fPIC) 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) + set(LIBCXXABI_UNWINDER_NAME "unwind") if ( APPLE ) @@ -86,11 +91,12 @@ if ( APPLE ) endif() string(REPLACE ";" " " LIBCXXABI_COMPILE_FLAGS "${LIBCXXABI_COMPILE_FLAGS}") +string(REPLACE ";" " " LIBUNWIND_COMPILE_FLAGS "${LIBUNWIND_COMPILE_FLAGS}") string(REPLACE ";" " " LIBCXXABI_LINK_FLAGS "${LIBCXXABI_LINK_FLAGS}") set_target_properties(unwind PROPERTIES - COMPILE_FLAGS "${LIBCXXABI_COMPILE_FLAGS}" + COMPILE_FLAGS "${LIBCXXABI_COMPILE_FLAGS} ${LIBUNWIND_COMPILE_FLAGS}" LINK_FLAGS "${LIBCXXABI_LINK_FLAGS}" OUTPUT_NAME "${LIBCXXABI_UNWINDER_NAME}" VERSION "1.0"