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