[llvm] fffa05a - Reland [compiler-rt][CMake] Properly set COMPILER_RT_HAS_LLD
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 5 14:36:22 PDT 2023
Author: Arthur Eubanks
Date: 2023-06-05T14:35:52-07:00
New Revision: fffa05a2bcb548d5189e8c2e52d2ed2e7ebb2498
URL: https://github.com/llvm/llvm-project/commit/fffa05a2bcb548d5189e8c2e52d2ed2e7ebb2498
DIFF: https://github.com/llvm/llvm-project/commit/fffa05a2bcb548d5189e8c2e52d2ed2e7ebb2498.diff
LOG: Reland [compiler-rt][CMake] Properly set COMPILER_RT_HAS_LLD
LLVM_TOOL_LLD_BUILD is a relic of the pre-monorepo times. This causes us to never set COMPILER_RT_HAS_LLD.
Instead, set it from the runtimes build if lld is being built and lld is used as the compiler-rt linker.
Mark a test that requires libstdc++ as requiring Android, as other platforms may not have a libstdc++ lying around.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D144660
Added:
Modified:
compiler-rt/CMakeLists.txt
compiler-rt/test/hwasan/TestCases/sizes.cpp
llvm/runtimes/CMakeLists.txt
Removed:
################################################################################
diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index 6489aa17c2292..80954df33c216 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -738,14 +738,8 @@ if(COMPILER_RT_USE_LIBCXX)
endif()
endif()
-set(COMPILER_RT_LLD_PATH ${LLVM_MAIN_SRC_DIR}/tools/lld)
-if(EXISTS ${COMPILER_RT_LLD_PATH}/ AND LLVM_TOOL_LLD_BUILD)
+if(COMPILER_RT_HAS_TRUNK_LLD AND LLVM_USE_LINKER STREQUAL "lld")
set(COMPILER_RT_HAS_LLD TRUE)
-else()
- set(COMPILER_RT_LLD_PATH ${LLVM_MAIN_SRC_DIR}/../lld)
- if(EXISTS ${COMPILER_RT_LLD_PATH}/ AND LLVM_TOOL_LLD_BUILD)
- set(COMPILER_RT_HAS_LLD TRUE)
- endif()
endif()
if(ANDROID)
diff --git a/compiler-rt/test/hwasan/TestCases/sizes.cpp b/compiler-rt/test/hwasan/TestCases/sizes.cpp
index 2cb70f52147ac..e3cc5826a952c 100644
--- a/compiler-rt/test/hwasan/TestCases/sizes.cpp
+++ b/compiler-rt/test/hwasan/TestCases/sizes.cpp
@@ -19,6 +19,8 @@
// RUN: %env_hwasan_opts=allocator_may_return_null=1 %run %t new-nothrow max 2>&1
// RUN: %run %t usable 2>&1
+// REQUIRES: android
+
// Tests for various edge cases related to sizes, notably the maximum size the
// allocator can allocate. Tests that an integer overflow in the parameters of
// calloc is caught.
diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index 75256c1326be9..4f2c1a1fe32cf 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -226,6 +226,10 @@ function(runtime_default_target)
set_enable_per_target_runtime_dir()
+ if ("lld" IN_LIST LLVM_ENABLE_PROJECTS)
+ list(APPEND extra_args -DCOMPILER_RT_HAS_TRUNK_LLD=TRUE)
+ endif()
+
llvm_ExternalProject_Add(runtimes
${CMAKE_CURRENT_SOURCE_DIR}/../../runtimes
DEPENDS ${ARG_DEPENDS}
@@ -242,6 +246,7 @@ function(runtime_default_target)
${COMMON_CMAKE_ARGS}
${RUNTIMES_CMAKE_ARGS}
${ARG_CMAKE_ARGS}
+ ${extra_args}
PASSTHROUGH_PREFIXES LLVM_ENABLE_RUNTIMES
LLVM_USE_LINKER
${ARG_PREFIXES}
@@ -334,6 +339,10 @@ function(runtime_register_target name)
set_enable_per_target_runtime_dir()
+ if ("lld" IN_LIST LLVM_ENABLE_PROJECTS)
+ list(APPEND ${name}_extra_args -DCOMPILER_RT_HAS_TRUNK_LLD=TRUE)
+ endif()
+
llvm_ExternalProject_Add(runtimes-${name}
${CMAKE_CURRENT_SOURCE_DIR}/../../runtimes
DEPENDS ${ARG_DEPENDS}
More information about the llvm-commits
mailing list