diff options
author | Martin Storsjö <martin@martin.st> | 2020-04-26 04:58:33 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-25 21:58:33 -0400 |
commit | c06468fa6674d3783a0edb1d0fae9afc8bc28513 (patch) | |
tree | e3a38584748199bd06b45a74b110dafcf2394d67 /configure.host | |
parent | 8c50837f0b58ba5b2bcb1b424a2a4bfa01559fb2 (diff) | |
download | libffi-c06468fa6674d3783a0edb1d0fae9afc8bc28513.tar.gz |
Fix building for aarch64 windows with mingw toolchains (#555)
* aarch64: Check _WIN32 instead of _M_ARM64 for detecting windows
This fixes building for aarch64 with mingw toolchains. _M_ARM64 is
predefined by MSVC, while mingw compilers predefine __aarch64__.
In aarch64 specific code, change checks for _M_ARM64 into checks for
_WIN32.
In arch independent code, check for
(defined(_M_ARM64) || defined(__aarch64__)) && defined(_WIN32)
instead of just _M_ARM64.
In src/closures.c, coalesce checks like
defined(X86_WIN32) || defined(X86_WIN64) || defined(_M_ARM64)
into plain defined(_WIN32). Technically, this enables code for
ARM32 windows where it wasn't, but as far as I can see it, those
codepaths should be fine for that architecture variant as well.
* aarch64: Only use armasm source when building with MSVC
When building for windows/arm64 with clang, the normal gas style .S
source works fine. sysv.S and win64_armasm.S seem to be functionally
equivalent, with only differences being due to assembler syntax.
Diffstat (limited to 'configure.host')
-rw-r--r-- | configure.host | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/configure.host b/configure.host index 055e955..7c951a0 100644 --- a/configure.host +++ b/configure.host @@ -8,7 +8,9 @@ case "${host}" in aarch64*-*-cygwin* | aarch64*-*-mingw* | aarch64*-*-win* ) TARGET=ARM_WIN64; TARGETDIR=aarch64 - MSVC=1 + if test "${ax_cv_c_compiler_vendor}" = "microsoft"; then + MSVC=1 + fi ;; aarch64*-*-*) @@ -259,7 +261,11 @@ case "${TARGET}" in SOURCES="ffi.c sysv_msvc_arm32.S" ;; ARM_WIN64) - SOURCES="ffi.c win64_armasm.S" + if test "$MSVC" = 1; then + SOURCES="ffi.c win64_armasm.S" + else + SOURCES="ffi.c sysv.S" + fi ;; MIPS) SOURCES="ffi.c o32.S n32.S" |