summaryrefslogtreecommitdiff
path: root/Modules/_ctypes/libffi.diff
blob: ffa7bafe0e097ae2113a4af0265dcc2a5a5a3b25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
diff -urN libffi-3.1/configure libffi/configure
--- libffi-3.1/configure	2014-05-19 15:44:03.000000000 +0200
+++ libffi/configure	2014-08-09 21:51:07.877871443 +0200
@@ -17236,6 +17236,10 @@
 	fi
 	;;
 
+  i*86-*-nto-qnx*)
+        TARGET=X86; TARGETDIR=x86
+        ;;
+
   x86_64-*-darwin*)
 	TARGET=X86_DARWIN; TARGETDIR=x86
 	;;
@@ -17298,12 +17302,12 @@
 	;;
 
   mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
-	TARGET=MIPS; TARGETDIR=mips
+	TARGET=MIPS_IRIX; TARGETDIR=mips
 	;;
   mips*-*linux* | mips*-*-openbsd*)
 	# Support 128-bit long double for NewABI.
 	HAVE_LONG_DOUBLE='defined(__mips64)'
-	TARGET=MIPS; TARGETDIR=mips
+	TARGET=MIPS_LINUX; TARGETDIR=mips
 	;;
 
   nios2*-linux*)
@@ -17373,7 +17377,7 @@
   as_fn_error $? "\"libffi has not been ported to $host.\"" "$LINENO" 5
 fi
 
- if test x$TARGET = xMIPS; then
+ if expr x$TARGET : 'xMIPS' > /dev/null; then
   MIPS_TRUE=
   MIPS_FALSE='#'
 else
@@ -18814,6 +18818,12 @@
 ac_config_files="$ac_config_files include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc"
 
 
+ac_config_links="$ac_config_links include/ffi_common.h:include/ffi_common.h"
+
+
+ac_config_files="$ac_config_files fficonfig.py"
+
+
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
@@ -20126,6 +20136,8 @@
     "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;;
     "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;;
     "libffi.pc") CONFIG_FILES="$CONFIG_FILES libffi.pc" ;;
+    "include/ffi_common.h") CONFIG_LINKS="$CONFIG_LINKS include/ffi_common.h:include/ffi_common.h" ;;
+    "fficonfig.py") CONFIG_FILES="$CONFIG_FILES fficonfig.py" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
diff -urN libffi-3.1/configure.ac libffi/configure.ac
--- libffi-3.1/configure.ac	2014-05-11 15:57:49.000000000 +0200
+++ libffi/configure.ac	2014-08-09 21:51:07.877871443 +0200
@@ -1,4 +1,7 @@
 dnl Process this with autoconf to create configure
+#
+# file from libffi - slightly patched for Python's ctypes
+#
 
 AC_PREREQ(2.68)
 
@@ -144,6 +147,9 @@
 	  AM_LTLDFLAGS='-no-undefined -bindir "$(bindir)"';
 	fi
 	;;
+  i*86-*-nto-qnx*) 
+        TARGET=X86; TARGETDIR=x86
+        ;;
   i?86-*-darwin*)
 	TARGET=X86_DARWIN; TARGETDIR=x86
 	;;
@@ -218,12 +224,12 @@
 	;;
 
   mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
-	TARGET=MIPS; TARGETDIR=mips
+	TARGET=MIPS_IRIX; TARGETDIR=mips
 	;;
   mips*-*linux* | mips*-*-openbsd*)
 	# Support 128-bit long double for NewABI.
 	HAVE_LONG_DOUBLE='defined(__mips64)'
-	TARGET=MIPS; TARGETDIR=mips
+	TARGET=MIPS_LINUX; TARGETDIR=mips
 	;;
 
   nios2*-linux*)
@@ -293,7 +299,7 @@
   AC_MSG_ERROR(["libffi has not been ported to $host."])
 fi
 
-AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS)
+AM_CONDITIONAL(MIPS,[expr x$TARGET : 'xMIPS' > /dev/null])
 AM_CONDITIONAL(BFIN, test x$TARGET = xBFIN)
 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
 AM_CONDITIONAL(X86, test x$TARGET = xX86)
@@ -617,4 +623,8 @@
 
 AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc)
 
+AC_CONFIG_LINKS(include/ffi_common.h:include/ffi_common.h)
+
+AC_CONFIG_FILES(fficonfig.py)
+
 AC_OUTPUT
