https://github.com/yueshe created 
https://github.com/llvm/llvm-project/pull/203917

This allows specifying a fixed host linker version during Clang configuration 
(e.g. -DHOST_LINK_VERSION=1249), bypassing the default auto-detection. This is 
useful for hermetic packaging scripts where the auto-detected host linker might 
differ from the intended target linker, and we do not want certain features to 
be enabled that depends on the host linker version -- e.g. 
https://github.com/llvm/llvm-project/issues/203385


>From bb50102862e6db9921fdfd7ea5ee14d49d8a0e5b Mon Sep 17 00:00:00 2001
From: Yue She <[email protected]>
Date: Mon, 15 Jun 2026 10:21:10 -0400
Subject: [PATCH] [clang][CMake] Make HOST_LINK_VERSION a CACHE option on
 Darwin

---
 clang/CMakeLists.txt | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index db79131af9c1f..cd7ba53b03061 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -407,9 +407,12 @@ if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
 endif ()
 
 # Determine HOST_LINK_VERSION on Darwin.
-set(HOST_LINK_VERSION)
-if (APPLE AND NOT CMAKE_LINKER MATCHES ".*lld.*")
+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_darwin_linker_version(HOST_LINK_VERSION)
+  set(HOST_LINK_VERSION "${HOST_LINK_VERSION}" CACHE STRING "Host linker 
version on Darwin" FORCE)
+endif()
+if (HOST_LINK_VERSION)
   message(STATUS "Host linker version: ${HOST_LINK_VERSION}")
 endif()
 

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to