- x64
- x86
- arm
+ - arm64
environment:
global:
$env:HOST="i686-pc-cygwin"
$env:MSVCC="/cygdrive/c/projects/libffi/msvcc.sh"
$env:SRC_ARCHITECTURE="x86"
+ } ElseIf ($env:Platform -Match "arm64") {
+ $env:VCVARS_PLATFORM="x86_arm64"
+ $env:BUILD="i686-pc-cygwin"
+ $env:HOST="aarch64-w64-cygwin"
+ $env:MSVCC="/cygdrive/c/projects/libffi/msvcc.sh -marm64"
+ $env:SRC_ARCHITECTURE="aarch64"
} ElseIf ($env:Platform -Match "arm") {
$env:VCVARS_PLATFORM="x86_arm"
$env:BUILD="i686-pc-cygwin"
EXTRA_libffi_la_SOURCES = \
src/aarch64/ffi.c src/aarch64/sysv.S \
+ src/aarch64/win64_armasm.S \
src/alpha/ffi.c src/alpha/osf.S \
src/arc/ffi.c src/arc/arcompact.S \
src/arm/ffi.c src/arm/sysv.S \
# THIS TABLE IS SORTED. KEEP IT THAT WAY.
# Most of the time we can define all the variables all at once...
case "${host}" in
+ aarch64*-*-cygwin* | aarch64*-*-mingw* | aarch64*-*-win* )
+ TARGET=ARM_WIN64; TARGETDIR=aarch64
+ MSVC=1
+ ;;
+
aarch64*-*-*)
TARGET=AARCH64; TARGETDIR=aarch64
SOURCES="ffi.c sysv.S"
ARM_WIN32)
SOURCES="ffi.c sysv_msvc_arm32.S"
;;
+ ARM_WIN64)
+ SOURCES="ffi.c win64_armasm.S"
+ ;;
MIPS)
SOURCES="ffi.c o32.S n32.S"
;;
FFI_EXTERN ffi_type ffi_type_double;
FFI_EXTERN ffi_type ffi_type_pointer;
-#ifndef _M_ARM64
+#ifndef _M_ARM64
FFI_EXTERN ffi_type ffi_type_longdouble;
#else
#define ffi_type_longdouble ffi_type_double
ffi_type *rtype;
unsigned bytes;
unsigned flags;
- unsigned isVariadic;
#ifdef FFI_EXTRA_CIF_FIELDS
FFI_EXTRA_CIF_FIELDS;
#endif
safeseh=
shift 1
;;
+ -marm64)
+ ml='armasm64'
+ safeseh=
+ shift 1
+ ;;
-clang-cl)
cl="clang-cl"
shift 1
defines="$defines -D_M_ARM"
fi
+ if [ $ml = "armasm64" ]; then
+ defines="$defines -D_M_ARM64"
+ fi
+
if test -n "$verbose"; then
echo "$cl -nologo -EP $includes $defines $src > $ppsrc"
fi
output="$(echo $output | sed 's%/F[dpa][^ ]*%%g')"
if [ $ml = "armasm" ]; then
args="-nologo -g -oldit $armasm_output $ppsrc -errorReport:prompt"
+ elif [ $ml = "armasm64" ]; then
+ args="-nologo -g $armasm_output $ppsrc -errorReport:prompt"
else
args="-nologo $safeseh $single $output $ppsrc"
fi
{
int elems = 4 - (h & 3);
#ifdef _M_ARM64 /* for handling armasm calling convention */
- if (cif->isVariadic)
+ if (cif->is_variadic)
{
if (state.ngrn + elems <= N_X_ARG_REG)
{
ffi_clear_cache(tramp, tramp + FFI_TRAMPOLINE_SIZE);
/* Also flush the cache for code mapping. */
+#ifdef _M_ARM64
+ // Not using dlmalloc.c for Windows ARM64 builds
+ // so calling ffi_data_to_code_pointer() isn't necessary
+ unsigned char *tramp_code = tramp;
+ #else
unsigned char *tramp_code = ffi_data_to_code_pointer (tramp);
+ #endif
ffi_clear_cache (tramp_code, tramp_code + FFI_TRAMPOLINE_SIZE);
#endif
{
n = 4 - (h & 3);
#ifdef _M_ARM64 /* for handling armasm calling convention */
- if (cif->isVariadic)
+ if (cif->is_variadic)
{
if (state.ngrn + n <= N_X_ARG_REG)
{
avalue[i] = allocate_to_stack(&state, stack,
ty->alignment, s);
}
-#ifdef _M_ARM64 /* for handling armasm calling convention */
+#ifdef _M_ARM64 /* for handling armasm calling convention */
}
#endif /* for handling armasm calling convention */
}
#define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE
#endif
+#ifdef _M_ARM64
+#define FFI_EXTRA_CIF_FIELDS unsigned is_variadic
+#endif
+
/* ---- Internal ---- */
#if defined (__APPLE__)
x5 closure\r
*/\r
\r
- NESTED_ENTRY ffi_call_SYSV\r
- /* Use a stack frame allocated by our caller. */\r
- PROLOG_NOP stp x29, x30, [x1, #32]\r
- /* For unwind information, Windows has to store fp and lr */\r
+ NESTED_ENTRY ffi_call_SYSV_fake\r
+\r
+ /* For unwind information, Windows has to store fp and lr */\r
PROLOG_SAVE_REG_PAIR x29, x30, #-32!\r
- \r
+\r
+ ALTERNATE_ENTRY ffi_call_SYSV\r
+ /* Use a stack frame allocated by our caller. */\r
+ stp x29, x30, [x1]\r
mov x29, x1\r
mov sp, x0\r
\r
\r
/* Partially deconstruct the stack frame. */\r
mov sp, x29 \r
- ldp x29, x30, [x29, #32]\r
- \r
+ ldp x29, x30, [x29]\r
+\r
/* Save the return value as directed. */\r
adr x5, ffi_call_SYSV_return\r
and w4, w4, #AARCH64_RET_MASK\r
nop\r
\r
\r
- NESTED_END ffi_call_SYSV \r
+ NESTED_END ffi_call_SYSV_fake\r
\r
\r
/* ffi_closure_SYSV\r
cif->rtype = rtype;
cif->flags = 0;
- #ifdef _M_ARM64
- cif->isVariadic = isvariadic;
+#ifdef _M_ARM64
+ cif->is_variadic = isvariadic;
#endif
#if HAVE_LONG_DOUBLE_VARIANT
ffi_prep_types (abi);