Files
clang-p2996/compiler-rt/test/hwasan/TestCases/cfi.cpp
Peter Collingbourne feef101ac2 Require lld for hwasan tests.
We're using relocations that are unsupported by the version of gold on the
bot, so force the use of lld. One of the tests is already using lld,
so this should be safe.

llvm-svn: 368111
2019-08-06 23:43:20 +00:00

19 lines
429 B
C++

// RUN: %clangxx_hwasan -fsanitize=cfi -fno-sanitize-trap=cfi -flto -fvisibility=hidden %s -o %t
// RUN: not %run %t 2>&1 | FileCheck %s
// REQUIRES: android
// Smoke test for CFI + HWASAN.
struct A {
virtual void f();
};
void A::f() {}
int main() {
// CHECK: control flow integrity check for type {{.*}} failed during cast to unrelated type
A *a = reinterpret_cast<A *>(reinterpret_cast<void *>(&main));
(void)a;
}