Blame libffi-3.2.1.local.patch

Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
diff -ru --new-file a/configure b/configure
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
--- a/configure	2014-11-12 06:59:57.000000000 -0500
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+++ b/configure	2016-01-25 18:26:47.000000000 -0500
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
@@ -17133,7 +17133,7 @@
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
   i?86-*-freebsd* | i?86-*-openbsd*)
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 	TARGET=X86_FREEBSD; TARGETDIR=x86
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 	;;
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
-  i?86-win32* | i?86-*-cygwin* | i?86-*-mingw* | i?86-*-os2* | i?86-*-interix*)
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+  i?86-win32* | i?86-*-cygwin* | i?86-*-mingw* | i?86-*-os2* | i?86-*-interix* | i?86-*-midipix*)
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 	TARGET=X86_WIN32; TARGETDIR=x86
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 	# All mingw/cygwin/win32 builds require -no-undefined for sharedlib.
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 	# We must also check with_cross_host to decide if this is a native
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
@@ -17161,7 +17161,7 @@
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 	TARGET=X86_DARWIN; TARGETDIR=x86
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 	;;
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
-  x86_64-*-cygwin* | x86_64-*-mingw*)
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+  x86_64-*-cygwin* | x86_64-*-mingw* | x86_64-*-midipix*)
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 	TARGET=X86_WIN64; TARGETDIR=x86
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 	# All mingw/cygwin/win32 builds require -no-undefined for sharedlib.
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 	# We must also check with_cross_host to decide if this is a native
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
diff -ru --new-file a/src/closures.c b/src/closures.c
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
--- a/src/closures.c	2014-11-08 07:47:24.000000000 -0500
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+++ b/src/closures.c	2016-01-25 17:57:43.000000000 -0500
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
@@ -26,6 +26,25 @@
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
    DEALINGS IN THE SOFTWARE.
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
    ----------------------------------------------------------------------- */
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+#ifdef __midipix__
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+#include <stdlib.h>
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+void * ffi_closure_alloc (size_t size, void ** code)
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+{
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+	if (code)
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+		return (*code = malloc(size));
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+	else
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+		return 0;
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+}
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+void ffi_closure_free (void * addr)
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+{
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+	free(addr);
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+}
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+#else
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 #if defined __linux__ && !defined _GNU_SOURCE
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 #define _GNU_SOURCE 1
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 #endif
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
@@ -686,3 +705,4 @@
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 # endif /* ! FFI_MMAP_EXEC_WRIT */
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 #endif /* FFI_CLOSURES */
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
diff -ru --new-file a/src/x86/ffi.c b/src/x86/ffi.c
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
--- a/src/x86/ffi.c	2014-11-08 07:47:24.000000000 -0500
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+++ b/src/x86/ffi.c	2016-01-25 17:52:14.000000000 -0500
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
@@ -31,8 +31,12 @@
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 #if !defined(__x86_64__) || defined(_WIN64) || defined(__CYGWIN__)
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 #ifdef _WIN64
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+#ifdef __midipix__
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+/* not needed */
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+#else
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 #include <windows.h>
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 #endif
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 #include <ffi.h>
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 #include <ffi_common.h>
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
diff -ru --new-file a/src/x86/win32.S b/src/x86/win32.S
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
--- a/src/x86/win32.S	2014-11-11 09:41:37.000000000 -0500
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+++ b/src/x86/win32.S	2016-01-25 18:36:49.000000000 -0500
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
@@ -1344,6 +1344,14 @@
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
         .align 4
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 .LEFDE5:
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+#ifdef __midipix__
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+	.section .got$ffi_call_win32,"r"
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+	.global __imp_ffi_call_win32
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+__imp_ffi_call_win32:
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+	.long	ffi_call_win32
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+	.linkonce discard
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 #endif /* !_MSC_VER */
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 #if defined __ELF__ && defined __linux__
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
diff -ru --new-file a/src/x86/win64.S b/src/x86/win64.S
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
--- a/src/x86/win64.S	2014-11-08 07:47:24.000000000 -0500
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+++ b/src/x86/win64.S	2016-01-25 17:47:17.000000000 -0500
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
@@ -516,5 +516,15 @@
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 	pop	%rbp
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 	retq
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 	.seh_endproc
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+#ifdef __midipix__
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+	.section .got$ffi_call_win64,"r"
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+	.global __imp_ffi_call_win64
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+__imp_ffi_call_win64:
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+	.quad	ffi_call_win64
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+	.linkonce discard
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
+
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 #endif /* !_MSC_VER */
Lucio Andrés Illanes Albornoz (arab, vxp) cddeef
 
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
--- libffi-3.2.1/src/x86/win32.S.orig2	2016-05-31 09:21:19.120895425 +0000
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+++ libffi-3.2.1/src/x86/win32.S	2016-05-31 09:22:19.252894091 +0000
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
@@ -529,7 +529,9 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
  
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         # This assumes we are using gas.
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         .balign 16
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+#ifndef __midipix__
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 FFI_HIDDEN(ffi_call_win32)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         .globl	USCORE_SYMBOL(ffi_call_win32)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 #if defined(X86_WIN32) && !defined(__OS2__)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         .def	_ffi_call_win32;	.scl	2;	.type	32;	.endef
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
@@ -712,7 +714,9 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         ret
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 .ffi_call_win32_end:
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         .balign 16
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+#ifndef __midipix__
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 FFI_HIDDEN(ffi_closure_THISCALL)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         .globl	USCORE_SYMBOL(ffi_closure_THISCALL)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 #if defined(X86_WIN32) && !defined(__OS2__)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         .def	_ffi_closure_THISCALL;	.scl	2;	.type	32;	.endef
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
@@ -725,7 +729,9 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         jmp	.ffi_closure_STDCALL_internal
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         .balign 16
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+#ifndef __midipix__
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 FFI_HIDDEN(ffi_closure_FASTCALL)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         .globl	USCORE_SYMBOL(ffi_closure_FASTCALL)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 #if defined(X86_WIN32) && !defined(__OS2__)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         .def	_ffi_closure_FASTCALL;	.scl	2;	.type	32;	.endef
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
@@ -737,7 +743,9 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         push	%edx
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         push	%ecx
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         jmp	.ffi_closure_STDCALL_internal
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+#ifndef __midipix__
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 FFI_HIDDEN(ffi_closure_REGISTER)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         .globl	USCORE_SYMBOL(ffi_closure_REGISTER)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 #if defined(X86_WIN32) && !defined(__OS2__)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         .def	_ffi_closure_REGISTER;	.scl	2;	.type	32;	.endef
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
@@ -754,7 +762,9 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 .LFE1:
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         # This assumes we are using gas.
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         .balign 16
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+#ifndef __midipix__
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 FFI_HIDDEN(ffi_closure_SYSV)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 #if defined(X86_WIN32)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         .globl	USCORE_SYMBOL(ffi_closure_SYSV)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 #if defined(X86_WIN32) && !defined(__OS2__)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
@@ -898,7 +908,9 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 #ifdef X86_WIN32
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         .balign 16
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+#ifndef __midipix__
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 FFI_HIDDEN(ffi_closure_raw_THISCALL)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         .globl	USCORE_SYMBOL(ffi_closure_raw_THISCALL)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 #if defined(X86_WIN32) && !defined(__OS2__)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         .def	_ffi_closure_raw_THISCALL;	.scl	2;	.type	32;	.endef
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
@@ -1040,7 +1052,9 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         # This assumes we are using gas.
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         .balign	16
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+#ifndef __midipix__
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 FFI_HIDDEN(ffi_closure_STDCALL)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         .globl	USCORE_SYMBOL(ffi_closure_STDCALL)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 #if defined(X86_WIN32) && !defined(__OS2__)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
         .def	_ffi_closure_STDCALL;	.scl	2;	.type	32;	.endef
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
@@ -1345,10 +1359,17 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 .LEFDE5:
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 #ifdef __midipix__
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+#if defined(SYMBOL_UNDERSCORE)
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+	.section .got$ffi__call_win32,"r"
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+	.global __imp__ffi_call_win32
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+__imp__ffi_call_win32:
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+	.long	_ffi_call_win32
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+#else
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 	.section .got$ffi_call_win32,"r"
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 	.global __imp_ffi_call_win32
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 __imp_ffi_call_win32:
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 	.long	ffi_call_win32
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 	.linkonce discard
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
 #endif
Lucio Andrés Illanes Albornoz (arab, vxp) 951620