From 46fb6e9b4842d245658a1a099ee0488d1d3a03e7 Mon Sep 17 00:00:00 2001 From: np511 Date: Tue, 22 Nov 2016 16:10:25 -0500 Subject: [PATCH] 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. --- cmake/BuildParameters.cmake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmake/BuildParameters.cmake b/cmake/BuildParameters.cmake index 0c318dcf31..29b9459c9d 100644 --- a/cmake/BuildParameters.cmake +++ b/cmake/BuildParameters.cmake @@ -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()