summaryrefslogtreecommitdiffstats
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
commitaf99cd41745093e753cfe59d81269d84a588fd9d (patch)
tree24ad032ff1531498ea16b4dcd7230f7f4a77aef9
parent428db150d16f671d9e99726a5068c6613496e799 (diff)
downloadbcm5719-llvm-af99cd41745093e753cfe59d81269d84a588fd9d.tar.gz
bcm5719-llvm-af99cd41745093e753cfe59d81269d84a588fd9d.zip
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
-rw-r--r--libcxxabi/src/cxa_personality.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/libcxxabi/src/cxa_personality.cpp b/libcxxabi/src/cxa_personality.cpp
index 6eb866e2165..63adf31f85a 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);
}
/*
OpenPOWER on IntegriCloud