Add USE_SPLIT_DWARF option for gcc+gold

This commit is contained in:
Luke Street 2021-04-05 13:31:31 -04:00
parent 53fb23fc17
commit 2b45ec3b43
1 changed files with 5 additions and 1 deletions

View File

@ -295,7 +295,11 @@ if(USE_LD_GOLD)
if("${LD_VERSION}" MATCHES "GNU gold")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
if(USE_LTO)
if (USE_SPLIT_DWARF)
add_compile_options(-gsplit-dwarf -Wl,--gdb-index)
add_link_options(-gsplit-dwarf -Wl,--gdb-index)
message(STATUS "GNU gold linker enabled with split DWARF.")
elseif (USE_LTO)
add_compile_options(-flto)
add_link_options(-flto)
message(STATUS "GNU gold linker enabled with LTO.")