[libcxx-commits] [libcxx] [libcxxabi] [libunwind] [libc++][test] Forward LLVM_USE_LINKER to Lit test suites (PR #237635)

Vitaly Buka via libcxx-commits libcxx-commits at lists.llvm.org
Sat Oct 31 14:32:53 PDT 2026


https://github.com/vitalybuka created https://github.com/llvm/llvm-project/pull/237635

Serialize LLVM_USE_LINKER as a use_linker Lit parameter in libcxx, libcxxabi, and libunwind so test binaries link with -fuse-ld=<linker> instead of falling back to the compiler's default system linker.

Assisted-by: Gemini

>From de658e352d303b55aaee17f6213ee69a36ffae7f Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Sat, 31 Oct 2026 14:32:41 -0700
Subject: [PATCH] [spr] update

Created using spr 2.0.0-beta.2
---
 libcxx/test/CMakeLists.txt         | 4 ++++
 libcxx/utils/libcxx/test/params.py | 7 +++++++
 libcxxabi/test/CMakeLists.txt      | 4 ++++
 libunwind/test/CMakeLists.txt      | 4 ++++
 4 files changed, 19 insertions(+)

diff --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt
index 74524c2330bd00..77cc3e7f9471ec 100644
--- a/libcxx/test/CMakeLists.txt
+++ b/libcxx/test/CMakeLists.txt
@@ -53,6 +53,10 @@ if (LLVM_USE_SANITIZER)
   serialize_lit_string_param(SERIALIZED_LIT_PARAMS use_sanitizer "${LLVM_USE_SANITIZER}")
 endif()
 
+if (LLVM_USE_LINKER)
+  serialize_lit_string_param(SERIALIZED_LIT_PARAMS use_linker "${LLVM_USE_LINKER}")
+endif()
+
 serialize_lit_params_list(SERIALIZED_LIT_PARAMS LIBCXX_TEST_PARAMS)
 
 include(AddLLVM) # for configure_lit_site_cfg and add_lit_testsuite
diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py
index 951b0a4dd9806e..fff1b9169a93e8 100644
--- a/libcxx/utils/libcxx/test/params.py
+++ b/libcxx/utils/libcxx/test/params.py
@@ -347,6 +347,13 @@ def getSuitableClangTidy(cfg):
             ]
         )
     ),
+    Parameter(
+        name="use_linker",
+        type=str,
+        default="",
+        help="An optional linker to use when linking tests via -fuse-ld=<linker>.",
+        actions=lambda linker: [AddLinkFlag(f"-fuse-ld={linker}")] if linker else [],
+    ),
     Parameter(
         name="enable_experimental",
         choices=[True, False],
diff --git a/libcxxabi/test/CMakeLists.txt b/libcxxabi/test/CMakeLists.txt
index a5ffcbb9d500a3..67556d85b1b5b4 100644
--- a/libcxxabi/test/CMakeLists.txt
+++ b/libcxxabi/test/CMakeLists.txt
@@ -48,6 +48,10 @@ if (LLVM_USE_SANITIZER)
   serialize_lit_string_param(SERIALIZED_LIT_PARAMS use_sanitizer "${LLVM_USE_SANITIZER}")
 endif()
 
+if (LLVM_USE_LINKER)
+  serialize_lit_string_param(SERIALIZED_LIT_PARAMS use_linker "${LLVM_USE_LINKER}")
+endif()
+
 if (CMAKE_CXX_COMPILER_TARGET)
   serialize_lit_string_param(SERIALIZED_LIT_PARAMS target_triple "${CMAKE_CXX_COMPILER_TARGET}")
 else()
diff --git a/libunwind/test/CMakeLists.txt b/libunwind/test/CMakeLists.txt
index b97c8b4d1d40d7..c1cce671ddae3e 100644
--- a/libunwind/test/CMakeLists.txt
+++ b/libunwind/test/CMakeLists.txt
@@ -70,6 +70,10 @@ if (LLVM_USE_SANITIZER)
   serialize_lit_string_param(SERIALIZED_LIT_PARAMS use_sanitizer "${LLVM_USE_SANITIZER}")
 endif()
 
+if (LLVM_USE_LINKER)
+  serialize_lit_string_param(SERIALIZED_LIT_PARAMS use_linker "${LLVM_USE_LINKER}")
+endif()
+
 if (CMAKE_CXX_COMPILER_TARGET)
   serialize_lit_string_param(SERIALIZED_LIT_PARAMS target_triple "${CMAKE_CXX_COMPILER_TARGET}")
 else()



More information about the libcxx-commits mailing list