mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Support for the mold linker (#4807)
This commit is contained in:
committed by
Manoj Doshi
parent
cf4e9e5578
commit
4dff203787
@@ -131,7 +131,16 @@ else ()
|
|||||||
>)
|
>)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (use_gold AND is_gcc)
|
if (use_mold)
|
||||||
|
# use mold linker if available
|
||||||
|
execute_process (
|
||||||
|
COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=mold -Wl,--version
|
||||||
|
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
||||||
|
if ("${LD_VERSION}" MATCHES "mold")
|
||||||
|
target_link_libraries (common INTERFACE -fuse-ld=mold)
|
||||||
|
endif ()
|
||||||
|
unset (LD_VERSION)
|
||||||
|
elseif (use_gold AND is_gcc)
|
||||||
# use gold linker if available
|
# use gold linker if available
|
||||||
execute_process (
|
execute_process (
|
||||||
COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=gold -Wl,--version
|
COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=gold -Wl,--version
|
||||||
@@ -163,9 +172,7 @@ if (use_gold AND is_gcc)
|
|||||||
$<$<NOT:$<BOOL:${static}>>:-Wl,--disable-new-dtags>)
|
$<$<NOT:$<BOOL:${static}>>:-Wl,--disable-new-dtags>)
|
||||||
endif ()
|
endif ()
|
||||||
unset (LD_VERSION)
|
unset (LD_VERSION)
|
||||||
endif ()
|
elseif (use_lld)
|
||||||
|
|
||||||
if (use_lld)
|
|
||||||
# use lld linker if available
|
# use lld linker if available
|
||||||
execute_process (
|
execute_process (
|
||||||
COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=lld -Wl,--version
|
COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=lld -Wl,--version
|
||||||
@@ -176,6 +183,7 @@ if (use_lld)
|
|||||||
unset (LD_VERSION)
|
unset (LD_VERSION)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if (assert)
|
if (assert)
|
||||||
foreach (var_ CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE)
|
foreach (var_ CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE)
|
||||||
STRING (REGEX REPLACE "[-/]DNDEBUG" "" ${var_} "${${var_}}")
|
STRING (REGEX REPLACE "[-/]DNDEBUG" "" ${var_} "${${var_}}")
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ if (is_linux)
|
|||||||
option (static "link protobuf, openssl, libc++, and boost statically" ON)
|
option (static "link protobuf, openssl, libc++, and boost statically" ON)
|
||||||
option (perf "Enables flags that assist with perf recording" OFF)
|
option (perf "Enables flags that assist with perf recording" OFF)
|
||||||
option (use_gold "enables detection of gold (binutils) linker" ON)
|
option (use_gold "enables detection of gold (binutils) linker" ON)
|
||||||
|
option (use_mold "enables detection of mold (binutils) linker" ON)
|
||||||
else ()
|
else ()
|
||||||
# we are not ready to allow shared-libs on windows because it would require
|
# we are not ready to allow shared-libs on windows because it would require
|
||||||
# export declarations. On macos it's more feasible, but static openssl
|
# export declarations. On macos it's more feasible, but static openssl
|
||||||
@@ -45,6 +46,7 @@ else ()
|
|||||||
set (static ON CACHE BOOL "static link, linux only. ON for WIN/macos" FORCE)
|
set (static ON CACHE BOOL "static link, linux only. ON for WIN/macos" FORCE)
|
||||||
set (perf OFF CACHE BOOL "perf flags, linux only" FORCE)
|
set (perf OFF CACHE BOOL "perf flags, linux only" FORCE)
|
||||||
set (use_gold OFF CACHE BOOL "gold linker, linux only" FORCE)
|
set (use_gold OFF CACHE BOOL "gold linker, linux only" FORCE)
|
||||||
|
set (use_mold OFF CACHE BOOL "mold linker, linux only" FORCE)
|
||||||
endif ()
|
endif ()
|
||||||
if (is_clang)
|
if (is_clang)
|
||||||
option (use_lld "enables detection of lld linker" ON)
|
option (use_lld "enables detection of lld linker" ON)
|
||||||
|
|||||||
Reference in New Issue
Block a user