Skip to content

Commit

Permalink
[fold] Use first non-default linker
Browse files Browse the repository at this point in the history
  • Loading branch information
seelabs committed Nov 7, 2023
1 parent 61553e2 commit f7a537a
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions Builds/CMake/RippledCompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,10 @@ if (use_mold)
COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=mold -Wl,--version
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if ("${LD_VERSION}" MATCHES "mold")
set(found_nondefault_linker TRUE)
target_link_libraries (common INTERFACE -fuse-ld=mold)
endif ()
unset (LD_VERSION)
endif ()

if (use_gold AND is_gcc AND (NOT found_non_default_linker))
elseif (use_gold AND is_gcc)
# use gold linker if available
execute_process (
COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=gold -Wl,--version
Expand All @@ -162,7 +159,6 @@ if (use_gold AND is_gcc AND (NOT found_non_default_linker))
required to make gold play nicely with jemalloc.
#]=========================================================]
if (("${LD_VERSION}" MATCHES "GNU gold") AND (NOT jemalloc))
set(found_nondefault_linker TRUE)
target_link_libraries (common
INTERFACE
-fuse-ld=gold
Expand All @@ -176,9 +172,7 @@ if (use_gold AND is_gcc AND (NOT found_non_default_linker))
$<$<NOT:$<BOOL:${static}>>:-Wl,--disable-new-dtags>)
endif ()
unset (LD_VERSION)
endif ()

if (use_lld AND (NOT found_nondefault_linker))
elseif (use_lld)
# use lld linker if available
execute_process (
COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=lld -Wl,--version
Expand Down

0 comments on commit f7a537a

Please sign in to comment.