[llvm-dev] Handling of the x18 register in Wine on AArch64

Alexandre Julliard via llvm-dev llvm-dev at lists.llvm.org
Mon May 20 04:17:32 PDT 2019

Martin Storsjö <martin at martin.st> writes:

> 1) Rebuild the surrounding host environment (the whole linux
> distribution) with -ffixed-x18. This would be the perfect solution,
> but is highly impractical for general use of Wine by regular users in
> their existing setups. (Convincing major distributions to start
> configuring their compilers in this way also doesn't seem to be
> happening.)

Any chance that this could be made the compiler default, so that distros
wouldn't need to do anything?

> 5) Enclose every callback call in Wine with a wrapper/thunk that sets
> up the register correctly. This would be a perfect solution, but is
> practically unfeasible. As far as I know, this is the approach that
> was used for Win16 back in the day, calling WOWCallback16Ex every time
> Wine code should call back into Win16 code. Given the size of Wine
> today and the number of different places where callbacks are made
> (where the function pointers are called without any extra wrapping),
> this is unfeasible (and I have a very hard time seeing such a patch
> accepted into Wine).

I don't think it's feasible to do this at the Windows/Wine boundary, but
with the PE cross-compilation support, we could conceivably build most
of Wine as PE and add wrappers at the PE/Unix boundary.

The wrappers could then be generated, or we could use a variant of your
option 4) that would have the compiler save/restore x18 when calling a
non-ms_abi function from an ms_abi one.

Alexandre Julliard
julliard at winehq.org

More information about the llvm-dev mailing list