mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[cmake] Add linker detection for Apple platforms
LLVM currently assumes that Apple platforms will always use ld64. In the future, LLD Mach-O might also be supported, so add the beginnings of linker detection support. ld64 is currently the only detected linker, since `ld64.lld -v` doesn't yield any useful version output, but we can add that detection later, and in the meantime it's still useful to have the ld64 identification. Switch clang's order file check to use this new detection rather than just checking for the presence of an ld64 executable. Differential Revision: https://reviews.llvm.org/D48201 llvm-svn: 334780
This commit is contained in:
parent
7ed3f1b26c
commit
4ae4788876
@ -147,7 +147,20 @@ function(add_llvm_symbol_exports target_name export_file)
|
||||
set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} PARENT_SCOPE)
|
||||
endfunction(add_llvm_symbol_exports)
|
||||
|
||||
if(NOT WIN32 AND NOT APPLE)
|
||||
if(APPLE)
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_LINKER}" -v
|
||||
ERROR_VARIABLE stderr
|
||||
)
|
||||
set(LLVM_LINKER_DETECTED ON)
|
||||
if("${stderr}" MATCHES "PROJECT:ld64")
|
||||
set(LLVM_LINKER_IS_LD64 ON)
|
||||
message(STATUS "Linker detection: ld64")
|
||||
else()
|
||||
set(LLVM_LINKER_DETECTED OFF)
|
||||
message(STATUS "Linker detection: unknown")
|
||||
endif()
|
||||
elseif(NOT WIN32)
|
||||
# Detect what linker we have here
|
||||
if( LLVM_USE_LINKER )
|
||||
set(command ${CMAKE_C_COMPILER} -fuse-ld=${LLVM_USE_LINKER} -Wl,--version)
|
||||
|
Loading…
Reference in New Issue
Block a user