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

Martin Storsjö martin at martin.st
Mon Jun 26 02:16:35 CDT 2017


On Sat, 24 Jun 2017, André Hentschel wrote:

> Am 21.06.2017 um 12:39 schrieb Martin Storsjo:
>> On aarch64/arm64, clang/LLVM feels free to use x18 for normal code
>> generation on linux (while the register is reserved on iOS/darwin).
>> For windows/arm64, this register must not be clobbered.
>>
>> If targeting arm64, check for the clang cflags that allows this
>> register to be left untouched.
>>
>> This makes sure that wine for aarch64 built with clang doesn't
>> crash immediately on startup.
>>
>> Signed-off-by: Martin Storsjo <martin at martin.st>
>> ---
>> Now with the sign-off included, which was forgotten in v1.
>> ---
>>  configure.ac | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/configure.ac b/configure.ac
>> index 7ae29f7..5b5a1d8 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -179,6 +179,11 @@ case $host in
>>      CFLAGS="$CFLAGS -marm"
>>      AC_SUBST(TARGETFLAGS,"-marm")
>>      ;;
>> +  aarch64*)
>> +    # Clang needs these flags in order not to clobber the x18 register
>> +    WINE_TRY_CFLAGS([-Xclang -target-feature -Xclang +reserve-x18],
>> +                    [CFLAGS="$CFLAGS -Xclang -target-feature -Xclang +reserve-x18"])
>> +    ;;
>>    i[[3456789]]86*)
>>      enable_win16=${enable_win16:-yes}
>>      ;;
>>
>
> I think it's worthwhile adding it
>
> Signed-off-by: André Hentschel <nerv at dawncrow.de>

FWIW, in case Alexandre also reconsiders merging it since you think it's 
worthwhile adding it - I reposted a v3, using the gcc compatible flag 
syntax and with an improved commit message.

// Martin


More information about the wine-devel mailing list