From cfd83431c040ffbd5dd946b4131a566195fe6d89 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sun, 16 Jul 2023 22:18:57 +0100 Subject: [PATCH] [Minor] Another try to use the proper linker --- CMakeLists.txt | 1 + cmake/Sanitizer.cmake | 1 - cmake/Toolset.cmake | 6 ++++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ac2585669..5ea71a060 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,6 +85,7 @@ ENDIF() FIND_PACKAGE(PkgConfig REQUIRED) FIND_PACKAGE(Perl REQUIRED) +option (SANITIZE "Enable sanitizer: address, memory, undefined, leak (comma separated list)" "") INCLUDE(Toolset) INCLUDE(Sanitizer) diff --git a/cmake/Sanitizer.cmake b/cmake/Sanitizer.cmake index b13e418e3..c2587066f 100644 --- a/cmake/Sanitizer.cmake +++ b/cmake/Sanitizer.cmake @@ -1,6 +1,5 @@ # Ported from Clickhouse: https://github.com/ClickHouse/ClickHouse/blob/master/cmake/sanitize.cmake -option (SANITIZE "Enable sanitizer: address, memory, undefined, leak (comma separated list)" "") set (SAN_FLAGS "${SAN_FLAGS} -g -fno-omit-frame-pointer -DSANITIZER") # O1 is normally set by clang, and -Og by gcc if (COMPILER_GCC) diff --git a/cmake/Toolset.cmake b/cmake/Toolset.cmake index dfd1d3008..4e7017dfd 100644 --- a/cmake/Toolset.cmake +++ b/cmake/Toolset.cmake @@ -80,12 +80,14 @@ if(NOT LINKER_NAME) if(LLD_PATH) if (COMPILER_CLANG) set(LINKER_NAME "lld") - else() + elseif(NOT SANITIZE) if(GOLD_PATH) set(LINKER_NAME "gold") else() - message(STATUS "Use generic 'ld' as a linker") + message(STATUS "Use generic 'ld' as a linker: gold not found") endif() + else() + message(STATUS "Use generic 'ld' as a linker: sanitizers are enabled") endif() elseif(GOLD_PATH) set(LINKER_NAME "gold") -- 2.39.5