[compiler-rt] c0d4f22 - [CMake][compiler-rt] Clean up the use of libcxx and libcxxabi
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 24 01:11:57 PDT 2022
Author: Petr Hosek
Date: 2022-06-24T08:11:37Z
New Revision: c0d4f2282d8335cd15338663b18cd7f22155456e
URL: https://github.com/llvm/llvm-project/commit/c0d4f2282d8335cd15338663b18cd7f22155456e
DIFF: https://github.com/llvm/llvm-project/commit/c0d4f2282d8335cd15338663b18cd7f22155456e.diff
LOG: [CMake][compiler-rt] Clean up the use of libcxx and libcxxabi
We no longer support the use of LLVM_ENABLE_PROJECTS for libcxx and
libcxxabi. We don't use paths to libcxx and libcxxabi in compiler-rt.
Differential Revision: https://reviews.llvm.org/D126905
Added:
Modified:
compiler-rt/CMakeLists.txt
compiler-rt/cmake/Modules/AddCompilerRT.cmake
compiler-rt/lib/fuzzer/CMakeLists.txt
compiler-rt/lib/fuzzer/tests/CMakeLists.txt
compiler-rt/lib/msan/tests/CMakeLists.txt
compiler-rt/lib/tsan/CMakeLists.txt
compiler-rt/test/msan/CMakeLists.txt
compiler-rt/test/tsan/CMakeLists.txt
Removed:
################################################################################
diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index cdafdfc7ecc3b..515b43bc9d2d4 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -621,32 +621,6 @@ add_subdirectory(include)
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
index b7eb04327bb1d..f3c26c8a8b994 100644
--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -585,13 +585,6 @@ endmacro(add_compiler_rt_script src name)
# CFLAGS <list of compile flags>
# 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
index 856cd732d5175..9a8e15aa174db 100644
--- a/compiler-rt/lib/fuzzer/CMakeLists.txt
+++ b/compiler-rt/lib/fuzzer/CMakeLists.txt
@@ -59,9 +59,7 @@ CHECK_CXX_SOURCE_COMPILES("
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 @@ add_compiler_rt_runtime(clang_rt.fuzzer_interceptors
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
index 10fcfbaa083e5..6ed5b86c1e21e 100644
--- a/compiler-rt/lib/fuzzer/tests/CMakeLists.txt
+++ b/compiler-rt/lib/fuzzer/tests/CMakeLists.txt
@@ -30,9 +30,7 @@ else()
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 @@ if(COMPILER_RT_DEFAULT_TARGET_ARCH IN_LIST FUZZER_SUPPORTED_ARCH)
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
index 3ed888b81c6e5..3dfc16bcc3049 100644
--- a/compiler-rt/lib/msan/tests/CMakeLists.txt
+++ b/compiler-rt/lib/msan/tests/CMakeLists.txt
@@ -130,9 +130,7 @@ macro(add_msan_tests_for_arch arch kind cflags)
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
index a327fb14de9a5..454f435341cff 100644
--- a/compiler-rt/lib/tsan/CMakeLists.txt
+++ b/compiler-rt/lib/tsan/CMakeLists.txt
@@ -24,8 +24,7 @@ else()
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
index 01b832b5ae3f9..bd7e8934ad888 100644
--- a/compiler-rt/test/msan/CMakeLists.txt
+++ b/compiler-rt/test/msan/CMakeLists.txt
@@ -45,9 +45,7 @@ if(NOT COMPILER_RT_STANDALONE_BUILD)
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
index 25e95aa98cf95..c0570801a271b 100644
--- a/compiler-rt/test/tsan/CMakeLists.txt
+++ b/compiler-rt/test/tsan/CMakeLists.txt
@@ -7,8 +7,7 @@ endif()
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)
More information about the llvm-commits
mailing list