summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerasym Oleh <oolleehh@gmail.com>2016-10-27 10:08:08 +0300
committerSergey Levchenko (GitHub) <slevchenko.work@gmail.com>2016-11-11 10:29:48 +0200
commita1438a408364c6d52be01f612d3a8c7714dd85e0 (patch)
tree59565fcca0e338d940b325fbf1b2ea2a3928795e
parent07598ade93708c0a0f14171eb41b55bc66d70044 (diff)
downloadsdl_core-a1438a408364c6d52be01f612d3a8c7714dd85e0.tar.gz
Add Gold Linker usage by default
Related: APPLINK-29754
-rw-r--r--.travis.yml1
-rw-r--r--CMakeLists.txt13
2 files changed, 14 insertions, 0 deletions
diff --git a/.travis.yml b/.travis.yml
index 8c2e2d6a5a..756f58d23e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,6 +23,7 @@ addons:
- cmake
- html2text
- clang-format-3.6
+ - binutils
before_install:
- sudo apt-get -qq update
- sudo apt-get -q -y install libavahi-client-dev bluez-tools sqlite3 libsqlite3-dev automake1.11
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7a802e3ac3..35b17a7564 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -50,6 +50,8 @@ option(ENABLE_SECURITY "Security Ford protocol protection" ON)
option(ENABLE_HMI_PTU_DECRYPTION "Policy table update parsed by hmi" ON)
option(ENABLE_EXTENDED_POLICY "Turns extended flow which requires embedded system interaction" ON)
option(USE_COTIRE "Use Cotire to speed up build (currently only for commands tests)" ON)
+option(USE_GOLD_LD "Use gold linker intead of GNU linker" ON)
+
set(OS_TYPE_OPTION "$ENV{OS_TYPE}")
set(DEBUG_OPTION "$ENV{DEBUG}")
set(HMI_TYPE_OPTION "$ENV{HMI_TYPE}")
@@ -186,6 +188,17 @@ set(ARCHIVE_OUTPUT_DIRECTORY ./bin)
set(CMAKE_CXX_FLAGS "-fPIC -std=gnu++0x -Wall -Werror -Wno-deprecated-declarations -Wuninitialized -Wvla")
+if (USE_GOLD_LD)
+ execute_process(COMMAND ld -v OUTPUT_VARIABLE result)
+ string(FIND ${result} Binutils GOLD_LD_FOUND)
+ if (GOLD_LD_FOUND EQUAL -1)
+ message(SEND_ERROR "Gold linker not found!")
+ else()
+ message(INFO " Use gold linker")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
+ endif()
+endif(USE_GOLD_LD)
+
if(ENABLE_SANITIZE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
endif()