https://bugs.winehq.org/show_bug.cgi?id=38780
--- Comment #15 from Martin Storsjö martin@martin.st --- (In reply to André H. from comment #14)
(In reply to Zebediah Figura from comment #13)
Is this something we could fix entirely on the Wine side? I'm not an ARM enthusiast (yet), but I guess we could do one of two things:
(1) unconditionally save and restore x18 in the function prologue, and also restore it around WINAPI callbacks; (2) save and restore it around all inferior function calls.
Both would require modification to GCC, I think, but maybe would be more feasible than trying to get distributions to compile everything with -ffixed-x18?
Well, rather in clang then. Martin? :) Can we add it to the aarch64 ms_abi attribute (maybe only on non-windows targets)?
I guess it could be doable to back it up in the prologue and restore it the epilogue in functions on non-windows that are marked with the ms_abi attribute. For restoring/setting it up around WINAPI callbacks, where would the compiler get the value to set into x18? I'm not sure how far in the compiler WINAPI is visible on non-i386 platforms where stdcall is a no-op. I don't quite follow what was suggested to be done in point (2) above though.