Index: lib/hwasan/CMakeLists.txt =================================================================== --- lib/hwasan/CMakeLists.txt +++ lib/hwasan/CMakeLists.txt @@ -145,6 +145,7 @@ RTSanitizerCommonCoverage RTSanitizerCommonSymbolizer RTUbsan + RTUbsan_cxx # The only purpose of RTHWAsan_dynamic_version_script_dummy is to # carry a dependency of the shared runtime on the version script. # Replacing it with a straightforward Index: test/hwasan/TestCases/cfi.cc =================================================================== --- test/hwasan/TestCases/cfi.cc +++ test/hwasan/TestCases/cfi.cc @@ -0,0 +1,18 @@ +// RUN: %clang_hwasan -fsanitize=cfi -fno-sanitize-trap=cfi -flto -fvisibility=hidden -fuse-ld=lld %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(reinterpret_cast(&main)); + (void)a; +}