diff -urN libffi-3.1/fficonfig.py.in libffi/fficonfig.py.in
--- libffi-3.1/fficonfig.py.in	1970-01-01 01:00:00.000000000 +0100
+++ libffi/fficonfig.py.in	2014-08-09 21:43:25.229871827 +0200
@@ -0,0 +1,35 @@
+ffi_sources = """
+src/prep_cif.c
+src/closures.c
+""".split()
+
+ffi_platforms = {
+    'MIPS_IRIX': ['src/mips/ffi.c', 'src/mips/o32.S', 'src/mips/n32.S'],
+    'MIPS_LINUX': ['src/mips/ffi.c', 'src/mips/o32.S'],
+    'X86': ['src/x86/ffi.c', 'src/x86/sysv.S', 'src/x86/win32.S'],
+    'X86_FREEBSD': ['src/x86/ffi.c', 'src/x86/freebsd.S'],
+    'X86_WIN32': ['src/x86/ffi.c', 'src/x86/win32.S'],
+    'SPARC': ['src/sparc/ffi.c', 'src/sparc/v8.S', 'src/sparc/v9.S'],
+    'ALPHA': ['src/alpha/ffi.c', 'src/alpha/osf.S'],
+    'IA64': ['src/ia64/ffi.c', 'src/ia64/unix.S'],
+    'M32R': ['src/m32r/sysv.S', 'src/m32r/ffi.c'],
+    'M68K': ['src/m68k/ffi.c', 'src/m68k/sysv.S'],
+    'POWERPC': ['src/powerpc/ffi.c', 'src/powerpc/ffi_sysv.c', 'src/powerpc/ffi_linux64.c', 'src/powerpc/sysv.S', 'src/powerpc/ppc_closure.S', 'src/powerpc/linux64.S', 'src/powerpc/linux64_closure.S'],
+    'POWERPC_AIX': ['src/powerpc/ffi_darwin.c', 'src/powerpc/aix.S', 'src/powerpc/aix_closure.S'],
+    'POWERPC_FREEBSD': ['src/powerpc/ffi.c', 'src/powerpc/sysv.S', 'src/powerpc/ppc_closure.S'],
+    'AARCH64': ['src/aarch64/sysv.S', 'src/aarch64/ffi.c'],
+    'ARM': ['src/arm/sysv.S', 'src/arm/ffi.c'],
+    'LIBFFI_CRIS': ['src/cris/sysv.S', 'src/cris/ffi.c'],
+    'FRV': ['src/frv/eabi.S', 'src/frv/ffi.c'],
+    'S390': ['src/s390/sysv.S', 'src/s390/ffi.c'],
+    'X86_64': ['src/x86/ffi64.c', 'src/x86/unix64.S', 'src/x86/ffi.c', 'src/x86/sysv.S'],
+    'SH': ['src/sh/sysv.S', 'src/sh/ffi.c'],
+    'SH64': ['src/sh64/sysv.S', 'src/sh64/ffi.c'],
+    'PA': ['src/pa/linux.S', 'src/pa/ffi.c'],
+    'PA_LINUX': ['src/pa/linux.S', 'src/pa/ffi.c'],
+    'PA_HPUX': ['src/pa/hpux32.S', 'src/pa/ffi.c'],
+}
+
+ffi_sources += ffi_platforms['@TARGET@']
+
+ffi_cflags = '@CFLAGS@'
diff -urN libffi-3.1/src/dlmalloc.c libffi/src/dlmalloc.c
--- libffi-3.1/src/dlmalloc.c	2014-04-25 19:45:13.000000000 +0200
+++ libffi/src/dlmalloc.c	2014-08-09 21:51:07.881871443 +0200
@@ -457,6 +457,11 @@
 #define LACKS_ERRNO_H
 #define MALLOC_FAILURE_ACTION
 #define MMAP_CLEARS 0 /* WINCE and some others apparently don't clear */
+#elif !defined _GNU_SOURCE
+/* mremap() on Linux requires this via sys/mman.h
+ * See roundup issue 10309
+ */
+#define _GNU_SOURCE 1
 #endif  /* WIN32 */
 
 #ifdef __OS2__
@@ -4497,7 +4502,7 @@
     char* tbase = (char*)(CALL_MMAP(tsize));
     if (tbase != CMFAIL) {
       m = init_user_mstate(tbase, tsize);
-      set_segment_flags(&m->seg, IS_MMAPPED_BIT);
+      (void)set_segment_flags(&m->seg, IS_MMAPPED_BIT);
       set_lock(m, locked);
     }
   }
@@ -4512,7 +4517,7 @@
   if (capacity > msize + TOP_FOOT_SIZE &&
       capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) {
     m = init_user_mstate((char*)base, capacity);
-    set_segment_flags(&m->seg, EXTERN_BIT);
+    (void)set_segment_flags(&m->seg, EXTERN_BIT);
     set_lock(m, locked);
   }
   return (mspace)m;
diff -urN libffi-3.1/src/arm/ffi.c libffi/src/arm/ffi.c
--- libffi-3.1/src/arm/ffi.c	Sat Aug 09 23:52:34 2014 +0200
+++ libffi/src/arm/ffi.c	Sat Aug 09 23:58:38 2014 +0200
@@ -154,9 +154,6 @@
 
 int ffi_prep_args_VFP(char *stack, extended_cif *ecif, float *vfp_space)
 {
-  // make sure we are using FFI_VFP
-  FFI_ASSERT(ecif->cif->abi == FFI_VFP);
-
   register unsigned int i, vi = 0;
   register void **p_argv;
   register char *argp, *regp, *eo_regp;
@@ -165,6 +162,9 @@
   char done_with_regs = 0;
   char is_vfp_type;
 
+  // make sure we are using FFI_VFP
+  FFI_ASSERT(ecif->cif->abi == FFI_VFP);
+
   /* the first 4 words on the stack are used for values passed in core
    * registers. */
   regp = stack;