From fa297566f193066e7fc002c90bdf34414e152442 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 25 Apr 2013 08:07:10 -0600 Subject: [PATCH] libffi fix Closes PR 13707 --- src/foreign/README | 3 +++ src/foreign/libffi/src/x86/ffi.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/foreign/README b/src/foreign/README index 99f018a156..ea4635381e 100644 --- a/src/foreign/README +++ b/src/foreign/README @@ -20,6 +20,9 @@ Local changes: * In "x86/darwin.S", added ".long 0" after ".LFE3:" to avoid linker problems compiling with gcc-4.0 on Mac OS X 10.7. + * In "x86/ffi.c" for Win32, don't try to align stack for + stdcall, fastcall, or thiscall. + ========== libffi_msvc directory ===================================== This directory is synced from the CTypes repository diff --git a/src/foreign/libffi/src/x86/ffi.c b/src/foreign/libffi/src/x86/ffi.c index 0600414d45..aa1808745e 100644 --- a/src/foreign/libffi/src/x86/ffi.c +++ b/src/foreign/libffi/src/x86/ffi.c @@ -315,7 +315,12 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) cif->bytes += 4 * sizeof(ffi_arg); #endif - cif->bytes = (cif->bytes + 15) & ~0xF; +#ifdef X86_WIN32 + if ((cif->abi != FFI_STDCALL) + && (cif->abi != FFI_FASTCALL) + && (cif->abi != FFI_THISCALL)) +#endif + cif->bytes = (cif->bytes + 15) & ~0xF; return FFI_OK; }