summaryrefslogtreecommitdiff
path: root/lib/ubsan/ubsan_handlers.cc
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2013-10-20 21:29:46 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2013-10-20 21:29:46 +0000
commit9b5f95f5fe1a24be4dfb7436b64cb0e0f8c00535 (patch)
treefbae7a194cba4874ec6393403f354075d5b50914 /lib/ubsan/ubsan_handlers.cc
parent49d29ed950f9e309a7b755b2a0601ed483ce3ade (diff)
Runtime support for the indirect function call checker.
Differential Revision: http://llvm-reviews.chandlerc.com/D1339 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193060 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ubsan/ubsan_handlers.cc')
-rw-r--r--lib/ubsan/ubsan_handlers.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/ubsan/ubsan_handlers.cc b/lib/ubsan/ubsan_handlers.cc
index 5ed0d5923..d55643143 100644
--- a/lib/ubsan/ubsan_handlers.cc
+++ b/lib/ubsan/ubsan_handlers.cc
@@ -259,3 +259,23 @@ void __ubsan::__ubsan_handle_load_invalid_value_abort(InvalidValueData *Data,
__ubsan_handle_load_invalid_value(Data, Val);
Die();
}
+
+void __ubsan::__ubsan_handle_function_type_mismatch(
+ FunctionTypeMismatchData *Data,
+ ValueHandle Function) {
+ const char *FName = "(unknown)";
+
+ Location Loc = getFunctionLocation(Function, &FName);
+
+ Diag(Data->Loc, DL_Error,
+ "call to function %0 through pointer to incorrect function type %1")
+ << FName << Data->Type;
+ Diag(Loc, DL_Note, "%0 defined here") << FName;
+}
+
+void __ubsan::__ubsan_handle_function_type_mismatch_abort(
+ FunctionTypeMismatchData *Data,
+ ValueHandle Function) {
+ __ubsan_handle_function_type_mismatch(Data, Function);
+ Die();
+}