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>
6059namespace 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'
6463int main (int argc, char **argv) {
6564 printf (" PASS: %p\n " , &foo::G);
0 commit comments