[libcxxabi] r275505 - libc++abi: add a top level option for using CompilerRT

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 14 17:49:42 PDT 2016


Author: compnerd
Date: Thu Jul 14 19:49:42 2016
New Revision: 275505

URL: http://llvm.org/viewvc/llvm-project?rev=275505&view=rev
Log:
libc++abi: add a top level option for using CompilerRT

Add an option to opt into compiler-rt instead of libgcc.  This option defaults
to OFF to avoid a behaviour change.  It is not possible to mix and match
different runtime libraries.  Disabling this requires that libc++ is built
accordingly.  This knob is particularly useful for targets that are GCC by
default (i.e. Linux).

Modified:
    libcxxabi/trunk/CMakeLists.txt
    libcxxabi/trunk/cmake/config-ix.cmake

Modified: libcxxabi/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=275505&r1=275504&r2=275505&view=diff
==============================================================================
--- libcxxabi/trunk/CMakeLists.txt (original)
+++ libcxxabi/trunk/CMakeLists.txt Thu Jul 14 19:49:42 2016
@@ -113,6 +113,7 @@ option(LIBCXXABI_ENABLE_ASSERTIONS "Enab
 option(LIBCXXABI_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
 option(LIBCXXABI_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
 option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
+option(LIBCXXABI_USE_COMPILER_RT "Use compiler-rt instead of libgcc" OFF)
 option(LIBCXXABI_ENABLE_THREADS "Build with threads enabled" ON)
 option(LIBCXXABI_HAS_PTHREAD_API "Ignore auto-detection and force use of pthread API" OFF)
 option(LIBCXXABI_BUILD_32_BITS "Build 32 bit libc++abi." ${LLVM_BUILD_32_BITS})
@@ -243,6 +244,9 @@ if (LIBCXXABI_HAS_NOSTDINCXX_FLAG)
   string(REPLACE "-stdlib=libstdc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
 endif()
 
+if (LIBCXXABI_USE_COMPILER_RT)
+  list(APPEND LIBCXXABI_LINK_FLAGS "-rtlib=compiler-rt")
+endif ()
 
 append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WERROR_FLAG -Werror=return-type)
 

Modified: libcxxabi/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/cmake/config-ix.cmake?rev=275505&r1=275504&r2=275505&view=diff
==============================================================================
--- libcxxabi/trunk/cmake/config-ix.cmake (original)
+++ libcxxabi/trunk/cmake/config-ix.cmake Thu Jul 14 19:49:42 2016
@@ -42,6 +42,8 @@ check_cxx_compiler_flag(/GR-
 check_library_exists(c fopen "" LIBCXXABI_HAS_C_LIB)
 check_library_exists(dl dladdr "" LIBCXXABI_HAS_DL_LIB)
 check_library_exists(pthread pthread_once "" LIBCXXABI_HAS_PTHREAD_LIB)
-check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXXABI_HAS_GCC_S_LIB)
+if (NOT LIBCXXABI_USE_COMPILER_RT)
+  check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXXABI_HAS_GCC_S_LIB)
+endif ()
 check_library_exists(c __cxa_thread_atexit_impl ""
   LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL)




More information about the cfe-commits mailing list