summaryrefslogtreecommitdiffstats
path: root/libcxxabi
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2012-02-29 22:14:19 +0000
committerHoward Hinnant <hhinnant@apple.com>2012-02-29 22:14:19 +0000
commit20d6c14c887aba175c66c82793eccb456e29a23a (patch)
treef5a016ec8cc63c7c94d9176e9c0dec429f76476a /libcxxabi
parent3f4b23933f91cdaf8340e278fe7468cdd26f1eee (diff)
downloadbcm5719-llvm-20d6c14c887aba175c66c82793eccb456e29a23a.tar.gz
bcm5719-llvm-20d6c14c887aba175c66c82793eccb456e29a23a.zip
First attempt at arm support.
llvm-svn: 151765
Diffstat (limited to 'libcxxabi')
-rw-r--r--libcxxabi/src/cxa_exception.cpp4
-rw-r--r--libcxxabi/src/cxa_personality.cpp55
2 files changed, 51 insertions, 8 deletions
diff --git a/libcxxabi/src/cxa_exception.cpp b/libcxxabi/src/cxa_exception.cpp
index b866f9e4df8..1c36299395b 100644
--- a/libcxxabi/src/cxa_exception.cpp
+++ b/libcxxabi/src/cxa_exception.cpp
@@ -466,9 +466,9 @@ __cxa_rethrow()
globals->caughtExceptions = 0;
}
#if __arm__
- (void) _Unwind_SjLj_Resume_or_Rethrow(&exception_header->unwindHeader);
+ _Unwind_SjLj_RaiseException(&exception_header->unwindHeader);
#else
- (void)_Unwind_RaiseException(&exception_header->unwindHeader);
+ _Unwind_RaiseException(&exception_header->unwindHeader);
#endif
// If we get here, some kind of unwinding error has occurred.
diff --git a/libcxxabi/src/cxa_personality.cpp b/libcxxabi/src/cxa_personality.cpp
index e49278c0ba6..8938a725106 100644
--- a/libcxxabi/src/cxa_personality.cpp
+++ b/libcxxabi/src/cxa_personality.cpp
@@ -48,19 +48,36 @@
| callSiteEncoding | (char) | Encoding for Call Site Table |
+------------------+--+-----+-----+------------------------+--------------------------+
| callSiteTableLength | (ULEB128) | Call Site Table length, used to find Action table |
-+---------------------+-----------+------------------------------------------------+--+
-| Beginning of Call Site Table If the current ip lies within the |
++---------------------+-----------+---------------------------------------------------+
+#if !__arm__
++---------------------+-----------+------------------------------------------------+
+| Beginning of Call Site Table The current ip lies within the |
| ... (start, length) range of one of these |
-| call sites, there may be action needed. |
+| call sites. There may be action needed. |
| +-------------+---------------------------------+------------------------------+ |
| | start | (encoded with callSiteEncoding) | offset relative to funcStart | |
-| | length | (encoded with callSiteEncoding) | lenght of code fragment | |
+| | length | (encoded with callSiteEncoding) | length of code fragment | |
| | landingPad | (encoded with callSiteEncoding) | offset relative to lpStart | |
| | actionEntry | (ULEB128) | Action Table Index 1-based | |
| | | | actionEntry == 0 -> cleanup | |
| +-------------+---------------------------------+------------------------------+ |
| ... |
-+---------------------------------------------------------------------+------------+
++----------------------------------------------------------------------------------+
+#else // __arm_
++---------------------+-----------+------------------------------------------------+
+| Beginning of Call Site Table The current ip is a 1-based index into |
+| ... this table. Or it is -1 meaning no |
+| action is needed. Or it is 0 meaning |
+| terminate. |
+| +-------------+---------------------------------+------------------------------+ |
+| | landingPad | (ULEB128) | offset relative to lpStart | |
+| | actionEntry | (ULEB128) | Action Table Index 1-based | |
+| | | | actionEntry == 0 -> cleanup | |
+| +-------------+---------------------------------+------------------------------+ |
+| ... |
++----------------------------------------------------------------------------------+
+#endif // __arm_
++---------------------------------------------------------------------+
| Beginning of Action Table ttypeIndex == 0 : cleanup |
| ... ttypeIndex > 0 : catch |
| ttypeIndex < 0 : exception spec |
@@ -477,7 +494,19 @@ scan_eh_tab(scan_results& results, _Unwind_Action actions, bool native_exception
// Get beginning current frame's code (as defined by the
// emitted dwarf code)
uintptr_t funcStart = _Unwind_GetRegionStart(context);
+#if __arm__
+ if (ip == uintptr_t(-1))
+ {
+ // no action
+ results.reason = _URC_CONTINUE_UNWIND;
+ return;
+ }
+ else if (ip == 0)
+ call_terminate(native_exception, unwind_exception);
+ // ip is 1-based index into call site table
+#else // __arm__
uintptr_t ipOffset = ip - funcStart;
+#endif // __arm__
const uint8_t* classInfo = NULL;
// Note: See JITDwarfEmitter::EmitExceptionTable(...) for corresponding
// dwarf emission
@@ -506,6 +535,7 @@ scan_eh_tab(scan_results& results, _Unwind_Action actions, bool native_exception
while (true)
{
// There is one entry per call site.
+#if !__arm__
// The call sites are non-overlapping in [start, start+length)
// The call sites are ordered in increasing value of start
uintptr_t start = readEncodedPointer(&callSitePtr, callSiteEncoding);
@@ -513,6 +543,12 @@ scan_eh_tab(scan_results& results, _Unwind_Action actions, bool native_exception
uintptr_t landingPad = readEncodedPointer(&callSitePtr, callSiteEncoding);
uintptr_t actionEntry = readULEB128(&callSitePtr);
if ((start <= ipOffset) && (ipOffset < (start + length)))
+#else // __arm__
+ // ip is 1-based index into this table
+ uintptr_t landingPad = readULEB128(&callSitePtr);
+ uintptr_t actionEntry = readULEB128(&callSitePtr);
+ if (--ip == 0)
+#endif // __arm__
{
// Found the call site containing ip.
if (landingPad == 0)
@@ -713,6 +749,7 @@ scan_eh_tab(scan_results& results, _Unwind_Action actions, bool native_exception
action += actionOffset;
} // there is no break out of this loop, only return
}
+#if !__arm__
else if (ipOffset < start)
{
// There is no call site for this ip
@@ -720,6 +757,7 @@ scan_eh_tab(scan_results& results, _Unwind_Action actions, bool native_exception
// Possible stack corruption.
call_terminate(native_exception, unwind_exception);
}
+#endif // !__arm__
} // there is no break out of this loop, only return
}
@@ -772,7 +810,12 @@ _UA_CLEANUP_PHASE
*/
_Unwind_Reason_Code
-__gxx_personality_v0(int version, _Unwind_Action actions, uint64_t exceptionClass,
+#if __arm__
+__gxx_personality_sj0
+#else
+__gxx_personality_v0
+#endif
+ (int version, _Unwind_Action actions, uint64_t exceptionClass,
_Unwind_Exception* unwind_exception, _Unwind_Context* context)
{
if (version != 1 || unwind_exception == 0 || context == 0)
OpenPOWER on IntegriCloud