Skip to content

Commit

Permalink
(Hopefully) fix C++ exception interop on ARM.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidchisnall committed Dec 25, 2015
1 parent 77df8d3 commit 42b78db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 4 additions & 0 deletions dwarf_eh.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 2 additions & 5 deletions eh_personality.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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
Expand Down

0 comments on commit 42b78db

Please sign in to comment.