From d99a6180cdca6274f1a8b868c38a89883daf6e23 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Wed, 21 Jun 2017 11:42:40 +0300 Subject: [PATCH] configure: Avoid clobbering x18 on arm64 within wine On aarch64/arm64 on linux, the compiler is free to use x18 for normal code generation (while the register is reserved on iOS/darwin, and on windows). If targeting arm64, check for the flags that allows this register to be left untouched (the flag is supported both by gcc and clang). Similar issues can still pop up as soon as system library functions that happen to touch x18 are called, unless the system libraries have been built with the same flag. Signed-off-by: Martin Storsjo --- configure.ac | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configure.ac b/configure.ac index d1502bacf7..6cf838ef09 100644 --- a/configure.ac +++ b/configure.ac @@ -212,6 +212,10 @@ case $host in [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[void func(__builtin_ms_va_list *args);]])], [wine_cv_builtin_ms_va_list=yes],[wine_cv_builtin_ms_va_list=no])]) test $wine_cv_builtin_ms_va_list != no || AC_MSG_ERROR([You need clang >= 5.0 to build Wine for arm64.]) + # Avoid clobbering the x18 register which is reserved in windows. + # This isn't complete/enough unless all of the system libraries have + # been built with the same flag though. + WINE_TRY_CFLAGS([-ffixed-x18], [CFLAGS="$CFLAGS -ffixed-x18"]) ;; i[[3456789]]86*) enable_win16=${enable_win16:-yes} -- 2.17.1