[compiler-rt] [compiler-rt] Partially enable building compiler-rt unit tests for spirv64 target (PR #215717)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 21:47:54 PDT 2026


https://github.com/jinge90 created https://github.com/llvm/llvm-project/pull/215717

None

>From c314f63e1f301445a20cf0997174ad517da9b1cb Mon Sep 17 00:00:00 2001
From: jinge90 <ge.jin at intel.com>
Date: Wed, 12 Aug 2026 12:39:42 +0800
Subject: [PATCH] [compiler-rt] Partially enable building compiler-rt unit
 tests for SPIRV64

Signed-off-by: jinge90 <ge.jin at intel.com>
---
 compiler-rt/test/builtins/CMakeLists.txt  |  3 +++
 compiler-rt/test/builtins/Unit/lit.cfg.py | 11 ++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/compiler-rt/test/builtins/CMakeLists.txt b/compiler-rt/test/builtins/CMakeLists.txt
index 6e6fabd3e2c15..729348c5a1978 100644
--- a/compiler-rt/test/builtins/CMakeLists.txt
+++ b/compiler-rt/test/builtins/CMakeLists.txt
@@ -73,6 +73,9 @@ foreach(arch ${BUILTIN_TEST_ARCH})
     elseif("${arch}" MATCHES "nvptx")
       list(APPEND BUILTINS_TEST_TARGET_CFLAGS
            -Wno-multi-gpu -flto -march=native -nogpulib -startfiles -stdlib)
+    elseif("${arch}" MATCHES "spirv64")
+      list(APPEND BUILTINS_TEST_TARGET_CFLAGS
+	   -Wno-multi-gpu -nogpulib -mllvm -spirv-ext=+SPV_EXT_relaxed_printf_string_address_space)
     endif()
     list(APPEND BUILTINS_TEST_TARGET_CFLAGS --target=${COMPILER_RT_DEFAULT_TARGET_TRIPLE})
     string(REPLACE ";" " " BUILTINS_TEST_TARGET_CFLAGS "${BUILTINS_TEST_TARGET_CFLAGS}")
diff --git a/compiler-rt/test/builtins/Unit/lit.cfg.py b/compiler-rt/test/builtins/Unit/lit.cfg.py
index f1ebd61438bd9..0f43fefdecaa1 100644
--- a/compiler-rt/test/builtins/Unit/lit.cfg.py
+++ b/compiler-rt/test/builtins/Unit/lit.cfg.py
@@ -85,7 +85,16 @@ def get_libgcc_file_name():
         )
         # Check if the linker supports --start-group and --end-group
         # For nvptx64 target, it falls back to the default.
-        if linker_supports_start_group and "nvptx" not in config.target_arch:
+        if "spirv" in config.target_arch:
+            builtins_bitcode_library = os.path.join(
+                config.compiler_rt_libdir, "libclang_rt.builtins%s.bc" % config.target_suffix)
+            librt_flags = "-Xclang -mlink-builtin-bitcode -Xclang " + builtins_bitcode_library + " "
+            libc_bitcode_library = os.path.join(
+                config.llvm_shlib_dir, config.target_triple, "libcbitcode.bc")
+            if (os.path.exists(libc_bitcode_library)):
+                librt_flags += "-Xclang -mlink-builtin-bitcode -Xclang " + libc_bitcode_library + " "
+            config.substitutions.append(("%librt ", librt_flags))
+        elif linker_supports_start_group and "nvptx" not in config.target_arch:
             config.substitutions.append(
                 (
                     "%librt ",



More information about the llvm-commits mailing list