diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2015-09-20 05:08:31 +0300 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2015-09-20 05:08:31 +0300 |
commit | af99cd41745093e753cfe59d81269d84a588fd9d (patch) | |
tree | 24ad032ff1531498ea16b4dcd7230f7f4a77aef9 /libcxxabi/src/cxa_personality.cpp | |
parent | 428db150d16f671d9e99726a5068c6613496e799 (diff) |
EH: fix register usage for SjLj
When using SjLj EH, do not use __builtin_eh_return_regno, map directly to the
ID. This would work on some targets, particularly those where the non-SjLj EH
personality used the same register mapping (0 -> 0, 1 -> 1). However, this is
not guaranteed. Avoiding the use of the builtin enables the use of libc++ with
SjLj EH on all targets.
llvm-svn: 248108
Diffstat (limited to 'libcxxabi/src/cxa_personality.cpp')
-rw-r--r-- | libcxxabi/src/cxa_personality.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libcxxabi/src/cxa_personality.cpp b/libcxxabi/src/cxa_personality.cpp index 6eb866e21656..63adf31f85ab 100644 --- a/libcxxabi/src/cxa_personality.cpp +++ b/libcxxabi/src/cxa_personality.cpp @@ -514,11 +514,14 @@ void set_registers(_Unwind_Exception* unwind_exception, _Unwind_Context* context, const scan_results& results) { - _Unwind_SetGR(context, __builtin_eh_return_data_regno(0), - reinterpret_cast<uintptr_t>(unwind_exception)); - _Unwind_SetGR(context, __builtin_eh_return_data_regno(1), - static_cast<uintptr_t>(results.ttypeIndex)); - _Unwind_SetIP(context, results.landingPad); +#if defined(__USING_SJLJ_EXCEPTIONS__) +#define __builtin_eh_return_data_regno(regno) regno +#endif + _Unwind_SetGR(context, __builtin_eh_return_data_regno(0), + reinterpret_cast<uintptr_t>(unwind_exception)); + _Unwind_SetGR(context, __builtin_eh_return_data_regno(1), + static_cast<uintptr_t>(results.ttypeIndex)); + _Unwind_SetIP(context, results.landingPad); } /* |