Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 21 additions & 22 deletions compiler-rt/test/asan/TestCases/Linux/odr-violation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,38 @@
// -fno-sanitize-address-use-odr-indicator turns off both.
//
// Different size: detect a bug if detect_odr_violation>=1
// RUN: mkdir -p %t.dir && cd %t.dir
// RUN: %clangxx_asan -g -DBUILD_SO=1 -fPIC -shared -fno-sanitize-address-use-odr-indicator %s -o %dynamiclib
// RUN: %clangxx_asan -g -fno-sanitize-address-use-odr-indicator %s %ld_flags_rpath_exe -o %t.dir/ODR-EXE
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=1 not %run %t.dir/ODR-EXE 2>&1 | FileCheck %s
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t.dir/ODR-EXE 2>&1 | FileCheck %s
// 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
// RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t.dir/ODR-EXE 2>&1 | FileCheck %s
// RUN: %clangxx_asan -g -fno-sanitize-address-use-odr-indicator %s %ld_flags_rpath_exe -o %t-ODR-EXE
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=1 not %run %t-ODR-EXE 2>&1 | FileCheck %s
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t-ODR-EXE 2>&1 | FileCheck %s
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=0 %run %t-ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED
// RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t-ODR-EXE 2>&1 | FileCheck %s
//
// Same size: report a bug only if detect_odr_violation>=2.
// RUN: %clangxx_asan -g -DBUILD_SO=1 -fPIC -shared -fno-sanitize-address-use-odr-indicator %s -o %dynamiclib -DSZ=100
// 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
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t.dir/ODR-EXE 2>&1 | FileCheck %s
// RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t.dir/ODR-EXE 2>&1 | FileCheck %s
// RUN: echo "odr_violation:foo::ZZZ" > %t.dir/supp
// 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
// RUN: echo "odr_violation:foo::G" > %t.dir/supp
// 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
// RUN: rm -f %t.dir/supp
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=1 %run %t-ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t-ODR-EXE 2>&1 | FileCheck %s
// RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t-ODR-EXE 2>&1 | FileCheck %s
// RUN: echo "odr_violation:foo::ZZZ" > %t.supp
// 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
// RUN: echo "odr_violation:foo::G" > %t.supp
// 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
// RUN: rm -f %t.supp
//
// Use private aliases for global variables without indicator symbol.
// RUN: %clangxx_asan -g -DBUILD_SO=1 -fPIC -shared -mllvm -asan-use-odr-indicator=0 %s -o %dynamiclib -DSZ=100
// RUN: %clangxx_asan -g -mllvm -asan-use-odr-indicator=0 %s %ld_flags_rpath_exe -o %t.dir/ODR-EXE
// RUN: %env_asan_opts=fast_unwind_on_malloc=0 %run %t.dir/ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED
// RUN: %clangxx_asan -g -mllvm -asan-use-odr-indicator=0 %s %ld_flags_rpath_exe -o %t-ODR-EXE
// RUN: %env_asan_opts=fast_unwind_on_malloc=0 %run %t-ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED

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

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

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

// CHECK: These globals were registered at these points:
// CHECK: {{odr-violation.cpp|ODR-EXE}}
// CHECK: {{odr-violation.cpp|.*ODR-EXE}}
// CHECK: odr-violation.cpp{{$}}
// CHECK: SUMMARY: AddressSanitizer: odr-violation: global 'foo::G' at {{.*}}odr-violation.cpp
// DISABLED: PASS
5 changes: 2 additions & 3 deletions compiler-rt/test/asan/TestCases/Linux/preinit_test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// RUN: mkdir -p %t.dir && cd %t.dir
// RUN: %clangxx -DFUNC=zzzz %s -shared -o %dynamiclib -fPIC
// RUN: %clangxx_asan -DFUNC=main %s -o %t.dir/EXE %ld_flags_rpath_exe
// RUN: %run %t.dir/EXE
// RUN: %clangxx_asan -DFUNC=main %s -o %t-EXE %ld_flags_rpath_exe
// RUN: %run %t-EXE

