diff --git a/src/unwind/SetGR.c b/src/unwind/SetGR.c index 056bfc7..e684065 100644 --- a/src/unwind/SetGR.c +++ b/src/unwind/SetGR.c @@ -29,6 +29,16 @@ PROTECTED void _Unwind_SetGR (struct _Unwind_Context *context, int index, unsigned long new_value) { + // quidk'n'dirty workaround for gcc compatibility + // gcc uses __builtin_eh_return_data_regno(0) == 0 as index for first parameter (EAX) + // and __builtin_eh_return_data_regno(1) == 2 as index for second parameter (EDX) + if (index == __builtin_eh_return_data_regno(0)) { + index = 0; + } + if (index == __builtin_eh_return_data_regno(1)) { + index = 1; + } + unw_set_reg (&context->cursor, index, new_value); #ifdef UNW_TARGET_IA64 if (index >= UNW_IA64_GR && index <= UNW_IA64_GR + 127)