This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
[patch libffi]: Add support for ffi_prep_raw_closure_loc for X86_WIN32 for fixing finally PR 51500
- From: Kai Tietz <ktietz70 at googlemail dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: libffi-discuss at sourceware dot org, Anthony Green <green at redhat dot com>
- Date: Fri, 10 Feb 2012 19:50:35 +0100
- Subject: [patch libffi]: Add support for ffi_prep_raw_closure_loc for X86_WIN32 for fixing finally PR 51500
Hi,
ChangeLog
2012-02-10 Kai Tietz <ktietz@redhat.com>
* src/x86/ffi.c (ffi_prep_raw_closure_loc): Add thiscall
support for X86_WIN32.
Tested for i686-w64-mingw32, x86_64-w64-mingw32, and x86_64-unknown-linux-gnu.
Ok for apply?
Regards,
Kai
Index: src/x86/ffi.c
===================================================================
--- src/x86/ffi.c (revision 184105)
+++ src/x86/ffi.c (working copy)
@@ -720,6 +720,9 @@
int i;
if (cif->abi != FFI_SYSV) {
+#ifdef X86_WIN32
+ if (cif->abi != FFI_THISCALL)
+#endif
return FFI_BAD_ABI;
}
@@ -734,10 +737,20 @@
FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_LONGDOUBLE);
}
-
+#if X86_WIN32
+ if (cif->abi == FFI_SYSV)
+ {
+#endif
FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_raw_SYSV,
codeloc);
-
+#if X86_WIN32
+ }
+ else if (cif->abi == FFI_THISCALL)
+ {
+ FFI_INIT_TRAMPOLINE_THISCALL (&closure->tramp[0], &ffi_closure_raw_SYSV,
+ codeloc, cif->bytes);
+ }
+#endif
closure->cif = cif;
closure->user_data = user_data;
closure->fun = fun;