From e81fcb81dc03d5898133e5b961fb1e8a4c741aca Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Wed, 24 Aug 2016 04:22:52 +0000 Subject: [PATCH] libc++: add an option to build against compiler-rt This mirrors the option in libc++abi to build without libgcc. llvm-svn: 279606 --- libcxx/CMakeLists.txt | 5 +++++ libcxx/cmake/config-ix.cmake | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index 2934c6d..3d35be9 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -68,6 +68,7 @@ option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON) option(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY "Install libc++experimental.a" OFF) set(LIBCXX_ABI_VERSION 1 CACHE STRING "ABI version of libc++.") option(LIBCXX_ABI_UNSTABLE "Unstable ABI of libc++." OFF) +option(LIBCXX_USE_COMPILER_RT "Use compiler-rt instead of libgcc" OFF) if (NOT LIBCXX_ENABLE_SHARED AND NOT LIBCXX_ENABLE_STATIC) message(FATAL_ERROR "libc++ must be built as either a shared or static library.") @@ -277,6 +278,10 @@ add_target_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain ${LIBCXX_GCC_TOOLCHAIN} # Configure compiler. include(config-ix) +if (LIBCXX_USE_COMPILER_RT) + list(APPEND LIBCXX_LINK_FLAGS "-rtlib=compiler-rt") +endif() + # Configure coverage options. if (LIBCXX_GENERATE_COVERAGE) include(CodeCoverage) diff --git a/libcxx/cmake/config-ix.cmake b/libcxx/cmake/config-ix.cmake index 3e6c359..bbbe7c6 100644 --- a/libcxx/cmake/config-ix.cmake +++ b/libcxx/cmake/config-ix.cmake @@ -17,4 +17,6 @@ check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB) check_library_exists(c fopen "" LIBCXX_HAS_C_LIB) check_library_exists(m ccos "" LIBCXX_HAS_M_LIB) check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB) -check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB) +if (NOT LIBCXX_USE_COMPILER_RT) + check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB) +endif() -- 2.7.4