<div dir="ltr">Sorry for the delay. I've attached a revised patch.<div><br></div><div>I opted to switch unwind.h to the more generic definition as well since that seems cleaner. Let me know if there's a good reason to do otherwise.</div>
<div><br></div><div>- Dan</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 16, 2014 at 11:18 AM, Jonathan Roelofs <span dir="ltr"><<a href="mailto:jonathan@codesourcery.com" target="_blank">jonathan@codesourcery.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dan,<br>
<br>
I think that it would be a good idea to keep libc++abi from depending on this particular unwinder, because not all targets are going to use it, and they really are two separate components. Also, I've read rumors that folks want to move said unwinder over to the compiler-rt repository...<br>
<br>
Therefore the guards in cxa_exception.cpp and cxa_personality.cpp should be using __USING_SJLJ_EXCEPTIONS__ instead (which is defined by the compiler when setjmp-longjmp exceptions are being used). In unwind.h, to me it still makes sense to use _LIBUNWIND_BUILD_SJLJ_APIS, but its definition needs to be pulled in from config.h.<br>
<br>
Jon<div><div class="h5"><br>
<br>
On 4/16/14, 9:29 AM, Dan Albert wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The was working because, given __APPLE__, _LIBUNWIND_BUILD_SJLJ_APIS was set to<br>
__arm__, but other ARM targets not using SJ/LJ will fail to compile.<br>
---<br>
include/unwind.h | 2 +-<br>
src/cxa_exception.cpp | 6 +++---<br>
src/cxa_personality.cpp | 2 +-<br>
3 files changed, 5 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/include/unwind.h b/include/unwind.h<br>
index c5acd93..50e2d4b 100644<br>
--- a/include/unwind.h<br>
+++ b/include/unwind.h<br>
@@ -83,7 +83,7 @@ extern "C" {<br>
//<br>
// The following are the base functions documented by the C++ ABI<br>
//<br>
-#if __arm__<br>
+#if _LIBUNWIND_BUILD_SJLJ_APIS<br>
extern _Unwind_Reason_Code<br>
_Unwind_SjLj_RaiseException(<u></u>struct _Unwind_Exception *exception_object);<br>
extern void _Unwind_SjLj_Resume(struct _Unwind_Exception *exception_object);<br>
diff --git a/src/cxa_exception.cpp b/src/cxa_exception.cpp<br>
index 744dddd..787d8a8 100644<br>
--- a/src/cxa_exception.cpp<br>
+++ b/src/cxa_exception.cpp<br>
@@ -232,7 +232,7 @@ __cxa_throw(void* thrown_object, std::type_info* tinfo, void (*dest)(void*))<br>
globals->uncaughtExceptions += 1; // Not atomically, since globals are thread-local<br>
<br>
exception_header-><u></u>unwindHeader.exception_cleanup = exception_cleanup_func;<br>
-#if __arm__<br>
+#if _LIBUNWIND_BUILD_SJLJ_APIS<br>
_Unwind_SjLj_RaiseException(&<u></u>exception_header-><u></u>unwindHeader);<br>
#else<br>
_Unwind_RaiseException(&<u></u>exception_header-><u></u>unwindHeader);<br>
@@ -465,7 +465,7 @@ __cxa_rethrow()<br>
// nothing<br>
globals->caughtExceptions = 0;<br>
}<br>
-#if __arm__<br>
+#if _LIBUNWIND_BUILD_SJLJ_APIS<br>
_Unwind_SjLj_RaiseException(&<u></u>exception_header-><u></u>unwindHeader);<br>
#else<br>
_Unwind_RaiseException(&<u></u>exception_header-><u></u>unwindHeader);<br>
@@ -594,7 +594,7 @@ __cxa_rethrow_primary_<u></u>exception(void* thrown_object)<br>
setDependentExceptionClass(&<u></u>dep_exception_header-><u></u>unwindHeader);<br>
__cxa_get_globals()-><u></u>uncaughtExceptions += 1;<br>
dep_exception_header-><u></u>unwindHeader.exception_cleanup = dependent_exception_cleanup;<br>
-#if __arm__<br>
+#if _LIBUNWIND_BUILD_SJLJ_APIS<br>
_Unwind_SjLj_RaiseException(&<u></u>dep_exception_header-><u></u>unwindHeader);<br>
#else<br>
_Unwind_RaiseException(&dep_<u></u>exception_header-><u></u>unwindHeader);<br>
diff --git a/src/cxa_personality.cpp b/src/cxa_personality.cpp<br>
index 81104b8..32a3127 100644<br>
--- a/src/cxa_personality.cpp<br>
+++ b/src/cxa_personality.cpp<br>
@@ -838,7 +838,7 @@ _UA_CLEANUP_PHASE<br>
*/<br>
<br>
_Unwind_Reason_Code<br>
-#if __arm__<br>
+#if _LIBUNWIND_BUILD_SJLJ_APIS<br>
__gxx_personality_sj0<br>
#else<br>
__gxx_personality_v0<br>
<br>
</blockquote>
<br>
-- <br></div></div>
Jon Roelofs<br>
<a href="mailto:jonathan@codesourcery.com" target="_blank">jonathan@codesourcery.com</a><br>
CodeSourcery / Mentor Embedded<br>
</blockquote></div><br></div>