[PATCH] D35325: [Solaris] detect Solaris LD, use detection results to pass Solaris-ld options
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 12 14:43:50 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL307852: [Solaris] Detect Solaris LD, use detection results to pass Solaris-ld options (authored by ruiu).
Changed prior to commit:
https://reviews.llvm.org/D35325?vs=106306&id=106317#toc
Repository:
rL LLVM
https://reviews.llvm.org/D35325
Files:
llvm/trunk/cmake/modules/AddLLVM.cmake
Index: llvm/trunk/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake
+++ llvm/trunk/cmake/modules/AddLLVM.cmake
@@ -91,7 +91,7 @@
DEPENDS ${export_file}
VERBATIM
COMMENT "Creating export file for ${target_name}")
- if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
+ if (${LLVM_LINKER_IS_SOLARISLD})
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-M,${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}")
else()
@@ -148,13 +148,28 @@
endfunction(add_llvm_symbol_exports)
if(NOT WIN32 AND NOT APPLE)
+ # Detect what linker we have here
execute_process(
COMMAND ${CMAKE_C_COMPILER} -Wl,--version
OUTPUT_VARIABLE stdout
- ERROR_QUIET
+ ERROR_VARIABLE stderr
)
+ set(LLVM_LINKER_DETECTED ON)
if("${stdout}" MATCHES "GNU gold")
set(LLVM_LINKER_IS_GOLD ON)
+ message(STATUS "Linker detection: GNU Gold")
+ elseif("${stdout}" MATCHES "^LLD")
+ set(LLVM_LINKER_IS_LLD ON)
+ message(STATUS "Linker detection: LLD")
+ elseif("${stdout}" MATCHES "GNU ld")
+ set(LLVM_LINKER_IS_GNULD ON)
+ message(STATUS "Linker detection: GNU ld")
+ elseif("${stderr}" MATCHES "Solaris Link Editors")
+ set(LLVM_LINKER_IS_SOLARISLD ON)
+ message(STATUS "Linker detection: Solaris ld")
+ else()
+ set(LLVM_LINKER_DETECTED OFF)
+ message(STATUS "Linker detection: unknown")
endif()
endif()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35325.106317.patch
Type: text/x-patch
Size: 1501 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170712/e14ab8f1/attachment.bin>
More information about the llvm-commits
mailing list