D Exception handling broken on aarch64 (with LDC?)
When an unhandled exception is thrown the program terminates with:
dwarfeh(374) fatal error
Program received signal SIGABRT, Aborted
on aarch64. This works fine on x86_64. Tested with apk-polkit
by doing /usr/libexec/apk-polkit/apkd-dbus-server --replica
(or any unknown option, at which point getopt throws an exception. I guess that shouldn't really ever happen, as dwarfeh.d
says:
/* Shouldn't have returned, but if it did:
*/
switch (r)
{
case _URC_END_OF_STACK:
/* Unwound the stack without encountering a catch clause.
* In C++, this would mean call uncaught_exception().
* In D, this can happen only if `rt_trapExceptions` is cleared
* since otherwise everything is enclosed by a top-level
* try/catch.
*/
fprintf(stderr, "uncaught exception\n");
/**
As _d_print_throwable() itself may throw multiple times when calling core.demangle,
and with the uncaught exception still on the EH stack, this doesn't bode well with core.demangle's error r>
*/
version (LDC)
_d_eh_enter_catch(&eh.exception_object);
else
__dmd_begin_catch(&eh.exception_object);
_d_print_throwable(o);
abort();
assert(0);
case _URC_FATAL_PHASE1_ERROR:
/* Unexpected error, likely some sort of corruption.
* In C++, terminate() would be called.
*/
terminate(__LINE__); // should never happen
assert(0);
case _URC_FATAL_PHASE2_ERROR:
/* Unexpected error. Program is in an unknown state.
* In C++, terminate() would be called.
*/
terminate(__LINE__); // should never happen
assert(0);
default:
terminate(__LINE__); // should never happen - line 375
assert(0);
}