From: Martin Storsjo Subject: [PATCH v3] configure: Avoid clobbering x18 on arm64 within wine Message-Id: <1498461244-15385-1-git-send-email-martin@martin.st> Date: Mon, 26 Jun 2017 10:14:04 +0300 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). This makes sure that wine for aarch64 built with clang doesn't crash immediately on startup. (clang/llvm seems to be more eager on using this register than gcc.) 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 --- Changed to try a different flag which is supported by both gcc and clang. (Internally, clang maps it to the flag used in the previous generation of the patch.) Reworded the commit message to clarify that the same issue is present with gcc as well (although I hit the issue sooner with clang). Also clarified, both in the commit message and in the configure comment, that this issue isn't a complete fix. --- configure.ac | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/configure.ac b/configure.ac index 7ae29f7..fe98b80 100644 --- a/configure.ac +++ b/configure.ac @@ -179,6 +179,12 @@ case $host in CFLAGS="$CFLAGS -marm" AC_SUBST(TARGETFLAGS,"-marm") ;; + aarch64*) + # 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.7.4