Skip to content

Commit

Permalink
[compiler-rt][CMake] Properly set COMPILER_RT_HAS_LLD
Browse files Browse the repository at this point in the history
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.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D144660
  • Loading branch information
aeubanks committed May 31, 2023
1 parent 763e036 commit 395a614
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 1 addition & 7 deletions compiler-rt/CMakeLists.txt
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions llvm/runtimes/CMakeLists.txt
Expand Up @@ -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}
Expand All @@ -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}
Expand Down Expand Up @@ -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}
Expand Down

0 comments on commit 395a614

Please sign in to comment.