Skip to content

Commit 740629d

Browse files
author
Nenad Vukicevic
committed
Use CMAKE compiler to detect if linker script is supported.
UPC linker script support requires GNU ld with linker script dump capability (--verbose option). Note that GNU Gold linker is not compatible with this requirement.
1 parent d014a75 commit 740629d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,13 @@ set(UPC_IR_RP_ADDRSPACE ${UPC_IR_RP_ADDRSPACE})
267267

268268
# UPC link script enable/disable
269269
set(LIBUPC_ENABLE_LINK_SCRIPT TRUE CACHE BOOL "enable UPC's use of a custom linker script; this will define the UPC shared section as a no load section on targets where this feature is supported (requires GNU LD)")
270-
# Check for GNU linker
271-
execute_process(COMMAND ${CMAKE_C_COMPILER} -Wl,--version OUTPUT_VARIABLE LIBUPC_LD_VERSION ERROR_QUIET)
270+
set(LIBUPC_LINK_SCRIPT ${LIBUPC_ENABLE_LINK_SCRIPT})
271+
# Link sctipt option only works with GNU linker (not Gold, or others)
272+
string(REPLACE " " ";" CMAKE_C_FLAGS_LIST "${CMAKE_C_FLAGS} -Wl,--version")
273+
execute_process(COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS_LIST} OUTPUT_VARIABLE LIBUPC_LD_VERSION ERROR_QUIET)
272274
if (NOT "${LIBUPC_LD_VERSION}" MATCHES "GNU ld")
273-
set(LIBUPC_ENABLE_LINK_SCRIPT FALSE)
275+
set(LIBUPC_LINK_SCRIPT FALSE)
274276
endif()
275-
set(LIBUPC_LINK_SCRIPT ${LIBUPC_ENABLE_LINK_SCRIPT})
276277

277278
# Define an option controlling whether we should build for 32-bit on 64-bit
278279
# platforms, where supported.

0 commit comments

Comments
 (0)