@@ -22,10 +22,12 @@ #ifdef HAVE_SEH_EXCEPTIONS # include #endif #import "runtime.h" + +#import "macros.h" #if defined(HAVE_DWARF_EXCEPTIONS) # define PERSONALITY __gnu_objc_personality_v0 #elif defined(HAVE_SJLJ_EXCEPTIONS) # define PERSONALITY __gnu_objc_personality_sj0 @@ -84,11 +86,11 @@ struct objc_exception { struct _Unwind_Exception { uint64_t class; void (*cleanup)(_Unwind_Reason_Code, struct _Unwind_Exception*); -#if defined(__arm__) || defined(__ARM__) +#ifdef OF_ARM /* From "Exception Handling ABI for the ARM(R) Architecture" */ struct { uint32_t reserved1, reserved2, reserved3, reserved4; uint32_t reserved; } unwinder_cache; @@ -117,11 +119,11 @@ uint64_t private1, private2; # endif #endif } exception; id object; -#if !defined(__arm__) && !defined(__ARM__) +#ifndef OF_ARM uintptr_t landingpad; intptr_t filter; #endif }; @@ -139,11 +141,11 @@ extern void* _Unwind_GetLanguageSpecificData(struct _Unwind_Context*); extern uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context*); extern uintptr_t _Unwind_GetDataRelBase(struct _Unwind_Context*); extern uintptr_t _Unwind_GetTextRelBase(struct _Unwind_Context*); -#if defined(__arm__) || defined(__ARM__) +#ifdef OF_ARM extern _Unwind_Reason_Code __gnu_unwind_frame(struct _Unwind_Exception*, struct _Unwind_Context*); extern int _Unwind_VRS_Get(struct _Unwind_Context*, int, uint32_t, int, void*); extern int _Unwind_VRS_Set(struct _Unwind_Context*, int, uint32_t, int, void*); @@ -312,11 +314,11 @@ #undef READ return value; } -#if !defined(__arm__) && !defined(__ARM__) +#ifndef OF_ARM static uint64_t resolve_value(uint64_t value, uint8_t enc, const uint8_t *start, uint64_t base) { if (value == 0) return 0; @@ -459,17 +461,17 @@ Class class; const char *className; uintptr_t c; const uint8_t *tmp; -#if defined(__arm__) || defined(__ARM__) +#ifdef OF_ARM tmp = lsda->typestable - (filter * 4); c = *(uintptr_t*)(void*)tmp; if (c != 0) { c += (uintptr_t)tmp; -# if defined(__linux__) || defined(__NetBSD__) +# if defined(OF_LINUX) || defined(OF_NETBSD) c = *(uintptr_t*)c; # endif } #else uintptr_t i; @@ -500,11 +502,11 @@ } while (displacement != 0); return 0; } -#if defined(__arm__) || defined(__ARM__) +#ifdef OF_ARM _Unwind_Reason_Code PERSONALITY(uint32_t state, struct _Unwind_Exception *ex, struct _Unwind_Context *ctx) { int version = 1; @@ -556,11 +558,11 @@ * For handlers, reg #0 must be the exception's object and reg * #1 the filter. */ _Unwind_SetGR(ctx, __builtin_eh_return_data_regno(0), (uintptr_t)e->object); -#if defined(__arm__) || defined(__ARM__) +#ifdef OF_ARM _Unwind_SetGR(ctx, __builtin_eh_return_data_regno(1), ex->barrier_cache.bitpattern[1]); _Unwind_SetIP(ctx, ex->barrier_cache.bitpattern[3]); #else _Unwind_SetGR(ctx, __builtin_eh_return_data_regno(1), @@ -594,11 +596,11 @@ if (actions & _UA_SEARCH_PHASE) { if (!(found & HANDLER_FOUND) || foreign) CONTINUE_UNWIND; /* Cache it so we don't have to search it again in phase 2 */ -#if defined(__arm__) || defined(__ARM__) +#ifdef OF_ARM ex->barrier_cache.sp = _Unwind_GetGR(ctx, 13); ex->barrier_cache.bitpattern[1] = filter; ex->barrier_cache.bitpattern[3] = landingpad; #else e->landingpad = landingpad;