summaryrefslogtreecommitdiff
path: root/src/cxa_personality.cpp
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2015-09-20 02:08:31 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2015-09-20 02:08:31 +0000
commit6bf23547295cfd6cd373e56adcb6f69e28b5aaaf (patch)
tree2aef961db44500f8fe3e6081a5c54bc4c66c523a /src/cxa_personality.cpp
parent7aff420fb2b10cbad3339f45fbdb924fa21d76d7 (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. git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@248108 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'src/cxa_personality.cpp')
-rw-r--r--src/cxa_personality.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/cxa_personality.cpp b/src/cxa_personality.cpp
index 6eb866e..63adf31 100644
--- a/src/cxa_personality.cpp
+++ b/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);
}
/*