Sorry for the delay. I've attached a revised patch. 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.
- Dan On Wed, Apr 16, 2014 at 11:18 AM, Jonathan Roelofs < [email protected]> wrote: > Dan, > > 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... > > 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. > > Jon > > > On 4/16/14, 9:29 AM, Dan Albert wrote: > >> The was working because, given __APPLE__, _LIBUNWIND_BUILD_SJLJ_APIS was >> set to >> __arm__, but other ARM targets not using SJ/LJ will fail to compile. >> --- >> include/unwind.h | 2 +- >> src/cxa_exception.cpp | 6 +++--- >> src/cxa_personality.cpp | 2 +- >> 3 files changed, 5 insertions(+), 5 deletions(-) >> >> diff --git a/include/unwind.h b/include/unwind.h >> index c5acd93..50e2d4b 100644 >> --- a/include/unwind.h >> +++ b/include/unwind.h >> @@ -83,7 +83,7 @@ extern "C" { >> // >> // The following are the base functions documented by the C++ ABI >> // >> -#if __arm__ >> +#if _LIBUNWIND_BUILD_SJLJ_APIS >> extern _Unwind_Reason_Code >> _Unwind_SjLj_RaiseException(struct _Unwind_Exception >> *exception_object); >> extern void _Unwind_SjLj_Resume(struct _Unwind_Exception >> *exception_object); >> diff --git a/src/cxa_exception.cpp b/src/cxa_exception.cpp >> index 744dddd..787d8a8 100644 >> --- a/src/cxa_exception.cpp >> +++ b/src/cxa_exception.cpp >> @@ -232,7 +232,7 @@ __cxa_throw(void* thrown_object, std::type_info* >> tinfo, void (*dest)(void*)) >> globals->uncaughtExceptions += 1; // Not atomically, since >> globals are thread-local >> >> exception_header->unwindHeader.exception_cleanup = >> exception_cleanup_func; >> -#if __arm__ >> +#if _LIBUNWIND_BUILD_SJLJ_APIS >> _Unwind_SjLj_RaiseException(&exception_header->unwindHeader); >> #else >> _Unwind_RaiseException(&exception_header->unwindHeader); >> @@ -465,7 +465,7 @@ __cxa_rethrow() >> // nothing >> globals->caughtExceptions = 0; >> } >> -#if __arm__ >> +#if _LIBUNWIND_BUILD_SJLJ_APIS >> _Unwind_SjLj_RaiseException(&exception_header->unwindHeader); >> #else >> _Unwind_RaiseException(&exception_header->unwindHeader); >> @@ -594,7 +594,7 @@ __cxa_rethrow_primary_exception(void* thrown_object) >> setDependentExceptionClass(&dep_exception_header-> >> unwindHeader); >> __cxa_get_globals()->uncaughtExceptions += 1; >> dep_exception_header->unwindHeader.exception_cleanup = >> dependent_exception_cleanup; >> -#if __arm__ >> +#if _LIBUNWIND_BUILD_SJLJ_APIS >> _Unwind_SjLj_RaiseException(&dep_exception_header-> >> unwindHeader); >> #else >> _Unwind_RaiseException(&dep_exception_header->unwindHeader); >> diff --git a/src/cxa_personality.cpp b/src/cxa_personality.cpp >> index 81104b8..32a3127 100644 >> --- a/src/cxa_personality.cpp >> +++ b/src/cxa_personality.cpp >> @@ -838,7 +838,7 @@ _UA_CLEANUP_PHASE >> */ >> >> _Unwind_Reason_Code >> -#if __arm__ >> +#if _LIBUNWIND_BUILD_SJLJ_APIS >> __gxx_personality_sj0 >> #else >> __gxx_personality_v0 >> >> > -- > Jon Roelofs > [email protected] > CodeSourcery / Mentor Embedded >
From 27da6f70ea69a6e2b39089a44ea71822337907f8 Mon Sep 17 00:00:00 2001 From: Dan Albert <[email protected]> Date: Tue, 15 Apr 2014 17:08:14 -0700 Subject: [PATCH] Fixes incorrect #ifs for SJ/LJ exceptions To: [email protected] The was working because, given __APPLE__, _LIBUNWIND_BUILD_SJLJ_APIS was set to __arm__, but other ARM targets not using SJ/LJ will fail to compile. --- include/unwind.h | 2 +- src/cxa_exception.cpp | 6 +++--- src/cxa_personality.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/unwind.h b/include/unwind.h index c5acd93..20634ae 100644 --- a/include/unwind.h +++ b/include/unwind.h @@ -83,7 +83,7 @@ extern "C" { // // The following are the base functions documented by the C++ ABI // -#if __arm__ +#if __USING_SJLJ_EXCEPTIONS__ extern _Unwind_Reason_Code _Unwind_SjLj_RaiseException(struct _Unwind_Exception *exception_object); extern void _Unwind_SjLj_Resume(struct _Unwind_Exception *exception_object); diff --git a/src/cxa_exception.cpp b/src/cxa_exception.cpp index 744dddd..64040fd 100644 --- a/src/cxa_exception.cpp +++ b/src/cxa_exception.cpp @@ -232,7 +232,7 @@ __cxa_throw(void* thrown_object, std::type_info* tinfo, void (*dest)(void*)) globals->uncaughtExceptions += 1; // Not atomically, since globals are thread-local exception_header->unwindHeader.exception_cleanup = exception_cleanup_func; -#if __arm__ +#if __USING_SJLJ_EXCEPTIONS__ _Unwind_SjLj_RaiseException(&exception_header->unwindHeader); #else _Unwind_RaiseException(&exception_header->unwindHeader); @@ -465,7 +465,7 @@ __cxa_rethrow() // nothing globals->caughtExceptions = 0; } -#if __arm__ +#if __USING_SJLJ_EXCEPTIONS__ _Unwind_SjLj_RaiseException(&exception_header->unwindHeader); #else _Unwind_RaiseException(&exception_header->unwindHeader); @@ -594,7 +594,7 @@ __cxa_rethrow_primary_exception(void* thrown_object) setDependentExceptionClass(&dep_exception_header->unwindHeader); __cxa_get_globals()->uncaughtExceptions += 1; dep_exception_header->unwindHeader.exception_cleanup = dependent_exception_cleanup; -#if __arm__ +#if __USING_SJLJ_EXCEPTIONS__ _Unwind_SjLj_RaiseException(&dep_exception_header->unwindHeader); #else _Unwind_RaiseException(&dep_exception_header->unwindHeader); diff --git a/src/cxa_personality.cpp b/src/cxa_personality.cpp index 81104b8..60b7db5 100644 --- a/src/cxa_personality.cpp +++ b/src/cxa_personality.cpp @@ -838,7 +838,7 @@ _UA_CLEANUP_PHASE */ _Unwind_Reason_Code -#if __arm__ +#if __USING_SJLJ_EXCEPTIONS__ __gxx_personality_sj0 #else __gxx_personality_v0 -- 1.9.1.423.g4596e3a
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
