Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
don't enable flto if ld version <= 2.22, as there are bugs with some version of GCC
authorAugustin Degomme <degomme@idpann.imag.fr>
Mon, 14 Apr 2014 10:38:52 +0000 (12:38 +0200)
committerAugustin Degomme <degomme@idpann.imag.fr>
Mon, 14 Apr 2014 10:58:57 +0000 (12:58 +0200)
Its not clear whether bugs were actually in gcc < 4.7.2 or in the bfl ld version ...
example of related bugs : http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53780 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52900
Disabling flto when ld is too old is one of the possible fixes, as ld 2.24 doesn't triggers these bugs.

CMakeLists.txt
buildtools/Cmake/Flags.cmake

index 4803a26..edd9041 100644 (file)
@@ -99,6 +99,9 @@ if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
   endif()
 endif()
 
+exec_program("${CMAKE_LINKER} --version" OUTPUT_VARIABLE "LINKER_VERSION")
+string(REGEX MATCH "[0-9].[0-9]*" LINKER_VERSION "${LINKER_VERSION}")
+
 string(REGEX MATCH "cl.exe" VBC "${CMAKE_C_COMPILER}")
 if(VBC)
   message(FATAL_ERROR "VB is not yet supported by Simgrid.")
index 5e959e3..675587b 100644 (file)
@@ -36,7 +36,7 @@ if(enable_compile_optimizations)
       endif()
     else()    
       # On non-windows, 4.6 is enough for that
-      if(COMPILER_C_VERSION_MAJOR_MINOR STRGREATER "4.5")
+      if(COMPILER_C_VERSION_MAJOR_MINOR STRGREATER "4.5" AND LINKER_VERSION STRGREATER "2.22")
         set(optCFLAGS "${optCFLAGS} -flto ")
       endif()
     endif()