10
10
// -fno-sanitize-address-use-odr-indicator turns off both.
11
11
//
12
12
// Different size: detect a bug if detect_odr_violation>=1
13
- // RUN: mkdir -p %t.dir && cd %t.dir
14
13
// 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
20
19
//
21
20
// Same size: report a bug only if detect_odr_violation>=2.
22
21
// 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
31
30
//
32
31
// Use private aliases for global variables without indicator symbol.
33
32
// 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
36
35
37
36
// Use private aliases for global variables: use indicator symbol to detect ODR violation.
38
37
// 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
41
40
42
41
// Same as above but with clang switches.
43
42
// 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
46
45
47
46
// GNU driver doesn't handle .so files properly.
48
47
// REQUIRES: Clang
@@ -59,7 +58,7 @@ namespace foo { char G[SZ]; }
59
58
#include < stdio.h>
60
59
namespace foo { char G[100 ]; }
61
60
// 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
63
62
// CHECK: size={{4|100}} 'foo::G'
64
63
int main (int argc, char **argv) {
65
64
printf (" PASS: %p\n " , &foo::G);
0 commit comments