[llvm] c77db81 - [CMake] Fix runtimes cross-compilation when using LLVM_USE_LINKER
Vincent Lee via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 3 11:24:22 PDT 2022
Author: Vincent Lee
Date: 2022-08-03T11:24:09-07:00
New Revision: c77db81616805936fa8471241b3b0fce4af12cec
URL: https://github.com/llvm/llvm-project/commit/c77db81616805936fa8471241b3b0fce4af12cec
DIFF: https://github.com/llvm/llvm-project/commit/c77db81616805936fa8471241b3b0fce4af12cec.diff
LOG: [CMake] Fix runtimes cross-compilation when using LLVM_USE_LINKER
This is motivated by https://reviews.llvm.org/D115852#3226050 where passing
`LLVM_USE_LINKER` in PASSTHROUGH_PREFIXES breaks cross-compilation
(e.g. targeting Windows on a Linux host). As suggested on that diff, implement
an override for it by allowing users to pass `RUNTIMES_${target}_LLVM_USE_LINKER`
to specify the linker for runtimes. Defaults to host linker if not specified.
Reviewed By: phosek, smeenai
Differential Revision: https://reviews.llvm.org/D131051
Added:
Modified:
llvm/runtimes/CMakeLists.txt
Removed:
################################################################################
diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index 34fcccab100c5..d9041216beb5f 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -346,6 +346,10 @@ function(runtime_register_target name target)
list(APPEND ${name}_extra_args -DLLVM_ENABLE_RUNTIMES=${LLVM_ENABLE_RUNTIMES_PASSTHROUGH})
endif()
+ if(NOT RUNTIMES_${name}_LLVM_USE_LINKER AND NOT RUNTIMES_${target}_LLVM_USE_LINKER)
+ list(APPEND ${name}_extra_args -DLLVM_USE_LINKER=${LLVM_USE_LINKER})
+ endif()
+
llvm_ExternalProject_Add(runtimes-${name}
${CMAKE_CURRENT_SOURCE_DIR}/../../runtimes
DEPENDS ${${name}_deps}
@@ -362,7 +366,6 @@ function(runtime_register_target name target)
-DLLVM_RUNTIMES_TARGET=${name}
${COMMON_CMAKE_ARGS}
${${name}_extra_args}
- PASSTHROUGH_PREFIXES LLVM_USE_LINKER
EXTRA_TARGETS ${${name}_extra_targets}
${${name}_test_targets}
USE_TOOLCHAIN
More information about the llvm-commits
mailing list