Skip to content

Commit 029273f

Browse files
committed
Fixes issue #17192: Update the ctypes module's libffi to v3.0.13. This
specifically addresses a stack misalignment issue on x86 and issues on some more recent platforms.
1 parent a846f5a commit 029273f

File tree

240 files changed

+35070
-8098
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

240 files changed

+35070
-8098
lines changed

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,10 @@ Library
940940
Extension Modules
941941
-----------------
942942

943+
- Issue #17192: Update the ctypes module's libffi to v3.0.13. This
944+
specifically addresses a stack misalignment issue on x86 and issues on
945+
some more recent platforms.
946+
943947
- Issue #12268: The io module file object write methods no longer abort early
944948
when one of its write system calls is interrupted (EINTR).
945949

Modules/_ctypes/libffi.diff

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,43 @@
1-
diff -urN libffi.orig/configure libffi/configure
2-
--- libffi.orig/configure 2010-03-19 18:29:54.588499862 +0100
3-
+++ libffi/configure 2010-03-19 18:32:09.113499479 +0100
4-
@@ -11228,6 +11228,9 @@
5-
i?86-*-solaris2.1[0-9]*)
6-
TARGET=X86_64; TARGETDIR=x86
1+
diff -r -N -u libffi.orig/autom4te.cache/output.0 libffi/autom4te.cache/output.0
2+
diff -r -N -u libffi.orig/configure libffi/configure
3+
--- libffi.orig/configure 2013-03-17 15:37:50.000000000 -0700
4+
+++ libffi/configure 2013-03-18 15:11:39.611575163 -0700
5+
@@ -13368,6 +13368,10 @@
6+
fi
77
;;
8+
89
+ i*86-*-nto-qnx*)
910
+ TARGET=X86; TARGETDIR=x86
1011
+ ;;
11-
i?86-*-*)
12-
TARGET=X86; TARGETDIR=x86
12+
+
13+
x86_64-*-darwin*)
14+
TARGET=X86_DARWIN; TARGETDIR=x86
1315
;;
14-
@@ -11245,12 +11248,12 @@
16+
@@ -13426,12 +13430,12 @@
1517
;;
1618

17-
mips-sgi-irix5.* | mips-sgi-irix6.*)
19+
mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
1820
- TARGET=MIPS; TARGETDIR=mips
1921
+ TARGET=MIPS_IRIX; TARGETDIR=mips
2022
;;
21-
mips*-*-linux*)
23+
mips*-*-linux* | mips*-*-openbsd*)
2224
# Support 128-bit long double for NewABI.
2325
HAVE_LONG_DOUBLE='defined(__mips64)'
2426
- TARGET=MIPS; TARGETDIR=mips
2527
+ TARGET=MIPS_IRIX; TARGETDIR=mips
2628
;;
2729

2830
powerpc*-*-linux* | powerpc-*-sysv*)
29-
@@ -11307,7 +11310,7 @@
30-
as_fn_error "\"libffi has not been ported to $host.\"" "$LINENO" 5
31+
@@ -13491,7 +13495,7 @@
32+
as_fn_error $? "\"libffi has not been ported to $host.\"" "$LINENO" 5
3133
fi
3234

3335
- if test x$TARGET = xMIPS; then
3436
+ if expr x$TARGET : 'xMIPS' > /dev/null; then
3537
MIPS_TRUE=
3638
MIPS_FALSE='#'
3739
else
38-
@@ -12422,6 +12425,12 @@
40+
@@ -14862,6 +14866,12 @@
3941
ac_config_files="$ac_config_files include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc"
4042

4143

@@ -48,61 +50,62 @@ diff -urN libffi.orig/configure libffi/configure
4850
cat >confcache <<\_ACEOF
4951
# This file is a shell script that caches the results of configure
5052
# tests run on this system so they can be shared between configure
51-
@@ -13521,6 +13530,8 @@
53+
@@ -16047,6 +16057,8 @@
5254
"testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;;
5355
"man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;;
5456
"libffi.pc") CONFIG_FILES="$CONFIG_FILES libffi.pc" ;;
5557
+ "include/ffi_common.h") CONFIG_LINKS="$CONFIG_LINKS include/ffi_common.h:include/ffi_common.h" ;;
5658
+ "fficonfig.py") CONFIG_FILES="$CONFIG_FILES fficonfig.py" ;;
5759

