[compiler-rt] 05e3143 - Revert "[compiler-rt] Remove %T from shared object substitutions (#155302)"

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 8 01:00:28 PDT 2025


Author: Hans Wennborg
Date: 2025-09-08T10:00:13+02:00
New Revision: 05e31438ac9491cfc72c48664480796de874c860

URL: https://github.com/llvm/llvm-project/commit/05e31438ac9491cfc72c48664480796de874c860
DIFF: https://github.com/llvm/llvm-project/commit/05e31438ac9491cfc72c48664480796de874c860.diff

LOG: Revert "[compiler-rt] Remove %T from shared object substitutions (#155302)"

This broke a bunch of Mac lit tests, see comment on the PR.

This reverts commit bbd48fbb2fadebd8597e9cce6e318e9d07809783.

Added: 
    

Modified: 
    compiler-rt/test/asan/TestCases/Linux/coverage-missing.cpp
    compiler-rt/test/asan/TestCases/Linux/local_alias.cpp
    compiler-rt/test/asan/TestCases/Linux/odr-violation.cpp
    compiler-rt/test/asan/TestCases/Linux/odr-vtable.cpp
    compiler-rt/test/asan/TestCases/Linux/odr_c_test.c
    compiler-rt/test/asan/TestCases/Linux/preinit_test.cpp
    compiler-rt/test/asan/TestCases/Posix/coverage-module-unloaded.cpp
    compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp
    compiler-rt/test/asan/TestCases/Posix/coverage.cpp
    compiler-rt/test/asan/TestCases/Posix/interception-in-shared-lib-test.cpp
    compiler-rt/test/asan/TestCases/suppressions-library.cpp
    compiler-rt/test/cfi/cross-dso-diagnostic.cpp
    compiler-rt/test/cfi/cross-dso/icall/diag.cpp
    compiler-rt/test/cfi/cross-dso/icall/icall-from-dso.cpp
    compiler-rt/test/cfi/cross-dso/icall/icall.cpp
    compiler-rt/test/cfi/cross-dso/simple-fail.cpp
    compiler-rt/test/cfi/cross-dso/simple-pass.cpp
    compiler-rt/test/cfi/target_uninstrumented.cpp
    compiler-rt/test/fuzzer/coverage.test
    compiler-rt/test/fuzzer/dso.test
    compiler-rt/test/fuzzer/full-coverage.test
    compiler-rt/test/lit.common.cfg.py
    compiler-rt/test/tsan/on_initialize_finalize_hooks.cpp
    compiler-rt/test/ubsan/TestCases/Misc/no-interception.cpp
    compiler-rt/test/ubsan/TestCases/TypeCheck/Function/function.cpp
    compiler-rt/test/ubsan/TestCases/TypeCheck/vptr-non-unique-typeinfo.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/asan/TestCases/Linux/coverage-missing.cpp b/compiler-rt/test/asan/TestCases/Linux/coverage-missing.cpp
index b38333e7fa06e..10acef9af4b03 100644
--- a/compiler-rt/test/asan/TestCases/Linux/coverage-missing.cpp
+++ b/compiler-rt/test/asan/TestCases/Linux/coverage-missing.cpp
@@ -1,17 +1,19 @@
 // Test for "sancov.py missing ...".
 
 // First case: coverage from executable. main() is called on every code path.
-// RUN: rm -rf %t.dir && mkdir -p %t.dir && cd %t.dir
 // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s -o %t -DFOOBAR -DMAIN
-// RUN: %env_asan_opts=coverage=1:coverage_dir=%t.dir %run %t
+// RUN: rm -rf %t-dir
+// RUN: mkdir -p %t-dir
+// RUN: cd %t-dir
+// RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t
 // RUN: %sancov print *.sancov > main.txt
 // RUN: rm *.sancov
 // RUN: count 1 < main.txt
-// RUN: %env_asan_opts=coverage=1:coverage_dir=%t.dir %run %t x
+// RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t x
 // RUN: %sancov print *.sancov > foo.txt
 // RUN: rm *.sancov
 // RUN: count 3 < foo.txt
-// RUN: %env_asan_opts=coverage=1:coverage_dir=%t.dir %run %t x x
+// RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t x x
 // RUN: %sancov print *.sancov > bar.txt
 // RUN: rm *.sancov
 // RUN: count 4 < bar.txt
@@ -24,15 +26,18 @@
 // RUN: not grep "^<" %t.log
 
 // Second case: coverage from DSO.
-// RUN: cd ..
-// RUN: rm -rf %t.dir && mkdir -p %t.dir && cd %t.dir
+// cd %t-dir
 // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s -o %dynamiclib -DFOOBAR -shared -fPIC
 // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s %dynamiclib -o %t -DMAIN
