https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115242

--- Comment #6 from Florian Weimer <fw at gcc dot gnu.org> ---
(In reply to Alisa Sireneva from comment #4)
> I think this is a wider issue. The root of the problem is that
> __builtin_unwind_init() affects what it _thinks_ are _callee-saved_
> registers.

I think this should be fine. The functions use the platform calling convention.
If they are called from a function that preserves additional registers, the
compiler needs to emit code to spill those registers before calling those
functions. As far as I understand it, the unwinder code tracks a larger
register set than just the callee-saved registers, so this should work.

> In this bug, the compiler thinks a register doesn't exist when it does. But
> it's also possible that the compiler thinks a register is caller-saved while
> it's actually callee-saved, due to differences in ABI between libgcc_s and
> user code (as reproduced e.g. on x64 by throwing from
> __attribute__((ms_abi)), but should be possible with plain forced unwinding
> too).

According to a quick test, GCC handles this correctly and spills the additional
registers when calling a non-ms_abi function from an ms_abi function. I expect
that it's also possible to compensate for the lack of vector register tracking
in the GNU/Linux x86-64 unwinder through appropriate code generation, but I
haven't got a good test case for that.

The issue on POWER is different because the ABI was enhanced retroactively,
supposedly in a transparent way.

Reply via email to