Index: include/unwind.h =================================================================== --- include/unwind.h +++ include/unwind.h @@ -23,6 +23,18 @@ #define LIBUNWIND_UNAVAIL #endif +#if defined(__USING_SJLJ_EXCEPTIONS__) +# define LIBUNWIND_SJLJ 1 +#else +# define LIBUNWIND_SJLJ 0 +#endif + +#if __arm__ && !LIBUNWIND_SJLJ +# define LIBUNWIND_ARM_EHABI 1 +#else +# define LIBUNWIND_ARM_EHABI 0 +#endif + typedef enum { _URC_NO_REASON = 0, _URC_FOREIGN_EXCEPTION_CAUGHT = 1, @@ -83,7 +95,7 @@ // // The following are the base functions documented by the C++ ABI // -#if __arm__ +#if LIBUNWIND_SJLJ extern _Unwind_Reason_Code _Unwind_SjLj_RaiseException(struct _Unwind_Exception *exception_object); extern void _Unwind_SjLj_Resume(struct _Unwind_Exception *exception_object); @@ -101,7 +113,7 @@ extern uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context *context); extern uintptr_t _Unwind_GetLanguageSpecificData(struct _Unwind_Context *context); -#if __arm__ +#if LIBUNWIND_SJLJ extern _Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind(struct _Unwind_Exception *exception_object, _Unwind_Stop_Fn stop, void *stop_parameter); @@ -111,7 +123,7 @@ _Unwind_Stop_Fn stop, void *stop_parameter); #endif -#if __arm__ +#if LIBUNWIND_SJLJ typedef struct _Unwind_FunctionContext *_Unwind_FunctionContext_t; extern void _Unwind_SjLj_Register(_Unwind_FunctionContext_t fc); extern void _Unwind_SjLj_Unregister(_Unwind_FunctionContext_t fc); @@ -124,7 +136,7 @@ // // called by __cxa_rethrow(). // -#if __arm__ +#if LIBUNWIND_SJLJ extern _Unwind_Reason_Code _Unwind_SjLj_Resume_or_Rethrow(struct _Unwind_Exception *exception_object); #else Index: src/cxa_exception.cpp =================================================================== --- src/cxa_exception.cpp +++ src/cxa_exception.cpp @@ -232,7 +232,7 @@ globals->uncaughtExceptions += 1; // Not atomically, since globals are thread-local exception_header->unwindHeader.exception_cleanup = exception_cleanup_func; -#if __arm__ +#if LIBUNWIND_SJLJ _Unwind_SjLj_RaiseException(&exception_header->unwindHeader); #else _Unwind_RaiseException(&exception_header->unwindHeader); @@ -465,7 +465,7 @@ // nothing globals->caughtExceptions = 0; } -#if __arm__ +#if LIBUNWIND_SJLJ _Unwind_SjLj_RaiseException(&exception_header->unwindHeader); #else _Unwind_RaiseException(&exception_header->unwindHeader); @@ -594,7 +594,7 @@ setDependentExceptionClass(&dep_exception_header->unwindHeader); __cxa_get_globals()->uncaughtExceptions += 1; dep_exception_header->unwindHeader.exception_cleanup = dependent_exception_cleanup; -#if __arm__ +#if LIBUNWIND_SJLJ _Unwind_SjLj_RaiseException(&dep_exception_header->unwindHeader); #else _Unwind_RaiseException(&dep_exception_header->unwindHeader);