58-
*) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
60+
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
5961
esac
60-
diff -urN libffi.orig/configure.ac libffi/configure.ac
61-
--- libffi.orig/configure.ac 2010-03-19 18:27:44.988498585 +0100
62-
+++ libffi/configure.ac 2010-03-19 18:31:29.252505178 +0100
62+
diff -r -N -u libffi.orig/configure.ac libffi/configure.ac
63+
--- libffi.orig/configure.ac 2013-03-17 15:37:50.000000000 -0700
64+
+++ libffi/configure.ac 2013-03-18 15:11:11.392989136 -0700
6365
@@ -1,4 +1,7 @@
6466
dnl Process this with autoconf to create configure
6567
+#
66-
+# file from libffi - slightly patched for ctypes
68+
+# file from libffi - slightly patched for Python's ctypes
6769
+#
6870

69-
AC_PREREQ(2.63)
71+
AC_PREREQ(2.68)
7072

71-
@@ -91,6 +94,9 @@
72-
i?86-*-solaris2.1[[0-9]]*)
73-
TARGET=X86_64; TARGETDIR=x86
73+
@@ -146,6 +149,10 @@
74+
fi
7475
;;
76+
7577
+ i*86-*-nto-qnx*)
7678
+ TARGET=X86; TARGETDIR=x86
7779
+ ;;
78-
i?86-*-*)
79-
TARGET=X86; TARGETDIR=x86
80+
+
81+
x86_64-*-darwin*)
82+
TARGET=X86_DARWIN; TARGETDIR=x86
8083
;;
81-
@@ -108,12 +114,12 @@
84+
@@ -204,12 +211,12 @@
8285
;;
8386

84-
mips-sgi-irix5.* | mips-sgi-irix6.*)
87+
mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
8588
- TARGET=MIPS; TARGETDIR=mips
8689
+ TARGET=MIPS_IRIX; TARGETDIR=mips
8790
;;
88-
mips*-*-linux*)
91+
mips*-*-linux* | mips*-*-openbsd*)
8992
# Support 128-bit long double for NewABI.
9093
HAVE_LONG_DOUBLE='defined(__mips64)'
9194
- TARGET=MIPS; TARGETDIR=mips
9295
+ TARGET=MIPS_IRIX; TARGETDIR=mips
9396
;;
9497

9598
powerpc*-*-linux* | powerpc-*-sysv*)
96-
@@ -170,7 +176,7 @@
99+
@@ -269,7 +276,7 @@
97100
AC_MSG_ERROR(["libffi has not been ported to $host."])
98101
fi
99102

100103
-AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS)
101104
+AM_CONDITIONAL(MIPS,[expr x$TARGET : 'xMIPS' > /dev/null])
105+
AM_CONDITIONAL(BFIN, test x$TARGET = xBFIN)
102106
AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
103107
AM_CONDITIONAL(X86, test x$TARGET = xX86)
104-
AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD)
105-
@@ -401,4 +407,8 @@
108+
@@ -567,4 +574,8 @@
106109

107110
AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc)
108111

Modules/_ctypes/libffi/.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.libs
2+
.deps
3+
*.o
4+
*.lo
5+
.dirstamp
6+
*.la
7+
Makefile
8+
config.log
9+
config.status
10+
*~
11+
fficonfig.h
12+
include/ffi.h
13+
include/ffitarget.h
14+
libffi.pc
15+
libtool
16+
stamp-h1
17+
libffi*gz
18+
autom4te.cache
19+
libffi.xcodeproj/xcuserdata
20+
libffi.xcodeproj/project.xcworkspace
21+
ios/

Modules/_ctypes/libffi/.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: c
2+
compiler:
3+
- gcc
4+
- clang
5+
6+
before_script: sudo apt-get install dejagnu
7+
8+
script: ./configure && make && make check

0 commit comments

Comments
 (0)