// GNU driver doesn't handle .so files properly.
// REQUIRES: Clang
Expand Down
5 changes: 2 additions & 3 deletions compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// RUN: rm -rf %t.dir && mkdir -p %t.dir && cd %t.dir
// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard -DSHARED %s -shared -o %dynamiclib -fPIC %ld_flags_rpath_so
// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s %ld_flags_rpath_exe -o %t.dir/EXE
// RUN: %env_asan_opts=coverage=1:verbosity=1 %run %t.dir/EXE 2>&1 | tee /tmp/test
// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s %ld_flags_rpath_exe -o %t-EXE
// RUN: %env_asan_opts=coverage=1:verbosity=1 %run %t-EXE 2>&1 | tee /tmp/test
//
// UNSUPPORTED: ios

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Check that memset() call from a shared library gets intercepted.
// RUN: mkdir -p %t.dir && cd %t.dir
// RUN: %clangxx_asan -O0 %s -DSHARED_LIB \
// RUN: -shared -o %dynamiclib -fPIC %ld_flags_rpath_so
// RUN: %clangxx_asan -O0 %s -o %t.dir/EXE %ld_flags_rpath_exe && \
// RUN: not %run %t.dir/EXE 2>&1 | FileCheck %s
// RUN: %clangxx_asan -O0 %s -o %t-EXE %ld_flags_rpath_exe && \
// RUN: not %run %t-EXE 2>&1 | FileCheck %s

#include <stdio.h>
#include <string.h>
Expand Down
5 changes: 2 additions & 3 deletions compiler-rt/test/cfi/cross-dso-diagnostic.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Check that cross-DSO diagnostics print the names of both modules

// RUN: mkdir -p %t.dir && cd %t.dir
// RUN: %clangxx_cfi_diag -g -DSHARED_LIB -fPIC -shared -o %dynamiclib %s %ld_flags_rpath_so
// RUN: %clangxx_cfi_diag -g -o %t.dir/file_exe_suffix %s %ld_flags_rpath_exe
// RUN: %t.dir/file_exe_suffix 2>&1 | FileCheck -DDSONAME=%xdynamiclib_namespec %s
// RUN: %clangxx_cfi_diag -g -o %t-file_exe_suffix %s %ld_flags_rpath_exe
// RUN: %t-file_exe_suffix 2>&1 | FileCheck -DDSONAME=%xdynamiclib_namespec %s

// UNSUPPORTED: target={{.*windows-msvc.*}}
// REQUIRES: cxxabi
Expand Down
35 changes: 17 additions & 18 deletions compiler-rt/test/cfi/cross-dso/icall/diag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,34 @@
// * otherwise, the callee decides between trap/recover/norecover.

// Full-recover.
// RUN: mkdir -p %t.dir && cd %t.dir
// RUN: %clangxx_cfi_dso_diag -g -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
// RUN: %clangxx_cfi_dso_diag -g %s -o %t.dir/exe %ld_flags_rpath_exe
// RUN: %clangxx_cfi_dso_diag -g %s -o %t-exe %ld_flags_rpath_exe

// RUN: %t.dir/exe icv 2>&1 | FileCheck %s --check-prefix=ICALL-DIAG --check-prefix=CAST-DIAG \
// RUN: %t-exe icv 2>&1 | FileCheck %s --check-prefix=ICALL-DIAG --check-prefix=CAST-DIAG \
// RUN: --check-prefix=VCALL-DIAG --check-prefix=ALL-RECOVER

// RUN: %t.dir/exe i_v 2>&1 | FileCheck %s --check-prefix=ICALL-DIAG --check-prefix=CAST-NODIAG \
// RUN: %t-exe i_v 2>&1 | FileCheck %s --check-prefix=ICALL-DIAG --check-prefix=CAST-NODIAG \
// RUN: --check-prefix=VCALL-DIAG --check-prefix=ALL-RECOVER

