diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt index 6489aa17c229..80954df33c21 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/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt index 75256c1326be..4f2c1a1fe32c 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}