[libcxxabi] r248108 - EH: fix register usage for SjLj
Saleem Abdulrasool via cfe-commits
cfe-commits at lists.llvm.org
Sat Sep 19 19:08:31 PDT 2015
Author: compnerd
Date: Sat Sep 19 21:08:31 2015
New Revision: 248108
URL: http://llvm.org/viewvc/llvm-project?rev=248108&view=rev
Log:
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.
Modified:
libcxxabi/trunk/src/cxa_personality.cpp
Modified: libcxxabi/trunk/src/cxa_personality.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_personality.cpp?rev=248108&r1=248107&r2=248108&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_personality.cpp (original)
+++ libcxxabi/trunk/src/cxa_personality.cpp Sat Sep 19 21:08:31 2015
@@ -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);
}
/*
More information about the cfe-commits
mailing list