}
}
-#ifdef __LP64__
-/**
- * There's an ABI bug in __cxa_exception: unwindHeader requires 16-byte
- * alignment but it was broken by the addition of the referenceCount.
- * The unwindHeader is at offset 0x58 in __cxa_exception. In order to keep
- * compatibility with consumers of the broken __cxa_exception, explicitly add
- * padding on allocation (and account for it on free).
- */
-static const int exception_alignment_padding = 8;
-#else
-static const int exception_alignment_padding = 0;
-#endif
-
/**
* Allocates an exception structure. Returns a pointer to the space that can
* be used to store an object of thrown_size bytes. This function will use an
*/
extern "C" void *__cxa_allocate_exception(size_t thrown_size)
{
- size_t size = exception_alignment_padding + sizeof(__cxa_exception) +
- thrown_size;
+ size_t size = thrown_size + sizeof(__cxa_exception);
char *buffer = alloc_or_die(size);
- return buffer + exception_alignment_padding + sizeof(__cxa_exception);
+ return buffer+sizeof(__cxa_exception);
}
extern "C" void *__cxa_allocate_dependent_exception(void)
{
- size_t size = exception_alignment_padding +
- sizeof(__cxa_dependent_exception);
+ size_t size = sizeof(__cxa_dependent_exception);
char *buffer = alloc_or_die(size);
- return buffer + exception_alignment_padding +
- sizeof(__cxa_dependent_exception);
+ return buffer+sizeof(__cxa_dependent_exception);
}
/**
}
}
- free_exception(reinterpret_cast<char*>(ex) -
- exception_alignment_padding);
+ free_exception(reinterpret_cast<char*>(ex));
}
static void releaseException(__cxa_exception *exception)
{
releaseException(realExceptionFromException(reinterpret_cast<__cxa_exception*>(ex)));
}
- free_exception(reinterpret_cast<char*>(ex) -
- exception_alignment_padding);
+ free_exception(reinterpret_cast<char*>(ex));
}
/**
{
uint64_t exception_class;
_Unwind_Exception_Cleanup_Fn exception_cleanup;
- unsigned long private_1;
- unsigned long private_2;
- } ;
+ uintptr_t private_1;
+ uintptr_t private_2;
+#if __SIZEOF_POINTER__ == 4
+ uint32_t reserved[3];
+#endif
+ } __attribute__((__aligned__));
extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *);
extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *,