Skip to content

Commit 05e3143

Browse files
committed
Revert "[compiler-rt] Remove %T from shared object substitutions (llvm#155302)"
This broke a bunch of Mac lit tests, see comment on the PR. This reverts commit bbd48fb.
1 parent 1d131ff commit 05e3143

26 files changed

+62
-77
lines changed

compiler-rt/test/asan/TestCases/Linux/coverage-missing.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
// Test for "sancov.py missing ...".
22

33
// First case: coverage from executable. main() is called on every code path.
4-
// RUN: rm -rf %t.dir && mkdir -p %t.dir && cd %t.dir
54
// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s -o %t -DFOOBAR -DMAIN
6-
// RUN: %env_asan_opts=coverage=1:coverage_dir=%t.dir %run %t
5+
// RUN: rm -rf %t-dir
6+
// RUN: mkdir -p %t-dir
7+
// RUN: cd %t-dir
8+
// RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t
79
// RUN: %sancov print *.sancov > main.txt
810
// RUN: rm *.sancov
911
// RUN: count 1 < main.txt
10-
// RUN: %env_asan_opts=coverage=1:coverage_dir=%t.dir %run %t x
12+
// RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t x
1113
// RUN: %sancov print *.sancov > foo.txt
1214
// RUN: rm *.sancov
1315
// RUN: count 3 < foo.txt
14-
// RUN: %env_asan_opts=coverage=1:coverage_dir=%t.dir %run %t x x
16+
// RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t x x
1517
// RUN: %sancov print *.sancov > bar.txt
1618
// RUN: rm *.sancov
1719
// RUN: count 4 < bar.txt
@@ -24,15 +26,18 @@
2426
// RUN: not grep "^<" %t.log
2527

2628
// Second case: coverage from DSO.
27-
// RUN: cd ..
28-
// RUN: rm -rf %t.dir && mkdir -p %t.dir && cd %t.dir
29+
// cd %t-dir
2930
// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s -o %dynamiclib -DFOOBAR -shared -fPIC
3031
// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s %dynamiclib -o %t -DMAIN
31-
// RUN: %env_asan_opts=coverage=1:coverage_dir=%t.dir %run %t x
32+
// RUN: cd ..
33+
// RUN: rm -rf %t-dir
34+
// RUN: mkdir -p %t-dir
35+
// RUN: cd %t-dir
36+
// RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t x
3237
// RUN: %sancov print %xdynamiclib_filename.*.sancov > foo.txt
3338
// RUN: rm *.sancov
3439
// RUN: count 2 < foo.txt
35-
// RUN: %env_asan_opts=coverage=1:coverage_dir=%t.dir %run %t x x
40+
// RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t x x
3641
// RUN: %sancov print %xdynamiclib_filename.*.sancov > bar.txt
3742
// RUN: rm *.sancov
3843
// RUN: count 3 < bar.txt

compiler-rt/test/asan/TestCases/Linux/local_alias.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
// false positive global-buffer-overflow due to sanitized library poisons
55
// globals from non-sanitized one.
66
//
7-
// RUN: mkdir -p %t.dir && cd %t.dir
87
// RUN: %clangxx_asan -DBUILD_INSTRUMENTED_DSO=1 -fPIC -shared -mllvm -asan-use-private-alias %s -o %dynamiclib1
98
// RUN: %clangxx -DBUILD_UNINSTRUMENTED_DSO=1 -fPIC -shared %s -o %dynamiclib2
109
// RUN: %clangxx %s -c -mllvm -asan-use-private-alias -o %t.o
11-
// RUN: %clangxx_asan %t.o %ld_flags_rpath_exe2 %ld_flags_rpath_exe1 -o %t.dir/EXE
12-
// RUN: %run %t.dir/EXE
10+
// RUN: %clangxx_asan %t.o %ld_flags_rpath_exe2 %ld_flags_rpath_exe1 -o %t-EXE
11+
// RUN: %run %t-EXE
1312

1413
#if defined (BUILD_INSTRUMENTED_DSO)
1514
long h = 15;

compiler-rt/test/asan/TestCases/Linux/odr-violation.cpp

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,38 @@
1010
// -fno-sanitize-address-use-odr-indicator turns off both.
1111
//
1212
// Different size: detect a bug if detect_odr_violation>=1
13-
// RUN: mkdir -p %t.dir && cd %t.dir
1413
// RUN: %clangxx_asan -g -DBUILD_SO=1 -fPIC -shared -fno-sanitize-address-use-odr-indicator %s -o %dynamiclib
15-
// RUN: %clangxx_asan -g -fno-sanitize-address-use-odr-indicator %s %ld_flags_rpath_exe -o %t.dir/ODR-EXE
16-
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=1 not %run %t.dir/ODR-EXE 2>&1 | FileCheck %s
17-
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t.dir/ODR-EXE 2>&1 | FileCheck %s
18-
// 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
19-
// RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t.dir/ODR-EXE 2>&1 | FileCheck %s
14+
// RUN: %clangxx_asan -g -fno-sanitize-address-use-odr-indicator %s %ld_flags_rpath_exe -o %t-ODR-EXE
15+
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=1 not %run %t-ODR-EXE 2>&1 | FileCheck %s
16+
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t-ODR-EXE 2>&1 | FileCheck %s
17+
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=0 %run %t-ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED
18+
// RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t-ODR-EXE 2>&1 | FileCheck %s
2019
//
2120
// Same size: report a bug only if detect_odr_violation>=2.
2221
// RUN: %clangxx_asan -g -DBUILD_SO=1 -fPIC -shared -fno-sanitize-address-use-odr-indicator %s -o %dynamiclib -DSZ=100
23-
// 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
24-
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t.dir/ODR-EXE 2>&1 | FileCheck %s
25-
// RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t.dir/ODR-EXE 2>&1 | FileCheck %s
26-
// RUN: echo "odr_violation:foo::ZZZ" > %t.dir/supp
27-
// 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
28-
// RUN: echo "odr_violation:foo::G" > %t.dir/supp
29-
// 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
30-
// RUN: rm -f %t.dir/supp
22+
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=1 %run %t-ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED
23+
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t-ODR-EXE 2>&1 | FileCheck %s
24+
// RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t-ODR-EXE 2>&1 | FileCheck %s
25+
// RUN: echo "odr_violation:foo::ZZZ" > %t.supp
26+
// 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
27+
// RUN: echo "odr_violation:foo::G" > %t.supp
28+
// 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
29+
// RUN: rm -f %t.supp
3130
//
3231
// Use private aliases for global variables without indicator symbol.
3332
// RUN: %clangxx_asan -g -DBUILD_SO=1 -fPIC -shared -mllvm -asan-use-odr-indicator=0 %s -o %dynamiclib -DSZ=100
34-
// RUN: %clangxx_asan -g -mllvm -asan-use-odr-indicator=0 %s %ld_flags_rpath_exe -o %t.dir/ODR-EXE
35-
// RUN: %env_asan_opts=fast_unwind_on_malloc=0 %run %t.dir/ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED
33+
// RUN: %clangxx_asan -g -mllvm -asan-use-odr-indicator=0 %s %ld_flags_rpath_exe -o %t-ODR-EXE
34+
// RUN: %env_asan_opts=fast_unwind_on_malloc=0 %run %t-ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED
3635

3736
// Use private aliases for global variables: use indicator symbol to detect ODR violation.
3837
// RUN: %clangxx_asan -g -DBUILD_SO=1 -fPIC -shared %s -o %dynamiclib -DSZ=100
39-
// RUN: %clangxx_asan -g %s %ld_flags_rpath_exe -o %t.dir/ODR-EXE
40-
// RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t.dir/ODR-EXE 2>&1 | FileCheck %s
38+
// RUN: %clangxx_asan -g %s %ld_flags_rpath_exe -o %t-ODR-EXE
39+
// RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t-ODR-EXE 2>&1 | FileCheck %s
4140

4241
// Same as above but with clang switches.
4342
// RUN: %clangxx_asan -g -DBUILD_SO=1 -fPIC -shared -fsanitize-address-use-odr-indicator %s -o %dynamiclib -DSZ=100
44-
// RUN: %clangxx_asan -g -fsanitize-address-use-odr-indicator %s %ld_flags_rpath_exe -o %t.dir/ODR-EXE
45-
// RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t.dir/ODR-EXE 2>&1 | FileCheck %s
43+
// RUN: %clangxx_asan -g -fsanitize-address-use-odr-indicator %s %ld_flags_rpath_exe -o %t-ODR-EXE
44+
// RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t-ODR-EXE 2>&1 | FileCheck %s
4645

