Fix building for aarch64 windows with mingw toolchains (#555)
authorMartin Storsjö <martin@martin.st>
Sun, 26 Apr 2020 01:58:33 +0000 (04:58 +0300)
committerGitHub <noreply@github.com>
Sun, 26 Apr 2020 01:58:33 +0000 (21:58 -0400)
commitc06468fa6674d3783a0edb1d0fae9afc8bc28513
treee3a38584748199bd06b45a74b110dafcf2394d67
parent8c50837f0b58ba5b2bcb1b424a2a4bfa01559fb2
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.
configure.host
src/aarch64/ffi.c
src/aarch64/ffitarget.h
src/closures.c
src/prep_cif.c