diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt @@ -621,32 +621,6 @@ option(COMPILER_RT_USE_LIBCXX "Enable compiler-rt to use libc++ from the source tree" ON) -if(COMPILER_RT_USE_LIBCXX) - if(LLVM_ENABLE_PROJECTS_USED) - # Don't use libcxx if LLVM_ENABLE_PROJECTS does not enable it. - set(COMPILER_RT_LIBCXX_PATH ${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR}) - set(COMPILER_RT_LIBCXXABI_PATH ${LLVM_EXTERNAL_LIBCXXABI_SOURCE_DIR}) - else() - foreach(path IN ITEMS ${LLVM_MAIN_SRC_DIR}/projects/libcxx - ${LLVM_MAIN_SRC_DIR}/runtimes/libcxx - ${LLVM_MAIN_SRC_DIR}/../libcxx - ${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR}) - if(IS_DIRECTORY ${path}) - set(COMPILER_RT_LIBCXX_PATH ${path}) - break() - endif() - endforeach() - foreach(path IN ITEMS ${LLVM_MAIN_SRC_DIR}/projects/libcxxabi - ${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi - ${LLVM_MAIN_SRC_DIR}/../libcxxabi - ${LLVM_EXTERNAL_LIBCXXABI_SOURCE_DIR}) - if(IS_DIRECTORY ${path}) - set(COMPILER_RT_LIBCXXABI_PATH ${path}) - break() - endif() - endforeach() - endif() -endif() set(COMPILER_RT_LLD_PATH ${LLVM_MAIN_SRC_DIR}/tools/lld) if(EXISTS ${COMPILER_RT_LLD_PATH}/ AND LLVM_TOOL_LLD_BUILD) diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake --- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake +++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake @@ -585,13 +585,6 @@ # CFLAGS # USE_TOOLCHAIN) macro(add_custom_libcxx name prefix) - if(NOT COMPILER_RT_LIBCXX_PATH) - message(FATAL_ERROR "libcxx not found!") - endif() - if(NOT COMPILER_RT_LIBCXXABI_PATH) - message(FATAL_ERROR "libcxxabi not found!") - endif() - cmake_parse_arguments(LIBCXX "USE_TOOLCHAIN" "" "DEPS;CFLAGS;CMAKE_ARGS" ${ARGN}) if(LIBCXX_USE_TOOLCHAIN) diff --git a/compiler-rt/lib/fuzzer/CMakeLists.txt b/compiler-rt/lib/fuzzer/CMakeLists.txt --- a/compiler-rt/lib/fuzzer/CMakeLists.txt +++ b/compiler-rt/lib/fuzzer/CMakeLists.txt @@ -59,9 +59,7 @@ set(LIBFUZZER_CFLAGS ${COMPILER_RT_COMMON_CFLAGS}) -if(OS_NAME MATCHES "Linux|Fuchsia" AND - COMPILER_RT_LIBCXX_PATH AND - COMPILER_RT_LIBCXXABI_PATH) +if(OS_NAME MATCHES "Linux|Fuchsia" AND COMPILER_RT_USE_LIBCXX) list(APPEND LIBFUZZER_CFLAGS -D_LIBCPP_ABI_VERSION=Fuzzer) append_list_if(COMPILER_RT_HAS_NOSTDINCXX_FLAG -nostdinc++ LIBFUZZER_CFLAGS) elseif(TARGET cxx-headers OR HAVE_LIBCXX) @@ -134,9 +132,7 @@ CFLAGS ${LIBFUZZER_CFLAGS} PARENT_TARGET fuzzer) -if(OS_NAME MATCHES "Linux|Fuchsia" AND - COMPILER_RT_LIBCXX_PATH AND - COMPILER_RT_LIBCXXABI_PATH) +if(OS_NAME MATCHES "Linux|Fuchsia" AND COMPILER_RT_USE_LIBCXX) macro(partially_link_libcxx name dir arch) get_target_flags_for_arch(${arch} target_cflags) if(CMAKE_CXX_COMPILER_ID MATCHES Clang) diff --git a/compiler-rt/lib/fuzzer/tests/CMakeLists.txt b/compiler-rt/lib/fuzzer/tests/CMakeLists.txt --- a/compiler-rt/lib/fuzzer/tests/CMakeLists.txt +++ b/compiler-rt/lib/fuzzer/tests/CMakeLists.txt @@ -30,9 +30,7 @@ list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS -lpthread) endif() -if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND - COMPILER_RT_LIBCXX_PATH AND - COMPILER_RT_LIBCXXABI_PATH) +if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND COMPILER_RT_USE_LIBCXX) list(APPEND LIBFUZZER_UNITTEST_CFLAGS -nostdinc++ -fno-exceptions) list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS -nostdlib++ -fno-exceptions) endif() @@ -60,9 +58,7 @@ ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} FOLDER "Compiler-RT Runtime tests") - if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND - COMPILER_RT_LIBCXX_PATH AND - COMPILER_RT_LIBCXXABI_PATH) + if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND COMPILER_RT_USE_LIBCXX) file(GLOB libfuzzer_headers ../*.h) set(LIBFUZZER_TEST_RUNTIME_DEPS libcxx_fuzzer_${arch}-build ${libfuzzer_headers}) set(LIBFUZZER_TEST_RUNTIME_CFLAGS -isystem ${LIBCXX_${arch}_PREFIX}/include/c++/v1) diff --git a/compiler-rt/lib/msan/tests/CMakeLists.txt b/compiler-rt/lib/msan/tests/CMakeLists.txt --- a/compiler-rt/lib/msan/tests/CMakeLists.txt +++ b/compiler-rt/lib/msan/tests/CMakeLists.txt @@ -130,9 +130,7 @@ endmacro() # We should only build MSan unit tests if we can build instrumented libcxx. -if(COMPILER_RT_CAN_EXECUTE_TESTS AND - COMPILER_RT_LIBCXX_PATH AND - COMPILER_RT_LIBCXXABI_PATH) +if(COMPILER_RT_CAN_EXECUTE_TESTS AND COMPILER_RT_USE_LIBCXX) foreach(arch ${MSAN_SUPPORTED_ARCH}) get_target_flags_for_arch(${arch} TARGET_CFLAGS) set(LIBCXX_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/../libcxx_msan_${arch}) diff --git a/compiler-rt/lib/tsan/CMakeLists.txt b/compiler-rt/lib/tsan/CMakeLists.txt --- a/compiler-rt/lib/tsan/CMakeLists.txt +++ b/compiler-rt/lib/tsan/CMakeLists.txt @@ -24,8 +24,7 @@ endif() # Build libcxx instrumented with TSan. -if(COMPILER_RT_LIBCXX_PATH AND - COMPILER_RT_LIBCXXABI_PATH AND +if(COMPILER_RT_USE_LIBCXX AND COMPILER_RT_TEST_COMPILER_ID STREQUAL "Clang" AND NOT ANDROID) set(libcxx_tsan_deps) diff --git a/compiler-rt/test/msan/CMakeLists.txt b/compiler-rt/test/msan/CMakeLists.txt --- a/compiler-rt/test/msan/CMakeLists.txt +++ b/compiler-rt/test/msan/CMakeLists.txt @@ -45,9 +45,7 @@ list(APPEND MSAN_TEST_DEPS msan) endif() -if(COMPILER_RT_INCLUDE_TESTS AND - COMPILER_RT_LIBCXX_PATH AND - COMPILER_RT_LIBCXXABI_PATH) +if(COMPILER_RT_INCLUDE_TESTS AND COMPILER_RT_USE_LIBCXX) configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py) diff --git a/compiler-rt/test/tsan/CMakeLists.txt b/compiler-rt/test/tsan/CMakeLists.txt --- a/compiler-rt/test/tsan/CMakeLists.txt +++ b/compiler-rt/test/tsan/CMakeLists.txt @@ -7,8 +7,7 @@ if(NOT COMPILER_RT_STANDALONE_BUILD) list(APPEND TSAN_TEST_DEPS tsan) endif() -if(COMPILER_RT_LIBCXX_PATH AND - COMPILER_RT_LIBCXXABI_PATH AND +if(COMPILER_RT_USE_LIBCXX AND COMPILER_RT_TEST_COMPILER_ID STREQUAL "Clang" AND NOT APPLE AND NOT ANDROID) list(APPEND TSAN_TEST_DEPS libcxx_tsan)