[PATCH] D55589: [hwasan] Link ubsan_cxx to shared runtime library.
Evgenii Stepanov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 11 17:44:36 PST 2018
eugenis created this revision.
eugenis added reviewers: kcc, vitalybuka.
Herald added subscribers: mgorny, kubamracek, srhines.
This is needed for C++-specific ubsan and cfi error reporting to work.
https://reviews.llvm.org/D55589
Files:
compiler-rt/lib/hwasan/CMakeLists.txt
compiler-rt/test/hwasan/TestCases/cfi.cc
Index: compiler-rt/test/hwasan/TestCases/cfi.cc
===================================================================
--- /dev/null
+++ compiler-rt/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<A *>(reinterpret_cast<void *>(&main));
+ (void)a;
+}
Index: compiler-rt/lib/hwasan/CMakeLists.txt
===================================================================
--- compiler-rt/lib/hwasan/CMakeLists.txt
+++ compiler-rt/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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55589.177805.patch
Type: text/x-patch
Size: 1202 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181212/2495ee11/attachment.bin>
More information about the llvm-commits
mailing list