summaryrefslogtreecommitdiffstats
path: root/contrib/libstdc++/libsupc++/unwind-cxx.h
diff options
context:
space:
mode:
authorandrew <andrew@FreeBSD.org>2013-02-04 09:28:36 +0000
committerandrew <andrew@FreeBSD.org>2013-02-04 09:28:36 +0000
commit897e2fb50579aef227fdadb07059bf19f3bbf36c (patch)
treec72214dda9049bdf2f7953b44a83f0f78dea4744 /contrib/libstdc++/libsupc++/unwind-cxx.h
parenta191badca4be9f93dc348a040fa425d66aef3a25 (diff)
downloadFreeBSD-src-897e2fb50579aef227fdadb07059bf19f3bbf36c.zip
FreeBSD-src-897e2fb50579aef227fdadb07059bf19f3bbf36c.tar.gz
Allow the unwind functions int libgcc_s to interact correctly with libthr.
_Unwind_ForcedUnwind in libgcc_s takes as one of it's parameters a stop function to tell it when to stop unwinding. One of the stop function's parameters is a _Unwind_Exception_Class. On most architectures this is an int64_t, however on ARM EABI the gcc developers have made this a char array with 8 items. While both of these take the same space they are passed into the stop function differently, an int64_t is passed in in registers r2 and r3, while the char[8] is passed in as a pointer to the first item in register r2. Because libthr expects the value to be an int64_t we would get incorrect results when it passes a function that take an int64_t but libgcc passes in a pointer to a char array including crashing. The fix is to update libgcc_s to make it pass an int64_t to the stop function and to libstdc++ as it expects _Unwind_Exception_Class to be an array.
Diffstat (limited to 'contrib/libstdc++/libsupc++/unwind-cxx.h')
-rw-r--r--contrib/libstdc++/libsupc++/unwind-cxx.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/contrib/libstdc++/libsupc++/unwind-cxx.h b/contrib/libstdc++/libsupc++/unwind-cxx.h
index c5636556..523c054 100644
--- a/contrib/libstdc++/libsupc++/unwind-cxx.h
+++ b/contrib/libstdc++/libsupc++/unwind-cxx.h
@@ -173,7 +173,7 @@ __get_exception_header_from_ue (_Unwind_Exception *exc)
return reinterpret_cast<__cxa_exception *>(exc + 1) - 1;
}
-#ifdef __ARM_EABI_UNWINDER__
+#if defined(__ARM_EABI_UNWINDER__) && !defined(__FreeBSD__)
static inline bool
__is_gxx_exception_class(_Unwind_Exception_Class c)
{
@@ -200,13 +200,7 @@ __GXX_INIT_EXCEPTION_CLASS(_Unwind_Exception_Class c)
c[6] = '+';
c[7] = '\0';
}
-
-static inline void*
-__gxx_caught_object(_Unwind_Exception* eo)
-{
- return (void*)eo->barrier_cache.bitpattern[0];
-}
-#else // !__ARM_EABI_UNWINDER__
+#else // !__ARM_EABI_UNWINDER__ || __FreeBSD__
// This is the exception class we report -- "GNUCC++\0".
const _Unwind_Exception_Class __gxx_exception_class
= ((((((((_Unwind_Exception_Class) 'G'
@@ -223,8 +217,16 @@ __is_gxx_exception_class(_Unwind_Exception_Class c)
{
return c == __gxx_exception_class;
}
-
#define __GXX_INIT_EXCEPTION_CLASS(c) c = __gxx_exception_class
+#endif
+
+#ifdef __ARM_EABI_UNWINDER__
+static inline void*
+__gxx_caught_object(_Unwind_Exception* eo)
+{
+ return (void*)eo->barrier_cache.bitpattern[0];
+}
+#else // !__ARM_EABI_UNWINDER__
// GNU C++ personality routine, Version 0.
extern "C" _Unwind_Reason_Code __gxx_personality_v0
OpenPOWER on IntegriCloud