summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2016-01-27 21:15:10 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2016-01-27 21:15:10 +0000
commitcff640958bde56788657d0d5e312b97c44250eeb (patch)
tree639a93ae59d99f9f6d9b4463ce5ea9e8f0e03472
parent3507cf2b17408cb17ec3a44b1c02161bbba77bb5 (diff)
[cfi] Disable vtable diagnostics when no cxxabi.
This should fix the build on Mac 10.8 and earlier. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@258988 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/ubsan/CMakeLists.txt5
-rw-r--r--lib/ubsan/ubsan_handlers.cc7
-rw-r--r--test/cfi/cross-dso/icall/diag.cpp2
3 files changed, 14 insertions, 0 deletions
diff --git a/lib/ubsan/CMakeLists.txt b/lib/ubsan/CMakeLists.txt
index 5ece9a62c..a12b8b117 100644
--- a/lib/ubsan/CMakeLists.txt
+++ b/lib/ubsan/CMakeLists.txt
@@ -23,9 +23,14 @@ include_directories(..)
set(UBSAN_CFLAGS ${SANITIZER_COMMON_CFLAGS})
append_no_rtti_flag(UBSAN_CFLAGS)
+append_list_if(SANITIZER_CAN_USE_CXXABI -DUBSAN_CAN_USE_CXXABI UBSAN_CFLAGS)
+
set(UBSAN_STANDALONE_CFLAGS ${SANITIZER_COMMON_CFLAGS})
append_no_rtti_flag(UBSAN_STANDALONE_CFLAGS)
+append_list_if(SANITIZER_CAN_USE_CXXABI -DUBSAN_CAN_USE_CXXABI UBSAN_STANDALONE_CFLAGS)
+
set(UBSAN_CXXFLAGS ${SANITIZER_COMMON_CFLAGS})
+append_list_if(SANITIZER_CAN_USE_CXXABI -DUBSAN_CAN_USE_CXXABI UBSAN_CXXFLAGS)
add_custom_target(ubsan)
diff --git a/lib/ubsan/ubsan_handlers.cc b/lib/ubsan/ubsan_handlers.cc
index d0dc6b569..3b37af669 100644
--- a/lib/ubsan/ubsan_handlers.cc
+++ b/lib/ubsan/ubsan_handlers.cc
@@ -548,9 +548,16 @@ static void handleCFIBadIcall(CFICheckFailData *Data, ValueHandle Function,
}
namespace __ubsan {
+#ifdef UBSAN_CAN_USE_CXXABI
SANITIZER_WEAK_ATTRIBUTE
void HandleCFIBadType(CFICheckFailData *Data, ValueHandle Vtable,
ReportOptions Opts);
+#else
+static void HandleCFIBadType(CFICheckFailData *Data, ValueHandle Vtable,
+ ReportOptions Opts) {
+ Die();
+}
+#endif
} // namespace __ubsan
void __ubsan::__ubsan_handle_cfi_check_fail(CFICheckFailData *Data,
diff --git a/test/cfi/cross-dso/icall/diag.cpp b/test/cfi/cross-dso/icall/diag.cpp
index b841a64c0..c9ca28cbf 100644
--- a/test/cfi/cross-dso/icall/diag.cpp
+++ b/test/cfi/cross-dso/icall/diag.cpp
@@ -70,6 +70,8 @@
// RUN: %expect_crash %t __v 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \
// RUN: --check-prefix=VCALL-NODIAG --check-prefix=VCALL-FATAL
+// REQUIRES: cxxabi
+
#include <assert.h>
#include <stdio.h>
#include <string.h>