mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[clang][cmake] Force CMAKE_LINKER for multistage build in case of BOOTSTRAP_LLVM_ENABLE_LLD and MSVC
The issue with LLVM_ENABLE_LLD is that it just passes -fuse-ld=lld to compiler/linker options which makes sense only for those platforms where cmake invokes a compiler driver for linking. On Windows (MSVC) cmake invokes the linker directly and requires CMAKE_LINKER to be specified otherwise it defaults CMAKE_LINKER to be link.exe. This patch allows BOOTSTRAP_LLVM_ENABLE_LLD to set CMAKE_LINKER in two cases: * if building for host Windows, * if crosscompiling for target Windows. It also skips adding '-fuse-ld=lld' to make lld-link not warning about 'unknown argument'. This fixes build with `clang/cmake/caches/DistributionExample.cmake` on Windows. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D80873
This commit is contained in:
parent
ea833b5a3d
commit
8ae75949b3
@ -261,7 +261,12 @@ if( LLVM_ENABLE_LLD )
|
||||
if ( LLVM_USE_LINKER )
|
||||
message(FATAL_ERROR "LLVM_ENABLE_LLD and LLVM_USE_LINKER can't be set at the same time")
|
||||
endif()
|
||||
set(LLVM_USE_LINKER "lld")
|
||||
# In case of MSVC cmake always invokes the linker directly, so the linker
|
||||
# should be specified by CMAKE_LINKER cmake variable instead of by -fuse-ld
|
||||
# compiler option.
|
||||
if ( NOT MSVC )
|
||||
set(LLVM_USE_LINKER "lld")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( LLVM_USE_LINKER )
|
||||
|
Loading…
x
Reference in New Issue
Block a user