// RUN: %t.dir/exe _cv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-DIAG \
// RUN: %t-exe _cv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-DIAG \
// RUN: --check-prefix=VCALL-DIAG --check-prefix=ALL-RECOVER

// RUN: %t.dir/exe ic_ 2>&1 | FileCheck %s --check-prefix=ICALL-DIAG --check-prefix=CAST-DIAG \
// RUN: %t-exe ic_ 2>&1 | FileCheck %s --check-prefix=ICALL-DIAG --check-prefix=CAST-DIAG \
// RUN: --check-prefix=VCALL-NODIAG --check-prefix=ALL-RECOVER

// Trap on icall, no-recover on cast.
// RUN: %clangxx_cfi_dso_diag -fsanitize-trap=cfi-icall -fno-sanitize-recover=cfi-unrelated-cast \
// RUN: -g -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
// RUN: %clangxx_cfi_dso_diag -fsanitize-trap=cfi-icall -fno-sanitize-recover=cfi-unrelated-cast \
// RUN: -g %s -o %t.dir/exe %ld_flags_rpath_exe
// RUN: -g %s -o %t-exe %ld_flags_rpath_exe

// RUN: %expect_crash %t.dir/exe icv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \
// RUN: %expect_crash %t-exe icv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \
// RUN: --check-prefix=VCALL-NODIAG --check-prefix=ICALL-FATAL

// RUN: not %t.dir/exe _cv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-DIAG \
// RUN: not %t-exe _cv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-DIAG \
// RUN: --check-prefix=VCALL-NODIAG --check-prefix=CAST-FATAL

// RUN: %t.dir/exe __v 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \
// RUN: %t-exe __v 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \
// RUN: --check-prefix=VCALL-DIAG

// Callee: trap on icall, no-recover on cast.
Expand All @@ -43,15 +42,15 @@
// RUN: %clangxx_cfi_dso_diag -fsanitize-trap=cfi-icall -fno-sanitize-recover=cfi-unrelated-cast \
// RUN: -g -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
// RUN: %clangxx_cfi_dso_diag \
// RUN: -g %s -o %t.dir/exe %ld_flags_rpath_exe
// RUN: -g %s -o %t-exe %ld_flags_rpath_exe

// RUN: %expect_crash %t.dir/exe icv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \
// RUN: %expect_crash %t-exe icv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \
// RUN: --check-prefix=VCALL-NODIAG --check-prefix=ICALL-FATAL

// RUN: not %t.dir/exe _cv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-DIAG \
// RUN: not %t-exe _cv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-DIAG \
// RUN: --check-prefix=VCALL-NODIAG --check-prefix=CAST-FATAL

// RUN: %t.dir/exe __v 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \
// RUN: %t-exe __v 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \
// RUN: --check-prefix=VCALL-DIAG

// Caller in trapping mode, callee with full diagnostic+recover.
Expand All @@ -60,15 +59,15 @@
// RUN: %clangxx_cfi_dso_diag \
// RUN: -g -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
// RUN: %clangxx_cfi_dso -fno-sanitize-trap=cfi-nvcall \
// RUN: -g %s -o %t.dir/exe %ld_flags_rpath_exe
// RUN: -g %s -o %t-exe %ld_flags_rpath_exe

// RUN: %expect_crash %t.dir/exe icv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \
// RUN: %expect_crash %t-exe icv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \
// RUN: --check-prefix=VCALL-NODIAG --check-prefix=ICALL-FATAL

// RUN: %expect_crash %t.dir/exe _cv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \
// RUN: %expect_crash %t-exe _cv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \
// RUN: --check-prefix=VCALL-NODIAG --check-prefix=CAST-FATAL

