[clang] [llvm] [Driver] Restore compiler-rt arch suffix for PS and Windows (PR #89775)
Paul T Robinson via llvm-commits
llvm-commits at lists.llvm.org
Fri May 3 07:34:59 PDT 2024
https://github.com/pogo59 updated https://github.com/llvm/llvm-project/pull/89775
>From 8bac3e20afd666b0786d5f0c3bdf75b6761b3539 Mon Sep 17 00:00:00 2001
From: Paul Robinson <paul.robinson at sony.com>
Date: Tue, 23 Apr 2024 08:10:47 -0700
Subject: [PATCH 1/4] [Driver] Restore arch suffix for PS and Windows
Commit b876596 corrected default compiler-rt library names for many
targets, this patch restores the arch suffix for PlayStation and Windows
which both distribute these libraries with the arch suffix.
---
clang/lib/Driver/ToolChain.cpp | 4 +++-
clang/test/Driver/cl-link.c | 16 ++++++++--------
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 0e86bc07e0ea2c..27405f0c94ba6e 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -684,7 +684,9 @@ std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component,
if (Path.empty())
Path = P;
}
- if (getTriple().isOSAIX())
+ // Some targets default to the old layout.
+ if (getTriple().isOSAIX() || getTriple().isPS() ||
+ getTriple().isWindowsMSVCEnvironment())
Path.clear();
// Check the filename for the old layout if the new one does not exist.
diff --git a/clang/test/Driver/cl-link.c b/clang/test/Driver/cl-link.c
index ffd0b5ac4bade8..444f0c01b3f999 100644
--- a/clang/test/Driver/cl-link.c
+++ b/clang/test/Driver/cl-link.c
@@ -13,20 +13,20 @@
// ASAN: link.exe
// ASAN: "-debug"
// ASAN: "-incremental:no"
-// ASAN: "{{[^"]*}}clang_rt.asan.lib"
-// ASAN: "-wholearchive:{{.*}}clang_rt.asan.lib"
-// ASAN: "{{[^"]*}}clang_rt.asan_cxx.lib"
-// ASAN: "-wholearchive:{{.*}}clang_rt.asan_cxx.lib"
+// ASAN: "{{[^"]*}}clang_rt.asan-i386.lib"
+// ASAN: "-wholearchive:{{.*}}clang_rt.asan-i386.lib"
+// ASAN: "{{[^"]*}}clang_rt.asan_cxx-i386.lib"
+// ASAN: "-wholearchive:{{.*}}clang_rt.asan_cxx-i386.lib"
// ASAN: "{{.*}}cl-link{{.*}}.obj"
// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /MD /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-MD %s
// ASAN-MD: link.exe
// ASAN-MD: "-debug"
// ASAN-MD: "-incremental:no"
-// ASAN-MD: "{{.*}}clang_rt.asan_dynamic.lib"
-// ASAN-MD: "{{[^"]*}}clang_rt.asan_dynamic_runtime_thunk.lib"
+// ASAN-MD: "{{.*}}clang_rt.asan_dynamic-i386.lib"
+// ASAN-MD: "{{[^"]*}}clang_rt.asan_dynamic_runtime_thunk-i386.lib"
// ASAN-MD: "-include:___asan_seh_interceptor"
-// ASAN-MD: "-wholearchive:{{.*}}clang_rt.asan_dynamic_runtime_thunk.lib"
+// ASAN-MD: "-wholearchive:{{.*}}clang_rt.asan_dynamic_runtime_thunk-i386.lib"
// ASAN-MD: "{{.*}}cl-link{{.*}}.obj"
// RUN: %clang_cl /LD -fuse-ld=link -### /Tc%s 2>&1 | FileCheck --check-prefix=DLL %s
@@ -40,7 +40,7 @@
// ASAN-DLL: "-dll"
// ASAN-DLL: "-debug"
// ASAN-DLL: "-incremental:no"
-// ASAN-DLL: "{{.*}}clang_rt.asan_dll_thunk.lib"
+// ASAN-DLL: "{{.*}}clang_rt.asan_dll_thunk-i386.lib"
// ASAN-DLL: "{{.*}}cl-link{{.*}}.obj"
// RUN: %clang_cl /Zi /Tc%s -fuse-ld=link -### 2>&1 | FileCheck --check-prefix=DEBUG %s
>From 6a0b933c833cf070d60100c9722ae1cc01c2a468 Mon Sep 17 00:00:00 2001
From: Paul Robinson <paul.robinson at sony.com>
Date: Wed, 1 May 2024 06:47:22 -0700
Subject: [PATCH 2/4] Base the decision on the CMake variable instead
---
clang/lib/Driver/ToolChain.cpp | 3 +-
clang/test/Driver/arm-compiler-rt.c | 39 ++--
clang/test/Driver/cl-link.c | 27 +--
clang/test/Driver/compiler-rt-unwind.c | 35 ++--
clang/test/Driver/coverage-ld.c | 3 +-
clang/test/Driver/fuchsia.c | 1 +
clang/test/Driver/instrprof-ld.c | 1 +
clang/test/Driver/lit.local.cfg | 4 +
clang/test/Driver/mingw-sanitizers.c | 24 ++-
clang/test/Driver/msp430-toolchain.c | 1 +
.../Driver/print-libgcc-file-name-clangrt.c | 38 ++--
clang/test/Driver/sanitizer-ld.c | 188 ++++++++++--------
clang/test/Driver/wasm-toolchain.c | 38 ++--
clang/test/Driver/wasm-toolchain.cpp | 34 ++--
clang/test/Driver/windows-cross.c | 40 ++--
clang/test/Driver/zos-ld.c | 1 +
clang/test/lit.site.cfg.py.in | 1 +
llvm/include/llvm/Config/llvm-config.h.cmake | 3 +
18 files changed, 270 insertions(+), 211 deletions(-)
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 27405f0c94ba6e..fc06ad001404dc 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -685,8 +685,7 @@ std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component,
Path = P;
}
// Some targets default to the old layout.
- if (getTriple().isOSAIX() || getTriple().isPS() ||
- getTriple().isWindowsMSVCEnvironment())
+ if (getTriple().isOSAIX() || !LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
Path.clear();
// Check the filename for the old layout if the new one does not exist.
diff --git a/clang/test/Driver/arm-compiler-rt.c b/clang/test/Driver/arm-compiler-rt.c
index cb6c29f48a7814..569742c9baa36a 100644
--- a/clang/test/Driver/arm-compiler-rt.c
+++ b/clang/test/Driver/arm-compiler-rt.c
@@ -1,56 +1,63 @@
+// DEFINE: %{arch} = arm
+// DEFINE: %{suffix} = -DSUFFIX=%if !per_target_runtime_dir %{-%{arch}%}
+
// RUN: %clang -target arm-none-eabi \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -rtlib=compiler-rt -### %s 2>&1 \
-// RUN: | FileCheck %s -check-prefix ARM-EABI
-// ARM-EABI: "{{[^"]*}}libclang_rt.builtins.a"
+// RUN: | FileCheck %s -check-prefix ARM-EABI %{suffix}
+// ARM-EABI: "{{[^"]*}}libclang_rt.builtins[[SUFFIX]].a"
// RUN: %clang -target arm-linux-gnueabi \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -rtlib=compiler-rt -### %s 2>&1 \
-// RUN: | FileCheck %s -check-prefix ARM-GNUEABI
-// ARM-GNUEABI: "{{.*[/\\]}}libclang_rt.builtins.a"
+// RUN: | FileCheck %s -check-prefix ARM-GNUEABI %{suffix}
+// ARM-GNUEABI: "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a"
+// REDEFINE: %{arch} = armhf
// RUN: %clang -target arm-linux-gnueabi \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -rtlib=compiler-rt -mfloat-abi=hard -### %s 2>&1 \
-// RUN: | FileCheck %s -check-prefix ARM-GNUEABI-ABI
-// ARM-GNUEABI-ABI: "{{.*[/\\]}}libclang_rt.builtins.a"
+// RUN: | FileCheck %s -check-prefix ARM-GNUEABI-ABI %{suffix}
+// ARM-GNUEABI-ABI: "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a"
// RUN: %clang -target arm-linux-gnueabihf \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -rtlib=compiler-rt -### %s 2>&1 \
-// RUN: | FileCheck %s -check-prefix ARM-GNUEABIHF
-// ARM-GNUEABIHF: "{{.*[/\\]}}libclang_rt.builtins.a"
+// RUN: | FileCheck %s -check-prefix ARM-GNUEABIHF %{suffix}
+// ARM-GNUEABIHF: "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a"
+// REDEFINE: %{arch} = arm
// RUN: %clang -target arm-linux-gnueabihf \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -rtlib=compiler-rt -mfloat-abi=soft -### %s 2>&1 \
-// RUN: | FileCheck %s -check-prefix ARM-GNUEABIHF-ABI
-// ARM-GNUEABIHF-ABI: "{{.*[/\\]}}libclang_rt.builtins.a"
+// RUN: | FileCheck %s -check-prefix ARM-GNUEABIHF-ABI %{suffix}
+// ARM-GNUEABIHF-ABI: "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a"
// RUN: %clang -target arm-windows-itanium \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -rtlib=compiler-rt -### %s 2>&1 \
-// RUN: | FileCheck %s -check-prefix ARM-WINDOWS
-// ARM-WINDOWS: "{{.*[/\\]}}clang_rt.builtins.lib"
+// RUN: | FileCheck %s -check-prefix ARM-WINDOWS %{suffix}
+// ARM-WINDOWS: "{{.*[/\\]}}clang_rt.builtins[[SUFFIX]].lib"
+// REDEFINE: %{arch} = arm-android
// RUN: %clang -target arm-linux-androideabi \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -rtlib=compiler-rt -### %s 2>&1 \
-// RUN: | FileCheck %s -check-prefix ARM-ANDROID
-// ARM-ANDROID: "{{.*[/\\]}}libclang_rt.builtins.a"
+// RUN: | FileCheck %s -check-prefix ARM-ANDROID %{suffix}
+// ARM-ANDROID: "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a"
+// REDEFINE: %{arch} = armhf-android
// RUN: not %clang --target=arm-linux-androideabi \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -rtlib=compiler-rt -mfloat-abi=hard -### %s 2>&1 \
-// RUN: | FileCheck %s -check-prefix ARM-ANDROIDHF
-// ARM-ANDROIDHF: "{{.*[/\\]}}libclang_rt.builtins.a"
+// RUN: | FileCheck %s -check-prefix ARM-ANDROIDHF %{suffix}
+// ARM-ANDROIDHF: "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a"
diff --git a/clang/test/Driver/cl-link.c b/clang/test/Driver/cl-link.c
index 444f0c01b3f999..c05d7348022d30 100644
--- a/clang/test/Driver/cl-link.c
+++ b/clang/test/Driver/cl-link.c
@@ -9,24 +9,27 @@
// LINK: "bar"
// LINK: "baz"
-// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN %s
+// DEFINE: %{arch} = i386
+// DEFINE: %{suffix} = -DSUFFIX=%if !per_target_runtime_dir %{-%{arch}%}
+
+// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN %s %{suffix}
// ASAN: link.exe
// ASAN: "-debug"
// ASAN: "-incremental:no"
-// ASAN: "{{[^"]*}}clang_rt.asan-i386.lib"
-// ASAN: "-wholearchive:{{.*}}clang_rt.asan-i386.lib"
-// ASAN: "{{[^"]*}}clang_rt.asan_cxx-i386.lib"
-// ASAN: "-wholearchive:{{.*}}clang_rt.asan_cxx-i386.lib"
+// ASAN: "{{[^"]*}}clang_rt.asan[[SUFFIX]].lib"
+// ASAN: "-wholearchive:{{.*}}clang_rt.asan[[SUFFIX]].lib"
+// ASAN: "{{[^"]*}}clang_rt.asan_cxx[[SUFFIX]].lib"
+// ASAN: "-wholearchive:{{.*}}clang_rt.asan_cxx[[SUFFIX]].lib"
// ASAN: "{{.*}}cl-link{{.*}}.obj"
-// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /MD /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-MD %s
+// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /MD /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-MD %s %{suffix}
// ASAN-MD: link.exe
// ASAN-MD: "-debug"
// ASAN-MD: "-incremental:no"
-// ASAN-MD: "{{.*}}clang_rt.asan_dynamic-i386.lib"
-// ASAN-MD: "{{[^"]*}}clang_rt.asan_dynamic_runtime_thunk-i386.lib"
+// ASAN-MD: "{{.*}}clang_rt.asan_dynamic[[SUFFIX]].lib"
+// ASAN-MD: "{{[^"]*}}clang_rt.asan_dynamic_runtime_thunk[[SUFFIX]].lib"
// ASAN-MD: "-include:___asan_seh_interceptor"
-// ASAN-MD: "-wholearchive:{{.*}}clang_rt.asan_dynamic_runtime_thunk-i386.lib"
+// ASAN-MD: "-wholearchive:{{.*}}clang_rt.asan_dynamic_runtime_thunk[[SUFFIX]].lib"
// ASAN-MD: "{{.*}}cl-link{{.*}}.obj"
// RUN: %clang_cl /LD -fuse-ld=link -### /Tc%s 2>&1 | FileCheck --check-prefix=DLL %s
@@ -34,13 +37,13 @@
// DLL: link.exe
// "-dll"
-// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /LD /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-DLL %s
-// RUN: not %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /LDd /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-DLL %s
+// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /LD /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-DLL %s %{suffix}
+// RUN: not %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /LDd /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-DLL %s %{suffix}
// ASAN-DLL: link.exe
// ASAN-DLL: "-dll"
// ASAN-DLL: "-debug"
// ASAN-DLL: "-incremental:no"
-// ASAN-DLL: "{{.*}}clang_rt.asan_dll_thunk-i386.lib"
+// ASAN-DLL: "{{.*}}clang_rt.asan_dll_thunk[[SUFFIX]].lib"
// ASAN-DLL: "{{.*}}cl-link{{.*}}.obj"
// RUN: %clang_cl /Zi /Tc%s -fuse-ld=link -### 2>&1 | FileCheck --check-prefix=DEBUG %s
diff --git a/clang/test/Driver/compiler-rt-unwind.c b/clang/test/Driver/compiler-rt-unwind.c
index c5040d7fd900ba..2ad8fd80766c7c 100644
--- a/clang/test/Driver/compiler-rt-unwind.c
+++ b/clang/test/Driver/compiler-rt-unwind.c
@@ -1,6 +1,9 @@
// General tests that the driver handles combinations of --rtlib=XXX and
// --unwindlib=XXX properly.
//
+// DEFINE: %{arch} = x86_64
+// DEFINE: %{suffix} = -DSUFFIX=%if !per_target_runtime_dir %{-%{arch}%}
+//
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux -rtlib=libgcc --unwindlib=platform \
// RUN: -resource-dir=%S/Inputs/resource_dir \
@@ -51,18 +54,18 @@
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt \
// RUN: -resource-dir=%S/Inputs/resource_dir \
-// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT %s
-// RTLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins.a"
+// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT %s %{suffix}
+// RTLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins[[SUFFIX]].a"
//
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=libunwind \
// RUN: -resource-dir=%S/Inputs/resource_dir \
-// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT %s
+// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT %s %{suffix}
// RUN: %clangxx -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=libunwind \
// RUN: -resource-dir=%S/Inputs/resource_dir \
-// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT %s
-// RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins.a"
+// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT %s %{suffix}
+// RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins[[SUFFIX]].a"
// RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT-SAME: "--as-needed"
// RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT-SAME: "-lunwind"
// RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT-SAME: "--no-as-needed"
@@ -70,15 +73,15 @@
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=libgcc \
// RUN: -resource-dir=%S/Inputs/resource_dir \
-// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-GCC %s
-// RTLIB-COMPILER-RT-UNWINDLIB-GCC: "{{.*}}libclang_rt.builtins.a"
+// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-GCC %s %{suffix}
+// RTLIB-COMPILER-RT-UNWINDLIB-GCC: "{{.*}}libclang_rt.builtins[[SUFFIX]].a"
// RTLIB-COMPILER-RT-UNWINDLIB-GCC-SAME: "-lgcc_s"
//
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=libgcc \
// RUN: -static -resource-dir=%S/Inputs/resource_dir \
-// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC %s
-// RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC: "{{.*}}libclang_rt.builtins.a"
+// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC %s %{suffix}
+// RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC: "{{.*}}libclang_rt.builtins[[SUFFIX]].a"
// RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC-SAME: "-lgcc_eh"
//
// RUN: not %clang %s 2> %t.err \
@@ -97,22 +100,22 @@
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-w64-mingw32 -rtlib=compiler-rt --unwindlib=libunwind \
// RUN: -shared-libgcc \
-// RUN: | FileCheck --check-prefix=MINGW-RTLIB-COMPILER-RT-SHARED-UNWINDLIB-COMPILER-RT %s
-// MINGW-RTLIB-COMPILER-RT-SHARED-UNWINDLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins.a"
+// RUN: | FileCheck --check-prefix=MINGW-RTLIB-COMPILER-RT-SHARED-UNWINDLIB-COMPILER-RT %s %{suffix}
+// MINGW-RTLIB-COMPILER-RT-SHARED-UNWINDLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins[[SUFFIX]].a"
// MINGW-RTLIB-COMPILER-RT-SHARED-UNWINDLIB-COMPILER-RT-SAME: "-l:libunwind.dll.a"
//
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-w64-mingw32 -rtlib=compiler-rt --unwindlib=libunwind \
// RUN: -static-libgcc \
-// RUN: | FileCheck --check-prefix=MINGW-RTLIB-COMPILER-RT-STATIC-UNWINDLIB-COMPILER-RT %s
-// MINGW-RTLIB-COMPILER-RT-STATIC-UNWINDLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins.a"
+// RUN: | FileCheck --check-prefix=MINGW-RTLIB-COMPILER-RT-STATIC-UNWINDLIB-COMPILER-RT %s %{suffix}
+// MINGW-RTLIB-COMPILER-RT-STATIC-UNWINDLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins[[SUFFIX]].a"
// MINGW-RTLIB-COMPILER-RT-STATIC-UNWINDLIB-COMPILER-RT-SAME: "-l:libunwind.a"
//
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-w64-mingw32 -rtlib=compiler-rt --unwindlib=libunwind \
-// RUN: | FileCheck --check-prefix=MINGW-RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT %s
+// RUN: | FileCheck --check-prefix=MINGW-RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT %s %{suffix}
// RUN: %clangxx -### %s 2>&1 \
// RUN: --target=x86_64-w64-mingw32 -rtlib=compiler-rt --unwindlib=libunwind \
-// RUN: | FileCheck --check-prefix=MINGW-RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT %s
-// MINGW-RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins.a"
+// RUN: | FileCheck --check-prefix=MINGW-RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT %s %{suffix}
+// MINGW-RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins[[SUFFIX]].a"
// MINGW-RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT-SAME: "-lunwind"
diff --git a/clang/test/Driver/coverage-ld.c b/clang/test/Driver/coverage-ld.c
index be1d8320ab8be2..1a488c71c82822 100644
--- a/clang/test/Driver/coverage-ld.c
+++ b/clang/test/Driver/coverage-ld.c
@@ -1,5 +1,6 @@
// Test coverage ld flags.
-//
+// REQUIRES: per_target_runtime_dir
+//
// RUN: %clang -### %s 2>&1 \
// RUN: --target=i386-unknown-linux -fprofile-arcs \
// RUN: -resource-dir=%S/Inputs/resource_dir \
diff --git a/clang/test/Driver/fuchsia.c b/clang/test/Driver/fuchsia.c
index c67f7f8c005b39..9e2f6836e61c96 100644
--- a/clang/test/Driver/fuchsia.c
+++ b/clang/test/Driver/fuchsia.c
@@ -1,3 +1,4 @@
+// REQUIRES: per_target_runtime_dir
// RUN: %clang -### %s --target=x86_64-unknown-fuchsia \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
// RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
diff --git a/clang/test/Driver/instrprof-ld.c b/clang/test/Driver/instrprof-ld.c
index a96bba4a1e763c..8275d668377505 100644
--- a/clang/test/Driver/instrprof-ld.c
+++ b/clang/test/Driver/instrprof-ld.c
@@ -1,4 +1,5 @@
// Test instrumented profiling ld flags.
+// REQUIRES: per_target_runtime_dir
//
// RUN: %clang -### %s 2>&1 \
// RUN: --target=i386-unknown-linux -fprofile-instr-generate -fuse-ld=ld \
diff --git a/clang/test/Driver/lit.local.cfg b/clang/test/Driver/lit.local.cfg
index 6370e9f92d89b9..a48444332d8855 100644
--- a/clang/test/Driver/lit.local.cfg
+++ b/clang/test/Driver/lit.local.cfg
@@ -49,3 +49,7 @@ if llvm_config.use_lld(required=False):
if config.ppc_linux_default_ieeelongdouble:
config.available_features.add("ppc_linux_default_ieeelongdouble")
+
+if config.per_target_runtime_dir:
+ config.available_features.add("per_target_runtime_dir")
+config.recursiveExpansionLimit = 2
\ No newline at end of file
diff --git a/clang/test/Driver/mingw-sanitizers.c b/clang/test/Driver/mingw-sanitizers.c
index 2325f8f0f1f23d..400eeee518f040 100644
--- a/clang/test/Driver/mingw-sanitizers.c
+++ b/clang/test/Driver/mingw-sanitizers.c
@@ -1,20 +1,24 @@
+// DEFINE: %{arch} = i386
+// DEFINE: %{suffix} = -DSUFFIX=%if !per_target_runtime_dir %{-%{arch}%}
+//
// RUN: touch %t.a
-// RUN: %clang -target i686-windows-gnu %s -### -fsanitize=address -lcomponent %/t.a 2>&1 | FileCheck --check-prefixes=ASAN-ALL,ASAN-I686 -DINPUT=%/t.a %s
-// RUN: %clang -target x86_64-windows-gnu %s -### -fsanitize=address -lcomponent %/t.a 2>&1 | FileCheck --check-prefixes=ASAN-ALL,ASAN-X86_64 -DINPUT=%/t.a %s
+// RUN: %clang -target i686-windows-gnu %s -### -fsanitize=address -lcomponent %/t.a 2>&1 | FileCheck --check-prefixes=ASAN-ALL,ASAN-I686 -DINPUT=%/t.a %s %{suffix}
+// REDEFINE: %{arch} = x86_64
+// RUN: %clang -target x86_64-windows-gnu %s -### -fsanitize=address -lcomponent %/t.a 2>&1 | FileCheck --check-prefixes=ASAN-ALL,ASAN-X86_64 -DINPUT=%/t.a %s %{suffix}
//
// ASAN-ALL-NOT:"-l{{[^"]+"]}}"
// ASAN-ALL-NOT:"[[INPUT]]"
-// ASAN-I686: "{{[^"]*}}libclang_rt.asan_dynamic.dll.a"
-// ASAN-X86_64: "{{[^"]*}}libclang_rt.asan_dynamic.dll.a"
+// ASAN-I686: "{{[^"]*}}libclang_rt.asan_dynamic[[SUFFIX]].dll.a"
+// ASAN-X86_64: "{{[^"]*}}libclang_rt.asan_dynamic[[SUFFIX]].dll.a"
// ASAN-ALL: "-lcomponent"
// ASAN-ALL: "[[INPUT]]"
-// ASAN-I686: "{{[^"]*}}libclang_rt.asan_dynamic.dll.a"
-// ASAN-I686: "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk.a"
+// ASAN-I686: "{{[^"]*}}libclang_rt.asan_dynamic[[SUFFIX]].dll.a"
+// ASAN-I686: "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk[[SUFFIX]].a"
// ASAN-I686: "--require-defined" "___asan_seh_interceptor"
-// ASAN-I686: "--whole-archive" "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk.a" "--no-whole-archive"
-// ASAN-X86_64: "{{[^"]*}}libclang_rt.asan_dynamic.dll.a"
-// ASAN-X86_64: "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk.a"
+// ASAN-I686: "--whole-archive" "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk[[SUFFIX]].a" "--no-whole-archive"
+// ASAN-X86_64: "{{[^"]*}}libclang_rt.asan_dynamic[[SUFFIX]].dll.a"
+// ASAN-X86_64: "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk[[SUFFIX]].a"
// ASAN-X86_64: "--require-defined" "__asan_seh_interceptor"
-// ASAN-X86_64: "--whole-archive" "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk.a" "--no-whole-archive"
+// ASAN-X86_64: "--whole-archive" "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk[[SUFFIX]].a" "--no-whole-archive"
// RUN: %clang -target x86_64-windows-gnu %s -### -fsanitize=vptr
diff --git a/clang/test/Driver/msp430-toolchain.c b/clang/test/Driver/msp430-toolchain.c
index 3c3042b482ef26..91928aa7ad75cc 100644
--- a/clang/test/Driver/msp430-toolchain.c
+++ b/clang/test/Driver/msp430-toolchain.c
@@ -1,5 +1,6 @@
// Splitting some tests into POS and NEG parts so the latter can validate
// output fragments as large as possible for absence of some text.
+// REQUIRES: per_target_runtime_dir
// Test for include paths and other cc1 flags
diff --git a/clang/test/Driver/print-libgcc-file-name-clangrt.c b/clang/test/Driver/print-libgcc-file-name-clangrt.c
index a902eedc852096..72f8cf792852cd 100644
--- a/clang/test/Driver/print-libgcc-file-name-clangrt.c
+++ b/clang/test/Driver/print-libgcc-file-name-clangrt.c
@@ -1,18 +1,21 @@
// Test that -print-libgcc-file-name correctly respects -rtlib=compiler-rt.
+// DEFINE: %{arch} = x86_64
+// DEFINE: %{suffix} = -DSUFFIX=%if !per_target_runtime_dir %{-%{arch}%}
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \
// RUN: --target=x86_64-pc-linux \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s
-// CHECK-CLANGRT-X8664: libclang_rt.builtins.a
+// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s %{suffix}
+// CHECK-CLANGRT-X8664: libclang_rt.builtins[[SUFFIX]].a
+// REDEFINE: %{arch} = i386
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \
// RUN: --target=i386-pc-linux \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-I386 %s
-// CHECK-CLANGRT-I386: libclang_rt.builtins.a
+// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-I386 %s %{suffix}
+// CHECK-CLANGRT-I386: libclang_rt.builtins[[SUFFIX]].a
// Check whether alternate arch values map to the correct library.
//
@@ -20,43 +23,48 @@
// RUN: --target=i686-pc-linux \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-I386 %s
+// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-I386 %s %{suffix}
+// REDEFINE: %{arch} = arm
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \
// RUN: --target=arm-linux-gnueabi \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-ARM %s
-// CHECK-CLANGRT-ARM: libclang_rt.builtins.a
+// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-ARM %s %{suffix}
+// CHECK-CLANGRT-ARM: libclang_rt.builtins[[SUFFIX]].a
+// REDEFINE: %{arch} = arm-android
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \
// RUN: --target=arm-linux-androideabi \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-ARM-ANDROID %s
-// CHECK-CLANGRT-ARM-ANDROID: libclang_rt.builtins.a
+// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-ARM-ANDROID %s %{suffix}
+// CHECK-CLANGRT-ARM-ANDROID: libclang_rt.builtins[[SUFFIX]].a
+// REDEFINE: %{arch} = armhf
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \
// RUN: --target=arm-linux-gnueabihf \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-ARMHF %s
-// CHECK-CLANGRT-ARMHF: libclang_rt.builtins.a
+// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-ARMHF %s %{suffix}
+// CHECK-CLANGRT-ARMHF: libclang_rt.builtins[[SUFFIX]].a
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \
// RUN: --target=arm-linux-gnueabi -mfloat-abi=hard \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-ARM-ABI %s
-// CHECK-CLANGRT-ARM-ABI: libclang_rt.builtins.a
+// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-ARM-ABI %s %{suffix}
+// CHECK-CLANGRT-ARM-ABI: libclang_rt.builtins[[SUFFIX]].a
+// REDEFINE: %{arch} = armv7m
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \
// RUN: --target=armv7m-none-eabi \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-ARM-BAREMETAL %s
-// CHECK-CLANGRT-ARM-BAREMETAL: libclang_rt.builtins.a
+// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-ARM-BAREMETAL %s %{suffix}
+// CHECK-CLANGRT-ARM-BAREMETAL: libclang_rt.builtins[[SUFFIX]].a
+// Note this one will never have an arch suffix.
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \
// RUN: --target=armv7m-vendor-none-eabi \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
diff --git a/clang/test/Driver/sanitizer-ld.c b/clang/test/Driver/sanitizer-ld.c
index 7289d09697b4d0..1135f21b679fa9 100644
--- a/clang/test/Driver/sanitizer-ld.c
+++ b/clang/test/Driver/sanitizer-ld.c
@@ -53,30 +53,32 @@
// CHECK-ASAN-SHARED-LINUX: libclang_rt.asan_static
// CHECK-ASAN-SHARED-LINUX-NOT: libclang_rt.asan
+// DEFINE: %{arch} = i386
+// DEFINE: %{suffix} = -DSUFFIX=%if !per_target_runtime_dir %{-%{arch}%}
// RUN: %clang -### %s 2>&1 \
// RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libsan \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s %{suffix}
// RUN: %clang -### %s 2>&1 \
// RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libasan \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s %{suffix}
// RUN: %clang -### %s 2>&1 \
// RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=address \
// RUN: -shared-libsan -static-libsan -shared-libasan \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s %{suffix}
//
// CHECK-SHARED-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-SHARED-ASAN-LINUX-NOT: "-lc"
-// CHECK-SHARED-ASAN-LINUX-NOT: libclang_rt.asan.a"
-// CHECK-SHARED-ASAN-LINUX: libclang_rt.asan.so"
-// CHECK-SHARED-ASAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.asan-preinit.a" "--no-whole-archive"
+// CHECK-SHARED-ASAN-LINUX-NOT: libclang_rt.asan[[SUFFIX]].a"
+// CHECK-SHARED-ASAN-LINUX: libclang_rt.asan[[SUFFIX]].so"
+// CHECK-SHARED-ASAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.asan-preinit[[SUFFIX]].a" "--no-whole-archive"
// CHECK-SHARED-ASAN-LINUX-NOT: "-lpthread"
// CHECK-SHARED-ASAN-LINUX-NOT: "-lrt"
// CHECK-SHARED-ASAN-LINUX-NOT: "-ldl"
@@ -88,13 +90,13 @@
// RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libsan \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-ASAN-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-ASAN-LINUX %s %{suffix}
//
// CHECK-DSO-SHARED-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lc"
-// CHECK-DSO-SHARED-ASAN-LINUX-NOT: libclang_rt.asan.a"
-// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "libclang_rt.asan-preinit.a"
-// CHECK-DSO-SHARED-ASAN-LINUX: libclang_rt.asan.so"
+// CHECK-DSO-SHARED-ASAN-LINUX-NOT: libclang_rt.asan[[SUFFIX]].a"
+// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "libclang_rt.asan-preinit[[SUFFIX]].a"
+// CHECK-DSO-SHARED-ASAN-LINUX: libclang_rt.asan[[SUFFIX]].so"
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lpthread"
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lrt"
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-ldl"
@@ -106,12 +108,12 @@
// RUN: --target=i386-unknown-freebsd -fuse-ld=ld -fsanitize=address \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_freebsd_tree \
-// RUN: | FileCheck --check-prefix=CHECK-ASAN-FREEBSD %s
+// RUN: | FileCheck --check-prefix=CHECK-ASAN-FREEBSD %s %{suffix}
//
// CHECK-ASAN-FREEBSD: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-ASAN-FREEBSD-NOT: "-lc"
// CHECK-ASAN-FREEBSD-NOT: libclang_rt.asan_cxx
-// CHECK-ASAN-FREEBSD: freebsd{{/|\\+}}libclang_rt.asan.a"
+// CHECK-ASAN-FREEBSD: freebsd{{/|\\+}}libclang_rt.asan[[SUFFIX]].a"
// CHECK-ASAN-FREEBSD-NOT: libclang_rt.asan_cxx
// CHECK-ASAN-FREEBSD-NOT: "--dynamic-list"
// CHECK-ASAN-FREEBSD: "--export-dynamic"
@@ -131,12 +133,12 @@
// RUN: --target=i386-unknown-linux -fuse-ld=ld -stdlib=platform -fsanitize=address \
// RUN: -resource-dir=%S/Inputs/empty_resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-ASAN-LINUX-CXX %s
+// RUN: | FileCheck --check-prefix=CHECK-ASAN-LINUX-CXX %s %{suffix}
//
// CHECK-ASAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-ASAN-LINUX-CXX-NOT: "-lc"
-// CHECK-ASAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan.a" "--no-whole-archive"
-// CHECK-ASAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan_cxx.a" "--no-whole-archive"
+// CHECK-ASAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan[[SUFFIX]].a" "--no-whole-archive"
+// CHECK-ASAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan_cxx[[SUFFIX]].a" "--no-whole-archive"
// CHECK-ASAN-LINUX-CXX-NOT: "--dynamic-list"
// CHECK-ASAN-LINUX-CXX: "--export-dynamic"
// CHECK-ASAN-LINUX-CXX: stdc++
@@ -156,36 +158,38 @@
// CHECK-ASAN-LINUX-CXX-STATIC: "--whole-archive" "{{.*}}libclang_rt.asan.a" "--no-whole-archive"
// CHECK-ASAN-LINUX-CXX-STATIC: stdc++
+// REDEFINE: %{arch} = arm
// RUN: %clang -### %s 2>&1 \
// RUN: --target=arm-linux-gnueabi -fuse-ld=ld -fsanitize=address \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
-// RUN: | FileCheck --check-prefix=CHECK-ASAN-ARM %s
+// RUN: | FileCheck --check-prefix=CHECK-ASAN-ARM %s %{suffix}
//
// CHECK-ASAN-ARM: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-ASAN-ARM-NOT: "-lc"
-// CHECK-ASAN-ARM: libclang_rt.asan.a"
+// CHECK-ASAN-ARM: libclang_rt.asan[[SUFFIX]].a"
//
// RUN: %clang -### %s 2>&1 \
// RUN: --target=armv7l-linux-gnueabi -fuse-ld=ld -fsanitize=address \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
-// RUN: | FileCheck --check-prefix=CHECK-ASAN-ARMv7 %s
+// RUN: | FileCheck --check-prefix=CHECK-ASAN-ARMv7 %s %{suffix}
//
// CHECK-ASAN-ARMv7: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-ASAN-ARMv7-NOT: "-lc"
-// CHECK-ASAN-ARMv7: libclang_rt.asan.a"
+// CHECK-ASAN-ARMv7: libclang_rt.asan[[SUFFIX]].a"
+// REDEFINE: %{arch} = arm-android
// RUN: %clang -### %s 2>&1 \
// RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=address \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -resource-dir=%S/Inputs/resource_dir \
-// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID %s
+// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID %s %{suffix}
//
// CHECK-ASAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
// CHECK-ASAN-ANDROID: "-pie"
// CHECK-ASAN-ANDROID-NOT: "-lc"
// CHECK-ASAN-ANDROID-NOT: "-lpthread"
// CHECK-ASAN-ANDROID-NOT: "-lresolv"
-// CHECK-ASAN-ANDROID: libclang_rt.asan.so"
+// CHECK-ASAN-ANDROID: libclang_rt.asan[[SUFFIX]].so"
// CHECK-ASAN-ANDROID-NOT: "-lpthread"
// CHECK-ASAN-ANDROID-NOT: "-lresolv"
@@ -194,10 +198,10 @@
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -static-libsan \
-// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-STATICLIBASAN %s
+// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-STATICLIBASAN %s %{suffix}
//
// CHECK-ASAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
-// CHECK-ASAN-ANDROID-STATICLIBASAN: libclang_rt.asan.a"
+// CHECK-ASAN-ANDROID-STATICLIBASAN: libclang_rt.asan[[SUFFIX]].a"
// CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lpthread"
// CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lrt"
// CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lresolv"
@@ -206,14 +210,14 @@
// RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=undefined \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -resource-dir=%S/Inputs/resource_dir \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-ANDROID %s
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-ANDROID %s %{suffix}
//
// CHECK-UBSAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
// CHECK-UBSAN-ANDROID: "-pie"
// CHECK-UBSAN-ANDROID-NOT: "-lc"
// CHECK-UBSAN-ANDROID-NOT: "-lpthread"
// CHECK-UBSAN-ANDROID-NOT: "-lresolv"
-// CHECK-UBSAN-ANDROID: libclang_rt.ubsan_standalone.so"
+// CHECK-UBSAN-ANDROID: libclang_rt.ubsan_standalone[[SUFFIX]].so"
// CHECK-UBSAN-ANDROID-NOT: "-lpthread"
// CHECK-UBSAN-ANDROID-NOT: "-lresolv"
@@ -222,27 +226,27 @@
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -static-libsan \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-ANDROID-STATICLIBASAN %s
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-ANDROID-STATICLIBASAN %s %{suffix}
//
// CHECK-UBSAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
-// CHECK-UBSAN-ANDROID-STATICLIBASAN: libclang_rt.ubsan_standalone.a"
+// CHECK-UBSAN-ANDROID-STATICLIBASAN: libclang_rt.ubsan_standalone[[SUFFIX]].a"
// CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lpthread"
// CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lrt"
// CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lresolv"
-//
+// REDEFINE: %{arch} = i686-android
// RUN: %clang -### %s 2>&1 \
// RUN: --target=i686-linux-android -fuse-ld=ld -fsanitize=address \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -resource-dir=%S/Inputs/resource_dir \
-// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-X86 %s
+// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-X86 %s %{suffix}
//
// CHECK-ASAN-ANDROID-X86: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
// CHECK-ASAN-ANDROID-X86: "-pie"
// CHECK-ASAN-ANDROID-X86-NOT: "-lc"
// CHECK-ASAN-ANDROID-X86-NOT: "-lpthread"
// CHECK-ASAN-ANDROID-X86-NOT: "-lresolv"
-// CHECK-ASAN-ANDROID-X86: libclang_rt.asan.so"
+// CHECK-ASAN-ANDROID-X86: libclang_rt.asan[[SUFFIX]].so"
// CHECK-ASAN-ANDROID-X86-NOT: "-lpthread"
// CHECK-ASAN-ANDROID-X86-NOT: "-lresolv"
//
@@ -254,16 +258,17 @@
//
// CHECK-ASAN-ANDROID-SHARED-LIBASAN-NOT: argument unused during compilation: '-shared-libsan'
//
+// REDEFINE: %{arch} = arm-android
// RUN: %clang -### %s 2>&1 \
// RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=address \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -shared \
-// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED %s
+// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED %s %{suffix}
//
// CHECK-ASAN-ANDROID-SHARED: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
// CHECK-ASAN-ANDROID-SHARED-NOT: "-lc"
-// CHECK-ASAN-ANDROID-SHARED: libclang_rt.asan.so"
+// CHECK-ASAN-ANDROID-SHARED: libclang_rt.asan[[SUFFIX]].so"
// CHECK-ASAN-ANDROID-SHARED-NOT: "-lpthread"
// CHECK-ASAN-ANDROID-SHARED-NOT: "-lresolv"
@@ -331,29 +336,30 @@
//
// CHECK-MSAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.msan
+// REDEFINE: %{arch} = x32
// RUN: %clang -fsanitize=undefined -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux-gnux32 -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s %{suffix}
// RUN: %clang -fsanitize=float-divide-by-zero -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux-gnux32 -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s %{suffix}
// RUN: %clang -fsanitize=undefined -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux-gnux32 -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
// RUN: -static-libsan \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s %{suffix}
// CHECK-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}"
// CHECK-UBSAN-LINUX-NOT: libclang_rt.asan
// CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_standalone_cxx
-// CHECK-UBSAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone.a" "--no-whole-archive"
+// CHECK-UBSAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone[[SUFFIX]].a" "--no-whole-archive"
// CHECK-UBSAN-LINUX-NOT: libclang_rt.asan
// CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_standalone_cxx
// CHECK-UBSAN-LINUX-NOT: "-lstdc++"
@@ -384,49 +390,50 @@
//
// CHECK-FUZZER-NO-LINK-RUNTIME-DARWIN-NOT: libclang_rt.fuzzer
+// REDEFINE: %{arch} = i386
// RUN: %clang -fsanitize=undefined -### %s 2>&1 \
// RUN: --target=i386-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: -shared-libsan \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s %{suffix}
// RUN: %clang -fsanitize=undefined -### %s 2>&1 \
// RUN: --target=i386-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: -static-libsan -shared-libsan \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s %{suffix}
// RUN: %clang -fsanitize=undefined -### %s 2>&1 \
// RUN: --target=i386-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: -shared -shared-libsan \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s %{suffix}
// CHECK-UBSAN-LINUX-SHAREDLIBASAN: "{{.*}}ld{{(.exe)?}}"
-// CHECK-UBSAN-LINUX-SHAREDLIBASAN: "{{.*}}libclang_rt.ubsan_standalone.so{{.*}}"
+// CHECK-UBSAN-LINUX-SHAREDLIBASAN: "{{.*}}libclang_rt.ubsan_standalone[[SUFFIX]].so{{.*}}"
// RUN: %clang -fsanitize=undefined -fsanitize-link-c++-runtime -### %s 2>&1 \
// RUN: --target=i386-unknown-linux \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-LINK-CXX %s
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-LINK-CXX %s %{suffix}
// CHECK-UBSAN-LINUX-LINK-CXX-NOT: "-lstdc++"
-// CHECK-UBSAN-LINUX-LINK-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone_cxx.a" "--no-whole-archive"
+// CHECK-UBSAN-LINUX-LINK-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone_cxx[[SUFFIX]].a" "--no-whole-archive"
// CHECK-UBSAN-LINUX-LINK-CXX-NOT: "-lstdc++"
// RUN: %clangxx -fsanitize=undefined -### %s 2>&1 \
// RUN: --target=i386-unknown-linux -fuse-ld=ld -stdlib=platform \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-CXX %s
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-CXX %s %{suffix}
// CHECK-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
// CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
-// CHECK-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone.a" "--no-whole-archive"
+// CHECK-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone[[SUFFIX]].a" "--no-whole-archive"
// CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
-// CHECK-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone_cxx.a" "--no-whole-archive"
+// CHECK-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone_cxx[[SUFFIX]].a" "--no-whole-archive"
// CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
// CHECK-UBSAN-LINUX-CXX: "-lstdc++"
// CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
@@ -437,9 +444,9 @@
// RUN: --target=i386-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-MINIMAL-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-MINIMAL-LINUX %s %{suffix}
// CHECK-UBSAN-MINIMAL-LINUX: "{{.*}}ld{{(.exe)?}}"
-// CHECK-UBSAN-MINIMAL-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_minimal.a" "--no-whole-archive"
+// CHECK-UBSAN-MINIMAL-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_minimal[[SUFFIX]].a" "--no-whole-archive"
// CHECK-UBSAN-MINIMAL-LINUX: "-lpthread"
// CHECK-UBSAN-MINIMAL-LINUX: "-lresolv"
@@ -484,10 +491,10 @@
// RUN: --target=i386-unknown-linux -fuse-ld=ld -stdlib=platform \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-ASAN-UBSAN-LINUX-CXX %s
+// RUN: | FileCheck --check-prefix=CHECK-ASAN-UBSAN-LINUX-CXX %s %{suffix}
// CHECK-ASAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
// CHECK-ASAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan.a" "--no-whole-archive"
-// CHECK-ASAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan_cxx.a" "--no-whole-archive"
+// CHECK-ASAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan_cxx[[SUFFIX]].a" "--no-whole-archive"
// CHECK-ASAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan
// CHECK-ASAN-UBSAN-LINUX-CXX: "-lstdc++"
// CHECK-ASAN-UBSAN-LINUX-CXX: "-lpthread"
@@ -522,16 +529,17 @@
// CHECK-UBSAN-LINUX-SHARED-NOT: --dynamic-list
// CHECK-UBSAN-LINUX-SHARED-NOT: libclang_rt.ubsan
+// REDEFINE: %{arch} = x86_64
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=leak \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-LSAN-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-LSAN-LINUX %s %{suffix}
//
// CHECK-LSAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-LSAN-LINUX-NOT: "-lc"
// CHECK-LSAN-LINUX-NOT: libclang_rt.ubsan
-// CHECK-LSAN-LINUX: libclang_rt.lsan.a"
+// CHECK-LSAN-LINUX: libclang_rt.lsan[[SUFFIX]].a"
// CHECK-LSAN-LINUX: "-lpthread"
// CHECK-LSAN-LINUX: "-ldl"
// CHECK-LSAN-LINUX: "-lresolv"
@@ -597,9 +605,9 @@
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-DFSAN-COV-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-DFSAN-COV-LINUX %s %{suffix}
// CHECK-DFSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
-// CHECK-DFSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.dfsan.a" "--no-whole-archive"
+// CHECK-DFSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.dfsan[[SUFFIX]].a" "--no-whole-archive"
// CHECK-DFSAN-COV-LINUX-NOT: libclang_rt.ubsan
// CHECK-DFSAN-COV-LINUX-NOT: "-lstdc++"
// CHECK-DFSAN-COV-LINUX: "-lpthread"
@@ -609,9 +617,9 @@
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-COV-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-COV-LINUX %s %{suffix}
// CHECK-UBSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
-// CHECK-UBSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone.a" "--no-whole-archive"
+// CHECK-UBSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone[[SUFFIX]].a" "--no-whole-archive"
// CHECK-UBSAN-COV-LINUX-NOT: "-lstdc++"
// CHECK-UBSAN-COV-LINUX: "-lpthread"
// CHECK-UBSAN-COV-LINUX: "-lresolv"
@@ -620,9 +628,9 @@
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-COV-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-COV-LINUX %s %{suffix}
// CHECK-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
-// CHECK-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone.a" "--no-whole-archive"
+// CHECK-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone[[SUFFIX]].a" "--no-whole-archive"
// CHECK-COV-LINUX-NOT: "-lstdc++"
// CHECK-COV-LINUX: "-lpthread"
// CHECK-COV-LINUX: "-lresolv"
@@ -642,18 +650,18 @@
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-CFI-DIAG-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-CFI-DIAG-LINUX %s %{suffix}
// CHECK-CFI-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}"
-// CHECK-CFI-DIAG-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.ubsan_standalone.a" "--no-whole-archive"
+// CHECK-CFI-DIAG-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.ubsan_standalone[[SUFFIX]].a" "--no-whole-archive"
// Cross-DSO CFI links the CFI runtime.
// RUN: not %clang -fsanitize=cfi -fsanitize-cfi-cross-dso -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-LINUX %s %{suffix}
// CHECK-CFI-CROSS-DSO-LINUX: "{{.*}}ld{{(.exe)?}}"
-// CHECK-CFI-CROSS-DSO-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.cfi.a" "--no-whole-archive"
+// CHECK-CFI-CROSS-DSO-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.cfi[[SUFFIX]].a" "--no-whole-archive"
// CHECK-CFI-CROSS-DSO-LINUX: -export-dynamic
// Cross-DSO CFI with diagnostics links just the CFI runtime.
@@ -662,9 +670,9 @@
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-LINUX %s %{suffix}
// CHECK-CFI-CROSS-DSO-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}"
-// CHECK-CFI-CROSS-DSO-DIAG-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.cfi_diag.a" "--no-whole-archive"
+// CHECK-CFI-CROSS-DSO-DIAG-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.cfi_diag[[SUFFIX]].a" "--no-whole-archive"
// CHECK-CFI-CROSS-DSO-DIAG-LINUX: -export-dynamic
// Cross-DSO CFI on Android does not link runtime libraries.
@@ -676,15 +684,16 @@
// CHECK-CFI-CROSS-DSO-ANDROID: "{{.*}}ld{{(.exe)?}}"
// CHECK-CFI-CROSS-DSO-ANDROID-NOT: libclang_rt.cfi
+// REDEFINE: %{arch} = aarch64-android
// Cross-DSO CFI with diagnostics on Android links just the UBSAN runtime.
// RUN: not %clang -fsanitize=cfi -fsanitize-cfi-cross-dso -### %s 2>&1 \
// RUN: -fno-sanitize-trap=cfi -fsanitize-recover=cfi \
// RUN: --target=aarch64-linux-android -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_android_tree \
-// RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-ANDROID %s
+// RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-ANDROID %s %{suffix}
// CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "{{.*}}ld{{(.exe)?}}"
-// CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "{{[^"]*}}libclang_rt.ubsan_standalone.so"
+// CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "{{[^"]*}}libclang_rt.ubsan_standalone[[SUFFIX]].so"
// CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "--export-dynamic-symbol=__cfi_check"
// RUN: %clangxx -fsanitize=address -### %s 2>&1 \
@@ -707,16 +716,17 @@
// CHECK-LSAN-DARWIN106-CXX: libclang_rt.lsan_osx_dynamic.dylib
// CHECK-LSAN-DARWIN106-CXX-NOT: -lc++abi
+// REDEFINE: %{arch} = x86_64
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=safe-stack \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-LINUX %s %{suffix}
//
// CHECK-SAFESTACK-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-SAFESTACK-LINUX-NOT: "-lc"
// CHECK-SAFESTACK-LINUX-NOT: whole-archive
-// CHECK-SAFESTACK-LINUX: libclang_rt.safestack.a"
+// CHECK-SAFESTACK-LINUX: libclang_rt.safestack[[SUFFIX]].a"
// CHECK-SAFESTACK-LINUX: "-u" "__safestack_init"
// CHECK-SAFESTACK-LINUX: "-lpthread"
// CHECK-SAFESTACK-LINUX: "-ldl"
@@ -776,11 +786,11 @@
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-LINUX %s %{suffix}
// CHECK-CFI-STATS-LINUX: "{{.*}}ld{{(.exe)?}}"
-// CHECK-CFI-STATS-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.stats_client.a" "--no-whole-archive"
+// CHECK-CFI-STATS-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.stats_client[[SUFFIX]].a" "--no-whole-archive"
// CHECK-CFI-STATS-LINUX-NOT: "--whole-archive"
-// CHECK-CFI-STATS-LINUX: "{{[^"]*}}libclang_rt.stats.a"
+// CHECK-CFI-STATS-LINUX: "{{[^"]*}}libclang_rt.stats[[SUFFIX]].a"
// RUN: not %clang -fsanitize=cfi -fsanitize-stats -### %s 2>&1 \
// RUN: --target=x86_64-apple-darwin -fuse-ld=ld \
@@ -910,13 +920,14 @@
// RUN: | FileCheck --check-prefix=CHECK-NOLIB-PS5 %s
// CHECK-NOLIB-PS5-NOT: SceAddressSanitizer_nosubmission_stub_weak
+// REDEFINE: %{arch} = i386
// RUN: %clang -fsanitize=scudo -### %s 2>&1 \
// RUN: --target=i386-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-SCUDO-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-SCUDO-LINUX %s %{suffix}
// CHECK-SCUDO-LINUX: "{{.*}}ld{{(.exe)?}}"
-// CHECK-SCUDO-LINUX: "--whole-archive" "{{.*}}libclang_rt.scudo_standalone.a" "--no-whole-archive"
+// CHECK-SCUDO-LINUX: "--whole-archive" "{{.*}}libclang_rt.scudo_standalone[[SUFFIX]].a" "--no-whole-archive"
// CHECK-SCUDO-LINUX-NOT: "-lstdc++"
// CHECK-SCUDO-LINUX: "-lpthread"
// CHECK-SCUDO-LINUX: "-ldl"
@@ -926,12 +937,12 @@
// RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=scudo -shared-libsan \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-SCUDO-SHARED-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-SCUDO-SHARED-LINUX %s %{suffix}
//
// CHECK-SCUDO-SHARED-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-SCUDO-SHARED-LINUX-NOT: "-lc"
-// CHECK-SCUDO-SHARED-LINUX-NOT: libclang_rt.scudo_standalone.a"
-// CHECK-SCUDO-SHARED-LINUX: libclang_rt.scudo_standalone.so"
+// CHECK-SCUDO-SHARED-LINUX-NOT: libclang_rt.scudo_standalone
+// CHECK-SCUDO-SHARED-LINUX: libclang_rt.scudo_standalone[[SUFFIX]].so"
// CHECK-SCUDO-SHARED-LINUX-NOT: "-lpthread"
// CHECK-SCUDO-SHARED-LINUX-NOT: "-lrt"
// CHECK-SCUDO-SHARED-LINUX-NOT: "-ldl"
@@ -939,17 +950,18 @@
// CHECK-SCUDO-SHARED-LINUX-NOT: "--export-dynamic"
// CHECK-SCUDO-SHARED-LINUX-NOT: "--dynamic-list"
+// REDEFINE: %{arch} = arm-android
// RUN: %clang -### %s 2>&1 \
// RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=scudo \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
-// RUN: | FileCheck --check-prefix=CHECK-SCUDO-ANDROID %s
+// RUN: | FileCheck --check-prefix=CHECK-SCUDO-ANDROID %s %{suffix}
//
// CHECK-SCUDO-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
// CHECK-SCUDO-ANDROID-NOT: "-lc"
// CHECK-SCUDO-ANDROID: "-pie"
// CHECK-SCUDO-ANDROID-NOT: "-lpthread"
// CHECK-SCUDO-ANDROID-NOT: "-lresolv"
-// CHECK-SCUDO-ANDROID: libclang_rt.scudo_standalone.so"
+// CHECK-SCUDO-ANDROID: libclang_rt.scudo_standalone[[SUFFIX]].so"
// CHECK-SCUDO-ANDROID-NOT: "-lpthread"
// CHECK-SCUDO-ANDROID-NOT: "-lresolv"
@@ -957,10 +969,10 @@
// RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=scudo \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -static-libsan \
-// RUN: | FileCheck --check-prefix=CHECK-SCUDO-ANDROID-STATIC %s
+// RUN: | FileCheck --check-prefix=CHECK-SCUDO-ANDROID-STATIC %s %{suffix}
// CHECK-SCUDO-ANDROID-STATIC: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
// CHECK-SCUDO-ANDROID-STATIC: "-pie"
-// CHECK-SCUDO-ANDROID-STATIC: "--whole-archive" "{{.*}}libclang_rt.scudo_standalone.a" "--no-whole-archive"
+// CHECK-SCUDO-ANDROID-STATIC: "--whole-archive" "{{.*}}libclang_rt.scudo_standalone[[SUFFIX]].a" "--no-whole-archive"
// CHECK-SCUDO-ANDROID-STATIC-NOT: "-lstdc++"
// CHECK-SCUDO-ANDROID-STATIC-NOT: "-lpthread"
// CHECK-SCUDO-ANDROID-STATIC-NOT: "-lrt"
@@ -983,15 +995,16 @@
// CHECK-HWASAN-X86-64-LINUX: "-ldl"
// CHECK-HWASAN-X86-64-LINUX: "-lresolv"
+// REDEFINE: %{arch} = x86_64
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
// RUN: -shared-libsan -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-SHARED-HWASAN-X86-64-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-SHARED-HWASAN-X86-64-LINUX %s %{suffix}
//
// CHECK-SHARED-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lc"
-// CHECK-SHARED-HWASAN-X86-64-LINUX: libclang_rt.hwasan.so"
+// CHECK-SHARED-HWASAN-X86-64-LINUX: libclang_rt.hwasan[[SUFFIX]].so"
// CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lpthread"
// CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lrt"
// CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-ldl"
@@ -1003,11 +1016,11 @@
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
// RUN: -shared-libsan -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-HWASAN-X86-64-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-HWASAN-X86-64-LINUX %s %{suffix}
//
// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lc"
-// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX: libclang_rt.hwasan.so"
+// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX: libclang_rt.hwasan[[SUFFIX]].so"
// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lpthread"
// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lrt"
// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-ldl"
@@ -1032,16 +1045,17 @@
// CHECK-HWASAN-AARCH64-LINUX: "-ldl"
// CHECK-HWASAN-AARCH64-LINUX: "-lresolv"
+// REDEFINE: %{arch} = aarch64
// RUN: %clang -### %s 2>&1 \
// RUN: --target=aarch64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
// RUN: -shared-libsan \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-SHARED-HWASAN-AARCH64-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-SHARED-HWASAN-AARCH64-LINUX %s %{suffix}
//
// CHECK-SHARED-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lc"
-// CHECK-SHARED-HWASAN-AARCH64-LINUX: libclang_rt.hwasan.so"
+// CHECK-SHARED-HWASAN-AARCH64-LINUX: libclang_rt.hwasan[[SUFFIX]].so"
// CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lpthread"
// CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lrt"
// CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-ldl"
@@ -1053,11 +1067,11 @@
// RUN: --target=aarch64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
// RUN: -shared-libsan -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX %s
+// RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX %s %{suffix}
//
// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lc"
-// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX: libclang_rt.hwasan.so"
+// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX: libclang_rt.hwasan[[SUFFIX]].so"
// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lpthread"
// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lrt"
// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-ldl"
diff --git a/clang/test/Driver/wasm-toolchain.c b/clang/test/Driver/wasm-toolchain.c
index dabf0ac2433bbb..4bf22baa2f2858 100644
--- a/clang/test/Driver/wasm-toolchain.c
+++ b/clang/test/Driver/wasm-toolchain.c
@@ -14,45 +14,47 @@
// A basic C link command-line with unknown OS.
+// DEFINE: %{arch} = wasm32
+// DEFINE: %{suffix} = -DSUFFIX=%if !per_target_runtime_dir %{-%{arch}%}
// RUN: %clang -### --target=wasm32-unknown-unknown --sysroot=/foo %s 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK %s
+// RUN: | FileCheck -check-prefix=LINK %s %{suffix}
// LINK: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
+// LINK: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
// A basic C link command-line with optimization with unknown OS.
// RUN: %clang -### -O2 --target=wasm32-unknown-unknown --sysroot=/foo %s 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_OPT %s
+// RUN: | FileCheck -check-prefix=LINK_OPT %s %{suffix}
// LINK_OPT: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_OPT: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
+// LINK_OPT: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
// A basic C link command-line with known OS.
// RUN: %clang -### --target=wasm32-wasi --sysroot=/foo %s 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_KNOWN %s
+// RUN: | FileCheck -check-prefix=LINK_KNOWN %s %{suffix}
// LINK_KNOWN: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
+// LINK_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
// -shared should be passed through to `wasm-ld` and include crt1-reactor.o with a known OS.
// RUN: %clang -### -shared -mexec-model=reactor --target=wasm32-wasi --sysroot=/foo %s 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_KNOWN_SHARED %s
+// RUN: | FileCheck -check-prefix=LINK_KNOWN_SHARED %s %{suffix}
// LINK_KNOWN_SHARED: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_KNOWN_SHARED: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1-reactor.o" "--entry" "_initialize" "-shared" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
+// LINK_KNOWN_SHARED: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1-reactor.o" "--entry" "_initialize" "-shared" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
// -shared should be passed through to `wasm-ld` and include crt1-reactor.o with an unknown OS.
// RUN: %clang -### -shared -mexec-model=reactor --target=wasm32-unknown-unknown --sysroot=/foo %s 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_UNKNOWN_SHARED %s
+// RUN: | FileCheck -check-prefix=LINK_UNKNOWN_SHARED %s %{suffix}
// LINK_UNKNOWN_SHARED: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_UNKNOWN_SHARED: wasm-ld{{.*}}" "crt1-reactor.o" "--entry" "_initialize" "-shared" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
+// LINK_UNKNOWN_SHARED: wasm-ld{{.*}}" "crt1-reactor.o" "--entry" "_initialize" "-shared" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
// A basic C link command-line with optimization with known OS.
// RUN: %clang -### -O2 --target=wasm32-wasi --sysroot=/foo %s 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_OPT_KNOWN %s
+// RUN: | FileCheck -check-prefix=LINK_OPT_KNOWN %s %{suffix}
// LINK_OPT_KNOWN: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_OPT_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
+// LINK_OPT_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
// A basic C compile command-line with known OS.
@@ -178,14 +180,14 @@
// Basic exec-model tests.
// RUN: %clang -### %s --target=wasm32-unknown-unknown --sysroot=%s/no-sysroot-there -mexec-model=command 2>&1 \
-// RUN: | FileCheck -check-prefix=CHECK-COMMAND %s
+// RUN: | FileCheck -check-prefix=CHECK-COMMAND %s %{suffix}
// CHECK-COMMAND: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// CHECK-COMMAND: wasm-ld{{.*}}" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
+// CHECK-COMMAND: wasm-ld{{.*}}" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
// RUN: %clang -### %s --target=wasm32-unknown-unknown --sysroot=%s/no-sysroot-there -mexec-model=reactor 2>&1 \
-// RUN: | FileCheck -check-prefix=CHECK-REACTOR %s
+// RUN: | FileCheck -check-prefix=CHECK-REACTOR %s %{suffix}
// CHECK-REACTOR: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// CHECK-REACTOR: wasm-ld{{.*}}" "crt1-reactor.o" "--entry" "_initialize" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
+// CHECK-REACTOR: wasm-ld{{.*}}" "crt1-reactor.o" "--entry" "_initialize" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
// -fPIC implies +mutable-globals
@@ -202,9 +204,9 @@
// instead of `wasm-ld`.
// RUN: %clang -### -O2 --target=wasm32-wasip2 %s --sysroot /foo 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_WASIP2 %s
+// RUN: | FileCheck -check-prefix=LINK_WASIP2 %s %{suffix}
// LINK_WASIP2: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_WASIP2: wasm-component-ld{{.*}}" "-L/foo/lib/wasm32-wasip2" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
+// LINK_WASIP2: wasm-component-ld{{.*}}" "-L/foo/lib/wasm32-wasip2" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
// Test that on `wasm32-wasip2` the `wasm-component-ld` programs is told where
// to find `wasm-ld` by default.
diff --git a/clang/test/Driver/wasm-toolchain.cpp b/clang/test/Driver/wasm-toolchain.cpp
index ba1c55b33edca4..b888f4a6eeaea5 100644
--- a/clang/test/Driver/wasm-toolchain.cpp
+++ b/clang/test/Driver/wasm-toolchain.cpp
@@ -14,51 +14,53 @@
// A basic C++ link command-line with unknown OS.
+// DEFINE: %{arch} = wasm32
+// DEFINE: %{suffix} = -DSUFFIX=%if !per_target_runtime_dir %{-%{arch}%}
// RUN: %clangxx -### --target=wasm32-unknown-unknown --sysroot=/foo --stdlib=libc++ %s 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK %s
+// RUN: | FileCheck -check-prefix=LINK %s %{suffix}
// LINK: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
+// LINK: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
// RUN: %clangxx -### --target=wasm32-unknown-unknown --sysroot=/foo --stdlib=libstdc++ %s 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_STDCXX %s
+// RUN: | FileCheck -check-prefix=LINK_STDCXX %s %{suffix}
// LINK_STDCXX: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_STDCXX: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lstdc++" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
+// LINK_STDCXX: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lstdc++" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
// A basic C++ link command-line with optimization with unknown OS.
// RUN: %clangxx -### -O2 --target=wasm32-unknown-unknown --sysroot=/foo %s --stdlib=libc++ 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_OPT %s
+// RUN: | FileCheck -check-prefix=LINK_OPT %s %{suffix}
// LINK_OPT: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_OPT: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
+// LINK_OPT: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
// RUN: %clangxx -### -O2 --target=wasm32-unknown-unknown --sysroot=/foo %s --stdlib=libstdc++ 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_OPT_STDCXX %s
+// RUN: | FileCheck -check-prefix=LINK_OPT_STDCXX %s %{suffix}
// LINK_OPT_STDCXX: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_OPT_STDCXX: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lstdc++" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
+// LINK_OPT_STDCXX: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lstdc++" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
// A basic C++ link command-line with known OS.
// RUN: %clangxx -### --target=wasm32-wasi --sysroot=/foo --stdlib=libc++ %s 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_KNOWN %s
+// RUN: | FileCheck -check-prefix=LINK_KNOWN %s %{suffix}
// LINK_KNOWN: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
+// LINK_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
// RUN: %clangxx -### --target=wasm32-wasi --sysroot=/foo --stdlib=libstdc++ %s 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_KNOWN_STDCXX %s
+// RUN: | FileCheck -check-prefix=LINK_KNOWN_STDCXX %s %{suffix}
// LINK_KNOWN_STDCXX: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_KNOWN_STDCXX: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lstdc++" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
+// LINK_KNOWN_STDCXX: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lstdc++" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
// A basic C++ link command-line with optimization with known OS.
// RUN: %clangxx -### -O2 --target=wasm32-wasi --sysroot=/foo %s --stdlib=libc++ 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_OPT_KNOWN %s
+// RUN: | FileCheck -check-prefix=LINK_OPT_KNOWN %s %{suffix}
// LINK_OPT_KNOWN: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_OPT_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
+// LINK_OPT_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
// RUN: %clangxx -### -O2 --target=wasm32-wasi --sysroot=/foo %s --stdlib=libstdc++ 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_OPT_KNOWN_STDCXX %s
+// RUN: | FileCheck -check-prefix=LINK_OPT_KNOWN_STDCXX %s %{suffix}
// LINK_OPT_KNOWN_STDCXX: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_OPT_KNOWN_STDCXX: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lstdc++" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
+// LINK_OPT_KNOWN_STDCXX: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lstdc++" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
// A basic C++ compile command-line with known OS.
diff --git a/clang/test/Driver/windows-cross.c b/clang/test/Driver/windows-cross.c
index f6e831f00e13a6..15928f49e83240 100644
--- a/clang/test/Driver/windows-cross.c
+++ b/clang/test/Driver/windows-cross.c
@@ -8,35 +8,38 @@
// CHECK-STATIC: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bstatic" "--entry" "mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" "{{[^"]*}}.o" "-lmsvcrt"
+// DEFINE: %{arch} = arm
+// DEFINE: %{suffix} = -DSUFFIX=%if !per_target_runtime_dir %{-%{arch}%}
+
// RUN: %clang -### -target armv7-windows-itanium --sysroot %s/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=ld -rtlib=compiler-rt -stdlib=libstdc++ -o /dev/null %s 2>&1 \
-// RUN: | FileCheck %s --check-prefix CHECK-RTLIB
+// RUN: | FileCheck %s --check-prefix CHECK-RTLIB %{suffix}
-// CHECK-RTLIB: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bdynamic" "--entry" "mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins.lib"
+// CHECK-RTLIB: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bdynamic" "--entry" "mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins[[SUFFIX]].lib"
// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=ld -rtlib=compiler-rt -stdlib=libc++ -o /dev/null %s 2>&1 \
-// RUN: | FileCheck %s --check-prefix CHECK-C-LIBCXX
+// RUN: | FileCheck %s --check-prefix CHECK-C-LIBCXX %{suffix}
-// CHECK-C-LIBCXX: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bdynamic" "--entry" "mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins.lib"
+// CHECK-C-LIBCXX: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bdynamic" "--entry" "mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins[[SUFFIX]].lib"
// RUN: %clangxx -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=ld -rtlib=compiler-rt -stdlib=libc++ -o /dev/null %s 2>&1 \
-// RUN: | FileCheck %s --check-prefix CHECK-LIBCXX
+// RUN: | FileCheck %s --check-prefix CHECK-LIBCXX %{suffix}
-// CHECK-LIBCXX: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bdynamic" "--entry" "mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" "{{.*}}.o" "-lc++" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins.lib"
+// CHECK-LIBCXX: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bdynamic" "--entry" "mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" "{{.*}}.o" "-lc++" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins[[SUFFIX]].lib"
// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=ld -shared -rtlib=compiler-rt -stdlib=libc++ -o shared.dll %s 2>&1 \
-// RUN: | FileCheck %s --check-prefix CHECK-SHARED
+// RUN: | FileCheck %s --check-prefix CHECK-SHARED %{suffix}
-// CHECK-SHARED: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-shared" "-Bdynamic" "--enable-auto-image-base" "--entry" "_DllMainCRTStartup" "--allow-multiple-definition" "-o" "shared.dll" "--out-implib" "shared.lib" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins.lib"
+// CHECK-SHARED: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-shared" "-Bdynamic" "--enable-auto-image-base" "--entry" "_DllMainCRTStartup" "--allow-multiple-definition" "-o" "shared.dll" "--out-implib" "shared.lib" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins[[SUFFIX]].lib"
// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=ld -shared -rtlib=compiler-rt -stdlib=libc++ -static -o shared.dll %s 2>&1 \
-// RUN: | FileCheck %s --check-prefix CHECK-SHARED-STATIC
+// RUN: | FileCheck %s --check-prefix CHECK-SHARED-STATIC %{suffix}
-// CHECK-SHARED-STATIC: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-shared" "-Bstatic" "--enable-auto-image-base" "--entry" "_DllMainCRTStartup" "--allow-multiple-definition" "-o" "shared.dll" "--out-implib" "shared.lib" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins.lib"
+// CHECK-SHARED-STATIC: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-shared" "-Bstatic" "--enable-auto-image-base" "--entry" "_DllMainCRTStartup" "--allow-multiple-definition" "-o" "shared.dll" "--out-implib" "shared.lib" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins[[SUFFIX]].lib"
// RUN: %clang -### -target armv7-windows-itanium --sysroot %s/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=ld -shared -rtlib=compiler-rt -stdlib=libc++ -nostartfiles -o shared.dll %s 2>&1 \
-// RUN: | FileCheck %s --check-prefix CHECK-NOSTARTFILES
+// RUN: | FileCheck %s --check-prefix CHECK-NOSTARTFILES %{suffix}
-// CHECK-NOSTARTFILES: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-shared" "-Bdynamic" "--enable-auto-image-base" "--entry" "_DllMainCRTStartup" "--allow-multiple-definition" "-o" "shared.dll" "--out-implib" "shared.lib" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins.lib"
+// CHECK-NOSTARTFILES: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-shared" "-Bdynamic" "--enable-auto-image-base" "--entry" "_DllMainCRTStartup" "--allow-multiple-definition" "-o" "shared.dll" "--out-implib" "shared.lib" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins[[SUFFIX]].lib"
// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=ld -shared -rtlib=compiler-rt -stdlib=libc++ -nostartfiles -nodefaultlibs -o shared.dll %s 2>&1 \
// RUN: | FileCheck %s --check-prefix CHECK-STANDALONE
@@ -49,22 +52,23 @@
// CHECK-FUSE-LD: "{{.*}}lld-link2"
// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=lld-link2 -shared -o shared.dll -fsanitize=address -x c++ %s 2>&1 \
-// RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-ADDRESS
+// RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-ADDRESS %{suffix}
// CHECK-SANITIZE-ADDRESS: "-fsanitize=address"
-// CHECK-SANITIZE-ADDRESS: "{{.*}}clang_rt.asan_dll_thunk.lib"
+// CHECK-SANITIZE-ADDRESS: "{{.*}}clang_rt.asan_dll_thunk[[SUFFIX]].lib"
// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=lld-link2 -o test.exe -fsanitize=address -x c++ %s 2>&1 \
-// RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-ADDRESS-EXE
+// RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-ADDRESS-EXE %{suffix}
// CHECK-SANITIZE-ADDRESS-EXE: "-fsanitize=address"
-// CHECK-SANITIZE-ADDRESS-EXE: "{{.*}}clang_rt.asan_dynamic.lib" "{{.*}}clang_rt.asan_dynamic_runtime_thunk.lib" "--undefined" "__asan_seh_interceptor"
+// CHECK-SANITIZE-ADDRESS-EXE: "{{.*}}clang_rt.asan_dynamic[[SUFFIX]].lib" "{{.*}}clang_rt.asan_dynamic_runtime_thunk[[SUFFIX]].lib" "--undefined" "__asan_seh_interceptor"
+// REDEFINE: %{arch} = i386
// RUN: %clang -### -target i686-windows-itanium -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=lld-link2 -o test.exe -fsanitize=address -x c++ %s 2>&1 \
-// RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-ADDRESS-EXE-X86
+// RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-ADDRESS-EXE-X86 %{suffix}
// CHECK-SANITIZE-ADDRESS-EXE-X86: "-fsanitize=address"
-// CHECK-SANITIZE-ADDRESS-EXE-X86: "{{.*}}clang_rt.asan_dynamic.lib" "{{.*}}clang_rt.asan_dynamic_runtime_thunk.lib" "--undefined" "___asan_seh_interceptor"
+// CHECK-SANITIZE-ADDRESS-EXE-X86: "{{.*}}clang_rt.asan_dynamic[[SUFFIX]].lib" "{{.*}}clang_rt.asan_dynamic_runtime_thunk[[SUFFIX]].lib" "--undefined" "___asan_seh_interceptor"
// RUN: not %clang -### --target=armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=lld-link2 -shared -o shared.dll -fsanitize=tsan -x c++ %s 2>&1 \
// RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-TSAN
diff --git a/clang/test/Driver/zos-ld.c b/clang/test/Driver/zos-ld.c
index 87d169936e1295..37dd9e541ba85a 100644
--- a/clang/test/Driver/zos-ld.c
+++ b/clang/test/Driver/zos-ld.c
@@ -1,4 +1,5 @@
// General tests that ld invocations for z/OS are valid.
+// REQUIRES: per_target_runtime_dir
// 1. General C link for executable
// RUN: %clang -### --target=s390x-ibm-zos %s 2>&1 \
diff --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index 6641811c588395..e6ae0c8572cfca 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -42,6 +42,7 @@ config.llvm_external_lit = path(r"@LLVM_EXTERNAL_LIT@")
config.standalone_build = @CLANG_BUILT_STANDALONE@
config.ppc_linux_default_ieeelongdouble = @PPC_LINUX_DEFAULT_IEEELONGDOUBLE@
config.have_llvm_driver = @LLVM_TOOL_LLVM_DRIVER_BUILD@
+config.per_target_runtime_dir = @LLVM_ENABLE_PER_TARGET_RUNTIME_DIR@
import lit.llvm
lit.llvm.initialize(lit_config, config)
diff --git a/llvm/include/llvm/Config/llvm-config.h.cmake b/llvm/include/llvm/Config/llvm-config.h.cmake
index 6605ea60df99e1..4564d363b02845 100644
--- a/llvm/include/llvm/Config/llvm-config.h.cmake
+++ b/llvm/include/llvm/Config/llvm-config.h.cmake
@@ -198,4 +198,7 @@
/* Define if plugins enabled */
#cmakedefine LLVM_ENABLE_PLUGINS
+/* Are we using a per-target directory tree for compiler-rt? */
+#cmakedefine01 LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
+
#endif
>From e42895aeea237a0291501ae76e9838697a1c5e3e Mon Sep 17 00:00:00 2001
From: Paul Robinson <paul.robinson at sony.com>
Date: Thu, 2 May 2024 09:53:44 -0700
Subject: [PATCH 3/4] Revert "Base the decision on the CMake variable instead"
This reverts commit 6a0b933c833cf070d60100c9722ae1cc01c2a468.
---
clang/lib/Driver/ToolChain.cpp | 3 +-
clang/test/Driver/arm-compiler-rt.c | 39 ++--
clang/test/Driver/cl-link.c | 27 ++-
clang/test/Driver/compiler-rt-unwind.c | 35 ++--
clang/test/Driver/coverage-ld.c | 3 +-
clang/test/Driver/fuchsia.c | 1 -
clang/test/Driver/instrprof-ld.c | 1 -
clang/test/Driver/lit.local.cfg | 4 -
clang/test/Driver/mingw-sanitizers.c | 24 +--
clang/test/Driver/msp430-toolchain.c | 1 -
.../Driver/print-libgcc-file-name-clangrt.c | 38 ++--
clang/test/Driver/sanitizer-ld.c | 188 ++++++++----------
clang/test/Driver/wasm-toolchain.c | 38 ++--
clang/test/Driver/wasm-toolchain.cpp | 34 ++--
clang/test/Driver/windows-cross.c | 40 ++--
clang/test/Driver/zos-ld.c | 1 -
clang/test/lit.site.cfg.py.in | 1 -
llvm/include/llvm/Config/llvm-config.h.cmake | 3 -
18 files changed, 211 insertions(+), 270 deletions(-)
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index fc06ad001404dc..27405f0c94ba6e 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -685,7 +685,8 @@ std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component,
Path = P;
}
// Some targets default to the old layout.
- if (getTriple().isOSAIX() || !LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
+ if (getTriple().isOSAIX() || getTriple().isPS() ||
+ getTriple().isWindowsMSVCEnvironment())
Path.clear();
// Check the filename for the old layout if the new one does not exist.
diff --git a/clang/test/Driver/arm-compiler-rt.c b/clang/test/Driver/arm-compiler-rt.c
index 569742c9baa36a..cb6c29f48a7814 100644
--- a/clang/test/Driver/arm-compiler-rt.c
+++ b/clang/test/Driver/arm-compiler-rt.c
@@ -1,63 +1,56 @@
-// DEFINE: %{arch} = arm
-// DEFINE: %{suffix} = -DSUFFIX=%if !per_target_runtime_dir %{-%{arch}%}
-
// RUN: %clang -target arm-none-eabi \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -rtlib=compiler-rt -### %s 2>&1 \
-// RUN: | FileCheck %s -check-prefix ARM-EABI %{suffix}
-// ARM-EABI: "{{[^"]*}}libclang_rt.builtins[[SUFFIX]].a"
+// RUN: | FileCheck %s -check-prefix ARM-EABI
+// ARM-EABI: "{{[^"]*}}libclang_rt.builtins.a"
// RUN: %clang -target arm-linux-gnueabi \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -rtlib=compiler-rt -### %s 2>&1 \
-// RUN: | FileCheck %s -check-prefix ARM-GNUEABI %{suffix}
-// ARM-GNUEABI: "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a"
+// RUN: | FileCheck %s -check-prefix ARM-GNUEABI
+// ARM-GNUEABI: "{{.*[/\\]}}libclang_rt.builtins.a"
-// REDEFINE: %{arch} = armhf
// RUN: %clang -target arm-linux-gnueabi \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -rtlib=compiler-rt -mfloat-abi=hard -### %s 2>&1 \
-// RUN: | FileCheck %s -check-prefix ARM-GNUEABI-ABI %{suffix}
-// ARM-GNUEABI-ABI: "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a"
+// RUN: | FileCheck %s -check-prefix ARM-GNUEABI-ABI
+// ARM-GNUEABI-ABI: "{{.*[/\\]}}libclang_rt.builtins.a"
// RUN: %clang -target arm-linux-gnueabihf \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -rtlib=compiler-rt -### %s 2>&1 \
-// RUN: | FileCheck %s -check-prefix ARM-GNUEABIHF %{suffix}
-// ARM-GNUEABIHF: "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a"
+// RUN: | FileCheck %s -check-prefix ARM-GNUEABIHF
+// ARM-GNUEABIHF: "{{.*[/\\]}}libclang_rt.builtins.a"
-// REDEFINE: %{arch} = arm
// RUN: %clang -target arm-linux-gnueabihf \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -rtlib=compiler-rt -mfloat-abi=soft -### %s 2>&1 \
-// RUN: | FileCheck %s -check-prefix ARM-GNUEABIHF-ABI %{suffix}
-// ARM-GNUEABIHF-ABI: "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a"
+// RUN: | FileCheck %s -check-prefix ARM-GNUEABIHF-ABI
+// ARM-GNUEABIHF-ABI: "{{.*[/\\]}}libclang_rt.builtins.a"
// RUN: %clang -target arm-windows-itanium \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -rtlib=compiler-rt -### %s 2>&1 \
-// RUN: | FileCheck %s -check-prefix ARM-WINDOWS %{suffix}
-// ARM-WINDOWS: "{{.*[/\\]}}clang_rt.builtins[[SUFFIX]].lib"
+// RUN: | FileCheck %s -check-prefix ARM-WINDOWS
+// ARM-WINDOWS: "{{.*[/\\]}}clang_rt.builtins.lib"
-// REDEFINE: %{arch} = arm-android
// RUN: %clang -target arm-linux-androideabi \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -rtlib=compiler-rt -### %s 2>&1 \
-// RUN: | FileCheck %s -check-prefix ARM-ANDROID %{suffix}
-// ARM-ANDROID: "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a"
+// RUN: | FileCheck %s -check-prefix ARM-ANDROID
+// ARM-ANDROID: "{{.*[/\\]}}libclang_rt.builtins.a"
-// REDEFINE: %{arch} = armhf-android
// RUN: not %clang --target=arm-linux-androideabi \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -rtlib=compiler-rt -mfloat-abi=hard -### %s 2>&1 \
-// RUN: | FileCheck %s -check-prefix ARM-ANDROIDHF %{suffix}
-// ARM-ANDROIDHF: "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a"
+// RUN: | FileCheck %s -check-prefix ARM-ANDROIDHF
+// ARM-ANDROIDHF: "{{.*[/\\]}}libclang_rt.builtins.a"
diff --git a/clang/test/Driver/cl-link.c b/clang/test/Driver/cl-link.c
index c05d7348022d30..444f0c01b3f999 100644
--- a/clang/test/Driver/cl-link.c
+++ b/clang/test/Driver/cl-link.c
@@ -9,27 +9,24 @@
// LINK: "bar"
// LINK: "baz"
-// DEFINE: %{arch} = i386
-// DEFINE: %{suffix} = -DSUFFIX=%if !per_target_runtime_dir %{-%{arch}%}
-
-// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN %s %{suffix}
+// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN %s
// ASAN: link.exe
// ASAN: "-debug"
// ASAN: "-incremental:no"
-// ASAN: "{{[^"]*}}clang_rt.asan[[SUFFIX]].lib"
-// ASAN: "-wholearchive:{{.*}}clang_rt.asan[[SUFFIX]].lib"
-// ASAN: "{{[^"]*}}clang_rt.asan_cxx[[SUFFIX]].lib"
-// ASAN: "-wholearchive:{{.*}}clang_rt.asan_cxx[[SUFFIX]].lib"
+// ASAN: "{{[^"]*}}clang_rt.asan-i386.lib"
+// ASAN: "-wholearchive:{{.*}}clang_rt.asan-i386.lib"
+// ASAN: "{{[^"]*}}clang_rt.asan_cxx-i386.lib"
+// ASAN: "-wholearchive:{{.*}}clang_rt.asan_cxx-i386.lib"
// ASAN: "{{.*}}cl-link{{.*}}.obj"
-// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /MD /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-MD %s %{suffix}
+// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /MD /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-MD %s
// ASAN-MD: link.exe
// ASAN-MD: "-debug"
// ASAN-MD: "-incremental:no"
-// ASAN-MD: "{{.*}}clang_rt.asan_dynamic[[SUFFIX]].lib"
-// ASAN-MD: "{{[^"]*}}clang_rt.asan_dynamic_runtime_thunk[[SUFFIX]].lib"
+// ASAN-MD: "{{.*}}clang_rt.asan_dynamic-i386.lib"
+// ASAN-MD: "{{[^"]*}}clang_rt.asan_dynamic_runtime_thunk-i386.lib"
// ASAN-MD: "-include:___asan_seh_interceptor"
-// ASAN-MD: "-wholearchive:{{.*}}clang_rt.asan_dynamic_runtime_thunk[[SUFFIX]].lib"
+// ASAN-MD: "-wholearchive:{{.*}}clang_rt.asan_dynamic_runtime_thunk-i386.lib"
// ASAN-MD: "{{.*}}cl-link{{.*}}.obj"
// RUN: %clang_cl /LD -fuse-ld=link -### /Tc%s 2>&1 | FileCheck --check-prefix=DLL %s
@@ -37,13 +34,13 @@
// DLL: link.exe
// "-dll"
-// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /LD /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-DLL %s %{suffix}
-// RUN: not %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /LDd /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-DLL %s %{suffix}
+// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /LD /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-DLL %s
+// RUN: not %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /LDd /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-DLL %s
// ASAN-DLL: link.exe
// ASAN-DLL: "-dll"
// ASAN-DLL: "-debug"
// ASAN-DLL: "-incremental:no"
-// ASAN-DLL: "{{.*}}clang_rt.asan_dll_thunk[[SUFFIX]].lib"
+// ASAN-DLL: "{{.*}}clang_rt.asan_dll_thunk-i386.lib"
// ASAN-DLL: "{{.*}}cl-link{{.*}}.obj"
// RUN: %clang_cl /Zi /Tc%s -fuse-ld=link -### 2>&1 | FileCheck --check-prefix=DEBUG %s
diff --git a/clang/test/Driver/compiler-rt-unwind.c b/clang/test/Driver/compiler-rt-unwind.c
index 2ad8fd80766c7c..c5040d7fd900ba 100644
--- a/clang/test/Driver/compiler-rt-unwind.c
+++ b/clang/test/Driver/compiler-rt-unwind.c
@@ -1,9 +1,6 @@
// General tests that the driver handles combinations of --rtlib=XXX and
// --unwindlib=XXX properly.
//
-// DEFINE: %{arch} = x86_64
-// DEFINE: %{suffix} = -DSUFFIX=%if !per_target_runtime_dir %{-%{arch}%}
-//
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux -rtlib=libgcc --unwindlib=platform \
// RUN: -resource-dir=%S/Inputs/resource_dir \
@@ -54,18 +51,18 @@
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt \
// RUN: -resource-dir=%S/Inputs/resource_dir \
-// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT %s %{suffix}
-// RTLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins[[SUFFIX]].a"
+// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT %s
+// RTLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins.a"
//
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=libunwind \
// RUN: -resource-dir=%S/Inputs/resource_dir \
-// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT %s %{suffix}
+// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT %s
// RUN: %clangxx -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=libunwind \
// RUN: -resource-dir=%S/Inputs/resource_dir \
-// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT %s %{suffix}
-// RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins[[SUFFIX]].a"
+// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT %s
+// RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins.a"
// RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT-SAME: "--as-needed"
// RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT-SAME: "-lunwind"
// RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT-SAME: "--no-as-needed"
@@ -73,15 +70,15 @@
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=libgcc \
// RUN: -resource-dir=%S/Inputs/resource_dir \
-// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-GCC %s %{suffix}
-// RTLIB-COMPILER-RT-UNWINDLIB-GCC: "{{.*}}libclang_rt.builtins[[SUFFIX]].a"
+// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-GCC %s
+// RTLIB-COMPILER-RT-UNWINDLIB-GCC: "{{.*}}libclang_rt.builtins.a"
// RTLIB-COMPILER-RT-UNWINDLIB-GCC-SAME: "-lgcc_s"
//
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=libgcc \
// RUN: -static -resource-dir=%S/Inputs/resource_dir \
-// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC %s %{suffix}
-// RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC: "{{.*}}libclang_rt.builtins[[SUFFIX]].a"
+// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC %s
+// RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC: "{{.*}}libclang_rt.builtins.a"
// RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC-SAME: "-lgcc_eh"
//
// RUN: not %clang %s 2> %t.err \
@@ -100,22 +97,22 @@
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-w64-mingw32 -rtlib=compiler-rt --unwindlib=libunwind \
// RUN: -shared-libgcc \
-// RUN: | FileCheck --check-prefix=MINGW-RTLIB-COMPILER-RT-SHARED-UNWINDLIB-COMPILER-RT %s %{suffix}
-// MINGW-RTLIB-COMPILER-RT-SHARED-UNWINDLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins[[SUFFIX]].a"
+// RUN: | FileCheck --check-prefix=MINGW-RTLIB-COMPILER-RT-SHARED-UNWINDLIB-COMPILER-RT %s
+// MINGW-RTLIB-COMPILER-RT-SHARED-UNWINDLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins.a"
// MINGW-RTLIB-COMPILER-RT-SHARED-UNWINDLIB-COMPILER-RT-SAME: "-l:libunwind.dll.a"
//
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-w64-mingw32 -rtlib=compiler-rt --unwindlib=libunwind \
// RUN: -static-libgcc \
-// RUN: | FileCheck --check-prefix=MINGW-RTLIB-COMPILER-RT-STATIC-UNWINDLIB-COMPILER-RT %s %{suffix}
-// MINGW-RTLIB-COMPILER-RT-STATIC-UNWINDLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins[[SUFFIX]].a"
+// RUN: | FileCheck --check-prefix=MINGW-RTLIB-COMPILER-RT-STATIC-UNWINDLIB-COMPILER-RT %s
+// MINGW-RTLIB-COMPILER-RT-STATIC-UNWINDLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins.a"
// MINGW-RTLIB-COMPILER-RT-STATIC-UNWINDLIB-COMPILER-RT-SAME: "-l:libunwind.a"
//
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-w64-mingw32 -rtlib=compiler-rt --unwindlib=libunwind \
-// RUN: | FileCheck --check-prefix=MINGW-RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT %s %{suffix}
+// RUN: | FileCheck --check-prefix=MINGW-RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT %s
// RUN: %clangxx -### %s 2>&1 \
// RUN: --target=x86_64-w64-mingw32 -rtlib=compiler-rt --unwindlib=libunwind \
-// RUN: | FileCheck --check-prefix=MINGW-RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT %s %{suffix}
-// MINGW-RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins[[SUFFIX]].a"
+// RUN: | FileCheck --check-prefix=MINGW-RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT %s
+// MINGW-RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins.a"
// MINGW-RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT-SAME: "-lunwind"
diff --git a/clang/test/Driver/coverage-ld.c b/clang/test/Driver/coverage-ld.c
index 1a488c71c82822..be1d8320ab8be2 100644
--- a/clang/test/Driver/coverage-ld.c
+++ b/clang/test/Driver/coverage-ld.c
@@ -1,6 +1,5 @@
// Test coverage ld flags.
-// REQUIRES: per_target_runtime_dir
-//
+//
// RUN: %clang -### %s 2>&1 \
// RUN: --target=i386-unknown-linux -fprofile-arcs \
// RUN: -resource-dir=%S/Inputs/resource_dir \
diff --git a/clang/test/Driver/fuchsia.c b/clang/test/Driver/fuchsia.c
index 9e2f6836e61c96..c67f7f8c005b39 100644
--- a/clang/test/Driver/fuchsia.c
+++ b/clang/test/Driver/fuchsia.c
@@ -1,4 +1,3 @@
-// REQUIRES: per_target_runtime_dir
// RUN: %clang -### %s --target=x86_64-unknown-fuchsia \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
// RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
diff --git a/clang/test/Driver/instrprof-ld.c b/clang/test/Driver/instrprof-ld.c
index 8275d668377505..a96bba4a1e763c 100644
--- a/clang/test/Driver/instrprof-ld.c
+++ b/clang/test/Driver/instrprof-ld.c
@@ -1,5 +1,4 @@
// Test instrumented profiling ld flags.
-// REQUIRES: per_target_runtime_dir
//
// RUN: %clang -### %s 2>&1 \
// RUN: --target=i386-unknown-linux -fprofile-instr-generate -fuse-ld=ld \
diff --git a/clang/test/Driver/lit.local.cfg b/clang/test/Driver/lit.local.cfg
index a48444332d8855..6370e9f92d89b9 100644
--- a/clang/test/Driver/lit.local.cfg
+++ b/clang/test/Driver/lit.local.cfg
@@ -49,7 +49,3 @@ if llvm_config.use_lld(required=False):
if config.ppc_linux_default_ieeelongdouble:
config.available_features.add("ppc_linux_default_ieeelongdouble")
-
-if config.per_target_runtime_dir:
- config.available_features.add("per_target_runtime_dir")
-config.recursiveExpansionLimit = 2
\ No newline at end of file
diff --git a/clang/test/Driver/mingw-sanitizers.c b/clang/test/Driver/mingw-sanitizers.c
index 400eeee518f040..2325f8f0f1f23d 100644
--- a/clang/test/Driver/mingw-sanitizers.c
+++ b/clang/test/Driver/mingw-sanitizers.c
@@ -1,24 +1,20 @@
-// DEFINE: %{arch} = i386
-// DEFINE: %{suffix} = -DSUFFIX=%if !per_target_runtime_dir %{-%{arch}%}
-//
// RUN: touch %t.a
-// RUN: %clang -target i686-windows-gnu %s -### -fsanitize=address -lcomponent %/t.a 2>&1 | FileCheck --check-prefixes=ASAN-ALL,ASAN-I686 -DINPUT=%/t.a %s %{suffix}
-// REDEFINE: %{arch} = x86_64
-// RUN: %clang -target x86_64-windows-gnu %s -### -fsanitize=address -lcomponent %/t.a 2>&1 | FileCheck --check-prefixes=ASAN-ALL,ASAN-X86_64 -DINPUT=%/t.a %s %{suffix}
+// RUN: %clang -target i686-windows-gnu %s -### -fsanitize=address -lcomponent %/t.a 2>&1 | FileCheck --check-prefixes=ASAN-ALL,ASAN-I686 -DINPUT=%/t.a %s
+// RUN: %clang -target x86_64-windows-gnu %s -### -fsanitize=address -lcomponent %/t.a 2>&1 | FileCheck --check-prefixes=ASAN-ALL,ASAN-X86_64 -DINPUT=%/t.a %s
//
// ASAN-ALL-NOT:"-l{{[^"]+"]}}"
// ASAN-ALL-NOT:"[[INPUT]]"
-// ASAN-I686: "{{[^"]*}}libclang_rt.asan_dynamic[[SUFFIX]].dll.a"
-// ASAN-X86_64: "{{[^"]*}}libclang_rt.asan_dynamic[[SUFFIX]].dll.a"
+// ASAN-I686: "{{[^"]*}}libclang_rt.asan_dynamic.dll.a"
+// ASAN-X86_64: "{{[^"]*}}libclang_rt.asan_dynamic.dll.a"
// ASAN-ALL: "-lcomponent"
// ASAN-ALL: "[[INPUT]]"
-// ASAN-I686: "{{[^"]*}}libclang_rt.asan_dynamic[[SUFFIX]].dll.a"
-// ASAN-I686: "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk[[SUFFIX]].a"
+// ASAN-I686: "{{[^"]*}}libclang_rt.asan_dynamic.dll.a"
+// ASAN-I686: "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk.a"
// ASAN-I686: "--require-defined" "___asan_seh_interceptor"
-// ASAN-I686: "--whole-archive" "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk[[SUFFIX]].a" "--no-whole-archive"
-// ASAN-X86_64: "{{[^"]*}}libclang_rt.asan_dynamic[[SUFFIX]].dll.a"
-// ASAN-X86_64: "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk[[SUFFIX]].a"
+// ASAN-I686: "--whole-archive" "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk.a" "--no-whole-archive"
+// ASAN-X86_64: "{{[^"]*}}libclang_rt.asan_dynamic.dll.a"
+// ASAN-X86_64: "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk.a"
// ASAN-X86_64: "--require-defined" "__asan_seh_interceptor"
-// ASAN-X86_64: "--whole-archive" "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk[[SUFFIX]].a" "--no-whole-archive"
+// ASAN-X86_64: "--whole-archive" "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk.a" "--no-whole-archive"
// RUN: %clang -target x86_64-windows-gnu %s -### -fsanitize=vptr
diff --git a/clang/test/Driver/msp430-toolchain.c b/clang/test/Driver/msp430-toolchain.c
index 91928aa7ad75cc..3c3042b482ef26 100644
--- a/clang/test/Driver/msp430-toolchain.c
+++ b/clang/test/Driver/msp430-toolchain.c
@@ -1,6 +1,5 @@
// Splitting some tests into POS and NEG parts so the latter can validate
// output fragments as large as possible for absence of some text.
-// REQUIRES: per_target_runtime_dir
// Test for include paths and other cc1 flags
diff --git a/clang/test/Driver/print-libgcc-file-name-clangrt.c b/clang/test/Driver/print-libgcc-file-name-clangrt.c
index 72f8cf792852cd..a902eedc852096 100644
--- a/clang/test/Driver/print-libgcc-file-name-clangrt.c
+++ b/clang/test/Driver/print-libgcc-file-name-clangrt.c
@@ -1,21 +1,18 @@
// Test that -print-libgcc-file-name correctly respects -rtlib=compiler-rt.
-// DEFINE: %{arch} = x86_64
-// DEFINE: %{suffix} = -DSUFFIX=%if !per_target_runtime_dir %{-%{arch}%}
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \
// RUN: --target=x86_64-pc-linux \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s %{suffix}
-// CHECK-CLANGRT-X8664: libclang_rt.builtins[[SUFFIX]].a
+// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s
+// CHECK-CLANGRT-X8664: libclang_rt.builtins.a
-// REDEFINE: %{arch} = i386
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \
// RUN: --target=i386-pc-linux \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-I386 %s %{suffix}
-// CHECK-CLANGRT-I386: libclang_rt.builtins[[SUFFIX]].a
+// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-I386 %s
+// CHECK-CLANGRT-I386: libclang_rt.builtins.a
// Check whether alternate arch values map to the correct library.
//
@@ -23,48 +20,43 @@
// RUN: --target=i686-pc-linux \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-I386 %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-I386 %s
-// REDEFINE: %{arch} = arm
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \
// RUN: --target=arm-linux-gnueabi \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-ARM %s %{suffix}
-// CHECK-CLANGRT-ARM: libclang_rt.builtins[[SUFFIX]].a
+// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-ARM %s
+// CHECK-CLANGRT-ARM: libclang_rt.builtins.a
-// REDEFINE: %{arch} = arm-android
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \
// RUN: --target=arm-linux-androideabi \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-ARM-ANDROID %s %{suffix}
-// CHECK-CLANGRT-ARM-ANDROID: libclang_rt.builtins[[SUFFIX]].a
+// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-ARM-ANDROID %s
+// CHECK-CLANGRT-ARM-ANDROID: libclang_rt.builtins.a
-// REDEFINE: %{arch} = armhf
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \
// RUN: --target=arm-linux-gnueabihf \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-ARMHF %s %{suffix}
-// CHECK-CLANGRT-ARMHF: libclang_rt.builtins[[SUFFIX]].a
+// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-ARMHF %s
+// CHECK-CLANGRT-ARMHF: libclang_rt.builtins.a
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \
// RUN: --target=arm-linux-gnueabi -mfloat-abi=hard \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-ARM-ABI %s %{suffix}
-// CHECK-CLANGRT-ARM-ABI: libclang_rt.builtins[[SUFFIX]].a
+// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-ARM-ABI %s
+// CHECK-CLANGRT-ARM-ABI: libclang_rt.builtins.a
-// REDEFINE: %{arch} = armv7m
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \
// RUN: --target=armv7m-none-eabi \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-ARM-BAREMETAL %s %{suffix}
-// CHECK-CLANGRT-ARM-BAREMETAL: libclang_rt.builtins[[SUFFIX]].a
+// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-ARM-BAREMETAL %s
+// CHECK-CLANGRT-ARM-BAREMETAL: libclang_rt.builtins.a
-// Note this one will never have an arch suffix.
// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name \
// RUN: --target=armv7m-vendor-none-eabi \
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \
diff --git a/clang/test/Driver/sanitizer-ld.c b/clang/test/Driver/sanitizer-ld.c
index 1135f21b679fa9..7289d09697b4d0 100644
--- a/clang/test/Driver/sanitizer-ld.c
+++ b/clang/test/Driver/sanitizer-ld.c
@@ -53,32 +53,30 @@
// CHECK-ASAN-SHARED-LINUX: libclang_rt.asan_static
// CHECK-ASAN-SHARED-LINUX-NOT: libclang_rt.asan
-// DEFINE: %{arch} = i386
-// DEFINE: %{suffix} = -DSUFFIX=%if !per_target_runtime_dir %{-%{arch}%}
// RUN: %clang -### %s 2>&1 \
// RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libsan \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s
// RUN: %clang -### %s 2>&1 \
// RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libasan \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s
// RUN: %clang -### %s 2>&1 \
// RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=address \
// RUN: -shared-libsan -static-libsan -shared-libasan \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s
//
// CHECK-SHARED-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-SHARED-ASAN-LINUX-NOT: "-lc"
-// CHECK-SHARED-ASAN-LINUX-NOT: libclang_rt.asan[[SUFFIX]].a"
-// CHECK-SHARED-ASAN-LINUX: libclang_rt.asan[[SUFFIX]].so"
-// CHECK-SHARED-ASAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.asan-preinit[[SUFFIX]].a" "--no-whole-archive"
+// CHECK-SHARED-ASAN-LINUX-NOT: libclang_rt.asan.a"
+// CHECK-SHARED-ASAN-LINUX: libclang_rt.asan.so"
+// CHECK-SHARED-ASAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.asan-preinit.a" "--no-whole-archive"
// CHECK-SHARED-ASAN-LINUX-NOT: "-lpthread"
// CHECK-SHARED-ASAN-LINUX-NOT: "-lrt"
// CHECK-SHARED-ASAN-LINUX-NOT: "-ldl"
@@ -90,13 +88,13 @@
// RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libsan \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-ASAN-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-ASAN-LINUX %s
//
// CHECK-DSO-SHARED-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lc"
-// CHECK-DSO-SHARED-ASAN-LINUX-NOT: libclang_rt.asan[[SUFFIX]].a"
-// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "libclang_rt.asan-preinit[[SUFFIX]].a"
-// CHECK-DSO-SHARED-ASAN-LINUX: libclang_rt.asan[[SUFFIX]].so"
+// CHECK-DSO-SHARED-ASAN-LINUX-NOT: libclang_rt.asan.a"
+// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "libclang_rt.asan-preinit.a"
+// CHECK-DSO-SHARED-ASAN-LINUX: libclang_rt.asan.so"
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lpthread"
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lrt"
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-ldl"
@@ -108,12 +106,12 @@
// RUN: --target=i386-unknown-freebsd -fuse-ld=ld -fsanitize=address \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_freebsd_tree \
-// RUN: | FileCheck --check-prefix=CHECK-ASAN-FREEBSD %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-ASAN-FREEBSD %s
//
// CHECK-ASAN-FREEBSD: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-ASAN-FREEBSD-NOT: "-lc"
// CHECK-ASAN-FREEBSD-NOT: libclang_rt.asan_cxx
-// CHECK-ASAN-FREEBSD: freebsd{{/|\\+}}libclang_rt.asan[[SUFFIX]].a"
+// CHECK-ASAN-FREEBSD: freebsd{{/|\\+}}libclang_rt.asan.a"
// CHECK-ASAN-FREEBSD-NOT: libclang_rt.asan_cxx
// CHECK-ASAN-FREEBSD-NOT: "--dynamic-list"
// CHECK-ASAN-FREEBSD: "--export-dynamic"
@@ -133,12 +131,12 @@
// RUN: --target=i386-unknown-linux -fuse-ld=ld -stdlib=platform -fsanitize=address \
// RUN: -resource-dir=%S/Inputs/empty_resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-ASAN-LINUX-CXX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-ASAN-LINUX-CXX %s
//
// CHECK-ASAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-ASAN-LINUX-CXX-NOT: "-lc"
-// CHECK-ASAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan[[SUFFIX]].a" "--no-whole-archive"
-// CHECK-ASAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan_cxx[[SUFFIX]].a" "--no-whole-archive"
+// CHECK-ASAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan.a" "--no-whole-archive"
+// CHECK-ASAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan_cxx.a" "--no-whole-archive"
// CHECK-ASAN-LINUX-CXX-NOT: "--dynamic-list"
// CHECK-ASAN-LINUX-CXX: "--export-dynamic"
// CHECK-ASAN-LINUX-CXX: stdc++
@@ -158,38 +156,36 @@
// CHECK-ASAN-LINUX-CXX-STATIC: "--whole-archive" "{{.*}}libclang_rt.asan.a" "--no-whole-archive"
// CHECK-ASAN-LINUX-CXX-STATIC: stdc++
-// REDEFINE: %{arch} = arm
// RUN: %clang -### %s 2>&1 \
// RUN: --target=arm-linux-gnueabi -fuse-ld=ld -fsanitize=address \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
-// RUN: | FileCheck --check-prefix=CHECK-ASAN-ARM %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-ASAN-ARM %s
//
// CHECK-ASAN-ARM: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-ASAN-ARM-NOT: "-lc"
-// CHECK-ASAN-ARM: libclang_rt.asan[[SUFFIX]].a"
+// CHECK-ASAN-ARM: libclang_rt.asan.a"
//
// RUN: %clang -### %s 2>&1 \
// RUN: --target=armv7l-linux-gnueabi -fuse-ld=ld -fsanitize=address \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
-// RUN: | FileCheck --check-prefix=CHECK-ASAN-ARMv7 %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-ASAN-ARMv7 %s
//
// CHECK-ASAN-ARMv7: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-ASAN-ARMv7-NOT: "-lc"
-// CHECK-ASAN-ARMv7: libclang_rt.asan[[SUFFIX]].a"
+// CHECK-ASAN-ARMv7: libclang_rt.asan.a"
-// REDEFINE: %{arch} = arm-android
// RUN: %clang -### %s 2>&1 \
// RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=address \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -resource-dir=%S/Inputs/resource_dir \
-// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID %s
//
// CHECK-ASAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
// CHECK-ASAN-ANDROID: "-pie"
// CHECK-ASAN-ANDROID-NOT: "-lc"
// CHECK-ASAN-ANDROID-NOT: "-lpthread"
// CHECK-ASAN-ANDROID-NOT: "-lresolv"
-// CHECK-ASAN-ANDROID: libclang_rt.asan[[SUFFIX]].so"
+// CHECK-ASAN-ANDROID: libclang_rt.asan.so"
// CHECK-ASAN-ANDROID-NOT: "-lpthread"
// CHECK-ASAN-ANDROID-NOT: "-lresolv"
@@ -198,10 +194,10 @@
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -static-libsan \
-// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-STATICLIBASAN %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-STATICLIBASAN %s
//
// CHECK-ASAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
-// CHECK-ASAN-ANDROID-STATICLIBASAN: libclang_rt.asan[[SUFFIX]].a"
+// CHECK-ASAN-ANDROID-STATICLIBASAN: libclang_rt.asan.a"
// CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lpthread"
// CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lrt"
// CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lresolv"
@@ -210,14 +206,14 @@
// RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=undefined \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -resource-dir=%S/Inputs/resource_dir \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-ANDROID %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-ANDROID %s
//
// CHECK-UBSAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
// CHECK-UBSAN-ANDROID: "-pie"
// CHECK-UBSAN-ANDROID-NOT: "-lc"
// CHECK-UBSAN-ANDROID-NOT: "-lpthread"
// CHECK-UBSAN-ANDROID-NOT: "-lresolv"
-// CHECK-UBSAN-ANDROID: libclang_rt.ubsan_standalone[[SUFFIX]].so"
+// CHECK-UBSAN-ANDROID: libclang_rt.ubsan_standalone.so"
// CHECK-UBSAN-ANDROID-NOT: "-lpthread"
// CHECK-UBSAN-ANDROID-NOT: "-lresolv"
@@ -226,27 +222,27 @@
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -static-libsan \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-ANDROID-STATICLIBASAN %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-ANDROID-STATICLIBASAN %s
//
// CHECK-UBSAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
-// CHECK-UBSAN-ANDROID-STATICLIBASAN: libclang_rt.ubsan_standalone[[SUFFIX]].a"
+// CHECK-UBSAN-ANDROID-STATICLIBASAN: libclang_rt.ubsan_standalone.a"
// CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lpthread"
// CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lrt"
// CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lresolv"
-// REDEFINE: %{arch} = i686-android
+//
// RUN: %clang -### %s 2>&1 \
// RUN: --target=i686-linux-android -fuse-ld=ld -fsanitize=address \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -resource-dir=%S/Inputs/resource_dir \
-// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-X86 %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-X86 %s
//
// CHECK-ASAN-ANDROID-X86: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
// CHECK-ASAN-ANDROID-X86: "-pie"
// CHECK-ASAN-ANDROID-X86-NOT: "-lc"
// CHECK-ASAN-ANDROID-X86-NOT: "-lpthread"
// CHECK-ASAN-ANDROID-X86-NOT: "-lresolv"
-// CHECK-ASAN-ANDROID-X86: libclang_rt.asan[[SUFFIX]].so"
+// CHECK-ASAN-ANDROID-X86: libclang_rt.asan.so"
// CHECK-ASAN-ANDROID-X86-NOT: "-lpthread"
// CHECK-ASAN-ANDROID-X86-NOT: "-lresolv"
//
@@ -258,17 +254,16 @@
//
// CHECK-ASAN-ANDROID-SHARED-LIBASAN-NOT: argument unused during compilation: '-shared-libsan'
//
-// REDEFINE: %{arch} = arm-android
// RUN: %clang -### %s 2>&1 \
// RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=address \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -shared \
-// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED %s
//
// CHECK-ASAN-ANDROID-SHARED: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
// CHECK-ASAN-ANDROID-SHARED-NOT: "-lc"
-// CHECK-ASAN-ANDROID-SHARED: libclang_rt.asan[[SUFFIX]].so"
+// CHECK-ASAN-ANDROID-SHARED: libclang_rt.asan.so"
// CHECK-ASAN-ANDROID-SHARED-NOT: "-lpthread"
// CHECK-ASAN-ANDROID-SHARED-NOT: "-lresolv"
@@ -336,30 +331,29 @@
//
// CHECK-MSAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.msan
-// REDEFINE: %{arch} = x32
// RUN: %clang -fsanitize=undefined -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux-gnux32 -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s
// RUN: %clang -fsanitize=float-divide-by-zero -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux-gnux32 -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s
// RUN: %clang -fsanitize=undefined -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux-gnux32 -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
// RUN: -static-libsan \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s
// CHECK-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}"
// CHECK-UBSAN-LINUX-NOT: libclang_rt.asan
// CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_standalone_cxx
-// CHECK-UBSAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone[[SUFFIX]].a" "--no-whole-archive"
+// CHECK-UBSAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone.a" "--no-whole-archive"
// CHECK-UBSAN-LINUX-NOT: libclang_rt.asan
// CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_standalone_cxx
// CHECK-UBSAN-LINUX-NOT: "-lstdc++"
@@ -390,50 +384,49 @@
//
// CHECK-FUZZER-NO-LINK-RUNTIME-DARWIN-NOT: libclang_rt.fuzzer
-// REDEFINE: %{arch} = i386
// RUN: %clang -fsanitize=undefined -### %s 2>&1 \
// RUN: --target=i386-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: -shared-libsan \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s
// RUN: %clang -fsanitize=undefined -### %s 2>&1 \
// RUN: --target=i386-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: -static-libsan -shared-libsan \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s
// RUN: %clang -fsanitize=undefined -### %s 2>&1 \
// RUN: --target=i386-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: -shared -shared-libsan \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s
// CHECK-UBSAN-LINUX-SHAREDLIBASAN: "{{.*}}ld{{(.exe)?}}"
-// CHECK-UBSAN-LINUX-SHAREDLIBASAN: "{{.*}}libclang_rt.ubsan_standalone[[SUFFIX]].so{{.*}}"
+// CHECK-UBSAN-LINUX-SHAREDLIBASAN: "{{.*}}libclang_rt.ubsan_standalone.so{{.*}}"
// RUN: %clang -fsanitize=undefined -fsanitize-link-c++-runtime -### %s 2>&1 \
// RUN: --target=i386-unknown-linux \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-LINK-CXX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-LINK-CXX %s
// CHECK-UBSAN-LINUX-LINK-CXX-NOT: "-lstdc++"
-// CHECK-UBSAN-LINUX-LINK-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone_cxx[[SUFFIX]].a" "--no-whole-archive"
+// CHECK-UBSAN-LINUX-LINK-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone_cxx.a" "--no-whole-archive"
// CHECK-UBSAN-LINUX-LINK-CXX-NOT: "-lstdc++"
// RUN: %clangxx -fsanitize=undefined -### %s 2>&1 \
// RUN: --target=i386-unknown-linux -fuse-ld=ld -stdlib=platform \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-CXX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-CXX %s
// CHECK-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
// CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
-// CHECK-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone[[SUFFIX]].a" "--no-whole-archive"
+// CHECK-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone.a" "--no-whole-archive"
// CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
-// CHECK-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone_cxx[[SUFFIX]].a" "--no-whole-archive"
+// CHECK-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone_cxx.a" "--no-whole-archive"
// CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
// CHECK-UBSAN-LINUX-CXX: "-lstdc++"
// CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
@@ -444,9 +437,9 @@
// RUN: --target=i386-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-MINIMAL-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-MINIMAL-LINUX %s
// CHECK-UBSAN-MINIMAL-LINUX: "{{.*}}ld{{(.exe)?}}"
-// CHECK-UBSAN-MINIMAL-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_minimal[[SUFFIX]].a" "--no-whole-archive"
+// CHECK-UBSAN-MINIMAL-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_minimal.a" "--no-whole-archive"
// CHECK-UBSAN-MINIMAL-LINUX: "-lpthread"
// CHECK-UBSAN-MINIMAL-LINUX: "-lresolv"
@@ -491,10 +484,10 @@
// RUN: --target=i386-unknown-linux -fuse-ld=ld -stdlib=platform \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-ASAN-UBSAN-LINUX-CXX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-ASAN-UBSAN-LINUX-CXX %s
// CHECK-ASAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
// CHECK-ASAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan.a" "--no-whole-archive"
-// CHECK-ASAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan_cxx[[SUFFIX]].a" "--no-whole-archive"
+// CHECK-ASAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan_cxx.a" "--no-whole-archive"
// CHECK-ASAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan
// CHECK-ASAN-UBSAN-LINUX-CXX: "-lstdc++"
// CHECK-ASAN-UBSAN-LINUX-CXX: "-lpthread"
@@ -529,17 +522,16 @@
// CHECK-UBSAN-LINUX-SHARED-NOT: --dynamic-list
// CHECK-UBSAN-LINUX-SHARED-NOT: libclang_rt.ubsan
-// REDEFINE: %{arch} = x86_64
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=leak \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-LSAN-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-LSAN-LINUX %s
//
// CHECK-LSAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-LSAN-LINUX-NOT: "-lc"
// CHECK-LSAN-LINUX-NOT: libclang_rt.ubsan
-// CHECK-LSAN-LINUX: libclang_rt.lsan[[SUFFIX]].a"
+// CHECK-LSAN-LINUX: libclang_rt.lsan.a"
// CHECK-LSAN-LINUX: "-lpthread"
// CHECK-LSAN-LINUX: "-ldl"
// CHECK-LSAN-LINUX: "-lresolv"
@@ -605,9 +597,9 @@
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-DFSAN-COV-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-DFSAN-COV-LINUX %s
// CHECK-DFSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
-// CHECK-DFSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.dfsan[[SUFFIX]].a" "--no-whole-archive"
+// CHECK-DFSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.dfsan.a" "--no-whole-archive"
// CHECK-DFSAN-COV-LINUX-NOT: libclang_rt.ubsan
// CHECK-DFSAN-COV-LINUX-NOT: "-lstdc++"
// CHECK-DFSAN-COV-LINUX: "-lpthread"
@@ -617,9 +609,9 @@
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-UBSAN-COV-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-UBSAN-COV-LINUX %s
// CHECK-UBSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
-// CHECK-UBSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone[[SUFFIX]].a" "--no-whole-archive"
+// CHECK-UBSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone.a" "--no-whole-archive"
// CHECK-UBSAN-COV-LINUX-NOT: "-lstdc++"
// CHECK-UBSAN-COV-LINUX: "-lpthread"
// CHECK-UBSAN-COV-LINUX: "-lresolv"
@@ -628,9 +620,9 @@
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-COV-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-COV-LINUX %s
// CHECK-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
-// CHECK-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone[[SUFFIX]].a" "--no-whole-archive"
+// CHECK-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone.a" "--no-whole-archive"
// CHECK-COV-LINUX-NOT: "-lstdc++"
// CHECK-COV-LINUX: "-lpthread"
// CHECK-COV-LINUX: "-lresolv"
@@ -650,18 +642,18 @@
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-CFI-DIAG-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-CFI-DIAG-LINUX %s
// CHECK-CFI-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}"
-// CHECK-CFI-DIAG-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.ubsan_standalone[[SUFFIX]].a" "--no-whole-archive"
+// CHECK-CFI-DIAG-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.ubsan_standalone.a" "--no-whole-archive"
// Cross-DSO CFI links the CFI runtime.
// RUN: not %clang -fsanitize=cfi -fsanitize-cfi-cross-dso -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-LINUX %s
// CHECK-CFI-CROSS-DSO-LINUX: "{{.*}}ld{{(.exe)?}}"
-// CHECK-CFI-CROSS-DSO-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.cfi[[SUFFIX]].a" "--no-whole-archive"
+// CHECK-CFI-CROSS-DSO-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.cfi.a" "--no-whole-archive"
// CHECK-CFI-CROSS-DSO-LINUX: -export-dynamic
// Cross-DSO CFI with diagnostics links just the CFI runtime.
@@ -670,9 +662,9 @@
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-LINUX %s
// CHECK-CFI-CROSS-DSO-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}"
-// CHECK-CFI-CROSS-DSO-DIAG-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.cfi_diag[[SUFFIX]].a" "--no-whole-archive"
+// CHECK-CFI-CROSS-DSO-DIAG-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.cfi_diag.a" "--no-whole-archive"
// CHECK-CFI-CROSS-DSO-DIAG-LINUX: -export-dynamic
// Cross-DSO CFI on Android does not link runtime libraries.
@@ -684,16 +676,15 @@
// CHECK-CFI-CROSS-DSO-ANDROID: "{{.*}}ld{{(.exe)?}}"
// CHECK-CFI-CROSS-DSO-ANDROID-NOT: libclang_rt.cfi
-// REDEFINE: %{arch} = aarch64-android
// Cross-DSO CFI with diagnostics on Android links just the UBSAN runtime.
// RUN: not %clang -fsanitize=cfi -fsanitize-cfi-cross-dso -### %s 2>&1 \
// RUN: -fno-sanitize-trap=cfi -fsanitize-recover=cfi \
// RUN: --target=aarch64-linux-android -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_android_tree \
-// RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-ANDROID %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-ANDROID %s
// CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "{{.*}}ld{{(.exe)?}}"
-// CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "{{[^"]*}}libclang_rt.ubsan_standalone[[SUFFIX]].so"
+// CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "{{[^"]*}}libclang_rt.ubsan_standalone.so"
// CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "--export-dynamic-symbol=__cfi_check"
// RUN: %clangxx -fsanitize=address -### %s 2>&1 \
@@ -716,17 +707,16 @@
// CHECK-LSAN-DARWIN106-CXX: libclang_rt.lsan_osx_dynamic.dylib
// CHECK-LSAN-DARWIN106-CXX-NOT: -lc++abi
-// REDEFINE: %{arch} = x86_64
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=safe-stack \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-LINUX %s
//
// CHECK-SAFESTACK-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-SAFESTACK-LINUX-NOT: "-lc"
// CHECK-SAFESTACK-LINUX-NOT: whole-archive
-// CHECK-SAFESTACK-LINUX: libclang_rt.safestack[[SUFFIX]].a"
+// CHECK-SAFESTACK-LINUX: libclang_rt.safestack.a"
// CHECK-SAFESTACK-LINUX: "-u" "__safestack_init"
// CHECK-SAFESTACK-LINUX: "-lpthread"
// CHECK-SAFESTACK-LINUX: "-ldl"
@@ -786,11 +776,11 @@
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-LINUX %s
// CHECK-CFI-STATS-LINUX: "{{.*}}ld{{(.exe)?}}"
-// CHECK-CFI-STATS-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.stats_client[[SUFFIX]].a" "--no-whole-archive"
+// CHECK-CFI-STATS-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.stats_client.a" "--no-whole-archive"
// CHECK-CFI-STATS-LINUX-NOT: "--whole-archive"
-// CHECK-CFI-STATS-LINUX: "{{[^"]*}}libclang_rt.stats[[SUFFIX]].a"
+// CHECK-CFI-STATS-LINUX: "{{[^"]*}}libclang_rt.stats.a"
// RUN: not %clang -fsanitize=cfi -fsanitize-stats -### %s 2>&1 \
// RUN: --target=x86_64-apple-darwin -fuse-ld=ld \
@@ -920,14 +910,13 @@
// RUN: | FileCheck --check-prefix=CHECK-NOLIB-PS5 %s
// CHECK-NOLIB-PS5-NOT: SceAddressSanitizer_nosubmission_stub_weak
-// REDEFINE: %{arch} = i386
// RUN: %clang -fsanitize=scudo -### %s 2>&1 \
// RUN: --target=i386-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-SCUDO-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-SCUDO-LINUX %s
// CHECK-SCUDO-LINUX: "{{.*}}ld{{(.exe)?}}"
-// CHECK-SCUDO-LINUX: "--whole-archive" "{{.*}}libclang_rt.scudo_standalone[[SUFFIX]].a" "--no-whole-archive"
+// CHECK-SCUDO-LINUX: "--whole-archive" "{{.*}}libclang_rt.scudo_standalone.a" "--no-whole-archive"
// CHECK-SCUDO-LINUX-NOT: "-lstdc++"
// CHECK-SCUDO-LINUX: "-lpthread"
// CHECK-SCUDO-LINUX: "-ldl"
@@ -937,12 +926,12 @@
// RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=scudo -shared-libsan \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-SCUDO-SHARED-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-SCUDO-SHARED-LINUX %s
//
// CHECK-SCUDO-SHARED-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-SCUDO-SHARED-LINUX-NOT: "-lc"
-// CHECK-SCUDO-SHARED-LINUX-NOT: libclang_rt.scudo_standalone
-// CHECK-SCUDO-SHARED-LINUX: libclang_rt.scudo_standalone[[SUFFIX]].so"
+// CHECK-SCUDO-SHARED-LINUX-NOT: libclang_rt.scudo_standalone.a"
+// CHECK-SCUDO-SHARED-LINUX: libclang_rt.scudo_standalone.so"
// CHECK-SCUDO-SHARED-LINUX-NOT: "-lpthread"
// CHECK-SCUDO-SHARED-LINUX-NOT: "-lrt"
// CHECK-SCUDO-SHARED-LINUX-NOT: "-ldl"
@@ -950,18 +939,17 @@
// CHECK-SCUDO-SHARED-LINUX-NOT: "--export-dynamic"
// CHECK-SCUDO-SHARED-LINUX-NOT: "--dynamic-list"
-// REDEFINE: %{arch} = arm-android
// RUN: %clang -### %s 2>&1 \
// RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=scudo \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
-// RUN: | FileCheck --check-prefix=CHECK-SCUDO-ANDROID %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-SCUDO-ANDROID %s
//
// CHECK-SCUDO-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
// CHECK-SCUDO-ANDROID-NOT: "-lc"
// CHECK-SCUDO-ANDROID: "-pie"
// CHECK-SCUDO-ANDROID-NOT: "-lpthread"
// CHECK-SCUDO-ANDROID-NOT: "-lresolv"
-// CHECK-SCUDO-ANDROID: libclang_rt.scudo_standalone[[SUFFIX]].so"
+// CHECK-SCUDO-ANDROID: libclang_rt.scudo_standalone.so"
// CHECK-SCUDO-ANDROID-NOT: "-lpthread"
// CHECK-SCUDO-ANDROID-NOT: "-lresolv"
@@ -969,10 +957,10 @@
// RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=scudo \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -static-libsan \
-// RUN: | FileCheck --check-prefix=CHECK-SCUDO-ANDROID-STATIC %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-SCUDO-ANDROID-STATIC %s
// CHECK-SCUDO-ANDROID-STATIC: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
// CHECK-SCUDO-ANDROID-STATIC: "-pie"
-// CHECK-SCUDO-ANDROID-STATIC: "--whole-archive" "{{.*}}libclang_rt.scudo_standalone[[SUFFIX]].a" "--no-whole-archive"
+// CHECK-SCUDO-ANDROID-STATIC: "--whole-archive" "{{.*}}libclang_rt.scudo_standalone.a" "--no-whole-archive"
// CHECK-SCUDO-ANDROID-STATIC-NOT: "-lstdc++"
// CHECK-SCUDO-ANDROID-STATIC-NOT: "-lpthread"
// CHECK-SCUDO-ANDROID-STATIC-NOT: "-lrt"
@@ -995,16 +983,15 @@
// CHECK-HWASAN-X86-64-LINUX: "-ldl"
// CHECK-HWASAN-X86-64-LINUX: "-lresolv"
-// REDEFINE: %{arch} = x86_64
// RUN: %clang -### %s 2>&1 \
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
// RUN: -shared-libsan -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-SHARED-HWASAN-X86-64-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-SHARED-HWASAN-X86-64-LINUX %s
//
// CHECK-SHARED-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lc"
-// CHECK-SHARED-HWASAN-X86-64-LINUX: libclang_rt.hwasan[[SUFFIX]].so"
+// CHECK-SHARED-HWASAN-X86-64-LINUX: libclang_rt.hwasan.so"
// CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lpthread"
// CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lrt"
// CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-ldl"
@@ -1016,11 +1003,11 @@
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
// RUN: -shared-libsan -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-HWASAN-X86-64-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-HWASAN-X86-64-LINUX %s
//
// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lc"
-// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX: libclang_rt.hwasan[[SUFFIX]].so"
+// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX: libclang_rt.hwasan.so"
// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lpthread"
// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lrt"
// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-ldl"
@@ -1045,17 +1032,16 @@
// CHECK-HWASAN-AARCH64-LINUX: "-ldl"
// CHECK-HWASAN-AARCH64-LINUX: "-lresolv"
-// REDEFINE: %{arch} = aarch64
// RUN: %clang -### %s 2>&1 \
// RUN: --target=aarch64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
// RUN: -shared-libsan \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-SHARED-HWASAN-AARCH64-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-SHARED-HWASAN-AARCH64-LINUX %s
//
// CHECK-SHARED-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lc"
-// CHECK-SHARED-HWASAN-AARCH64-LINUX: libclang_rt.hwasan[[SUFFIX]].so"
+// CHECK-SHARED-HWASAN-AARCH64-LINUX: libclang_rt.hwasan.so"
// CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lpthread"
// CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lrt"
// CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-ldl"
@@ -1067,11 +1053,11 @@
// RUN: --target=aarch64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
// RUN: -shared-libsan -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
-// RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX %s %{suffix}
+// RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX %s
//
// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lc"
-// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX: libclang_rt.hwasan[[SUFFIX]].so"
+// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX: libclang_rt.hwasan.so"
// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lpthread"
// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lrt"
// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-ldl"
diff --git a/clang/test/Driver/wasm-toolchain.c b/clang/test/Driver/wasm-toolchain.c
index 4bf22baa2f2858..dabf0ac2433bbb 100644
--- a/clang/test/Driver/wasm-toolchain.c
+++ b/clang/test/Driver/wasm-toolchain.c
@@ -14,47 +14,45 @@
// A basic C link command-line with unknown OS.
-// DEFINE: %{arch} = wasm32
-// DEFINE: %{suffix} = -DSUFFIX=%if !per_target_runtime_dir %{-%{arch}%}
// RUN: %clang -### --target=wasm32-unknown-unknown --sysroot=/foo %s 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK %s %{suffix}
+// RUN: | FileCheck -check-prefix=LINK %s
// LINK: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
+// LINK: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
// A basic C link command-line with optimization with unknown OS.
// RUN: %clang -### -O2 --target=wasm32-unknown-unknown --sysroot=/foo %s 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_OPT %s %{suffix}
+// RUN: | FileCheck -check-prefix=LINK_OPT %s
// LINK_OPT: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_OPT: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
+// LINK_OPT: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
// A basic C link command-line with known OS.
// RUN: %clang -### --target=wasm32-wasi --sysroot=/foo %s 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_KNOWN %s %{suffix}
+// RUN: | FileCheck -check-prefix=LINK_KNOWN %s
// LINK_KNOWN: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
+// LINK_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
// -shared should be passed through to `wasm-ld` and include crt1-reactor.o with a known OS.
// RUN: %clang -### -shared -mexec-model=reactor --target=wasm32-wasi --sysroot=/foo %s 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_KNOWN_SHARED %s %{suffix}
+// RUN: | FileCheck -check-prefix=LINK_KNOWN_SHARED %s
// LINK_KNOWN_SHARED: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_KNOWN_SHARED: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1-reactor.o" "--entry" "_initialize" "-shared" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
+// LINK_KNOWN_SHARED: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1-reactor.o" "--entry" "_initialize" "-shared" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
// -shared should be passed through to `wasm-ld` and include crt1-reactor.o with an unknown OS.
// RUN: %clang -### -shared -mexec-model=reactor --target=wasm32-unknown-unknown --sysroot=/foo %s 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_UNKNOWN_SHARED %s %{suffix}
+// RUN: | FileCheck -check-prefix=LINK_UNKNOWN_SHARED %s
// LINK_UNKNOWN_SHARED: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_UNKNOWN_SHARED: wasm-ld{{.*}}" "crt1-reactor.o" "--entry" "_initialize" "-shared" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
+// LINK_UNKNOWN_SHARED: wasm-ld{{.*}}" "crt1-reactor.o" "--entry" "_initialize" "-shared" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
// A basic C link command-line with optimization with known OS.
// RUN: %clang -### -O2 --target=wasm32-wasi --sysroot=/foo %s 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_OPT_KNOWN %s %{suffix}
+// RUN: | FileCheck -check-prefix=LINK_OPT_KNOWN %s
// LINK_OPT_KNOWN: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_OPT_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
+// LINK_OPT_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
// A basic C compile command-line with known OS.
@@ -180,14 +178,14 @@
// Basic exec-model tests.
// RUN: %clang -### %s --target=wasm32-unknown-unknown --sysroot=%s/no-sysroot-there -mexec-model=command 2>&1 \
-// RUN: | FileCheck -check-prefix=CHECK-COMMAND %s %{suffix}
+// RUN: | FileCheck -check-prefix=CHECK-COMMAND %s
// CHECK-COMMAND: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// CHECK-COMMAND: wasm-ld{{.*}}" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
+// CHECK-COMMAND: wasm-ld{{.*}}" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
// RUN: %clang -### %s --target=wasm32-unknown-unknown --sysroot=%s/no-sysroot-there -mexec-model=reactor 2>&1 \
-// RUN: | FileCheck -check-prefix=CHECK-REACTOR %s %{suffix}
+// RUN: | FileCheck -check-prefix=CHECK-REACTOR %s
// CHECK-REACTOR: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// CHECK-REACTOR: wasm-ld{{.*}}" "crt1-reactor.o" "--entry" "_initialize" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
+// CHECK-REACTOR: wasm-ld{{.*}}" "crt1-reactor.o" "--entry" "_initialize" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
// -fPIC implies +mutable-globals
@@ -204,9 +202,9 @@
// instead of `wasm-ld`.
// RUN: %clang -### -O2 --target=wasm32-wasip2 %s --sysroot /foo 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_WASIP2 %s %{suffix}
+// RUN: | FileCheck -check-prefix=LINK_WASIP2 %s
// LINK_WASIP2: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_WASIP2: wasm-component-ld{{.*}}" "-L/foo/lib/wasm32-wasip2" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
+// LINK_WASIP2: wasm-component-ld{{.*}}" "-L/foo/lib/wasm32-wasip2" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
// Test that on `wasm32-wasip2` the `wasm-component-ld` programs is told where
// to find `wasm-ld` by default.
diff --git a/clang/test/Driver/wasm-toolchain.cpp b/clang/test/Driver/wasm-toolchain.cpp
index b888f4a6eeaea5..ba1c55b33edca4 100644
--- a/clang/test/Driver/wasm-toolchain.cpp
+++ b/clang/test/Driver/wasm-toolchain.cpp
@@ -14,53 +14,51 @@
// A basic C++ link command-line with unknown OS.
-// DEFINE: %{arch} = wasm32
-// DEFINE: %{suffix} = -DSUFFIX=%if !per_target_runtime_dir %{-%{arch}%}
// RUN: %clangxx -### --target=wasm32-unknown-unknown --sysroot=/foo --stdlib=libc++ %s 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK %s %{suffix}
+// RUN: | FileCheck -check-prefix=LINK %s
// LINK: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
+// LINK: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
// RUN: %clangxx -### --target=wasm32-unknown-unknown --sysroot=/foo --stdlib=libstdc++ %s 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_STDCXX %s %{suffix}
+// RUN: | FileCheck -check-prefix=LINK_STDCXX %s
// LINK_STDCXX: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_STDCXX: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lstdc++" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
+// LINK_STDCXX: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lstdc++" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
// A basic C++ link command-line with optimization with unknown OS.
// RUN: %clangxx -### -O2 --target=wasm32-unknown-unknown --sysroot=/foo %s --stdlib=libc++ 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_OPT %s %{suffix}
+// RUN: | FileCheck -check-prefix=LINK_OPT %s
// LINK_OPT: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_OPT: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
+// LINK_OPT: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
// RUN: %clangxx -### -O2 --target=wasm32-unknown-unknown --sysroot=/foo %s --stdlib=libstdc++ 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_OPT_STDCXX %s %{suffix}
+// RUN: | FileCheck -check-prefix=LINK_OPT_STDCXX %s
// LINK_OPT_STDCXX: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_OPT_STDCXX: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lstdc++" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
+// LINK_OPT_STDCXX: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lstdc++" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
// A basic C++ link command-line with known OS.
// RUN: %clangxx -### --target=wasm32-wasi --sysroot=/foo --stdlib=libc++ %s 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_KNOWN %s %{suffix}
+// RUN: | FileCheck -check-prefix=LINK_KNOWN %s
// LINK_KNOWN: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
+// LINK_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
// RUN: %clangxx -### --target=wasm32-wasi --sysroot=/foo --stdlib=libstdc++ %s 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_KNOWN_STDCXX %s %{suffix}
+// RUN: | FileCheck -check-prefix=LINK_KNOWN_STDCXX %s
// LINK_KNOWN_STDCXX: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_KNOWN_STDCXX: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lstdc++" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
+// LINK_KNOWN_STDCXX: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lstdc++" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
// A basic C++ link command-line with optimization with known OS.
// RUN: %clangxx -### -O2 --target=wasm32-wasi --sysroot=/foo %s --stdlib=libc++ 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_OPT_KNOWN %s %{suffix}
+// RUN: | FileCheck -check-prefix=LINK_OPT_KNOWN %s
// LINK_OPT_KNOWN: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_OPT_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
+// LINK_OPT_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
// RUN: %clangxx -### -O2 --target=wasm32-wasi --sysroot=/foo %s --stdlib=libstdc++ 2>&1 \
-// RUN: | FileCheck -check-prefix=LINK_OPT_KNOWN_STDCXX %s %{suffix}
+// RUN: | FileCheck -check-prefix=LINK_OPT_KNOWN_STDCXX %s
// LINK_OPT_KNOWN_STDCXX: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
-// LINK_OPT_KNOWN_STDCXX: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lstdc++" "-lc" "{{.*[/\\]}}libclang_rt.builtins[[SUFFIX]].a" "-o" "a.out"
+// LINK_OPT_KNOWN_STDCXX: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lstdc++" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out"
// A basic C++ compile command-line with known OS.
diff --git a/clang/test/Driver/windows-cross.c b/clang/test/Driver/windows-cross.c
index 15928f49e83240..f6e831f00e13a6 100644
--- a/clang/test/Driver/windows-cross.c
+++ b/clang/test/Driver/windows-cross.c
@@ -8,38 +8,35 @@
// CHECK-STATIC: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bstatic" "--entry" "mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" "{{[^"]*}}.o" "-lmsvcrt"
-// DEFINE: %{arch} = arm
-// DEFINE: %{suffix} = -DSUFFIX=%if !per_target_runtime_dir %{-%{arch}%}
-
// RUN: %clang -### -target armv7-windows-itanium --sysroot %s/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=ld -rtlib=compiler-rt -stdlib=libstdc++ -o /dev/null %s 2>&1 \
-// RUN: | FileCheck %s --check-prefix CHECK-RTLIB %{suffix}
+// RUN: | FileCheck %s --check-prefix CHECK-RTLIB
-// CHECK-RTLIB: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bdynamic" "--entry" "mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins[[SUFFIX]].lib"
+// CHECK-RTLIB: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bdynamic" "--entry" "mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins.lib"
// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=ld -rtlib=compiler-rt -stdlib=libc++ -o /dev/null %s 2>&1 \
-// RUN: | FileCheck %s --check-prefix CHECK-C-LIBCXX %{suffix}
+// RUN: | FileCheck %s --check-prefix CHECK-C-LIBCXX
-// CHECK-C-LIBCXX: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bdynamic" "--entry" "mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins[[SUFFIX]].lib"
+// CHECK-C-LIBCXX: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bdynamic" "--entry" "mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins.lib"
// RUN: %clangxx -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=ld -rtlib=compiler-rt -stdlib=libc++ -o /dev/null %s 2>&1 \
-// RUN: | FileCheck %s --check-prefix CHECK-LIBCXX %{suffix}
+// RUN: | FileCheck %s --check-prefix CHECK-LIBCXX
-// CHECK-LIBCXX: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bdynamic" "--entry" "mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" "{{.*}}.o" "-lc++" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins[[SUFFIX]].lib"
+// CHECK-LIBCXX: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bdynamic" "--entry" "mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" "{{.*}}.o" "-lc++" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins.lib"
// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=ld -shared -rtlib=compiler-rt -stdlib=libc++ -o shared.dll %s 2>&1 \
-// RUN: | FileCheck %s --check-prefix CHECK-SHARED %{suffix}
+// RUN: | FileCheck %s --check-prefix CHECK-SHARED
-// CHECK-SHARED: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-shared" "-Bdynamic" "--enable-auto-image-base" "--entry" "_DllMainCRTStartup" "--allow-multiple-definition" "-o" "shared.dll" "--out-implib" "shared.lib" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins[[SUFFIX]].lib"
+// CHECK-SHARED: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-shared" "-Bdynamic" "--enable-auto-image-base" "--entry" "_DllMainCRTStartup" "--allow-multiple-definition" "-o" "shared.dll" "--out-implib" "shared.lib" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins.lib"
// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=ld -shared -rtlib=compiler-rt -stdlib=libc++ -static -o shared.dll %s 2>&1 \
-// RUN: | FileCheck %s --check-prefix CHECK-SHARED-STATIC %{suffix}
+// RUN: | FileCheck %s --check-prefix CHECK-SHARED-STATIC
-// CHECK-SHARED-STATIC: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-shared" "-Bstatic" "--enable-auto-image-base" "--entry" "_DllMainCRTStartup" "--allow-multiple-definition" "-o" "shared.dll" "--out-implib" "shared.lib" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins[[SUFFIX]].lib"
+// CHECK-SHARED-STATIC: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-shared" "-Bstatic" "--enable-auto-image-base" "--entry" "_DllMainCRTStartup" "--allow-multiple-definition" "-o" "shared.dll" "--out-implib" "shared.lib" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins.lib"
// RUN: %clang -### -target armv7-windows-itanium --sysroot %s/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=ld -shared -rtlib=compiler-rt -stdlib=libc++ -nostartfiles -o shared.dll %s 2>&1 \
-// RUN: | FileCheck %s --check-prefix CHECK-NOSTARTFILES %{suffix}
+// RUN: | FileCheck %s --check-prefix CHECK-NOSTARTFILES
-// CHECK-NOSTARTFILES: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-shared" "-Bdynamic" "--enable-auto-image-base" "--entry" "_DllMainCRTStartup" "--allow-multiple-definition" "-o" "shared.dll" "--out-implib" "shared.lib" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins[[SUFFIX]].lib"
+// CHECK-NOSTARTFILES: {{[/\\]}}ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-shared" "-Bdynamic" "--enable-auto-image-base" "--entry" "_DllMainCRTStartup" "--allow-multiple-definition" "-o" "shared.dll" "--out-implib" "shared.lib" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins.lib"
// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=ld -shared -rtlib=compiler-rt -stdlib=libc++ -nostartfiles -nodefaultlibs -o shared.dll %s 2>&1 \
// RUN: | FileCheck %s --check-prefix CHECK-STANDALONE
@@ -52,23 +49,22 @@
// CHECK-FUSE-LD: "{{.*}}lld-link2"
// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=lld-link2 -shared -o shared.dll -fsanitize=address -x c++ %s 2>&1 \
-// RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-ADDRESS %{suffix}
+// RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-ADDRESS
// CHECK-SANITIZE-ADDRESS: "-fsanitize=address"
-// CHECK-SANITIZE-ADDRESS: "{{.*}}clang_rt.asan_dll_thunk[[SUFFIX]].lib"
+// CHECK-SANITIZE-ADDRESS: "{{.*}}clang_rt.asan_dll_thunk.lib"
// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=lld-link2 -o test.exe -fsanitize=address -x c++ %s 2>&1 \
-// RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-ADDRESS-EXE %{suffix}
+// RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-ADDRESS-EXE
// CHECK-SANITIZE-ADDRESS-EXE: "-fsanitize=address"
-// CHECK-SANITIZE-ADDRESS-EXE: "{{.*}}clang_rt.asan_dynamic[[SUFFIX]].lib" "{{.*}}clang_rt.asan_dynamic_runtime_thunk[[SUFFIX]].lib" "--undefined" "__asan_seh_interceptor"
+// CHECK-SANITIZE-ADDRESS-EXE: "{{.*}}clang_rt.asan_dynamic.lib" "{{.*}}clang_rt.asan_dynamic_runtime_thunk.lib" "--undefined" "__asan_seh_interceptor"
-// REDEFINE: %{arch} = i386
// RUN: %clang -### -target i686-windows-itanium -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=lld-link2 -o test.exe -fsanitize=address -x c++ %s 2>&1 \
-// RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-ADDRESS-EXE-X86 %{suffix}
+// RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-ADDRESS-EXE-X86
// CHECK-SANITIZE-ADDRESS-EXE-X86: "-fsanitize=address"
-// CHECK-SANITIZE-ADDRESS-EXE-X86: "{{.*}}clang_rt.asan_dynamic[[SUFFIX]].lib" "{{.*}}clang_rt.asan_dynamic_runtime_thunk[[SUFFIX]].lib" "--undefined" "___asan_seh_interceptor"
+// CHECK-SANITIZE-ADDRESS-EXE-X86: "{{.*}}clang_rt.asan_dynamic.lib" "{{.*}}clang_rt.asan_dynamic_runtime_thunk.lib" "--undefined" "___asan_seh_interceptor"
// RUN: not %clang -### --target=armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=lld-link2 -shared -o shared.dll -fsanitize=tsan -x c++ %s 2>&1 \
// RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-TSAN
diff --git a/clang/test/Driver/zos-ld.c b/clang/test/Driver/zos-ld.c
index 37dd9e541ba85a..87d169936e1295 100644
--- a/clang/test/Driver/zos-ld.c
+++ b/clang/test/Driver/zos-ld.c
@@ -1,5 +1,4 @@
// General tests that ld invocations for z/OS are valid.
-// REQUIRES: per_target_runtime_dir
// 1. General C link for executable
// RUN: %clang -### --target=s390x-ibm-zos %s 2>&1 \
diff --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index e6ae0c8572cfca..6641811c588395 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -42,7 +42,6 @@ config.llvm_external_lit = path(r"@LLVM_EXTERNAL_LIT@")
config.standalone_build = @CLANG_BUILT_STANDALONE@
config.ppc_linux_default_ieeelongdouble = @PPC_LINUX_DEFAULT_IEEELONGDOUBLE@
config.have_llvm_driver = @LLVM_TOOL_LLVM_DRIVER_BUILD@
-config.per_target_runtime_dir = @LLVM_ENABLE_PER_TARGET_RUNTIME_DIR@
import lit.llvm
lit.llvm.initialize(lit_config, config)
diff --git a/llvm/include/llvm/Config/llvm-config.h.cmake b/llvm/include/llvm/Config/llvm-config.h.cmake
index 4564d363b02845..6605ea60df99e1 100644
--- a/llvm/include/llvm/Config/llvm-config.h.cmake
+++ b/llvm/include/llvm/Config/llvm-config.h.cmake
@@ -198,7 +198,4 @@
/* Define if plugins enabled */
#cmakedefine LLVM_ENABLE_PLUGINS
-/* Are we using a per-target directory tree for compiler-rt? */
-#cmakedefine01 LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
-
#endif
>From 0f744f385e74cfb56867407e29c0bf229a41a92e Mon Sep 17 00:00:00 2001
From: Paul Robinson <paul.robinson at sony.com>
Date: Fri, 3 May 2024 07:34:14 -0700
Subject: [PATCH 4/4] Add an option to correct driver's fallback position
---
clang/include/clang/Driver/Options.td | 6 ++++++
clang/lib/Driver/ToolChain.cpp | 6 ++++--
clang/lib/Driver/ToolChains/Clang.cpp | 4 ++++
clang/test/Driver/sanitizer-ld.c | 15 +++++++++++++++
4 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 953f6fc649e621..6e8cde4802533b 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5541,6 +5541,12 @@ def fno_rtlib_defaultlib : Flag<["-"], "fno-rtlib-defaultlib">,
Visibility<[ClangOption, CLOption]>,
Group<f_Group>,
HelpText<"On Windows, do not emit /defaultlib: directives to link compiler-rt libraries">;
+def frtlib_per_target :
+ Flag<["-"], "frtlib-per-target">, Visibility<[ClangOption, CLOption]>, Group<f_Group>,
+ HelpText<"Compiler-rt libraries are in per-target directories">;
+def fno_rtlib_per_target :
+ Flag<["-"], "fno-rtlib-per-target">, Visibility<[ClangOption, CLOption]>, Group<f_Group>,
+ HelpText<"Compiler-rt libraries are in one directory and have target-specific names">;
def offload_add_rpath: Flag<["--"], "offload-add-rpath">,
Flags<[NoArgumentUnused]>,
Alias<frtlib_add_rpath>;
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 27405f0c94ba6e..798dd7dcc8b2ea 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -685,8 +685,10 @@ std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component,
Path = P;
}
// Some targets default to the old layout.
- if (getTriple().isOSAIX() || getTriple().isPS() ||
- getTriple().isWindowsMSVCEnvironment())
+ bool UseOldLayout =
+ getTriple().isOSAIX() || getTriple().isPS() || getTriple().isOSWindows();
+ if (!Args.hasFlag(options::OPT_frtlib_per_target,
+ options::OPT_fno_rtlib_per_target, !UseOldLayout))
Path.clear();
// Check the filename for the old layout if the new one does not exist.
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 2cb0c721354499..02664b76abde63 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6225,6 +6225,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
}
}
+ // Don't warn about compiler-rt layout options.
+ Args.ClaimAllArgs(options::OPT_frtlib_per_target);
+ Args.ClaimAllArgs(options::OPT_fno_rtlib_per_target);
+
// Warn about ignored options to clang.
for (const Arg *A :
Args.filtered(options::OPT_clang_ignored_gcc_optimization_f_Group)) {
diff --git a/clang/test/Driver/sanitizer-ld.c b/clang/test/Driver/sanitizer-ld.c
index 7289d09697b4d0..709990f2213d35 100644
--- a/clang/test/Driver/sanitizer-ld.c
+++ b/clang/test/Driver/sanitizer-ld.c
@@ -798,6 +798,21 @@
// CHECK-CFI-STATS-WIN64: "--dependent-lib=clang_rt.stats{{(-x86_64)?}}.lib"
// CHECK-CFI-STATS-WIN64: "--linker-option=/include:__sanitizer_stats_register"
+// RUN: not %clang -fsanitize=cfi -fsanitize-stats -### %s 2>&1 \
+// RUN: --target=x86_64-pc-windows \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: -frtlib-per-target \
+// RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-RTLIB %s -DSUFFIX=
+// RUN: not %clang -fsanitize=cfi -fsanitize-stats -### %s 2>&1 \
+// RUN: --target=x86_64-pc-windows \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: -fno-rtlib-per-target \
+// RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-RTLIB %s -DSUFFIX=-x86_64
+// CHECK-CFI-STATS-RTLIB: "--dependent-lib=clang_rt.stats_client[[SUFFIX]].lib"
+// CHECK-CFI-STATS-RTLIB: "--dependent-lib=clang_rt.stats[[SUFFIX]].lib"
+
// RUN: not %clang -fsanitize=cfi -fsanitize-stats -### %s 2>&1 \
// RUN: --target=i686-pc-windows \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
More information about the llvm-commits
mailing list