[CMake] Use ld.gold if it is available to speedup builds
authorossy@webkit.org <ossy@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Nov 2014 07:06:28 +0000 (07:06 +0000)
committerossy@webkit.org <ossy@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Nov 2014 07:06:28 +0000 (07:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=137953

Reviewed by Carlos Garcia Campos.

* Source/cmake/OptionsCommon.cmake:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@176442 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
Source/cmake/OptionsCommon.cmake

index 888ceed1dfabc6ba6394da01e96f4fdcefbdb5b8..895f4460c4d238780b3003f14362455027bd2481 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2014-11-20  Csaba Osztrogon√°c  <ossy@webkit.org>
+
+        [CMake] Use ld.gold if it is available to speedup builds
+        https://bugs.webkit.org/show_bug.cgi?id=137953
+
+        Reviewed by Carlos Garcia Campos.
+
+        * Source/cmake/OptionsCommon.cmake:
+
 2014-11-19  Akos Kiss  <akiss@inf.u-szeged.hu>
 
         Fix the detection of toolchain support for Cortex-A53 erratum 835769 workaround
index c76aa90ded77deb97161941db34a0b059ba1d178..d917153471856e1ebee66b5cb678f262c4a7daa1 100644 (file)
@@ -60,14 +60,25 @@ if (WTF_CPU_ARM64_CORTEXA53)
     endif ()
 endif ()
 
+# Use ld.gold if it is available and isn't disabled explicitly
+option(USE_LD_GOLD "Use GNU gold linker" ON)
+if (USE_LD_GOLD)
+    execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
+    if ("${LD_VERSION}" MATCHES "GNU gold")
+        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold")
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
+    else ()
+        message(WARNING "GNU gold linker isn't available, using the default system linker.")
+    endif ()
+endif ()
+
 option(DEBUG_FISSION "Use Debug Fission support")
 if (DEBUG_FISSION)
-    execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
-    if (NOT "${LD_VERSION}" MATCHES "GNU gold")
+    if (NOT USE_LD_GOLD)
         message(FATAL_ERROR "Need GNU gold linker for Debug Fission support")
     endif ()
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gsplit-dwarf -fuse-ld=gold")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gsplit-dwarf -fuse-ld=gold")
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gsplit-dwarf")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gsplit-dwarf")
     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gdb-index")
     set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gdb-index")
 endif ()