diff mbox

[libffi] : Add support for ffi_prep_raw_closure_loc for X86_WIN32 for fixing finally PR 51500

Message ID CAEwic4Zep+Nac3arRUhXD+3C=jRb0EPm33uY+FgszB+3+Ev05g@mail.gmail.com
State New
Headers show

Commit Message

Kai Tietz Feb. 10, 2012, 6:50 p.m. UTC
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
diff mbox

Patch

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;