[PATCH v2] configure: Avoid clobbering x18 on arm64 when building with clang

Martin Storsjö martin at martin.st
Fri Jun 23 13:22:30 CDT 2017


On Fri, 23 Jun 2017, André Hentschel wrote:

> Am 23.06.2017 um 11:38 schrieb Martin Storsjö:
>> On Fri, 23 Jun 2017, Alexandre Julliard wrote:
>>
>>> Martin Storsjö <martin at martin.st> writes:
>>>
>> I'm not sure if that discussion resulted in something else somewhere - if I'm just lucky that it has happened to work for me so far (but could break randomly if gcc would happen to use x18 anywhere in the called system libraries, and just clang seems to be using it more often so I only ran into it with clang?), or if something really was changed elsewhere with respect to this. André, can you fill us in on this matter?
>
> So your Wine build crashes even when running Wines cmd/winecfg/...? Is that fixed by removing the assembler line in dlls/ntdll/signal_arm64.c:signal_init_thread ?
> As you already mentioned, if x18 is not treated special it should be a normal scratch register and one should be able to write to it nearly always without producing a crash...

No, plain "wine64 cmd" runs fine (iirc), with wine built with both gcc and 
clang - with a debian jessie userland. (I've built wine without most extra 
libraries, so no X output or anything such, so I didn't try winecfg or 
anything like that.)

Now with a gcc-built wine, if I try "wine64 uuidgen.exe", it runs fine. If 
I instead try "wine64 midl.exe", I get similar crashes as you have in 
https://bugs.winehq.org/show_bug.cgi?id=38886.

If I instead switch to clang-built wine, "wine64 cmd" runs fine, but 
uuidgen.exe crashes before printing anything, with a crash point 
indicating that x18 had the wrong value.

Now if I rebuild wine with clang, with "-Xclang -target-feature -Xclang 
+reserve-x18", uuidgen.exe works just as with gcc. And later with 
https://reviews.llvm.org/D34474 and https://reviews.llvm.org/D34475 and 
some trivial hookups of __builtin_ms_va_list and __attribute__((ms_abi)), 
midl.exe also gives working printouts. That's about as far as I've gone.

> Thanks for your work on it! I'm also interested in doing the ARM64 work 
> in mingw-w64 again (as soon as clang is ready for that)

I guess clang support for actually targeting win/arm64 is much further 
away (especially since there's no public msvc tools yet to compare to); 
the only thing so far is my RFC for handling their va_list.

> See also:
> https://bugs.winehq.org/show_bug.cgi?id=38780
> https://bugs.winehq.org/show_bug.cgi?id=38886

Thanks, these are good pointers to follow up from!

// Martin


More information about the wine-devel mailing list