https://github.com/grahamc created https://github.com/llvm/llvm-project/pull/242747
Skipping HOST_LINK_VERSION detection when CMAKE_LINKER matches .*lld.* is too broad. Since that matched the entire path, "lld" in unrelated parts of the directory structure would erroneously match. This happened on a real environment when "lld" appeared in the Nix store path hash for a recent build. >From df2347e61c8ec179555b2e457efcfe9be552ab4e Mon Sep 17 00:00:00 2001 From: Graham Christensen <[email protected]> Date: Sat, 14 Nov 2026 20:54:00 -0500 Subject: [PATCH] [clang][CMake] Match "lld" only in the linker file name Skipping HOST_LINK_VERSION detection when CMAKE_LINKER matches .*lld.* is too broad. Since that matched the entire path, "lld" in unrelated parts of the directory structure would erroneously match. This happened on a real environment when "lld" appeared in the Nix store path hash for a recent build. --- clang/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index fbb4cfaf090059..5a83d51ac949c7 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -444,7 +444,8 @@ endif () # Determine HOST_LINK_VERSION on Darwin. set(HOST_LINK_VERSION "" CACHE STRING "Host linker version on Darwin") -if (APPLE AND NOT HOST_LINK_VERSION AND NOT CMAKE_LINKER MATCHES ".*lld.*") +get_filename_component(CLANG_LINKER_NAME "${CMAKE_LINKER}" NAME) +if (APPLE AND NOT HOST_LINK_VERSION AND NOT CLANG_LINKER_NAME MATCHES "lld") get_darwin_linker_version(HOST_LINK_VERSION) set(HOST_LINK_VERSION "${HOST_LINK_VERSION}" CACHE STRING "Host linker version on Darwin" FORCE) endif() _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
