forked from OSchip/llvm-project
[hwasan] Link ubsan_cxx to shared runtime library.
Summary: This is needed for C++-specific ubsan and cfi error reporting to work. Reviewers: kcc, vitalybuka Subscribers: srhines, kubamracek, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D55589 llvm-svn: 348986
This commit is contained in:
parent
967ce406d5
commit
1020085898
|
@ -145,6 +145,7 @@ foreach(arch ${HWASAN_SUPPORTED_ARCH})
|
|||
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
|
||||
|
|
|
@ -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<A *>(reinterpret_cast<void *>(&main));
|
||||
(void)a;
|
||||
}
|
Loading…
Reference in New Issue