4746
// GNU driver doesn't handle .so files properly.
4847
// REQUIRES: Clang
@@ -59,7 +58,7 @@ namespace foo { char G[SZ]; }
5958
#include <stdio.h>
6059
namespace foo { char G[100]; }
6160
// CHECK: ERROR: AddressSanitizer: odr-violation
62-
// CHECK: size=100 'foo::G' {{.*}}odr-violation.cpp:[[@LINE-2]] in {{.*}}/ODR-EXE
61+
// CHECK: size=100 'foo::G' {{.*}}odr-violation.cpp:[[@LINE-2]] in {{.*}}.tmp-ODR-EXE
6362
// CHECK: size={{4|100}} 'foo::G'
6463
int main(int argc, char **argv) {
6564
printf("PASS: %p\n", &foo::G);

compiler-rt/test/asan/TestCases/Linux/odr-vtable.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,19 @@
44
// REQUIRES: shared_cxxabi
55

66
/// Not using private alias or enabling ODR indicator can detect ODR issues.
7-
// RUN: mkdir -p %t.dir && cd %t.dir
87
// RUN: %clangxx_asan -fno-rtti -DBUILD_SO1 -fPIC -shared -mllvm -asan-use-private-alias=0 %s -o %dynamiclib1
98
// RUN: %clangxx_asan -fno-rtti -DBUILD_SO2 -fPIC -shared -mllvm -asan-use-private-alias=0 %s -o %dynamiclib2
10-
// RUN: %clangxx_asan -fno-rtti %s %ld_flags_rpath_exe1 %ld_flags_rpath_exe2 -o %t.dir/EXE
11-
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t.dir/EXE 2>&1 | FileCheck %s
9+
// RUN: %clangxx_asan -fno-rtti %s %ld_flags_rpath_exe1 %ld_flags_rpath_exe2 -o %t
10+
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t 2>&1 | FileCheck %s
1211

1312
// RUN: %clangxx_asan -fno-rtti -DBUILD_SO1 -fPIC -shared -mllvm -asan-use-odr-indicator=1 %s -o %dynamiclib1
1413
// RUN: %clangxx_asan -fno-rtti -DBUILD_SO2 -fPIC -shared -mllvm -asan-use-odr-indicator=1 %s -o %dynamiclib2
15-
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t.dir/EXE 2>&1 | FileCheck %s
14+
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t 2>&1 | FileCheck %s
1615

1716
/// By default we can detect ODR issues in vtables.
1817
// RUN: %clangxx_asan -fno-rtti -DBUILD_SO1 -fPIC -shared %s -o %dynamiclib1
1918
// RUN: %clangxx_asan -fno-rtti -DBUILD_SO2 -fPIC -shared %s -o %dynamiclib2
20-
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t.dir/EXE 2>&1 | FileCheck %s
19+
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t 2>&1 | FileCheck %s
2120

2221
struct XYZ {
2322
virtual void foo();

compiler-rt/test/asan/TestCases/Linux/odr_c_test.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
// Test that we can properly report an ODR violation between an instrumented
22
// global and a non-instrumented global if not using private aliases.
33

4-
// RUN: mkdir -p %t.dir && cd %t.dir
54
// RUN: %clang_asan -fcommon %s -fPIC -shared -mllvm -asan-use-private-alias=0 -o %dynamiclib1 -DFILE1
65
// RUN: %clang_asan -fcommon %s -fPIC -shared -mllvm -asan-use-private-alias=0 -o %dynamiclib2 -DFILE2
7-
// RUN: %clang_asan -fcommon %s -fPIE %ld_flags_rpath_exe1 %ld_flags_rpath_exe2 -o %t.dir/exe
8-
// RUN: not %run %t.dir/exe 2>&1 | FileCheck %s
6+
// RUN: %clang_asan -fcommon %s -fPIE %ld_flags_rpath_exe1 %ld_flags_rpath_exe2 -o %t
7+
// RUN: not %run %t 2>&1 | FileCheck %s
98

109
// RUN: %clang_asan -fcommon %s -fPIC -shared -mllvm -asan-use-private-alias=1 -o %dynamiclib1 -DFILE1
1110
// RUN: %clang_asan -fcommon %s -fPIC -shared -mllvm -asan-use-private-alias=1 -o %dynamiclib2 -DFILE2
12-
// RUN: %run %t.dir/exe 2>&1 | count 0
11+
// RUN: %run %t 2>&1 | count 0
1312

1413
// Unaligned accesses don't work on strict-alignment targets like SPARC.
1514
// UNSUPPORTED: sparc-target-arch

compiler-rt/test/asan/TestCases/Linux/preinit_test.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
// RUN: mkdir -p %t.dir && cd %t.dir
21
// RUN: %clangxx -DFUNC=zzzz %s -shared -o %dynamiclib -fPIC
3-
// RUN: %clangxx_asan -DFUNC=main %s -o %t.dir/EXE %ld_flags_rpath_exe
4-
// RUN: %run %t.dir/EXE
2+
// RUN: %clangxx_asan -DFUNC=main %s -o %t %ld_flags_rpath_exe
3+
// RUN: %run %t
54

65
// GNU driver doesn't handle .so files properly.
76
// REQUIRES: Clang

compiler-rt/test/asan/TestCases/Posix/coverage-module-unloaded.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Check that unloading a module doesn't break coverage dumping for remaining
22
// modules.
3-
// RUN: mkdir -p %t.dir && cd %t.dir
43
// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard -DSHARED %s -shared -o %dynamiclib1 -fPIC
54
// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard -DSHARED %s -shared -o %dynamiclib2 -fPIC
65
// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s %libdl -o %t.exe

compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// RUN: rm -rf %t.dir && mkdir -p %t.dir && cd %t.dir
21
// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard -DSHARED %s -shared -o %dynamiclib -fPIC %ld_flags_rpath_so
3-
// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s %ld_flags_rpath_exe -o %t.dir/EXE
4-
// RUN: %env_asan_opts=coverage=1:verbosity=1 %run %t.dir/EXE 2>&1 | tee /tmp/test
2+
// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s %ld_flags_rpath_exe -o %t
3+
// RUN: rm -rf %t-dir && mkdir -p %t-dir && cd %t-dir
4+
// RUN: %env_asan_opts=coverage=1:verbosity=1 %run %t 2>&1 | FileCheck %s
55
//
66
// UNSUPPORTED: ios
77

compiler-rt/test/asan/TestCases/Posix/coverage.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// RUN:rm -rf %t.dir && mkdir -p %t.dir && cd %t.dir
21
// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard -DSHARED %s -shared -o %dynamiclib -fPIC %ld_flags_rpath_so
32
// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s %ld_flags_rpath_exe -o %t
3+
// RUN: rm -rf %t-dir && mkdir -p %t-dir && cd %t-dir
44
// RUN: %env_asan_opts=coverage=1:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-main
55
// RUN: %sancov print coverage.*sancov 2>&1 | FileCheck %s --check-prefix=CHECK-SANCOV1
66
// RUN: %env_asan_opts=coverage=1:verbosity=1 %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-foo
@@ -14,6 +14,7 @@
1414
// RUN: %sancov print merged-cov 2>&1 | FileCheck %s --check-prefix=CHECK-SANCOV2
1515
// RUN: %env_asan_opts=coverage=1:verbosity=1 not %run %t foo bar 4 2>&1 | FileCheck %s --check-prefix=CHECK-report
1616
// RUN: %env_asan_opts=coverage=1:verbosity=1 not %run %t foo bar 4 5 2>&1 | FileCheck %s --check-prefix=CHECK-segv
17+
// RUN: cd .. && rm -rf %t-dir
1718
//
1819
// https://code.google.com/p/address-sanitizer/issues/detail?id=263
1920
// XFAIL: android

compiler-rt/test/asan/TestCases/Posix/interception-in-shared-lib-test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Check that memset() call from a shared library gets intercepted.
2-
// RUN: mkdir -p %t.dir && cd %t.dir
2+
33
// RUN: %clangxx_asan -O0 %s -DSHARED_LIB \
44
// RUN: -shared -o %dynamiclib -fPIC %ld_flags_rpath_so
5-
// RUN: %clangxx_asan -O0 %s -o %t.dir/EXE %ld_flags_rpath_exe && \
6-
// RUN: not %run %t.dir/EXE 2>&1 | FileCheck %s
5+
// RUN: %clangxx_asan -O0 %s -o %t %ld_flags_rpath_exe && \
6+
// RUN: not %run %t 2>&1 | FileCheck %s
77

88
#include <stdio.h>
99
#include <string.h>

0 commit comments

Comments
 (0)