Fixes LTO flags. Disables the use of the "gold" linker as a few plugins fail to compile with "gold" and "gold" is not used outside of LTO currently anyway.

This commit is contained in:
np511 2016-11-22 16:10:25 -05:00
parent 483b3d6368
commit 46fb6e9b48
1 changed files with 8 additions and 2 deletions

View File

@ -332,13 +332,19 @@ elseif (USE_GCC)
endif()
if (USE_LTO)
message(WARNING "LTO has not been thoroughly tested. It should work fine, but a bug is not impossible.")
#gcc --print-file-name=liblto_plugin.so
#set(LTO_FLAGS "-fuse-linker-plugin -flto=4 --plugin=/usr/lib/gcc/x86_64-linux-gnu/4.9/liblto_plugin.so")
#set(LTO_FLAGS "-fuse-linker-plugin -fuse-ld=gold -flto=4 --plugin=/usr/lib/gcc/x86_64-linux-gnu/4.9/liblto_plugin.so")
set(LTO_FLAGS "-fuse-linker-plugin -fuse-ld=gold -flto=4")
set(LTO_FLAGS "-fuse-linker-plugin -flto=4")
#set(LINK_FLAGS "--plugin=/usr/lib/gcc/x86_64-linux-gnu/4.9/liblto_plugin.so")
set(USER_CMAKE_LD_FLAGS "--plugin /usr/lib/gcc/x86_64-linux-gnu/4.9/liblto_plugin.so")
set(DBG "") # not supported with LTO
message(STATUS "Using \"gcc-ar\" instead of \"ar\"")
set(CMAKE_AR /usr/bin/gcc-ar CACHE STRING "Archiver" FORCE)
message(STATUS "Using \"gcc-ranlib\" instead of \"ranlib\"")
set(CMAKE_RANLIB /usr/bin/gcc-ranlib CACHE STRING "ranlib" FORCE)
message(STATUS "Using \"gcc-nm\" instead of \"nm\"")
set(CMAKE_NM /usr/bin/gcc-nm CACHE STRING "nm" FORCE)
else()
set(LTO_FLAGS "")
endif()