-// RUN: %env_asan_opts=coverage=1:coverage_dir=%t.dir %run %t x
+// RUN: cd ..
+// RUN: rm -rf %t-dir
+// RUN: mkdir -p %t-dir
+// RUN: cd %t-dir
+// RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t x
 // RUN: %sancov print %xdynamiclib_filename.*.sancov > foo.txt
 // RUN: rm *.sancov
 // RUN: count 2 < foo.txt
-// RUN: %env_asan_opts=coverage=1:coverage_dir=%t.dir %run %t x x
+// RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t x x
 // RUN: %sancov print %xdynamiclib_filename.*.sancov > bar.txt
 // RUN: rm *.sancov
 // RUN: count 3 < bar.txt

diff  --git a/compiler-rt/test/asan/TestCases/Linux/local_alias.cpp b/compiler-rt/test/asan/TestCases/Linux/local_alias.cpp
index c0edde69c0b8b..a8b3d75e375bf 100644
--- a/compiler-rt/test/asan/TestCases/Linux/local_alias.cpp
+++ b/compiler-rt/test/asan/TestCases/Linux/local_alias.cpp
@@ -4,12 +4,11 @@
 // false positive global-buffer-overflow due to sanitized library poisons
 // globals from non-sanitized one.
 //
-// RUN: mkdir -p %t.dir && cd %t.dir
 // RUN: %clangxx_asan -DBUILD_INSTRUMENTED_DSO=1 -fPIC -shared -mllvm -asan-use-private-alias %s -o %dynamiclib1
 // RUN: %clangxx -DBUILD_UNINSTRUMENTED_DSO=1 -fPIC -shared %s -o %dynamiclib2
 // RUN: %clangxx %s -c -mllvm -asan-use-private-alias -o %t.o
-// RUN: %clangxx_asan %t.o %ld_flags_rpath_exe2 %ld_flags_rpath_exe1 -o %t.dir/EXE
-// RUN: %run %t.dir/EXE
+// RUN: %clangxx_asan %t.o %ld_flags_rpath_exe2 %ld_flags_rpath_exe1 -o %t-EXE
+// RUN: %run %t-EXE
 
 #if defined (BUILD_INSTRUMENTED_DSO)
 long h = 15;

diff  --git a/compiler-rt/test/asan/TestCases/Linux/odr-violation.cpp b/compiler-rt/test/asan/TestCases/Linux/odr-violation.cpp
index 007308438ec93..b16f42cfa125d 100644
--- a/compiler-rt/test/asan/TestCases/Linux/odr-violation.cpp
+++ b/compiler-rt/test/asan/TestCases/Linux/odr-violation.cpp
@@ -10,39 +10,38 @@
 // -fno-sanitize-address-use-odr-indicator turns off both.
 //
 // Different size: detect a bug if detect_odr_violation>=1
-// RUN: mkdir -p %t.dir && cd %t.dir
 // RUN: %clangxx_asan -g -DBUILD_SO=1 -fPIC -shared -fno-sanitize-address-use-odr-indicator %s -o %dynamiclib
-// RUN: %clangxx_asan -g -fno-sanitize-address-use-odr-indicator %s %ld_flags_rpath_exe -o %t.dir/ODR-EXE
-// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=1 not %run %t.dir/ODR-EXE 2>&1 | FileCheck %s
-// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t.dir/ODR-EXE 2>&1 | FileCheck %s
-// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=0     %run %t.dir/ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED
-// RUN: %env_asan_opts=fast_unwind_on_malloc=0                        not %run %t.dir/ODR-EXE 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -g -fno-sanitize-address-use-odr-indicator %s %ld_flags_rpath_exe -o %t-ODR-EXE
+// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=1 not %run %t-ODR-EXE 2>&1 | FileCheck %s
+// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t-ODR-EXE 2>&1 | FileCheck %s
+// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=0     %run %t-ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED
+// RUN: %env_asan_opts=fast_unwind_on_malloc=0                        not %run %t-ODR-EXE 2>&1 | FileCheck %s
 //
 // Same size: report a bug only if detect_odr_violation>=2.
 // RUN: %clangxx_asan -g -DBUILD_SO=1 -fPIC -shared -fno-sanitize-address-use-odr-indicator %s -o %dynamiclib -DSZ=100
-// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=1     %run %t.dir/ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED
-// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t.dir/ODR-EXE 2>&1 | FileCheck %s
-// RUN: %env_asan_opts=fast_unwind_on_malloc=0                        not %run %t.dir/ODR-EXE 2>&1 | FileCheck %s
-// RUN: echo "odr_violation:foo::ZZZ" > %t.dir/supp
-// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2:suppressions=%t.dir/supp  not %run %t.dir/ODR-EXE 2>&1 | FileCheck %s
-// RUN: echo "odr_violation:foo::G" > %t.dir/supp
-// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2:suppressions=%t.dir/supp      %run %t.dir/ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED
-// RUN: rm -f %t.dir/supp
+// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=1     %run %t-ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED
+// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t-ODR-EXE 2>&1 | FileCheck %s
+// RUN: %env_asan_opts=fast_unwind_on_malloc=0                        not %run %t-ODR-EXE 2>&1 | FileCheck %s
+// RUN: echo "odr_violation:foo::ZZZ" > %t.supp
+// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2:suppressions=%t.supp  not %run %t-ODR-EXE 2>&1 | FileCheck %s
+// RUN: echo "odr_violation:foo::G" > %t.supp
+// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2:suppressions=%t.supp      %run %t-ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED
+// RUN: rm -f %t.supp
 //
 // Use private aliases for global variables without indicator symbol.
 // RUN: %clangxx_asan -g -DBUILD_SO=1 -fPIC -shared -mllvm -asan-use-odr-indicator=0 %s -o %dynamiclib -DSZ=100
-// RUN: %clangxx_asan -g -mllvm -asan-use-odr-indicator=0 %s %ld_flags_rpath_exe -o %t.dir/ODR-EXE
-// RUN: %env_asan_opts=fast_unwind_on_malloc=0 %run %t.dir/ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED
+// RUN: %clangxx_asan -g -mllvm -asan-use-odr-indicator=0 %s %ld_flags_rpath_exe -o %t-ODR-EXE
+// RUN: %env_asan_opts=fast_unwind_on_malloc=0 %run %t-ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED
 
 // Use private aliases for global variables: use indicator symbol to detect ODR violation.
 // RUN: %clangxx_asan -g -DBUILD_SO=1 -fPIC -shared %s -o %dynamiclib -DSZ=100
-// RUN: %clangxx_asan -g %s %ld_flags_rpath_exe -o %t.dir/ODR-EXE
-// RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t.dir/ODR-EXE 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -g %s %ld_flags_rpath_exe -o %t-ODR-EXE
+// RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t-ODR-EXE 2>&1 | FileCheck %s
 
 // Same as above but with clang switches.
 // RUN: %clangxx_asan -g -DBUILD_SO=1 -fPIC -shared -fsanitize-address-use-odr-indicator %s -o %dynamiclib -DSZ=100
-// RUN: %clangxx_asan -g -fsanitize-address-use-odr-indicator %s %ld_flags_rpath_exe -o %t.dir/ODR-EXE
-// RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t.dir/ODR-EXE 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -g -fsanitize-address-use-odr-indicator %s %ld_flags_rpath_exe -o %t-ODR-EXE
+// RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t-ODR-EXE 2>&1 | FileCheck %s
 
 // GNU driver doesn't handle .so files properly.
 // REQUIRES: Clang
@@ -59,7 +58,7 @@ namespace foo { char G[SZ]; }
 #include <stdio.h>
 namespace foo { char G[100]; }
 // CHECK: ERROR: AddressSanitizer: odr-violation
