From 42b78dba9b1dbd9e078b9d16430b712ae6b11ce1 Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Fri, 25 Dec 2015 14:57:05 +0000 Subject: [PATCH] (Hopefully) fix C++ exception interop on ARM. --- dwarf_eh.h | 4 ++++ eh_personality.c | 7 ++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dwarf_eh.h b/dwarf_eh.h index 56cb2801..e06a5855 100644 --- a/dwarf_eh.h +++ b/dwarf_eh.h @@ -258,6 +258,10 @@ static inline struct dwarf_eh_lsda parse_lsda(struct _Unwind_Context *context, u //lsda.type_table = (uintptr_t*)(data + v); } +#if defined(__arm__) && !defined(__ARM_DWARF_EH__) + lsda.type_table_encoding = (DW_EH_PE_pcrel | DW_EH_PE_indirect); +#endif + lsda.callsite_encoding = (enum dwarf_data_encoding)(*(data++)); // Action table is immediately after the call site table diff --git a/eh_personality.c b/eh_personality.c index e5abf5a4..31aecc16 100644 --- a/eh_personality.c +++ b/eh_personality.c @@ -486,8 +486,7 @@ BEGIN_PERSONALITY_FUNCTION(__gnustep_objc_personality_v0) return internal_objc_personality(version, actions, exceptionClass, exceptionObject, context, YES); } -// FIXME! -#ifndef __arm__ + BEGIN_PERSONALITY_FUNCTION(__gnustep_objcxx_personality_v0) if (exceptionClass == objc_exception_class) { @@ -497,17 +496,15 @@ BEGIN_PERSONALITY_FUNCTION(__gnustep_objcxx_personality_v0) id *newEx = __cxa_allocate_exception(sizeof(id)); *newEx = ex->object; ex->cxx_exception = objc_init_cxx_exception(newEx); + memcpy(ex->cxx_exception, exceptionObject, sizeof(struct _Unwind_Exception)); ex->cxx_exception->exception_class = cxx_exception_class; ex->cxx_exception->exception_cleanup = cleanup; - ex->cxx_exception->private_1 = exceptionObject->private_1; - ex->cxx_exception->private_2 = exceptionObject->private_2; } exceptionObject = ex->cxx_exception; exceptionClass = cxx_exception_class; } return CALL_PERSONALITY_FUNCTION(__gxx_personality_v0); } -#endif // Weak references to C++ runtime functions. We don't bother testing that // these are 0 before calling them, because if they are not resolved then we