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
1314// 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
1920//
2021// Same size: report a bug only if detect_odr_violation>=2.
2122// 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
3031//
3132// Use private aliases for global variables without indicator symbol.
3233// 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
3536
3637// Use private aliases for global variables: use indicator symbol to detect ODR violation.
3738// 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
4041
4142// Same as above but with clang switches.
4243// 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
4546
4647// GNU driver doesn't handle .so files properly.
4748// REQUIRES: Clang
@@ -58,7 +59,7 @@ namespace foo { char G[SZ]; }
5859#include < stdio.h>
5960namespace foo { char G[100 ]; }
6061// 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
6263// CHECK: size={{4|100}} 'foo::G'
6364int main (int argc, char **argv) {
6465 printf (" PASS: %p\n " , &foo::G);
0 commit comments