-// CHECK: size=100 'foo::G' {{.*}}odr-violation.cpp:[[@LINE-2]] in {{.*}}/ODR-EXE
+// CHECK: size=100 'foo::G' {{.*}}odr-violation.cpp:[[@LINE-2]] in {{.*}}.tmp-ODR-EXE
 // CHECK: size={{4|100}} 'foo::G'
 int main(int argc, char **argv) {
   printf("PASS: %p\n", &foo::G);

diff  --git a/compiler-rt/test/asan/TestCases/Linux/odr-vtable.cpp b/compiler-rt/test/asan/TestCases/Linux/odr-vtable.cpp
index 9e6b7ff6e00c5..aee5d2aacfc58 100644
--- a/compiler-rt/test/asan/TestCases/Linux/odr-vtable.cpp
+++ b/compiler-rt/test/asan/TestCases/Linux/odr-vtable.cpp
@@ -4,20 +4,19 @@
 // REQUIRES: shared_cxxabi
 
 /// Not using private alias or enabling ODR indicator can detect ODR issues.
-// RUN: mkdir -p %t.dir && cd %t.dir
 // RUN: %clangxx_asan -fno-rtti -DBUILD_SO1 -fPIC -shared -mllvm -asan-use-private-alias=0 %s -o %dynamiclib1
 // RUN: %clangxx_asan -fno-rtti -DBUILD_SO2 -fPIC -shared -mllvm -asan-use-private-alias=0 %s -o %dynamiclib2
-// RUN: %clangxx_asan -fno-rtti %s %ld_flags_rpath_exe1 %ld_flags_rpath_exe2 -o %t.dir/EXE
-// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t.dir/EXE 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -fno-rtti %s %ld_flags_rpath_exe1 %ld_flags_rpath_exe2 -o %t
+// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t 2>&1 | FileCheck %s
 
 // RUN: %clangxx_asan -fno-rtti -DBUILD_SO1 -fPIC -shared -mllvm -asan-use-odr-indicator=1 %s -o %dynamiclib1
 // RUN: %clangxx_asan -fno-rtti -DBUILD_SO2 -fPIC -shared -mllvm -asan-use-odr-indicator=1 %s -o %dynamiclib2
-// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t.dir/EXE 2>&1 | FileCheck %s
+// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t 2>&1 | FileCheck %s
 
 /// By default we can detect ODR issues in vtables.
 // RUN: %clangxx_asan -fno-rtti -DBUILD_SO1 -fPIC -shared %s -o %dynamiclib1
 // RUN: %clangxx_asan -fno-rtti -DBUILD_SO2 -fPIC -shared %s -o %dynamiclib2
-// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t.dir/EXE 2>&1 | FileCheck %s
+// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t 2>&1 | FileCheck %s
 
 struct XYZ {
   virtual void foo();

diff  --git a/compiler-rt/test/asan/TestCases/Linux/odr_c_test.c b/compiler-rt/test/asan/TestCases/Linux/odr_c_test.c
index f8a3eae7e7f35..4aafe6888c684 100644
--- a/compiler-rt/test/asan/TestCases/Linux/odr_c_test.c
+++ b/compiler-rt/test/asan/TestCases/Linux/odr_c_test.c
@@ -1,15 +1,14 @@
 // Test that we can properly report an ODR violation between an instrumented
 // global and a non-instrumented global if not using private aliases.
 
-// RUN: mkdir -p %t.dir && cd %t.dir
 // RUN: %clang_asan -fcommon %s -fPIC -shared -mllvm -asan-use-private-alias=0 -o %dynamiclib1  -DFILE1
 // RUN: %clang_asan -fcommon %s -fPIC -shared -mllvm -asan-use-private-alias=0 -o %dynamiclib2  -DFILE2
-// RUN: %clang_asan -fcommon %s -fPIE %ld_flags_rpath_exe1 %ld_flags_rpath_exe2 -o %t.dir/exe
-// RUN: not %run %t.dir/exe 2>&1 | FileCheck %s
+// RUN: %clang_asan -fcommon %s -fPIE %ld_flags_rpath_exe1 %ld_flags_rpath_exe2 -o %t
+// RUN: not %run %t 2>&1 | FileCheck %s
 
 // RUN: %clang_asan -fcommon %s -fPIC -shared -mllvm -asan-use-private-alias=1 -o %dynamiclib1  -DFILE1
 // RUN: %clang_asan -fcommon %s -fPIC -shared -mllvm -asan-use-private-alias=1 -o %dynamiclib2  -DFILE2
-// RUN: %run %t.dir/exe 2>&1 | count 0
+// RUN: %run %t 2>&1 | count 0
 
 // Unaligned accesses don't work on strict-alignment targets like SPARC.
 // UNSUPPORTED: sparc-target-arch

diff  --git a/compiler-rt/test/asan/TestCases/Linux/preinit_test.cpp b/compiler-rt/test/asan/TestCases/Linux/preinit_test.cpp
index ca20a8905b122..f8c2b6bf52f1d 100644
--- a/compiler-rt/test/asan/TestCases/Linux/preinit_test.cpp
+++ b/compiler-rt/test/asan/TestCases/Linux/preinit_test.cpp
@@ -1,7 +1,6 @@
-// RUN: mkdir -p %t.dir && cd %t.dir
 // RUN: %clangxx -DFUNC=zzzz %s -shared -o %dynamiclib -fPIC
-// RUN: %clangxx_asan -DFUNC=main %s -o %t.dir/EXE %ld_flags_rpath_exe
-// RUN: %run %t.dir/EXE
+// RUN: %clangxx_asan -DFUNC=main %s -o %t %ld_flags_rpath_exe
+// RUN: %run %t
 
 // GNU driver doesn't handle .so files properly.
 // REQUIRES: Clang

diff  --git a/compiler-rt/test/asan/TestCases/Posix/coverage-module-unloaded.cpp b/compiler-rt/test/asan/TestCases/Posix/coverage-module-unloaded.cpp
index 3681346f5fe32..d301bb5c7838d 100644
--- a/compiler-rt/test/asan/TestCases/Posix/coverage-module-unloaded.cpp
+++ b/compiler-rt/test/asan/TestCases/Posix/coverage-module-unloaded.cpp
@@ -1,6 +1,5 @@
 // Check that unloading a module doesn't break coverage dumping for remaining
 // modules.
-// RUN: mkdir -p %t.dir && cd %t.dir
 // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard -DSHARED %s -shared -o %dynamiclib1 -fPIC
 // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard -DSHARED %s -shared -o %dynamiclib2 -fPIC
 // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s %libdl -o %t.exe

diff  --git a/compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp b/compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp
index e3524fced6b4e..e89181cc6c376 100644
--- a/compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp
+++ b/compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp
@@ -1,7 +1,7 @@
-// RUN: rm -rf %t.dir && mkdir -p %t.dir && cd %t.dir
 // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard -DSHARED %s -shared -o %dynamiclib -fPIC %ld_flags_rpath_so
-// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s %ld_flags_rpath_exe -o %t.dir/EXE
-// RUN: %env_asan_opts=coverage=1:verbosity=1 %run %t.dir/EXE 2>&1 | tee /tmp/test
+// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s %ld_flags_rpath_exe -o %t
+// RUN: rm -rf %t-dir && mkdir -p %t-dir && cd %t-dir
+// RUN: %env_asan_opts=coverage=1:verbosity=1 %run %t 2>&1 | FileCheck %s
 //
 // UNSUPPORTED: ios
 

diff  --git a/compiler-rt/test/asan/TestCases/Posix/coverage.cpp b/compiler-rt/test/asan/TestCases/Posix/coverage.cpp
index 8e3952b31bcb7..12a88402eb5aa 100644
--- a/compiler-rt/test/asan/TestCases/Posix/coverage.cpp
+++ b/compiler-rt/test/asan/TestCases/Posix/coverage.cpp
@@ -1,6 +1,6 @@
-// RUN:rm -rf %t.dir && mkdir -p %t.dir && cd %t.dir
 // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard -DSHARED %s -shared -o %dynamiclib -fPIC %ld_flags_rpath_so
 // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s %ld_flags_rpath_exe -o %t
+// RUN: rm -rf %t-dir && mkdir -p %t-dir && cd %t-dir
 // RUN: %env_asan_opts=coverage=1:verbosity=1 %run %t 2>&1         | FileCheck %s --check-prefix=CHECK-main
 // RUN: %sancov print coverage.*sancov 2>&1 | FileCheck %s --check-prefix=CHECK-SANCOV1
 // RUN: %env_asan_opts=coverage=1:verbosity=1 %run %t foo 2>&1     | FileCheck %s --check-prefix=CHECK-foo
@@ -14,6 +14,7 @@
 // RUN: %sancov print merged-cov 2>&1 | FileCheck %s --check-prefix=CHECK-SANCOV2
 // RUN: %env_asan_opts=coverage=1:verbosity=1 not %run %t foo bar 4    2>&1 | FileCheck %s --check-prefix=CHECK-report
 // RUN: %env_asan_opts=coverage=1:verbosity=1 not %run %t foo bar 4 5  2>&1 | FileCheck %s --check-prefix=CHECK-segv
+// RUN: cd .. && rm -rf %t-dir
 //
 // https://code.google.com/p/address-sanitizer/issues/detail?id=263
 // XFAIL: android

diff  --git a/compiler-rt/test/asan/TestCases/Posix/interception-in-shared-lib-test.cpp b/compiler-rt/test/asan/TestCases/Posix/interception-in-shared-lib-test.cpp
index cfdc47c13e208..b592edb9f3df0 100644
--- a/compiler-rt/test/asan/TestCases/Posix/interception-in-shared-lib-test.cpp
+++ b/compiler-rt/test/asan/TestCases/Posix/interception-in-shared-lib-test.cpp
@@ -1,9 +1,9 @@
 // Check that memset() call from a shared library gets intercepted.
-// RUN: mkdir -p %t.dir && cd %t.dir
+
 // RUN: %clangxx_asan -O0 %s -DSHARED_LIB \
 // RUN:     -shared -o %dynamiclib -fPIC %ld_flags_rpath_so
-// RUN: %clangxx_asan -O0 %s -o %t.dir/EXE %ld_flags_rpath_exe && \
-// RUN:     not %run %t.dir/EXE 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O0 %s -o %t %ld_flags_rpath_exe && \
+// RUN:     not %run %t 2>&1 | FileCheck %s
 
 #include <stdio.h>
 #include <string.h>

diff  --git a/compiler-rt/test/asan/TestCases/suppressions-library.cpp b/compiler-rt/test/asan/TestCases/suppressions-library.cpp
index 604faf15c155f..5427122eaa92f 100644
--- a/compiler-rt/test/asan/TestCases/suppressions-library.cpp
+++ b/compiler-rt/test/asan/TestCases/suppressions-library.cpp
@@ -1,4 +1,3 @@
-// RUN: mkdir -p %t.dir && cd %t.dir
 // RUN: %clangxx_asan -O0 -DSHARED_LIB %s %fPIC -shared -o %dynamiclib %ld_flags_rpath_so
 // RUN: %clangxx_asan -O0 %s -o %t %ld_flags_rpath_exe
 

diff  --git a/compiler-rt/test/cfi/cross-dso-diagnostic.cpp b/compiler-rt/test/cfi/cross-dso-diagnostic.cpp
index ed2cab04c9180..f0a2ab4459c5f 100644
--- a/compiler-rt/test/cfi/cross-dso-diagnostic.cpp
+++ b/compiler-rt/test/cfi/cross-dso-diagnostic.cpp
@@ -1,9 +1,8 @@
 // Check that cross-DSO diagnostics print the names of both modules
 
-// RUN: mkdir -p %t.dir && cd %t.dir
 // RUN: %clangxx_cfi_diag -g -DSHARED_LIB -fPIC -shared -o %dynamiclib %s %ld_flags_rpath_so
-// RUN: %clangxx_cfi_diag -g -o %t.dir/file_exe_suffix %s %ld_flags_rpath_exe
-// RUN: %t.dir/file_exe_suffix 2>&1 | FileCheck -DDSONAME=%xdynamiclib_namespec %s
+// RUN: %clangxx_cfi_diag -g -o %t_exe_suffix %s %ld_flags_rpath_exe
+// RUN: %t_exe_suffix 2>&1 | FileCheck -DDSONAME=%xdynamiclib_namespec %s
 
 // UNSUPPORTED: target={{.*windows-msvc.*}}
 // REQUIRES: cxxabi

diff  --git a/compiler-rt/test/cfi/cross-dso/icall/diag.cpp b/compiler-rt/test/cfi/cross-dso/icall/diag.cpp
index 2921b69b23669..579ee835604a8 100644
--- a/compiler-rt/test/cfi/cross-dso/icall/diag.cpp
+++ b/compiler-rt/test/cfi/cross-dso/icall/diag.cpp
@@ -6,7 +6,6 @@
 // * otherwise, the callee decides between trap/recover/norecover.
 
 // Full-recover.
-// RUN: mkdir -p %t.dir && cd %t.dir
 // RUN: %clangxx_cfi_dso_diag -g -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
 // RUN: %clangxx_cfi_dso_diag -g %s -o %t %ld_flags_rpath_exe
 

diff  --git a/compiler-rt/test/cfi/cross-dso/icall/icall-from-dso.cpp b/compiler-rt/test/cfi/cross-dso/icall/icall-from-dso.cpp
index 53dcc56b7fbc0..125e030b5063c 100644
--- a/compiler-rt/test/cfi/cross-dso/icall/icall-from-dso.cpp
+++ b/compiler-rt/test/cfi/cross-dso/icall/icall-from-dso.cpp
@@ -1,4 +1,3 @@
-// RUN: mkdir -p %t.dir && cd %t.dir
 // RUN: %clangxx_cfi_dso -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
 // RUN: %clangxx_cfi_dso %s -o %t %ld_flags_rpath_exe && %expect_crash %t 2>&1 | FileCheck %s
 

diff  --git a/compiler-rt/test/cfi/cross-dso/icall/icall.cpp b/compiler-rt/test/cfi/cross-dso/icall/icall.cpp
index 8666047331bd6..9e9bfd07ed59f 100644
--- a/compiler-rt/test/cfi/cross-dso/icall/icall.cpp
+++ b/compiler-rt/test/cfi/cross-dso/icall/icall.cpp
@@ -1,4 +1,3 @@
-// RUN: mkdir -p %t.dir && cd %t.dir
 // RUN: %clangxx_cfi_dso -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
 // RUN: %clangxx_cfi_dso %s -o %t %ld_flags_rpath_exe && %expect_crash %t 2>&1 | FileCheck %s
 

diff  --git a/compiler-rt/test/cfi/cross-dso/simple-fail.cpp b/compiler-rt/test/cfi/cross-dso/simple-fail.cpp
index dfe262847859e..93503ebe5b363 100644
--- a/compiler-rt/test/cfi/cross-dso/simple-fail.cpp
+++ b/compiler-rt/test/cfi/cross-dso/simple-fail.cpp
@@ -1,4 +1,3 @@
-// RUN: mkdir -p %t.dir && cd %t.dir
 // RUN: %clangxx_cfi_dso -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
 // RUN: %clangxx_cfi_dso %s -o %t %ld_flags_rpath_exe
 // RUN: %expect_crash %t 2>&1 | FileCheck --check-prefix=CFI %s

diff  --git a/compiler-rt/test/cfi/cross-dso/simple-pass.cpp b/compiler-rt/test/cfi/cross-dso/simple-pass.cpp
index 21762632a560e..6ce64713a6e2c 100644
--- a/compiler-rt/test/cfi/cross-dso/simple-pass.cpp
+++ b/compiler-rt/test/cfi/cross-dso/simple-pass.cpp
@@ -1,4 +1,3 @@
-// RUN: mkdir -p %t.dir && cd %t.dir
 // RUN: %clangxx_cfi_dso -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
 // RUN: %clangxx_cfi_dso -g %s -o %t %ld_flags_rpath_exe
 // RUN: %t 2>&1 | FileCheck --check-prefix=CFI %s

diff  --git a/compiler-rt/test/cfi/target_uninstrumented.cpp b/compiler-rt/test/cfi/target_uninstrumented.cpp
index d92cb4cf61ff0..8543fdae1446c 100644
--- a/compiler-rt/test/cfi/target_uninstrumented.cpp
+++ b/compiler-rt/test/cfi/target_uninstrumented.cpp
@@ -1,7 +1,6 @@
-// RUN: mkdir -p %t.dir && cd %t.dir
 // RUN: %clangxx -g -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
-// RUN: %clangxx_cfi_diag -g %s -o %t.dir/EXE %ld_flags_rpath_exe
-// RUN: %run %t.dir/EXE 2>&1 | FileCheck %s
+// RUN: %clangxx_cfi_diag -g %s -o %t %ld_flags_rpath_exe
+// RUN: %run %t 2>&1 | FileCheck %s
 
 // REQUIRES: cxxabi
 // UNSUPPORTED: target={{.*windows-msvc.*}}

diff  --git a/compiler-rt/test/fuzzer/coverage.test b/compiler-rt/test/fuzzer/coverage.test
index 9c5d5254ffd79..ccbc3dc7cc2bf 100644
--- a/compiler-rt/test/fuzzer/coverage.test
+++ b/compiler-rt/test/fuzzer/coverage.test
@@ -2,7 +2,6 @@
 UNSUPPORTED: target={{.*windows.*}}
 # FIXME: CreatePCArray() emits PLT stub addresses for entry blocks, which are ignored by TracePC::PrintCoverage().
 UNSUPPORTED: target=s390x{{.*}}
-RUN: mkdir -p %t.dir && cd %t.dir
 RUN: %cpp_compiler -mllvm -use-unknown-locations=Disable  %S/NullDerefTest.cpp -o %t-NullDerefTest
 RUN: %cpp_compiler -mllvm -use-unknown-locations=Disable %S/DSO1.cpp -fPIC %ld_flags_rpath_so1 -O0 -shared -o %dynamiclib1
 RUN: %cpp_compiler -mllvm -use-unknown-locations=Disable %S/DSO2.cpp -fPIC %ld_flags_rpath_so2 -O0 -shared -o %dynamiclib2

diff  --git a/compiler-rt/test/fuzzer/dso.test b/compiler-rt/test/fuzzer/dso.test
index 836f13f37dcc4..b3027205cd1c7 100644
--- a/compiler-rt/test/fuzzer/dso.test
+++ b/compiler-rt/test/fuzzer/dso.test
@@ -1,6 +1,5 @@
 # FIXME: Disabled on Windows because -fPIC cannot be used to compile for Windows.
 UNSUPPORTED: target={{.*windows.*}}
-RUN: mkdir -p %t.dir && cd %t.dir
 RUN: %cpp_compiler %S/DSO1.cpp -fPIC %ld_flags_rpath_so1 -shared -o %dynamiclib1
 RUN: %cpp_compiler %S/DSO2.cpp -fPIC %ld_flags_rpath_so2 -shared -o %dynamiclib2
 RUN: %cpp_compiler %S/DSOTestMain.cpp %S/DSOTestExtra.cpp %ld_flags_rpath_exe1 %ld_flags_rpath_exe2 -o %t-DSOTest

diff  --git a/compiler-rt/test/fuzzer/full-coverage.test b/compiler-rt/test/fuzzer/full-coverage.test
index 2ba6742642c25..f189962399b0f 100644
--- a/compiler-rt/test/fuzzer/full-coverage.test
+++ b/compiler-rt/test/fuzzer/full-coverage.test
@@ -2,7 +2,6 @@
 UNSUPPORTED: target={{.*windows.*}}
 # FIXME: See coverage.test.  Using UNSUPPORTED here due to random failures.
 UNSUPPORTED: target=s390x{{.*}}
-RUN: mkdir -p %t.dir && cd %t.dir
 RUN: %cpp_compiler %S/DSO1.cpp -fPIC %ld_flags_rpath_so1 -O0 -shared -o %dynamiclib1
 RUN: %cpp_compiler %S/DSO2.cpp -fPIC %ld_flags_rpath_so2 -O0 -shared -o %dynamiclib2
 RUN: %cpp_compiler %S/DSOTestMain.cpp %S/DSOTestExtra.cpp %ld_flags_rpath_exe1 %ld_flags_rpath_exe2 -o %t-DSOTest

diff  --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py
index 02959a478d084..e2e815444dcf9 100644
--- a/compiler-rt/test/lit.common.cfg.py
+++ b/compiler-rt/test/lit.common.cfg.py
@@ -888,7 +888,7 @@ def is_windows_lto_supported():
         config.substitutions.append(
             (
                 "%ld_flags_rpath_exe" + postfix,
-                r"-Wl,-z,origin -Wl,-rpath,\$ORIGIN -L%t.dir -l%xdynamiclib_namespec"
+                r"-Wl,-z,origin -Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec"
                 + postfix,
             )
         )
@@ -897,7 +897,7 @@ def is_windows_lto_supported():
         config.substitutions.append(
             (
                 "%ld_flags_rpath_exe" + postfix,
-                r"-Wl,-rpath,\$ORIGIN -L%t.dir -l%xdynamiclib_namespec" + postfix,
+                r"-Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix,
             )
         )
         config.substitutions.append(("%ld_flags_rpath_so" + postfix, ""))
@@ -905,14 +905,14 @@ def is_windows_lto_supported():
         config.substitutions.append(
             (
                 "%ld_flags_rpath_exe" + postfix,
-                r"-Wl,-R\$ORIGIN -L%t.dir -l%xdynamiclib_namespec" + postfix,
+                r"-Wl,-R\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix,
             )
         )
         config.substitutions.append(("%ld_flags_rpath_so" + postfix, ""))
 
     # Must be defined after the substitutions that use %dynamiclib.
     config.substitutions.append(
-        ("%dynamiclib" + postfix, "%t.dir/%xdynamiclib_filename" + postfix)
+        ("%dynamiclib" + postfix, "%T/%xdynamiclib_filename" + postfix)
     )
     config.substitutions.append(
         (

diff  --git a/compiler-rt/test/tsan/on_initialize_finalize_hooks.cpp b/compiler-rt/test/tsan/on_initialize_finalize_hooks.cpp
index ef746dd7cea55..3f7b56bd636e7 100644
--- a/compiler-rt/test/tsan/on_initialize_finalize_hooks.cpp
+++ b/compiler-rt/test/tsan/on_initialize_finalize_hooks.cpp
@@ -1,4 +1,3 @@
-// RUN: mkdir -p %t.dir && cd %t.dir
 // RUN: %clang_tsan -O1 %s -DBUILD_LIB=1 -fno-sanitize=thread -shared -fPIC -o %dynamiclib %ld_flags_rpath_so
 // RUN: %clang_tsan -O1 %s -o %t %ld_flags_rpath_exe
 // RUN: %run %t | FileCheck %s

diff  --git a/compiler-rt/test/ubsan/TestCases/Misc/no-interception.cpp b/compiler-rt/test/ubsan/TestCases/Misc/no-interception.cpp
index 72066861fce0a..c82fed3bf3f69 100644
--- a/compiler-rt/test/ubsan/TestCases/Misc/no-interception.cpp
+++ b/compiler-rt/test/ubsan/TestCases/Misc/no-interception.cpp
@@ -4,12 +4,11 @@
 // runtime in the library search order, which means that we cannot intercept
 // symbols.
 
-// RUN: rm -rf %t.dir && mkdir -p %t.dir && cd %t.dir
 // RUN: %clangxx %p/Inputs/no-interception-dso.c -fsanitize=undefined -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
 
 // Make sure that libc is first in DT_NEEDED.
-// RUN: %clangxx %s -lc -o %t.dir/EXE %ld_flags_rpath_exe
-// RUN: %run %t.dir/EXE 2>&1 | FileCheck %s
+// RUN: %clangxx %s -lc -o %t %ld_flags_rpath_exe
+// RUN: %run %t 2>&1 | FileCheck %s
 
 #include <limits.h>
 

diff  --git a/compiler-rt/test/ubsan/TestCases/TypeCheck/Function/function.cpp b/compiler-rt/test/ubsan/TestCases/TypeCheck/Function/function.cpp
index 5b74d4171d688..ddd6933404c5e 100644
--- a/compiler-rt/test/ubsan/TestCases/TypeCheck/Function/function.cpp
+++ b/compiler-rt/test/ubsan/TestCases/TypeCheck/Function/function.cpp
@@ -1,4 +1,3 @@
-// RUN: mkdir -p %t.dir && cd %t.dir
 // RUN: %clangxx -std=c++17 -fsanitize=function %s -O3 -g -DSHARED_LIB -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
 // RUN: %clangxx -std=c++17 -fsanitize=function %s -O3 -g -o %t %ld_flags_rpath_exe
 // RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK

diff  --git a/compiler-rt/test/ubsan/TestCases/TypeCheck/vptr-non-unique-typeinfo.cpp b/compiler-rt/test/ubsan/TestCases/TypeCheck/vptr-non-unique-typeinfo.cpp
index 5a9d4fd3569f6..76be179fc4a17 100644
--- a/compiler-rt/test/ubsan/TestCases/TypeCheck/vptr-non-unique-typeinfo.cpp
+++ b/compiler-rt/test/ubsan/TestCases/TypeCheck/vptr-non-unique-typeinfo.cpp
@@ -1,4 +1,3 @@
-// RUN: mkdir -p %t.dir && cd %t.dir
 // RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -I%p/Helpers -g %s -fPIC -shared -o %dynamiclib -DBUILD_SO %ld_flags_rpath_so
 // RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -I%p/Helpers -g %s -O3 -o %t %ld_flags_rpath_exe
 // RUN: %run %t


        


More information about the llvm-commits mailing list