[PATCH] D48201: [cmake] Add linker detection for Apple platforms
Shoaib Meenai via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 14 16:32:42 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL334780: [cmake] Add linker detection for Apple platforms (authored by smeenai, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D48201?vs=151432&id=151437#toc
Repository:
rL LLVM
https://reviews.llvm.org/D48201
Files:
cfe/trunk/tools/driver/CMakeLists.txt
llvm/trunk/cmake/modules/AddLLVM.cmake
Index: cfe/trunk/tools/driver/CMakeLists.txt
===================================================================
--- cfe/trunk/tools/driver/CMakeLists.txt
+++ cfe/trunk/tools/driver/CMakeLists.txt
@@ -99,10 +99,10 @@
endif()
if(CLANG_ORDER_FILE AND
- (LD64_EXECUTABLE OR LLVM_LINKER_IS_GOLD OR LLVM_LINKER_IS_LLD))
+ (LLVM_LINKER_IS_LD64 OR LLVM_LINKER_IS_GOLD OR LLVM_LINKER_IS_LLD))
include(CheckLinkerFlag)
- if (LD64_EXECUTABLE)
+ if (LLVM_LINKER_IS_LD64)
set(LINKER_ORDER_FILE_OPTION "-Wl,-order_file,${CLANG_ORDER_FILE}")
elseif (LLVM_LINKER_IS_GOLD)
set(LINKER_ORDER_FILE_OPTION "-Wl,--section-ordering-file,${CLANG_ORDER_FILE}")
Index: llvm/trunk/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake
+++ llvm/trunk/cmake/modules/AddLLVM.cmake
@@ -147,7 +147,20 @@
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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48201.151437.patch
Type: text/x-patch
Size: 1538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180614/dc6ba86e/attachment.bin>
More information about the llvm-commits
mailing list