[PATCH] D131051: [CMake] Fix runtimes cross-compilation when using LLVM_USE_LINKER

Vincent Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 3 00:07:14 PDT 2022


thevinster created this revision.
Herald added a subscriber: mgorny.
Herald added a project: All.
thevinster edited the summary of this revision.
thevinster added reviewers: phosek, smeenai.
thevinster published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131051

Files:
  llvm/runtimes/CMakeLists.txt


Index: llvm/runtimes/CMakeLists.txt
===================================================================
--- llvm/runtimes/CMakeLists.txt
+++ llvm/runtimes/CMakeLists.txt
@@ -346,6 +346,10 @@
     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 @@
                                       -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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131051.449558.patch
Type: text/x-patch
Size: 1093 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220803/7357a8c7/attachment.bin>


More information about the llvm-commits mailing list