Skip to content

Commit c77db81

Browse files
committed
[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
1 parent a5a8a05 commit c77db81

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/runtimes/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,10 @@ function(runtime_register_target name target)
346346
list(APPEND ${name}_extra_args -DLLVM_ENABLE_RUNTIMES=${LLVM_ENABLE_RUNTIMES_PASSTHROUGH})
347347
endif()
348348

349+
if(NOT RUNTIMES_${name}_LLVM_USE_LINKER AND NOT RUNTIMES_${target}_LLVM_USE_LINKER)
350+
list(APPEND ${name}_extra_args -DLLVM_USE_LINKER=${LLVM_USE_LINKER})
351+
endif()
352+
349353
llvm_ExternalProject_Add(runtimes-${name}
350354
${CMAKE_CURRENT_SOURCE_DIR}/../../runtimes
351355
DEPENDS ${${name}_deps}
@@ -362,7 +366,6 @@ function(runtime_register_target name target)
362366
-DLLVM_RUNTIMES_TARGET=${name}
363367
${COMMON_CMAKE_ARGS}
364368
${${name}_extra_args}
365-
PASSTHROUGH_PREFIXES LLVM_USE_LINKER
366369
EXTRA_TARGETS ${${name}_extra_targets}
367370
${${name}_test_targets}
368371
USE_TOOLCHAIN

0 commit comments

Comments
 (0)