// RUN: %expect_crash %t.dir/exe __v 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \
// RUN: %expect_crash %t-exe __v 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \
// RUN: --check-prefix=VCALL-NODIAG --check-prefix=VCALL-FATAL

// REQUIRES: cxxabi
Expand Down
5 changes: 2 additions & 3 deletions compiler-rt/test/cfi/cross-dso/icall/icall-from-dso.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// RUN: mkdir -p %t.dir && cd %t.dir
// RUN: %clangxx_cfi_dso -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
// RUN: %clangxx_cfi_dso %s -o %t.dir/exe %ld_flags_rpath_exe && %expect_crash %t.dir/exe 2>&1 | FileCheck %s
// RUN: %clangxx_cfi_dso %s -o %t-exe %ld_flags_rpath_exe && %expect_crash %t-exe 2>&1 | FileCheck %s

// RUN: %clangxx_cfi_dso_diag -g -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
// RUN: %clangxx_cfi_dso_diag -g %s -o %t.dir/exe %ld_flags_rpath_exe && %t.dir/exe 2>&1 | FileCheck %s --check-prefix=CFI-DIAG
// RUN: %clangxx_cfi_dso_diag -g %s -o %t-exe %ld_flags_rpath_exe && %t-exe 2>&1 | FileCheck %s --check-prefix=CFI-DIAG

#include <stdio.h>

Expand Down
5 changes: 2 additions & 3 deletions compiler-rt/test/cfi/cross-dso/icall/icall.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// RUN: mkdir -p %t.dir && cd %t.dir
// RUN: %clangxx_cfi_dso -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
// RUN: %clangxx_cfi_dso %s -o %t.dir/exe %ld_flags_rpath_exe && %expect_crash %t.dir/exe 2>&1 | FileCheck %s
// RUN: %clangxx_cfi_dso %s -o %t-exe %ld_flags_rpath_exe && %expect_crash %t-exe 2>&1 | FileCheck %s

// RUN: %clangxx_cfi_dso_diag -g -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
// RUN: %clangxx_cfi_dso_diag -g %s -o %t.dir/exe %ld_flags_rpath_exe && %t.dir/exe 2>&1 | FileCheck %s --check-prefix=CFI-DIAG
// RUN: %clangxx_cfi_dso_diag -g %s -o %t-exe %ld_flags_rpath_exe && %t-exe 2>&1 | FileCheck %s --check-prefix=CFI-DIAG

#include <stdio.h>

Expand Down
43 changes: 21 additions & 22 deletions compiler-rt/test/cfi/cross-dso/simple-fail.cpp
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
// RUN: mkdir -p %t.dir && cd %t.dir
// RUN: %clangxx_cfi_dso -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
// RUN: %clangxx_cfi_dso %s -o %t.dir/exe %ld_flags_rpath_exe
// RUN: %expect_crash %t.dir/exe 2>&1 | FileCheck --check-prefix=CFI %s
// RUN: %expect_crash %t.dir/exe x 2>&1 | FileCheck --check-prefix=CFI-CAST %s
// RUN: %clangxx_cfi_dso %s -o %t-exe %ld_flags_rpath_exe
// RUN: %expect_crash %t-exe 2>&1 | FileCheck --check-prefix=CFI %s
// RUN: %expect_crash %t-exe x 2>&1 | FileCheck --check-prefix=CFI-CAST %s

// RUN: %clangxx_cfi_dso -DB32 -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
// RUN: %clangxx_cfi_dso -DB32 %s -o %t.dir/exe %ld_flags_rpath_exe
// RUN: %expect_crash %t.dir/exe 2>&1 | FileCheck --check-prefix=CFI %s
// RUN: %expect_crash %t.dir/exe x 2>&1 | FileCheck --check-prefix=CFI-CAST %s
// RUN: %clangxx_cfi_dso -DB32 %s -o %t-exe %ld_flags_rpath_exe
// RUN: %expect_crash %t-exe 2>&1 | FileCheck --check-prefix=CFI %s
// RUN: %expect_crash %t-exe x 2>&1 | FileCheck --check-prefix=CFI-CAST %s

