[PATCH] D15781: [compiler-rt] Add support for ARM EHABI to gcc_personality_v0.
Timon Van Overveldt via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 4 21:58:48 PST 2016
timonvo updated this revision to Diff 43962.
timonvo added a comment.
Herald added subscribers: rengolin, aemerson.
Updated the diff to address logan's comments.
Note that I've also got another review out (http://reviews.llvm.org/D15883) to add the various constants this patch needs to clang's unwind.h header, as logan asked.
http://reviews.llvm.org/D15781
Files:
lib/builtins/gcc_personality_v0.c
Index: lib/builtins/gcc_personality_v0.c
===================================================================
--- lib/builtins/gcc_personality_v0.c
+++ lib/builtins/gcc_personality_v0.c
@@ -131,6 +131,24 @@
return result;
}
+#if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \
+ !defined(__ARM_DWARF_EH__)
+#define USING_ARM_EHABI 1
+_Unwind_Reason_Code __gnu_unwind_frame(struct _Unwind_Exception*,
+ struct _Unwind_Context*);
+/*
+ * On ARM EHABI the personality routine is responsible for actually unwinding
+ * a single stack frame before returning (ARM EHABI Sec. 6.1).
+ */
+static inline _Unwind_Reason_Code continueUnwind(
+ struct _Unwind_Exception* exceptionObject,
+ struct _Unwind_Context* context) {
+ if (__gnu_unwind_frame(exceptionObject, context) != _URC_OK) {
+ return _URC_FAILURE;
+ }
+ return _URC_CONTINUE_UNWIND;
+}
+#endif
/*
* The C compiler makes references to __gcc_personality_v0 in
@@ -147,6 +165,12 @@
__gcc_personality_sj0(int version, _Unwind_Action actions,
uint64_t exceptionClass, struct _Unwind_Exception* exceptionObject,
struct _Unwind_Context *context)
+#elif USING_ARM_EHABI
+/* The ARM EHABI personality routine has a different signature. */
+COMPILER_RT_ABI _Unwind_Reason_Code
+__gcc_personality_v0(_Unwind_State state,
+ struct _Unwind_Exception* exceptionObject,
+ struct _Unwind_Context* context)
#else
COMPILER_RT_ABI _Unwind_Reason_Code
__gcc_personality_v0(int version, _Unwind_Action actions,
@@ -156,13 +180,22 @@
{
/* Since C does not have catch clauses, there is nothing to do during */
/* phase 1 (the search phase). */
+#if USING_ARM_EHABI
+ if ( (state & _US_ACTION_MASK) == _US_VIRTUAL_UNWIND_FRAME )
+ return continueUnwind(exceptionObject, context);
+#else
if ( actions & _UA_SEARCH_PHASE )
return _URC_CONTINUE_UNWIND;
-
+#endif
+
/* There is nothing to do if there is no LSDA for this frame. */
const uint8_t* lsda = (uint8_t*)_Unwind_GetLanguageSpecificData(context);
if ( lsda == (uint8_t*) 0 )
+#if USING_ARM_EHABI
+ return continueUnwind(exceptionObject, context);
+#else
return _URC_CONTINUE_UNWIND;
+#endif
uintptr_t pc = _Unwind_GetIP(context)-1;
uintptr_t funcStart = _Unwind_GetRegionStart(context);
@@ -205,6 +238,10 @@
}
/* No landing pad found, continue unwinding. */
+#if USING_ARM_EHABI
+ return continueUnwind(exceptionObject, context);
+#else
return _URC_CONTINUE_UNWIND;
+#endif
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15781.43962.patch
Type: text/x-patch
Size: 2571 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160105/3d5360fe/attachment.bin>
More information about the llvm-commits
mailing list