This is an automated email from the ASF dual-hosted git repository.
alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push:
new 1d789a87a [cmake_modules] fix linker detection
1d789a87a is described below
commit 1d789a87aa6d9ce42b8894761907e634a68aa293
Author: Zoltan Martonka <[email protected]>
AuthorDate: Thu Jan 22 14:06:13 2026 +0000
[cmake_modules] fix linker detection
KuduLinker.cmake does not work as intended.
The code is meant to prioritize:
1. lld
2. lld built in thirdparty
3. gold
However, the check for the thirdparty linker always fails,
because it uses:
-fuse-ld={kudu}/thirdparty/clang-toolchain/bin/lld
but it should use:
-fuse-ld=lld -B{kudu}/thirdparty/clang-toolchain/bin
g++ does not accepts a path in -fuse-ld, only clang (and
fake mac g++) does.
The GNU gold linker is officially deprecated.
This change will be needed for upgrading to
LLVM 16 with ORC codegen, since gold crashes
with an internal linker error on RHEL 9.
Change-Id: I567caf9b73b75020facce8ce800e50662af60f39
Reviewed-on: http://gerrit.cloudera.org:8080/23892
Reviewed-by: Alexey Serbin <[email protected]>
Tested-by: Alexey Serbin <[email protected]>
---
cmake_modules/KuduLinker.cmake | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/cmake_modules/KuduLinker.cmake b/cmake_modules/KuduLinker.cmake
index e19ff6c7c..9f045888e 100644
--- a/cmake_modules/KuduLinker.cmake
+++ b/cmake_modules/KuduLinker.cmake
@@ -24,12 +24,17 @@ function(APPEND_LINKER_FLAGS)
# On macOS, LLD from third-party ${THIRDPARTY_TOOLCHAIN_DIR}/bin/ld64.lld
# isn't fully functional yet: it doesn't support -U option, etc.
if (NOT APPLE)
- set(linkers "lld" "${THIRDPARTY_TOOLCHAIN_DIR}/bin/ld.lld" "gold")
+ set(linkers "lld" "thirdparty lld" "gold")
endif()
list(APPEND linkers "default")
foreach(candidate_linker ${linkers})
if(candidate_linker STREQUAL "default")
set(candidate_flags "")
+ elseif (candidate_linker STREQUAL "thirdparty lld")
+ set(candidate_flags
+ -fuse-ld=lld
+ -B${THIRDPARTY_TOOLCHAIN_DIR}/bin
+ )
else()
set(candidate_flags "-fuse-ld=${candidate_linker}")
endif()
@@ -87,8 +92,9 @@ function(APPEND_LINKER_FLAGS)
message(FATAL_ERROR "Could not find a suitable linker")
endif()
message(STATUS "Using linker flags: ${linker_flags}")
+ string(JOIN " " linker_flags_str ${linker_flags})
foreach(var CMAKE_SHARED_LINKER_FLAGS CMAKE_EXE_LINKER_FLAGS
CMAKE_MODULE_LINKER_FLAGS)
- set(${var} "${${var}} ${linker_flags}" PARENT_SCOPE)
+ set(${var} "${${var}} ${linker_flags_str}" PARENT_SCOPE)
endforeach()
endfunction()