diff options
author | Vedant Kumar <vsk@apple.com> | 2017-09-19 06:46:36 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2017-09-19 06:46:36 +0000 |
commit | c85c0b5fe40d3204e454b7452df80a524dda1823 (patch) | |
tree | d6884d86215e178fa83207a6df2507871520b019 /lib/ubsan_minimal/ubsan_minimal_handlers.cc | |
parent | 7bd22ca122d1a8289eda6962827e9ed1c1786577 (diff) |
[ubsan-minimal] Make the interface more compatible with RTUBSan
This eliminates a few inconsistencies between the symbol sets exported
by RTUBSan and RTUBSan_minimal:
* Handlers for nonnull_return were missing from the minimal RT, and
are now added in.
* The minimal runtime exported recoverable handlers for
builtin_unreachable and missing_return. These are not supposed to
exist, and are now removed.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313614 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ubsan_minimal/ubsan_minimal_handlers.cc')
-rw-r--r-- | lib/ubsan_minimal/ubsan_minimal_handlers.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/ubsan_minimal/ubsan_minimal_handlers.cc b/lib/ubsan_minimal/ubsan_minimal_handlers.cc index 97f7ae7b2..dac127bc2 100644 --- a/lib/ubsan_minimal/ubsan_minimal_handlers.cc +++ b/lib/ubsan_minimal/ubsan_minimal_handlers.cc @@ -57,17 +57,22 @@ static void abort_with_message(const char *) { abort(); } // FIXME: add caller pc to the error message (possibly as "ubsan: error-type // @1234ABCD"). -#define HANDLER(name, msg) \ +#define HANDLER_RECOVER(name, msg) \ INTERFACE void __ubsan_handle_##name##_minimal() { \ if (!report_this_error(__builtin_return_address(0))) return; \ message("ubsan: " msg "\n"); \ - } \ - \ + } + +#define HANDLER_NORECOVER(name, msg) \ INTERFACE void __ubsan_handle_##name##_minimal_abort() { \ message("ubsan: " msg "\n"); \ abort_with_message("ubsan: " msg); \ } +#define HANDLER(name, msg) \ + HANDLER_RECOVER(name, msg) \ + HANDLER_NORECOVER(name, msg) + HANDLER(type_mismatch, "type-mismatch") HANDLER(add_overflow, "add-overflow") HANDLER(sub_overflow, "sub-overflow") @@ -76,14 +81,16 @@ HANDLER(negate_overflow, "negate-overflow") HANDLER(divrem_overflow, "divrem-overflow") HANDLER(shift_out_of_bounds, "shift-out-of-bounds") HANDLER(out_of_bounds, "out-of-bounds") -HANDLER(builtin_unreachable, "builtin-unreachable") -HANDLER(missing_return, "missing-return") +HANDLER_RECOVER(builtin_unreachable, "builtin-unreachable") +HANDLER_RECOVER(missing_return, "missing-return") HANDLER(vla_bound_not_positive, "vla-bound-not-positive") HANDLER(float_cast_overflow, "float-cast-overflow") HANDLER(load_invalid_value, "load-invalid-value") HANDLER(invalid_builtin, "invalid-builtin") HANDLER(function_type_mismatch, "function-type-mismatch") HANDLER(nonnull_arg, "nonnull-arg") +HANDLER(nonnull_return, "nonnull-return") HANDLER(nullability_arg, "nullability-arg") +HANDLER(nullability_return, "nullability-return") HANDLER(pointer_overflow, "pointer-overflow") HANDLER(cfi_check_fail, "cfi-check-fail") |