// RUN: %clangxx_cfi_dso -DB64 -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
// RUN: %clangxx_cfi_dso -DB64 %s -o %t.dir/exe %ld_flags_rpath_exe
// RUN: %expect_crash %t.dir/exe 2>&1 | FileCheck --check-prefix=CFI %s
// RUN: %expect_crash %t.dir/exe x 2>&1 | FileCheck --check-prefix=CFI-CAST %s
// RUN: %clangxx_cfi_dso -DB64 %s -o %t-exe %ld_flags_rpath_exe
// RUN: %expect_crash %t-exe 2>&1 | FileCheck --check-prefix=CFI %s
// RUN: %expect_crash %t-exe x 2>&1 | FileCheck --check-prefix=CFI-CAST %s

// RUN: %clangxx_cfi_dso -DBM -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
// RUN: %clangxx_cfi_dso -DBM %s -o %t.dir/exe %ld_flags_rpath_exe
// RUN: %expect_crash %t.dir/exe 2>&1 | FileCheck --check-prefix=CFI %s
// RUN: %expect_crash %t.dir/exe x 2>&1 | FileCheck --check-prefix=CFI-CAST %s
// RUN: %clangxx_cfi_dso -DBM %s -o %t-exe %ld_flags_rpath_exe
// RUN: %expect_crash %t-exe 2>&1 | FileCheck --check-prefix=CFI %s
// RUN: %expect_crash %t-exe x 2>&1 | FileCheck --check-prefix=CFI-CAST %s

// RUN: %clangxx -DBM -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
// RUN: %clangxx -DBM %s -o %t.dir/exe %ld_flags_rpath_exe
// RUN: %t.dir/exe 2>&1 | FileCheck --check-prefix=NCFI %s
// RUN: %t.dir/exe x 2>&1 | FileCheck --check-prefix=NCFI %s
// RUN: %clangxx -DBM %s -o %t-exe %ld_flags_rpath_exe
// RUN: %t-exe 2>&1 | FileCheck --check-prefix=NCFI %s
// RUN: %t-exe x 2>&1 | FileCheck --check-prefix=NCFI %s

// RUN: %clangxx -DBM -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
// RUN: %clangxx_cfi_dso -DBM %s -o %t.dir/exe %ld_flags_rpath_exe
// RUN: %t.dir/exe 2>&1 | FileCheck --check-prefix=NCFI %s
// RUN: %t.dir/exe x 2>&1 | FileCheck --check-prefix=NCFI %s
// RUN: %clangxx_cfi_dso -DBM %s -o %t-exe %ld_flags_rpath_exe
// RUN: %t-exe 2>&1 | FileCheck --check-prefix=NCFI %s
// RUN: %t-exe x 2>&1 | FileCheck --check-prefix=NCFI %s

// RUN: %clangxx_cfi_dso_diag -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
// RUN: %clangxx_cfi_dso_diag %s -o %t.dir/exe %ld_flags_rpath_exe
// RUN: %t.dir/exe 2>&1 | FileCheck --check-prefix=CFI-DIAG-CALL %s
// RUN: %t.dir/exe x 2>&1 | FileCheck --check-prefix=CFI-DIAG-CALL --check-prefix=CFI-DIAG-CAST %s
// RUN: %clangxx_cfi_dso_diag %s -o %t-exe %ld_flags_rpath_exe
// RUN: %t-exe 2>&1 | FileCheck --check-prefix=CFI-DIAG-CALL %s
// RUN: %t-exe x 2>&1 | FileCheck --check-prefix=CFI-DIAG-CALL --check-prefix=CFI-DIAG-CAST %s

// Tests that the CFI mechanism crashes the program when making a virtual call
// to an object of the wrong class but with a compatible vtable, by casting a
Expand Down
Loading
Loading