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)