[Python-checkins] cpython (merge 3.3 -> default): Fixes Issue #17192: Update the ctypes module's libffi to v3.0.13. This

gregory.p.smith python-checkins at python.org
Tue Mar 19 23:34:09 CET 2013


http://hg.python.org/cpython/rev/a94b3b4599f1
changeset:   82791:a94b3b4599f1
parent:      82781:7779dbc20536
parent:      82790:9e501d0fb68c
user:        Gregory P. Smith <greg at krypto.org>
date:        Tue Mar 19 15:24:46 2013 -0700
summary:
  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.

files:
  Misc/NEWS                                                     |    6 +-
  Modules/_ctypes/libffi.diff                                   |  141 ++--
  Modules/_ctypes/libffi/.gitignore                             |   21 +
  Modules/_ctypes/libffi/.travis.yml                            |    8 +
  Modules/_ctypes/libffi/ChangeLog                              |   46 +
  Modules/_ctypes/libffi/Makefile.am                            |   72 +-
  Modules/_ctypes/libffi/Makefile.in                            |  107 +-
  Modules/_ctypes/libffi/README                                 |   15 +-
  Modules/_ctypes/libffi/build-ios.sh                           |    0 
  Modules/_ctypes/libffi/configure                              |   50 +-
  Modules/_ctypes/libffi/configure.ac                           |   21 +-
  Modules/_ctypes/libffi/doc/libffi.info                        |  Bin 
  Modules/_ctypes/libffi/doc/libffi.texi                        |    2 +-
  Modules/_ctypes/libffi/doc/stamp-vti                          |    8 +-
  Modules/_ctypes/libffi/doc/version.texi                       |    8 +-
  Modules/_ctypes/libffi/fficonfig.py.in                        |    1 -
  Modules/_ctypes/libffi/libtool-ldflags                        |    0 
  Modules/_ctypes/libffi/ltmain.sh                              |    0 
  Modules/_ctypes/libffi/mdate-sh                               |    0 
  Modules/_ctypes/libffi/msvcc.sh                               |    0 
  Modules/_ctypes/libffi/src/arm/gentramp.sh                    |    0 
  Modules/_ctypes/libffi/src/closures.c                         |    6 +-
  Modules/_ctypes/libffi/src/dlmalloc.c                         |   12 +-
  Modules/_ctypes/libffi/src/ia64/ffi.c                         |    4 +-
  Modules/_ctypes/libffi/src/m68k/sysv.S                        |   45 +-
  Modules/_ctypes/libffi/src/metag/ffi.c                        |  330 ++++++++++
  Modules/_ctypes/libffi/src/metag/ffitarget.h                  |   53 +
  Modules/_ctypes/libffi/src/metag/sysv.S                       |  311 +++++++++
  Modules/_ctypes/libffi/src/mips/ffi.c                         |   11 +-
  Modules/_ctypes/libffi/src/powerpc/ffi.c                      |   54 +-
  Modules/_ctypes/libffi/src/sparc/ffi.c                        |   16 +-
  Modules/_ctypes/libffi/src/x86/ffi.c                          |    2 -
  Modules/_ctypes/libffi/src/x86/ffi64.c                        |   44 +-
  Modules/_ctypes/libffi/src/x86/ffitarget.h                    |    3 +-
  Modules/_ctypes/libffi/src/x86/sysv.S                         |   17 +-
  Modules/_ctypes/libffi/src/x86/unix64.S                       |   10 +-
  Modules/_ctypes/libffi/stamp-h.in                             |    1 +
  Modules/_ctypes/libffi/testsuite/Makefile.am                  |  145 ++--
  Modules/_ctypes/libffi/testsuite/Makefile.in                  |  195 ++---
  Modules/_ctypes/libffi/testsuite/lib/libffi.exp               |   19 -
  Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c |    4 +-
  Modules/_ctypes/libffi/testsuite/libffi.call/ffitest.h        |   44 +-
  Modules/_ctypes/libffi/testsuite/libffi.call/float_va.c       |   16 +-
  Modules/_ctypes/libffi/testsuite/libffi.call/huge_struct.c    |    9 +-
  Modules/_ctypes/libffi/testsuite/libffi.call/many2.c          |    5 +-
  45 files changed, 1259 insertions(+), 603 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -289,9 +289,13 @@
 Library
 -------
 
+- 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.
+
 - Issue #8862: Fixed curses cleanup when getkey is interrputed by a signal.
 
-- Issue #17443: impalib.IMAP4_stream was using the default unbuffered IO
+- Issue #17443: imaplib.IMAP4_stream was using the default unbuffered IO
   in subprocess, but the imap code assumes buffered IO.  In Python2 this
   worked by accident.  IMAP4_stream now explicitly uses buffered IO.
 
diff --git a/Modules/_ctypes/libffi.diff b/Modules/_ctypes/libffi.diff
--- a/Modules/_ctypes/libffi.diff
+++ b/Modules/_ctypes/libffi.diff
@@ -1,26 +1,19 @@
-diff -urN libffi.orig/configure.ac libffi/configure.ac
---- libffi.orig/configure.ac	2013-02-11 20:24:24.000000000 +0100
-+++ libffi/configure.ac	2013-02-12 15:05:46.209844321 +0100
-@@ -1,4 +1,7 @@
- dnl Process this with autoconf to create configure
-+#
-+# file from libffi - slightly patched for ctypes
-+#
- 
- AC_PREREQ(2.68)
- 
-@@ -146,6 +149,10 @@
- 	fi	  
+diff -r -N -u libffi.orig/autom4te.cache/output.0 libffi/autom4te.cache/output.0
+diff -r -N -u libffi.orig/configure libffi/configure
+--- libffi.orig/configure	2013-03-17 15:37:50.000000000 -0700
++++ libffi/configure	2013-03-18 15:11:39.611575163 -0700
+@@ -13368,6 +13368,10 @@
+ 	fi
  	;;
  
-+  i*86-*-nto-qnx*) 
-+	TARGET=X86; TARGETDIR=x86
-+	;;
++  i*86-*-nto-qnx*)
++        TARGET=X86; TARGETDIR=x86
++        ;;
 +
    x86_64-*-darwin*)
  	TARGET=X86_DARWIN; TARGETDIR=x86
  	;;
-@@ -200,12 +207,12 @@
+@@ -13426,12 +13430,12 @@
  	;;
  
    mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
@@ -35,39 +28,60 @@
  	;;
  
    powerpc*-*-linux* | powerpc-*-sysv*)
-@@ -265,7 +272,7 @@
-   AC_MSG_ERROR(["libffi has not been ported to $host."])
+@@ -13491,7 +13495,7 @@
+   as_fn_error $? "\"libffi has not been ported to $host.\"" "$LINENO" 5
  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)
-@@ -562,4 +569,8 @@
+- if test x$TARGET = xMIPS; then
++ if expr x$TARGET : 'xMIPS' > /dev/null; then
+   MIPS_TRUE=
+   MIPS_FALSE='#'
+ else
+@@ -14862,6 +14866,12 @@
+ ac_config_files="$ac_config_files include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc"
  
- 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_links="$ac_config_links include/ffi_common.h:include/ffi_common.h"
 +
-+AC_CONFIG_FILES(fficonfig.py)
 +
- AC_OUTPUT
-diff -urN libffi.orig/configure libffi/configure
---- libffi.orig/configure	2013-02-11 20:24:24.000000000 +0100
-+++ libffi/configure	2013-02-12 15:11:42.353853081 +0100
-@@ -13366,6 +13366,10 @@
- 	fi
++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
+@@ -16047,6 +16057,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 -r -N -u libffi.orig/configure.ac libffi/configure.ac
+--- libffi.orig/configure.ac	2013-03-17 15:37:50.000000000 -0700
++++ libffi/configure.ac	2013-03-18 15:11:11.392989136 -0700
+@@ -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)
+ 
+@@ -146,6 +149,10 @@
+ 	fi	  
  	;;
  
-+  i*86-*-nto-qnx*)
-+	TARGET=X86; TARGETDIR=x86
-+	;;
++  i*86-*-nto-qnx*) 
++        TARGET=X86; TARGETDIR=x86
++        ;;
 +
    x86_64-*-darwin*)
  	TARGET=X86_DARWIN; TARGETDIR=x86
  	;;
-@@ -13420,12 +13424,12 @@
+@@ -204,12 +211,12 @@
  	;;
  
    mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
@@ -82,41 +96,27 @@
  	;;
  
    powerpc*-*-linux* | powerpc-*-sysv*)
-@@ -13485,7 +13489,7 @@
-   as_fn_error $? "\"libffi has not been ported to $host.\"" "$LINENO" 5
+@@ -269,7 +276,7 @@
+   AC_MSG_ERROR(["libffi has not been ported to $host."])
  fi
  
-- if test x$TARGET = xMIPS; then
-+ if expr x$TARGET : 'xMIPS' > /dev/null; then
-   MIPS_TRUE=
-   MIPS_FALSE='#'
- else
-@@ -14848,6 +14852,12 @@
- ac_config_files="$ac_config_files include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc"
+-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)
+@@ -567,4 +574,8 @@
  
+ 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_LINKS(include/ffi_common.h:include/ffi_common.h)
 +
++AC_CONFIG_FILES(fficonfig.py)
 +
-+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
-@@ -16029,6 +16039,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.orig/fficonfig.py.in libffi/fficonfig.py.in
---- libffi.orig/fficonfig.py.in	1970-01-01 01:00:00.000000000 +0100
-+++ libffi/fficonfig.py.in	2013-02-12 15:11:24.589852644 +0100
-@@ -0,0 +1,36 @@
+ AC_OUTPUT
+--- libffi-3.0.11/fficonfig.py.in	1970-01-01 01:00:00.000000000 +0100
++++ libffi/fficonfig.py.in	2012-03-15 01:04:27.000000000 +0100
+@@ -0,0 +1,35 @@
 +ffi_sources = """
 +src/prep_cif.c
 +src/closures.c
@@ -130,7 +130,6 @@
 +    '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'],
-+    'AARCH64': ['src/aarch64/ffi.c', 'src/aarch64/sysv.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'],
@@ -153,9 +152,9 @@
 +ffi_sources += ffi_platforms['@TARGET@']
 +
 +ffi_cflags = '@CFLAGS@'
-diff -urN libffi.orig/src/dlmalloc.c libffi/src/dlmalloc.c
---- libffi.orig/src/dlmalloc.c	2013-02-11 20:24:18.000000000 +0100
-+++ libffi/src/dlmalloc.c	2013-02-12 15:15:12.113858241 +0100
+diff -urN libffi-3.0.11/src/dlmalloc.c libffi/src/dlmalloc.c
+--- libffi-3.0.11/src/dlmalloc.c	2012-04-12 04:46:06.000000000 +0200
++++ libffi/src/dlmalloc.c	2012-06-26 15:15:58.949547461 +0200
 @@ -457,6 +457,11 @@
  #define LACKS_ERRNO_H
  #define MALLOC_FAILURE_ACTION
diff --git a/Modules/_ctypes/libffi/.gitignore b/Modules/_ctypes/libffi/.gitignore
new file mode 100644
--- /dev/null
+++ b/Modules/_ctypes/libffi/.gitignore
@@ -0,0 +1,21 @@
+.libs
+.deps
+*.o
+*.lo
+.dirstamp
+*.la
+Makefile
+config.log
+config.status
+*~
+fficonfig.h
+include/ffi.h
+include/ffitarget.h
+libffi.pc
+libtool
+stamp-h1
+libffi*gz
+autom4te.cache
+libffi.xcodeproj/xcuserdata
+libffi.xcodeproj/project.xcworkspace
+ios/
diff --git a/Modules/_ctypes/libffi/.travis.yml b/Modules/_ctypes/libffi/.travis.yml
new file mode 100644
--- /dev/null
+++ b/Modules/_ctypes/libffi/.travis.yml
@@ -0,0 +1,8 @@
+language: c
+compiler:
+  - gcc
+  - clang
+
+before_script: sudo apt-get install dejagnu
+
+script: ./configure && make && make check
diff --git a/Modules/_ctypes/libffi/ChangeLog b/Modules/_ctypes/libffi/ChangeLog
--- a/Modules/_ctypes/libffi/ChangeLog
+++ b/Modules/_ctypes/libffi/ChangeLog
@@ -1,3 +1,49 @@
+2013-03-17  Anthony Green  <green at moxielogic.com>
+
+	* README: Update for 3.0.13.
+	* configure.ac: Ditto.
+	* configure: Rebuilt.
+	* doc/*: Update version.
+
+2013-03-17  Dave Korn  <dave.korn.cygwin at gmail.com>
+
+	* src/closures.c (is_emutramp_enabled
+	[!FFI_MMAP_EXEC_EMUTRAMP_PAX]): Move default definition outside
+	enclosing #if scope.
+
+2013-03-17  Anthony Green  <green at moxielogic.com>
+
+	* configure.ac: Only modify toolexecdir in certain cases.
+	* configure: Rebuilt.
+
+2013-03-16  Gilles Talis  <gilles.talis at gmail.com>
+
+	* src/powerpc/ffi.c (ffi_prep_args_SYSV): Don't use
+	fparg_count,etc on __NO_FPRS__ targets.
+
+2013-03-16  Alan Hourihane  <alanh at fairlite.co.uk>
+
+	* src/m68k/sysv.S (epilogue): Don't use extb instruction on
+	m680000 machines.
+
+2013-03-16  Alex Gaynor <alex.gaynor at gmail.com>
+
+	* src/x86/ffi.c (ffi_prep_cif_machdep): Always align stack.
+
+2013-03-13  Markos Chandras <markos.chandras at imgtec.com>
+
+	* configure.ac: Add support for Imagination Technologies Meta.
+	* Makefile.am: Likewise.
+	* README: Add Imagination Technologies Meta details.
+	* src/metag/ffi.c: New.
+	* src/metag/ffitarget.h: Likewise.
+	* src/metag/sysv.S: Likewise.
+
+2013-02-24  Andreas Schwab  <schwab at linux-m68k.org>
+
+	* doc/libffi.texi (Structures): Fix missing category argument of
+	@deftp.
+
 2013-02-11  Anthony Green <green at moxielogic.com>
 
 	* configure.ac: Update release number to 3.0.12.
diff --git a/Modules/_ctypes/libffi/Makefile.am b/Modules/_ctypes/libffi/Makefile.am
--- a/Modules/_ctypes/libffi/Makefile.am
+++ b/Modules/_ctypes/libffi/Makefile.am
@@ -7,44 +7,45 @@
 SUBDIRS = include testsuite man
 
 EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host	\
-	 src/aarch64/ffi.c src/aarch64/ffitarget.h			\
-	 src/aarch64/sysv.S build-ios.sh				\
-	 src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h		\
-	 src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h		\
-	 src/avr32/ffi.c src/avr32/sysv.S src/avr32/ffitarget.h		\
-	 src/cris/ffi.c src/cris/sysv.S src/cris/ffitarget.h		\
-	 src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h	\
-	 src/ia64/unix.S src/mips/ffi.c src/mips/n32.S src/mips/o32.S	\
-	 src/mips/ffitarget.h src/m32r/ffi.c src/m32r/sysv.S		\
-	 src/m32r/ffitarget.h src/m68k/ffi.c src/m68k/sysv.S		\
-	 src/m68k/ffitarget.h src/microblaze/ffi.c			\
-	 src/microblaze/sysv.S src/microblaze/ffitarget.h		\
-	 src/powerpc/ffi.c src/powerpc/sysv.S				\
-	 src/powerpc/linux64.S src/powerpc/linux64_closure.S		\
-	 src/powerpc/ppc_closure.S src/powerpc/asm.h			\
-	src/powerpc/aix.S src/powerpc/darwin.S				\
-	src/powerpc/aix_closure.S src/powerpc/darwin_closure.S		\
-	src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h		\
-	src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h		\
-	src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/sh64/ffi.c	\
-	src/sh64/sysv.S src/sh64/ffitarget.h src/sparc/v8.S		\
-	src/sparc/v9.S src/sparc/ffitarget.h src/sparc/ffi.c		\
-	src/x86/darwin64.S src/x86/ffi.c src/x86/sysv.S			\
-	src/x86/win32.S src/x86/darwin.S src/x86/win64.S		\
-	src/x86/freebsd.S src/x86/ffi64.c src/x86/unix64.S		\
-	src/x86/ffitarget.h src/pa/ffitarget.h src/pa/ffi.c		\
-	src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c src/bfin/ffi.c	\
-	src/bfin/ffitarget.h src/bfin/sysv.S src/frv/eabi.S		\
-	src/frv/ffitarget.h src/dlmalloc.c src/tile/ffi.c		\
-	src/tile/ffitarget.h src/tile/tile.S libtool-version		\
-	src/xtensa/ffitarget.h src/xtensa/ffi.c src/xtensa/sysv.S	\
+	 src/aarch64/ffi.c src/aarch64/ffitarget.h src/aarch64/sysv.S	\
+	 build-ios.sh src/alpha/ffi.c src/alpha/osf.S			\
+	 src/alpha/ffitarget.h src/arm/ffi.c src/arm/sysv.S		\
+	 src/arm/ffitarget.h src/avr32/ffi.c src/avr32/sysv.S		\
+	 src/avr32/ffitarget.h src/cris/ffi.c src/cris/sysv.S		\
+	 src/cris/ffitarget.h src/ia64/ffi.c src/ia64/ffitarget.h	\
+	 src/ia64/ia64_flags.h src/ia64/unix.S src/mips/ffi.c		\
+	 src/mips/n32.S src/mips/o32.S src/metag/ffi.c			\
+	 src/metag/ffitarget.h src/metag/sysv.S src/moxie/ffi.c		\
+	 src/moxie/ffitarget.h src/moxie/eabi.S src/mips/ffitarget.h	\
+	 src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h		\
+	 src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h		\
+	 src/microblaze/ffi.c src/microblaze/sysv.S			\
+	 src/microblaze/ffitarget.h src/powerpc/ffi.c			\
+	 src/powerpc/sysv.S src/powerpc/linux64.S			\
+	 src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S	\
+	 src/powerpc/asm.h src/powerpc/aix.S src/powerpc/darwin.S	\
+	 src/powerpc/aix_closure.S src/powerpc/darwin_closure.S		\
+	 src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h		\
+	 src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h		\
+	 src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/sh64/ffi.c	\
+	 src/sh64/sysv.S src/sh64/ffitarget.h src/sparc/v8.S		\
+	 src/sparc/v9.S src/sparc/ffitarget.h src/sparc/ffi.c		\
+	 src/x86/darwin64.S src/x86/ffi.c src/x86/sysv.S		\
+	 src/x86/win32.S src/x86/darwin.S src/x86/win64.S		\
+	 src/x86/freebsd.S src/x86/ffi64.c src/x86/unix64.S		\
+	 src/x86/ffitarget.h src/pa/ffitarget.h src/pa/ffi.c		\
+	 src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c src/bfin/ffi.c	\
+	 src/bfin/ffitarget.h src/bfin/sysv.S src/frv/eabi.S		\
+	 src/frv/ffitarget.h src/dlmalloc.c src/tile/ffi.c		\
+	 src/tile/ffitarget.h src/tile/tile.S libtool-version		\
+	 src/xtensa/ffitarget.h src/xtensa/ffi.c src/xtensa/sysv.S	\
 	 ChangeLog.libffi m4/libtool.m4 m4/lt~obsolete.m4		\
 	 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4			\
 	 m4/ltversion.m4 src/arm/gentramp.sh src/debug.c msvcc.sh	\
-	generate-ios-source-and-headers.py				\
+	 generate-ios-source-and-headers.py				\
 	 generate-osx-source-and-headers.py				\
-	 libffi.xcodeproj/project.pbxproj src/arm/trampoline.S          \
-        libtool-ldflags
+	 libffi.xcodeproj/project.pbxproj src/arm/trampoline.S		\
+	 libtool-ldflags
 
 info_TEXINFOS = doc/libffi.texi
 
@@ -208,6 +209,9 @@
 if XTENSA
 nodist_libffi_la_SOURCES += src/xtensa/sysv.S src/xtensa/ffi.c
 endif
+if METAG
+nodist_libffi_la_SOURCES += src/metag/sysv.S src/metag/ffi.c
+endif
 
 libffi_convenience_la_SOURCES = $(libffi_la_SOURCES)
 nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
diff --git a/Modules/_ctypes/libffi/Makefile.in b/Modules/_ctypes/libffi/Makefile.in
--- a/Modules/_ctypes/libffi/Makefile.in
+++ b/Modules/_ctypes/libffi/Makefile.in
@@ -85,6 +85,7 @@
 @PA_HPUX_TRUE at am__append_31 = src/pa/hpux32.S src/pa/ffi.c
 @TILE_TRUE at am__append_32 = src/tile/tile.S src/tile/ffi.c
 @XTENSA_TRUE at am__append_33 = src/xtensa/sysv.S src/xtensa/ffi.c
+ at METAG_TRUE@am__append_34 = src/metag/sysv.S src/metag/ffi.c
 subdir = .
 DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in $(srcdir)/doc/stamp-vti \
@@ -196,6 +197,7 @@
 @PA_HPUX_TRUE at am__objects_31 = src/pa/hpux32.lo src/pa/ffi.lo
 @TILE_TRUE at am__objects_32 = src/tile/tile.lo src/tile/ffi.lo
 @XTENSA_TRUE at am__objects_33 = src/xtensa/sysv.lo src/xtensa/ffi.lo
+ at METAG_TRUE@am__objects_34 = src/metag/sysv.lo src/metag/ffi.lo
 nodist_libffi_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
 	$(am__objects_3) $(am__objects_4) $(am__objects_5) \
 	$(am__objects_6) $(am__objects_7) $(am__objects_8) \
@@ -207,17 +209,17 @@
 	$(am__objects_24) $(am__objects_25) $(am__objects_26) \
 	$(am__objects_27) $(am__objects_28) $(am__objects_29) \
 	$(am__objects_30) $(am__objects_31) $(am__objects_32) \
-	$(am__objects_33)
+	$(am__objects_33) $(am__objects_34)
 libffi_la_OBJECTS = $(am_libffi_la_OBJECTS) \
 	$(nodist_libffi_la_OBJECTS)
 libffi_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(libffi_la_LDFLAGS) $(LDFLAGS) -o $@
 libffi_convenience_la_LIBADD =
-am__objects_34 = src/prep_cif.lo src/types.lo src/raw_api.lo \
+am__objects_35 = src/prep_cif.lo src/types.lo src/raw_api.lo \
 	src/java_raw_api.lo src/closures.lo
-am_libffi_convenience_la_OBJECTS = $(am__objects_34)
-am__objects_35 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \
+am_libffi_convenience_la_OBJECTS = $(am__objects_35)
+am__objects_36 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \
 	$(am__objects_4) $(am__objects_5) $(am__objects_6) \
 	$(am__objects_7) $(am__objects_8) $(am__objects_9) \
 	$(am__objects_10) $(am__objects_11) $(am__objects_12) \
@@ -227,8 +229,9 @@
 	$(am__objects_22) $(am__objects_23) $(am__objects_24) \
 	$(am__objects_25) $(am__objects_26) $(am__objects_27) \
 	$(am__objects_28) $(am__objects_29) $(am__objects_30) \
-	$(am__objects_31) $(am__objects_32) $(am__objects_33)
-nodist_libffi_convenience_la_OBJECTS = $(am__objects_35)
+	$(am__objects_31) $(am__objects_32) $(am__objects_33) \
+	$(am__objects_34)
+nodist_libffi_convenience_la_OBJECTS = $(am__objects_36)
 libffi_convenience_la_OBJECTS = $(am_libffi_convenience_la_OBJECTS) \
 	$(nodist_libffi_convenience_la_OBJECTS)
 DEFAULT_INCLUDES = -I. at am__isrc@
@@ -466,44 +469,45 @@
 ACLOCAL_AMFLAGS = -I m4
 SUBDIRS = include testsuite man
 EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host	\
-	 src/aarch64/ffi.c src/aarch64/ffitarget.h			\
-	 src/aarch64/sysv.S build-ios.sh				\
-	 src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h		\
-	 src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h		\
-	 src/avr32/ffi.c src/avr32/sysv.S src/avr32/ffitarget.h		\
-	 src/cris/ffi.c src/cris/sysv.S src/cris/ffitarget.h		\
-	 src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h	\
-	 src/ia64/unix.S src/mips/ffi.c src/mips/n32.S src/mips/o32.S	\
-	 src/mips/ffitarget.h src/m32r/ffi.c src/m32r/sysv.S		\
-	 src/m32r/ffitarget.h src/m68k/ffi.c src/m68k/sysv.S		\
-	 src/m68k/ffitarget.h src/microblaze/ffi.c			\
-	 src/microblaze/sysv.S src/microblaze/ffitarget.h		\
-	 src/powerpc/ffi.c src/powerpc/sysv.S				\
-	 src/powerpc/linux64.S src/powerpc/linux64_closure.S		\
-	 src/powerpc/ppc_closure.S src/powerpc/asm.h			\
-	src/powerpc/aix.S src/powerpc/darwin.S				\
-	src/powerpc/aix_closure.S src/powerpc/darwin_closure.S		\
-	src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h		\
-	src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h		\
-	src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/sh64/ffi.c	\
-	src/sh64/sysv.S src/sh64/ffitarget.h src/sparc/v8.S		\
-	src/sparc/v9.S src/sparc/ffitarget.h src/sparc/ffi.c		\
-	src/x86/darwin64.S src/x86/ffi.c src/x86/sysv.S			\
-	src/x86/win32.S src/x86/darwin.S src/x86/win64.S		\
-	src/x86/freebsd.S src/x86/ffi64.c src/x86/unix64.S		\
-	src/x86/ffitarget.h src/pa/ffitarget.h src/pa/ffi.c		\
-	src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c src/bfin/ffi.c	\
-	src/bfin/ffitarget.h src/bfin/sysv.S src/frv/eabi.S		\
-	src/frv/ffitarget.h src/dlmalloc.c src/tile/ffi.c		\
-	src/tile/ffitarget.h src/tile/tile.S libtool-version		\
-	src/xtensa/ffitarget.h src/xtensa/ffi.c src/xtensa/sysv.S	\
+	 src/aarch64/ffi.c src/aarch64/ffitarget.h src/aarch64/sysv.S	\
+	 build-ios.sh src/alpha/ffi.c src/alpha/osf.S			\
+	 src/alpha/ffitarget.h src/arm/ffi.c src/arm/sysv.S		\
+	 src/arm/ffitarget.h src/avr32/ffi.c src/avr32/sysv.S		\
+	 src/avr32/ffitarget.h src/cris/ffi.c src/cris/sysv.S		\
+	 src/cris/ffitarget.h src/ia64/ffi.c src/ia64/ffitarget.h	\
+	 src/ia64/ia64_flags.h src/ia64/unix.S src/mips/ffi.c		\
+	 src/mips/n32.S src/mips/o32.S src/metag/ffi.c			\
+	 src/metag/ffitarget.h src/metag/sysv.S src/moxie/ffi.c		\
+	 src/moxie/ffitarget.h src/moxie/eabi.S src/mips/ffitarget.h	\
+	 src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h		\
+	 src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h		\
+	 src/microblaze/ffi.c src/microblaze/sysv.S			\
+	 src/microblaze/ffitarget.h src/powerpc/ffi.c			\
+	 src/powerpc/sysv.S src/powerpc/linux64.S			\
+	 src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S	\
+	 src/powerpc/asm.h src/powerpc/aix.S src/powerpc/darwin.S	\
+	 src/powerpc/aix_closure.S src/powerpc/darwin_closure.S		\
+	 src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h		\
+	 src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h		\
+	 src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/sh64/ffi.c	\
+	 src/sh64/sysv.S src/sh64/ffitarget.h src/sparc/v8.S		\
+	 src/sparc/v9.S src/sparc/ffitarget.h src/sparc/ffi.c		\
+	 src/x86/darwin64.S src/x86/ffi.c src/x86/sysv.S		\
+	 src/x86/win32.S src/x86/darwin.S src/x86/win64.S		\
+	 src/x86/freebsd.S src/x86/ffi64.c src/x86/unix64.S		\
+	 src/x86/ffitarget.h src/pa/ffitarget.h src/pa/ffi.c		\
+	 src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c src/bfin/ffi.c	\
+	 src/bfin/ffitarget.h src/bfin/sysv.S src/frv/eabi.S		\
+	 src/frv/ffitarget.h src/dlmalloc.c src/tile/ffi.c		\
+	 src/tile/ffitarget.h src/tile/tile.S libtool-version		\
+	 src/xtensa/ffitarget.h src/xtensa/ffi.c src/xtensa/sysv.S	\
 	 ChangeLog.libffi m4/libtool.m4 m4/lt~obsolete.m4		\
 	 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4			\
 	 m4/ltversion.m4 src/arm/gentramp.sh src/debug.c msvcc.sh	\
-	generate-ios-source-and-headers.py				\
+	 generate-ios-source-and-headers.py				\
 	 generate-osx-source-and-headers.py				\
-	 libffi.xcodeproj/project.pbxproj src/arm/trampoline.S          \
-        libtool-ldflags
+	 libffi.xcodeproj/project.pbxproj src/arm/trampoline.S		\
+	 libtool-ldflags
 
 info_TEXINFOS = doc/libffi.texi
 
@@ -567,7 +571,7 @@
 	$(am__append_24) $(am__append_25) $(am__append_26) \
 	$(am__append_27) $(am__append_28) $(am__append_29) \
 	$(am__append_30) $(am__append_31) $(am__append_32) \
-	$(am__append_33)
+	$(am__append_33) $(am__append_34)
 libffi_convenience_la_SOURCES = $(libffi_la_SOURCES)
 nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/libtool-ldflags $(LDFLAGS))
@@ -943,6 +947,16 @@
 	src/xtensa/$(DEPDIR)/$(am__dirstamp)
 src/xtensa/ffi.lo: src/xtensa/$(am__dirstamp) \
 	src/xtensa/$(DEPDIR)/$(am__dirstamp)
+src/metag/$(am__dirstamp):
+	@$(MKDIR_P) src/metag
+	@: > src/metag/$(am__dirstamp)
+src/metag/$(DEPDIR)/$(am__dirstamp):
+	@$(MKDIR_P) src/metag/$(DEPDIR)
+	@: > src/metag/$(DEPDIR)/$(am__dirstamp)
+src/metag/sysv.lo: src/metag/$(am__dirstamp) \
+	src/metag/$(DEPDIR)/$(am__dirstamp)
+src/metag/ffi.lo: src/metag/$(am__dirstamp) \
+	src/metag/$(DEPDIR)/$(am__dirstamp)
 libffi.la: $(libffi_la_OBJECTS) $(libffi_la_DEPENDENCIES) $(EXTRA_libffi_la_DEPENDENCIES) 
 	$(libffi_la_LINK) -rpath $(toolexeclibdir) $(libffi_la_OBJECTS) $(libffi_la_LIBADD) $(LIBS)
 libffi_convenience.la: $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_DEPENDENCIES) $(EXTRA_libffi_convenience_la_DEPENDENCIES) 
@@ -972,6 +986,8 @@
 	-rm -f src/m32r/*.lo
 	-rm -f src/m68k/*.$(OBJEXT)
 	-rm -f src/m68k/*.lo
+	-rm -f src/metag/*.$(OBJEXT)
+	-rm -f src/metag/*.lo
 	-rm -f src/microblaze/*.$(OBJEXT)
 	-rm -f src/microblaze/*.lo
 	-rm -f src/mips/*.$(OBJEXT)
@@ -1027,6 +1043,8 @@
 @AMDEP_TRUE@@am__include@ @am__quote at src/m32r/$(DEPDIR)/sysv.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at src/m68k/$(DEPDIR)/ffi.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at src/m68k/$(DEPDIR)/sysv.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at src/metag/$(DEPDIR)/ffi.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at src/metag/$(DEPDIR)/sysv.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at src/microblaze/$(DEPDIR)/ffi.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at src/microblaze/$(DEPDIR)/sysv.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at src/mips/$(DEPDIR)/ffi.Plo at am__quote@
@@ -1134,6 +1152,7 @@
 	-rm -rf src/ia64/.libs src/ia64/_libs
 	-rm -rf src/m32r/.libs src/m32r/_libs
 	-rm -rf src/m68k/.libs src/m68k/_libs
+	-rm -rf src/metag/.libs src/metag/_libs
 	-rm -rf src/microblaze/.libs src/microblaze/_libs
 	-rm -rf src/mips/.libs src/mips/_libs
 	-rm -rf src/moxie/.libs src/moxie/_libs
@@ -1711,6 +1730,8 @@
 	-rm -f src/m32r/$(am__dirstamp)
 	-rm -f src/m68k/$(DEPDIR)/$(am__dirstamp)
 	-rm -f src/m68k/$(am__dirstamp)
+	-rm -f src/metag/$(DEPDIR)/$(am__dirstamp)
+	-rm -f src/metag/$(am__dirstamp)
 	-rm -f src/microblaze/$(DEPDIR)/$(am__dirstamp)
 	-rm -f src/microblaze/$(am__dirstamp)
 	-rm -f src/mips/$(DEPDIR)/$(am__dirstamp)
@@ -1747,7 +1768,7 @@
 
 distclean: distclean-recursive
 	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-	-rm -rf src/$(DEPDIR) src/aarch64/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/bfin/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/microblaze/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/tile/$(DEPDIR) src/x86/$(DEPDIR) src/xtensa/$(DEPDIR)
+	-rm -rf src/$(DEPDIR) src/aarch64/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/bfin/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/metag/$(DEPDIR) src/microblaze/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/tile/$(DEPDIR) src/x86/$(DEPDIR) src/xtensa/$(DEPDIR)
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-hdr distclean-libtool distclean-tags
@@ -1886,7 +1907,7 @@
 maintainer-clean: maintainer-clean-recursive
 	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
 	-rm -rf $(top_srcdir)/autom4te.cache
-	-rm -rf src/$(DEPDIR) src/aarch64/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/bfin/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/microblaze/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/tile/$(DEPDIR) src/x86/$(DEPDIR) src/xtensa/$(DEPDIR)
+	-rm -rf src/$(DEPDIR) src/aarch64/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/bfin/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/metag/$(DEPDIR) src/microblaze/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/tile/$(DEPDIR) src/x86/$(DEPDIR) src/xtensa/$(DEPDIR)
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-aminfo \
 	maintainer-clean-generic maintainer-clean-vti
diff --git a/Modules/_ctypes/libffi/README b/Modules/_ctypes/libffi/README
--- a/Modules/_ctypes/libffi/README
+++ b/Modules/_ctypes/libffi/README
@@ -1,7 +1,7 @@
 Status
 ======
 
-libffi-3.0.12 was released on February 11, 2013.  Check the libffi web
+libffi-3.0.13 was released on March 17, 2013.  Check the libffi web
 page for updates: <URL:http://sourceware.org/libffi/>.
 
 
@@ -43,7 +43,7 @@
 For specific configuration details and testing status, please
 refer to the wiki page here:
 
- http://www.moxielogic.org/wiki/index.php?title=Libffi_3.0.12
+ http://www.moxielogic.org/wiki/index.php?title=Libffi_3.0.13
 
 At the time of release, the following basic configurations have been
 tested:
@@ -63,6 +63,7 @@
 | M68K            | FreeMiNT         | GCC                     |
 | M68K            | Linux	     | GCC                     |
 | M68K            | RTEMS            | GCC                     |
+| Meta            | Linux            | GCC                     |
 | MicroBlaze      | Linux            | GCC                     |
 | MIPS            | IRIX             | GCC                     |
 | MIPS            | Linux            | GCC                     |
@@ -162,6 +163,16 @@
 
 See the ChangeLog files for details.
 
+3.0.13 Mar-17-13
+	Add Meta support.
+	Add missing Moxie bits.
+	Fix stack alignment bug on 32-bit x86.
+	Build fix for m68000 targets.
+	Build fix for soft-float Power targets.
+	Fix the install dir location for some platforms when building
+	  with GCC (OS X, Solaris).
+	Fix Cygwin regression.
+
 3.0.12 Feb-11-13
         Add Moxie support.
 	Add AArch64 support.
diff --git a/Modules/_ctypes/libffi/build-ios.sh b/Modules/_ctypes/libffi/build-ios.sh
old mode 100755
new mode 100644
diff --git a/Modules/_ctypes/libffi/configure b/Modules/_ctypes/libffi/configure
--- a/Modules/_ctypes/libffi/configure
+++ b/Modules/_ctypes/libffi/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libffi 3.0.12.
+# Generated by GNU Autoconf 2.69 for libffi 3.0.13.
 #
 # Report bugs to <http://github.com/atgreen/libffi/issues>.
 #
@@ -590,8 +590,8 @@
 # Identity of this package.
 PACKAGE_NAME='libffi'
 PACKAGE_TARNAME='libffi'
-PACKAGE_VERSION='3.0.12'
-PACKAGE_STRING='libffi 3.0.12'
+PACKAGE_VERSION='3.0.13'
+PACKAGE_STRING='libffi 3.0.13'
 PACKAGE_BUGREPORT='http://github.com/atgreen/libffi/issues'
 PACKAGE_URL=''
 
@@ -685,6 +685,8 @@
 POWERPC_TRUE
 MOXIE_FALSE
 MOXIE_TRUE
+METAG_FALSE
+METAG_TRUE
 MICROBLAZE_FALSE
 MICROBLAZE_TRUE
 M68K_FALSE
@@ -1405,7 +1407,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures libffi 3.0.12 to adapt to many kinds of systems.
+\`configure' configures libffi 3.0.13 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1476,7 +1478,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libffi 3.0.12:";;
+     short | recursive ) echo "Configuration of libffi 3.0.13:";;
    esac
   cat <<\_ACEOF
 
@@ -1596,7 +1598,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-libffi configure 3.0.12
+libffi configure 3.0.13
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2202,7 +2204,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by libffi $as_me 3.0.12, which was
+It was created by libffi $as_me 3.0.13, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3245,7 +3247,7 @@
 
 # Define the identity of the package.
  PACKAGE='libffi'
- VERSION='3.0.12'
+ VERSION='3.0.13'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -13367,8 +13369,8 @@
 	;;
 
   i*86-*-nto-qnx*)
-	TARGET=X86; TARGETDIR=x86
-	;;
+        TARGET=X86; TARGETDIR=x86
+        ;;
 
   x86_64-*-darwin*)
 	TARGET=X86_DARWIN; TARGETDIR=x86
@@ -13423,6 +13425,10 @@
 	TARGET=MOXIE; TARGETDIR=moxie
 	;;
 
+  metag-*-*)
+	TARGET=METAG; TARGETDIR=metag
+	;;
+
   mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
 	TARGET=MIPS_IRIX; TARGETDIR=mips
 	;;
@@ -13593,6 +13599,14 @@
   MICROBLAZE_FALSE=
 fi
 
+ if test x$TARGET = xMETAG; then
+  METAG_TRUE=
+  METAG_FALSE='#'
+else
+  METAG_TRUE='#'
+  METAG_FALSE=
+fi
+
  if test x$TARGET = xMOXIE; then
   MOXIE_TRUE=
   MOXIE_FALSE='#'
@@ -14491,10 +14505,10 @@
   $as_echo_n "(cached) " >&6
 else
 
-	libffi_cv_as_x86_pcrel=no
+	libffi_cv_as_x86_pcrel=yes
 	echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s
-	if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then
-	    libffi_cv_as_x86_pcrel=yes
+	if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then
+	    libffi_cv_as_x86_pcrel=no
 	fi
 
 fi
@@ -14833,7 +14847,7 @@
   multi_os_directory=`$CC -print-multi-os-directory`
   case $multi_os_directory in
     .) ;; # Avoid trailing /.
-    *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
+    ../*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
   esac
 
 else
@@ -15055,6 +15069,10 @@
   as_fn_error $? "conditional \"MICROBLAZE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${METAG_TRUE}" && test -z "${METAG_FALSE}"; then
+  as_fn_error $? "conditional \"METAG\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${MOXIE_TRUE}" && test -z "${MOXIE_FALSE}"; then
   as_fn_error $? "conditional \"MOXIE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -15541,7 +15559,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by libffi $as_me 3.0.12, which was
+This file was extended by libffi $as_me 3.0.13, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -15611,7 +15629,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-libffi config.status 3.0.12
+libffi config.status 3.0.13
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/Modules/_ctypes/libffi/configure.ac b/Modules/_ctypes/libffi/configure.ac
--- a/Modules/_ctypes/libffi/configure.ac
+++ b/Modules/_ctypes/libffi/configure.ac
@@ -1,11 +1,11 @@
 dnl Process this with autoconf to create configure
 #
-# file from libffi - slightly patched for ctypes
+# file from libffi - slightly patched for Python's ctypes
 #
 
 AC_PREREQ(2.68)
 
-AC_INIT([libffi], [3.0.12], [http://github.com/atgreen/libffi/issues])
+AC_INIT([libffi], [3.0.13], [http://github.com/atgreen/libffi/issues])
 AC_CONFIG_HEADERS([fficonfig.h])
 
 AC_CANONICAL_SYSTEM
@@ -150,8 +150,8 @@
 	;;
 
   i*86-*-nto-qnx*) 
-	TARGET=X86; TARGETDIR=x86
-	;;
+        TARGET=X86; TARGETDIR=x86
+        ;;
 
   x86_64-*-darwin*)
 	TARGET=X86_DARWIN; TARGETDIR=x86
@@ -206,6 +206,10 @@
 	TARGET=MOXIE; TARGETDIR=moxie
 	;;
 
+  metag-*-*)
+	TARGET=METAG; TARGETDIR=metag
+	;;
+
   mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
 	TARGET=MIPS_IRIX; TARGETDIR=mips
 	;;
@@ -285,6 +289,7 @@
 AM_CONDITIONAL(M32R, test x$TARGET = xM32R)
 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
 AM_CONDITIONAL(MICROBLAZE, test x$TARGET = xMICROBLAZE)
+AM_CONDITIONAL(METAG, test x$TARGET = xMETAG)
 AM_CONDITIONAL(MOXIE, test x$TARGET = xMOXIE)
 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
 AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX)
@@ -362,10 +367,10 @@
 if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then
     AC_CACHE_CHECK([assembler supports pc related relocs],
 	libffi_cv_as_x86_pcrel, [
-	libffi_cv_as_x86_pcrel=no
+	libffi_cv_as_x86_pcrel=yes
 	echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s
-	if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then
-	    libffi_cv_as_x86_pcrel=yes
+	if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then
+	    libffi_cv_as_x86_pcrel=no
 	fi
 	])
     if test "x$libffi_cv_as_x86_pcrel" = xyes; then
@@ -551,7 +556,7 @@
   multi_os_directory=`$CC -print-multi-os-directory`
   case $multi_os_directory in
     .) ;; # Avoid trailing /.
-    *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
+    ../*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
   esac
   AC_SUBST(toolexecdir)
 else
diff --git a/Modules/_ctypes/libffi/doc/libffi.info b/Modules/_ctypes/libffi/doc/libffi.info
index 7b3d7565751d015d0b0fd239f2473cf270fbebf4..896a5ec0f1efe6231df04e22e25ec1e280b5e077
GIT binary patch
[stripped]
diff --git a/Modules/_ctypes/libffi/doc/libffi.texi b/Modules/_ctypes/libffi/doc/libffi.texi
--- a/Modules/_ctypes/libffi/doc/libffi.texi
+++ b/Modules/_ctypes/libffi/doc/libffi.texi
@@ -360,7 +360,7 @@
 new @code{ffi_type} object for it.
 
 @tindex ffi_type
- at deftp ffi_type
+ at deftp {Data type} ffi_type
 The @code{ffi_type} has the following members:
 @table @code
 @item size_t size
diff --git a/Modules/_ctypes/libffi/doc/stamp-vti b/Modules/_ctypes/libffi/doc/stamp-vti
--- a/Modules/_ctypes/libffi/doc/stamp-vti
+++ b/Modules/_ctypes/libffi/doc/stamp-vti
@@ -1,4 +1,4 @@
- at set UPDATED 6 February 2013
- at set UPDATED-MONTH February 2013
- at set EDITION 3.0.12
- at set VERSION 3.0.12
+ at set UPDATED 16 March 2013
+ at set UPDATED-MONTH March 2013
+ at set EDITION 3.0.13
+ at set VERSION 3.0.13
diff --git a/Modules/_ctypes/libffi/doc/version.texi b/Modules/_ctypes/libffi/doc/version.texi
--- a/Modules/_ctypes/libffi/doc/version.texi
+++ b/Modules/_ctypes/libffi/doc/version.texi
@@ -1,4 +1,4 @@
- at set UPDATED 6 February 2013
- at set UPDATED-MONTH February 2013
- at set EDITION 3.0.12
- at set VERSION 3.0.12
+ at set UPDATED 16 March 2013
+ at set UPDATED-MONTH March 2013
+ at set EDITION 3.0.13
+ at set VERSION 3.0.13
diff --git a/Modules/_ctypes/libffi/fficonfig.py.in b/Modules/_ctypes/libffi/fficonfig.py.in
--- a/Modules/_ctypes/libffi/fficonfig.py.in
+++ b/Modules/_ctypes/libffi/fficonfig.py.in
@@ -11,7 +11,6 @@
     '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'],
-    'AARCH64': ['src/aarch64/ffi.c', 'src/aarch64/sysv.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'],
diff --git a/Modules/_ctypes/libffi/libtool-ldflags b/Modules/_ctypes/libffi/libtool-ldflags
old mode 100755
new mode 100644
diff --git a/Modules/_ctypes/libffi/ltmain.sh b/Modules/_ctypes/libffi/ltmain.sh
old mode 100644
new mode 100755
diff --git a/Modules/_ctypes/libffi/mdate-sh b/Modules/_ctypes/libffi/mdate-sh
old mode 100644
new mode 100755
diff --git a/Modules/_ctypes/libffi/msvcc.sh b/Modules/_ctypes/libffi/msvcc.sh
old mode 100755
new mode 100644
diff --git a/Modules/_ctypes/libffi/src/arm/gentramp.sh b/Modules/_ctypes/libffi/src/arm/gentramp.sh
old mode 100755
new mode 100644
diff --git a/Modules/_ctypes/libffi/src/closures.c b/Modules/_ctypes/libffi/src/closures.c
--- a/Modules/_ctypes/libffi/src/closures.c
+++ b/Modules/_ctypes/libffi/src/closures.c
@@ -189,8 +189,6 @@
 
 #define is_emutramp_enabled() (emutramp_enabled >= 0 ? emutramp_enabled \
                                : (emutramp_enabled = emutramp_enabled_check ()))
-#else
-#define is_emutramp_enabled() 0
 #endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */
 
 #elif defined (__CYGWIN__) || defined(__INTERIX)
@@ -202,6 +200,10 @@
 
 #endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */
 
+#ifndef FFI_MMAP_EXEC_EMUTRAMP_PAX
+#define is_emutramp_enabled() 0
+#endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */
+
 /* Declare all functions defined in dlmalloc.c as static.  */
 static void *dlmalloc(size_t);
 static void dlfree(void*);
diff --git a/Modules/_ctypes/libffi/src/dlmalloc.c b/Modules/_ctypes/libffi/src/dlmalloc.c
--- a/Modules/_ctypes/libffi/src/dlmalloc.c
+++ b/Modules/_ctypes/libffi/src/dlmalloc.c
@@ -100,7 +100,7 @@
 
        If you don't like either of these options, you can define
        CORRUPTION_ERROR_ACTION and USAGE_ERROR_ACTION to do anything
-       else. And if you are sure that your program using malloc has
+       else. And if if you are sure that your program using malloc has
        no errors or vulnerabilities, you can define INSECURE to 1,
        which might (or might not) provide a small performance improvement.
 
@@ -607,7 +607,7 @@
   declaration needed is the mallinfo struct that is returned (by-copy)
   by mallinfo().  The malloinfo struct contains a bunch of fields that
   are not even meaningful in this version of malloc.  These fields are
-  instead filled by mallinfo() with other numbers that might be of
+  are instead filled by mallinfo() with other numbers that might be of
   interest.
 
   HAVE_USR_INCLUDE_MALLOC_H should be set if you have a
@@ -1621,7 +1621,7 @@
   Each freshly allocated chunk must have both cinuse and pinuse set.
   That is, each allocated chunk borders either a previously allocated
   and still in-use chunk, or the base of its memory arena. This is
-  ensured by making all allocations from the `lowest' part of any
+  ensured by making all allocations from the the `lowest' part of any
   found chunk.  Further, no free chunk physically borders another one,
   so each free chunk is known to be preceded and followed by either
   inuse chunks or the ends of memory.
@@ -1827,12 +1827,12 @@
   of the same size are arranged in a circularly-linked list, with only
   the oldest chunk (the next to be used, in our FIFO ordering)
   actually in the tree.  (Tree members are distinguished by a non-null
-  parent pointer.)  If a chunk with the same size as an existing node
+  parent pointer.)  If a chunk with the same size an an existing node
   is inserted, it is linked off the existing node using pointers that
   work in the same way as fd/bk pointers of small chunks.
 
   Each tree contains a power of 2 sized range of chunk sizes (the
-  smallest is 0x100 <= x < 0x180), which is divided in half at each
+  smallest is 0x100 <= x < 0x180), which is is divided in half at each
   tree level, with the chunks in the smaller half of the range (0x100
   <= x < 0x140 for the top nose) in the left subtree and the larger
   half (0x140 <= x < 0x180) in the right subtree.  This is, of course,
@@ -3442,7 +3442,7 @@
     least-preferred order):
     1. A call to MORECORE that can normally contiguously extend memory.
        (disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or
-       main space is mmapped or a previous contiguous call failed)
+       or main space is mmapped or a previous contiguous call failed)
     2. A call to MMAP new space (disabled if not HAVE_MMAP).
        Note that under the default settings, if MORECORE is unable to
        fulfill a request, and HAVE_MMAP is true, then mmap is
diff --git a/Modules/_ctypes/libffi/src/ia64/ffi.c b/Modules/_ctypes/libffi/src/ia64/ffi.c
--- a/Modules/_ctypes/libffi/src/ia64/ffi.c
+++ b/Modules/_ctypes/libffi/src/ia64/ffi.c
@@ -85,7 +85,7 @@
 #define ldf_fill(result, addr)	\
   asm ("ldf.fill %0 = %1%P1" : "=f"(result) : "m"(*addr));
 
-/* Return the size of the C type associated with TYPE, which will
+/* Return the size of the C type associated with with TYPE.  Which will
    be one of the FFI_IA64_TYPE_HFA_* values.  */
 
 static size_t
@@ -185,7 +185,7 @@
       break;
 
     case FFI_TYPE_LONGDOUBLE:
-      /* Similarly, except that HFA is true for double extended,
+      /* Similarly, except that that HFA is true for double extended,
 	 but not quad precision.  Both have sizeof == 16, so tell the
 	 difference based on the precision.  */
       if (LDBL_MANT_DIG == 64 && nested)
diff --git a/Modules/_ctypes/libffi/src/m68k/sysv.S b/Modules/_ctypes/libffi/src/m68k/sysv.S
--- a/Modules/_ctypes/libffi/src/m68k/sysv.S
+++ b/Modules/_ctypes/libffi/src/m68k/sysv.S
@@ -2,10 +2,9 @@
 	
    sysv.S - Copyright (c) 2012 Alan Hourihane
 	    Copyright (c) 1998, 2012 Andreas Schwab
-	    Copyright (c) 2008 Red Hat, Inc.
-	    Copyright (c) 2012 Thorsten Glaser
-
-   m68k Foreign Function Interface
+	    Copyright (c) 2008 Red Hat, Inc. 
+   
+   m68k Foreign Function Interface 
 
    Permission is hereby granted, free of charge, to any person obtaining
    a copy of this software and associated documentation files (the
@@ -169,22 +168,8 @@
 
 retstruct2:
 	btst	#7,%d2
-	jbeq	retsint8
+	jbeq	noretval
 	move.w	%d0,(%a1)
-	jbra	epilogue
-
-retsint8:
-	btst	#8,%d2
-	jbeq	retsint16
-	extb.l	%d0
-	move.l	%d0,(%a1)
-	jbra	epilogue
-
-retsint16:
-	btst	#9,%d2
-	jbeq	noretval
-	ext.l	%d0
-	move.l	%d0,(%a1)
 
 noretval:
 epilogue:
@@ -216,10 +201,8 @@
 	lsr.l	#1,%d0
 	jne	1f
 	jcc	.Lcls_epilogue
-	| CIF_FLAGS_INT
 	move.l	-12(%fp),%d0
 .Lcls_epilogue:
-	| no CIF_FLAGS_*
 	unlk	%fp
 	rts
 1:
@@ -227,7 +210,6 @@
 	lsr.l	#2,%d0
 	jne	1f
 	jcs	.Lcls_ret_float
-	| CIF_FLAGS_DINT
 	move.l	(%a0)+,%d0
 	move.l	(%a0),%d1
 	jra	.Lcls_epilogue
@@ -242,7 +224,6 @@
 	lsr.l	#2,%d0
 	jne	1f
 	jcs	.Lcls_ret_ldouble
-	| CIF_FLAGS_DOUBLE
 #if defined(__MC68881__) || defined(__HAVE_68881__)
 	fmove.d	(%a0),%fp0
 #else
@@ -261,31 +242,17 @@
 	jra	.Lcls_epilogue
 1:
 	lsr.l	#2,%d0
-	jne	1f
+	jne	.Lcls_ret_struct2
 	jcs	.Lcls_ret_struct1
-	| CIF_FLAGS_POINTER
 	move.l	(%a0),%a0
 	move.l	%a0,%d0
 	jra	.Lcls_epilogue
 .Lcls_ret_struct1:
 	move.b	(%a0),%d0
 	jra	.Lcls_epilogue
-1:
-	lsr.l	#2,%d0
-	jne	1f
-	jcs	.Lcls_ret_sint8
-	| CIF_FLAGS_STRUCT2
+.Lcls_ret_struct2:
 	move.w	(%a0),%d0
 	jra	.Lcls_epilogue
-.Lcls_ret_sint8:
-	move.l	(%a0),%d0
-	extb.l	%d0
-	jra	.Lcls_epilogue
-1:
-	| CIF_FLAGS_SINT16
-	move.l	(%a0),%d0
-	ext.l	%d0
-	jra	.Lcls_epilogue
 	CFI_ENDPROC()
 
 	.size	CALLFUNC(ffi_closure_SYSV),.-CALLFUNC(ffi_closure_SYSV)
diff --git a/Modules/_ctypes/libffi/src/metag/ffi.c b/Modules/_ctypes/libffi/src/metag/ffi.c
new file mode 100644
--- /dev/null
+++ b/Modules/_ctypes/libffi/src/metag/ffi.c
@@ -0,0 +1,330 @@
+/* ----------------------------------------------------------------------
+  ffi.c - Copyright (c) 2013 Imagination Technologies
+
+  Meta Foreign Function Interface
+  Permission is hereby granted, free of charge, to any person obtaining
+  a copy of this software and associated documentation files (the
+  `Software''), to deal in the Software without restriction, including
+  without limitation the rights to use, copy, modify, merge, publish,
+  distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to
+  the following conditions:
+
+  The above copyright notice and this permission notice shall be included
+  in all copies or substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED `AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+  IN NO EVENT SHALL SIMON POSNJAK BE LIABLE FOR ANY CLAIM, DAMAGES OR
+  OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+  ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+  OTHER DEALINGS IN THE SOFTWARE.
+----------------------------------------------------------------------- */
+
+#include <ffi.h>
+#include <ffi_common.h>
+
+#include <stdlib.h>
+
+#define MIN(a,b) (((a) < (b)) ? (a) : (b))
+
+/*
+ * ffi_prep_args is called by the assembly routine once stack space has been
+ * allocated for the function's arguments
+ */
+
+unsigned int ffi_prep_args(char *stack, extended_cif *ecif)
+{
+	register unsigned int i;
+	register void **p_argv;
+	register char *argp;
+	register ffi_type **p_arg;
+
+	argp = stack;
+
+	/* Store return value */
+	if ( ecif->cif->flags == FFI_TYPE_STRUCT ) {
+		argp -= 4;
+		*(void **) argp = ecif->rvalue;
+	}
+
+	p_argv = ecif->avalue;
+
+	/* point to next location */
+	for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0); i--, p_arg++, p_argv++)
+	{
+		size_t z;
+
+		/* Move argp to address of argument */
+		z = (*p_arg)->size;
+		argp -= z;
+
+		/* Align if necessary */
+		argp = (char *) ALIGN_DOWN(ALIGN_DOWN(argp, (*p_arg)->alignment), 4);
+
+		if (z < sizeof(int)) {
+			z = sizeof(int);
+			switch ((*p_arg)->type)
+			{
+			case FFI_TYPE_SINT8:
+				*(signed int *) argp = (signed int)*(SINT8 *)(* p_argv);
+				break;
+			case FFI_TYPE_UINT8:
+				*(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv);
+				break;
+			case FFI_TYPE_SINT16:
+				*(signed int *) argp = (signed int)*(SINT16 *)(* p_argv);
+				break;
+			case FFI_TYPE_UINT16:
+				*(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv);
+			case FFI_TYPE_STRUCT:
+				memcpy(argp, *p_argv, (*p_arg)->size);
+				break;
+			default:
+				FFI_ASSERT(0);
+			}
+		} else if ( z == sizeof(int)) {
+			*(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
+		} else {
+			memcpy(argp, *p_argv, z);
+		}
+	}
+
+	/* return the size of the arguments to be passed in registers,
+	   padded to an 8 byte boundary to preserve stack alignment */
+	return ALIGN(MIN(stack - argp, 6*4), 8);
+}
+
+/* Perform machine dependent cif processing */
+ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
+{
+	ffi_type **ptr;
+	unsigned i, bytes = 0;
+
+	for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) {
+		if ((*ptr)->size == 0)
+			return FFI_BAD_TYPEDEF;
+
+		/* Perform a sanity check on the argument type, do this
+		   check after the initialization.  */
+		FFI_ASSERT_VALID_TYPE(*ptr);
+
+		/* Add any padding if necessary */
+		if (((*ptr)->alignment - 1) & bytes)
+			bytes = ALIGN(bytes, (*ptr)->alignment);
+
+		bytes += ALIGN((*ptr)->size, 4);
+	}
+
+	/* Ensure arg space is aligned to an 8-byte boundary */
+	bytes = ALIGN(bytes, 8);
+
+	/* Make space for the return structure pointer */
+	if (cif->rtype->type == FFI_TYPE_STRUCT) {
+		bytes += sizeof(void*);
+
+		/* Ensure stack is aligned to an 8-byte boundary */
+		bytes = ALIGN(bytes, 8);
+	}
+
+	cif->bytes = bytes;
+
+	/* Set the return type flag */
+	switch (cif->rtype->type) {
+	case FFI_TYPE_VOID:
+	case FFI_TYPE_FLOAT:
+	case FFI_TYPE_DOUBLE:
+		cif->flags = (unsigned) cif->rtype->type;
+		break;
+	case FFI_TYPE_SINT64:
+	case FFI_TYPE_UINT64:
+		cif->flags = (unsigned) FFI_TYPE_SINT64;
+		break;
+	case FFI_TYPE_STRUCT:
+		/* Meta can store return values which are <= 64 bits */
+		if (cif->rtype->size <= 4)
+			/* Returned to D0Re0 as 32-bit value */
+			cif->flags = (unsigned)FFI_TYPE_INT;
+		else if ((cif->rtype->size > 4) && (cif->rtype->size <= 8))
+			/* Returned valued is stored to D1Re0|R0Re0 */
+			cif->flags = (unsigned)FFI_TYPE_DOUBLE;
+		else
+			/* value stored in memory */
+			cif->flags = (unsigned)FFI_TYPE_STRUCT;
+		break;
+	default:
+		cif->flags = (unsigned)FFI_TYPE_INT;
+		break;
+	}
+	return FFI_OK;
+}
+
+extern void ffi_call_SYSV(void (*fn)(void), extended_cif *, unsigned, unsigned, double *);
+
+/*
+ * Exported in API. Entry point
+ * cif -> ffi_cif object
+ * fn -> function pointer
+ * rvalue -> pointer to return value
+ * avalue -> vector of void * pointers pointing to memory locations holding the
+ * arguments
+ */
+void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
+{
+	extended_cif ecif;
+
+	int small_struct = (((cif->flags == FFI_TYPE_INT) || (cif->flags == FFI_TYPE_DOUBLE)) && (cif->rtype->type == FFI_TYPE_STRUCT));
+	ecif.cif = cif;
+	ecif.avalue = avalue;
+
+	double temp;
+
+	/*
+	 * If the return value is a struct and we don't have a return value address
+	 * then we need to make one
+	 */
+
+	if ((rvalue == NULL ) && (cif->flags == FFI_TYPE_STRUCT))
+		ecif.rvalue = alloca(cif->rtype->size);
+	else if (small_struct)
+		ecif.rvalue = &temp;
+	else
+		ecif.rvalue = rvalue;
+
+	switch (cif->abi) {
+	case FFI_SYSV:
+		ffi_call_SYSV(fn, &ecif, cif->bytes, cif->flags, ecif.rvalue);
+		break;
+	default:
+		FFI_ASSERT(0);
+		break;
+	}
+
+	if (small_struct)
+		memcpy (rvalue, &temp, cif->rtype->size);
+}
+
+/* private members */
+
+static void ffi_prep_incoming_args_SYSV (char *, void **, void **,
+	ffi_cif*, float *);
+
+void ffi_closure_SYSV (ffi_closure *);
+
+/* Do NOT change that without changing the FFI_TRAMPOLINE_SIZE */
+extern unsigned int ffi_metag_trampoline[10]; /* 10 instructions */
+
+/* end of private members */
+
+/*
+ * __tramp: trampoline memory location
+ * __fun: assembly routine
+ * __ctx: memory location for wrapper
+ *
+ * At this point, tramp[0] == __ctx !
+ */
+void ffi_init_trampoline(unsigned char *__tramp, unsigned int __fun, unsigned int __ctx) {
+	memcpy (__tramp, ffi_metag_trampoline, sizeof(ffi_metag_trampoline));
+	*(unsigned int*) &__tramp[40] = __ctx;
+	*(unsigned int*) &__tramp[44] = __fun;
+	/* This will flush the instruction cache */
+	__builtin_meta2_cachewd(&__tramp[0], 1);
+	__builtin_meta2_cachewd(&__tramp[47], 1);
+}
+
+
+
+/* the cif must already be prepared */
+
+ffi_status
+ffi_prep_closure_loc (ffi_closure *closure,
+	ffi_cif* cif,
+	void (*fun)(ffi_cif*,void*,void**,void*),
+	void *user_data,
+	void *codeloc)
+{
+	void (*closure_func)(ffi_closure*) = NULL;
+
+	if (cif->abi == FFI_SYSV)
+		closure_func = &ffi_closure_SYSV;
+	else
+		return FFI_BAD_ABI;
+
+	ffi_init_trampoline(
+		(unsigned char*)&closure->tramp[0],
+		(unsigned int)closure_func,
+		(unsigned int)codeloc);
+
+	closure->cif = cif;
+	closure->user_data = user_data;
+	closure->fun = fun;
+
+	return FFI_OK;
+}
+
+
+/* This function is jumped to by the trampoline */
+unsigned int ffi_closure_SYSV_inner (closure, respp, args, vfp_args)
+	ffi_closure *closure;
+	void **respp;
+	void *args;
+	void *vfp_args;
+{
+	ffi_cif *cif;
+	void **arg_area;
+
+	cif = closure->cif;
+	arg_area = (void**) alloca (cif->nargs * sizeof (void*));
+
+	/*
+	 * This call will initialize ARG_AREA, such that each
+	 * element in that array points to the corresponding
+	 * value on the stack; and if the function returns
+	 * a structure, it will re-set RESP to point to the
+	 * structure return address.
+	 */
+	ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif, vfp_args);
+
+	(closure->fun) ( cif, *respp, arg_area, closure->user_data);
+
+	return cif->flags;
+}
+
+static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue,
+	void **avalue, ffi_cif *cif,
+	float *vfp_stack)
+{
+	register unsigned int i;
+	register void **p_argv;
+	register char *argp;
+	register ffi_type **p_arg;
+
+	/* stack points to original arguments */
+	argp = stack;
+
+	/* Store return value */
+	if ( cif->flags == FFI_TYPE_STRUCT ) {
+		argp -= 4;
+		*rvalue = *(void **) argp;
+	}
+
+	p_argv = avalue;
+
+	for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) {
+		size_t z;
+		size_t alignment;
+
+		alignment = (*p_arg)->alignment;
+		if (alignment < 4)
+			alignment = 4;
+		if ((alignment - 1) & (unsigned)argp)
+			argp = (char *) ALIGN(argp, alignment);
+
+		z = (*p_arg)->size;
+		*p_argv = (void*) argp;
+		p_argv++;
+		argp -= z;
+	}
+	return;
+}
diff --git a/Modules/_ctypes/libffi/src/metag/ffitarget.h b/Modules/_ctypes/libffi/src/metag/ffitarget.h
new file mode 100644
--- /dev/null
+++ b/Modules/_ctypes/libffi/src/metag/ffitarget.h
@@ -0,0 +1,53 @@
+/* -----------------------------------------------------------------*-C-*-
+   ffitarget.h - Copyright (c) 2013 Imagination Technologies Ltd.
+   Target configuration macros for Meta
+
+   Permission is hereby granted, free of charge, to any person obtaining
+   a copy of this software and associated documentation files (the
+   ``Software''), to deal in the Software without restriction, including
+   without limitation the rights to use, copy, modify, merge, publish,
+   distribute, sublicense, and/or sell copies of the Software, and to
+   permit persons to whom the Software is furnished to do so, subject to
+   the following conditions:
+
+   The above copyright notice and this permission notice shall be included
+   in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+   NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+   DEALINGS IN THE SOFTWARE.
+
+   ----------------------------------------------------------------------- */
+
+#ifndef LIBFFI_TARGET_H
+#define LIBFFI_TARGET_H
+
+#ifndef LIBFFI_H
+#error "Please do not include ffitarget.h directly into your source.  Use ffi.h instead."
+#endif
+
+#ifndef LIBFFI_ASM
+typedef unsigned long          ffi_arg;
+typedef signed long            ffi_sarg;
+
+typedef enum ffi_abi {
+  FFI_FIRST_ABI = 0,
+  FFI_SYSV,
+  FFI_DEFAULT_ABI = FFI_SYSV,
+  FFI_LAST_ABI = FFI_DEFAULT_ABI + 1,
+} ffi_abi;
+#endif
+
+/* ---- Definitions for closures ----------------------------------------- */
+
+#define FFI_CLOSURES 1
+#define FFI_TRAMPOLINE_SIZE 48
+#define FFI_NATIVE_RAW_API 0
+
+#endif
+
diff --git a/Modules/_ctypes/libffi/src/metag/sysv.S b/Modules/_ctypes/libffi/src/metag/sysv.S
new file mode 100644
--- /dev/null
+++ b/Modules/_ctypes/libffi/src/metag/sysv.S
@@ -0,0 +1,311 @@
+/* -----------------------------------------------------------------------
+   sysv.S - Copyright (c) 2013 Imagination Technologies Ltd.
+
+   Meta Foreign Function Interface
+
+   Permission is hereby granted, free of charge, to any person obtaining
+   a copy of this software and associated documentation files (the
+   ``Software''), to deal in the Software without restriction, including
+   without limitation the rights to use, copy, modify, merge, publish,
+   distribute, sublicense, and/or sell copies of the Software, and to
+   permit persons to whom the Software is furnished to do so, subject to
+   the following conditions:
+
+   The above copyright notice and this permission notice shall be included
+   in all copies or substantial portions of the Software.
+
+
+   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+   NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+   DEALINGS IN THE SOFTWARE.
+   ----------------------------------------------------------------------- */
+
+#define LIBFFI_ASM
+#include <fficonfig.h>
+#include <ffi.h>
+#ifdef HAVE_MACHINE_ASM_H
+#include <machine/asm.h>
+#else
+#ifdef __USER_LABEL_PREFIX__
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+/* Use the right prefix for global labels. */
+#define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+#else
+#define CNAME(x) x
+#endif
+#define ENTRY(x) .globl CNAME(x); .type CNAME(x), %function; CNAME(x):
+#endif
+
+#ifdef __ELF__
+#define LSYM(x) .x
+#else
+#define LSYM(x) x
+#endif
+
+.macro call_reg x=
+	.text
+	.balign 4
+	mov D1RtP, \x
+	swap D1RtP, PC
+.endm
+
+! Save register arguments
+.macro SAVE_ARGS
+	.text
+	.balign 4
+	setl	[A0StP++], D0Ar6, D1Ar5
+	setl	[A0StP++], D0Ar4, D1Ar3
+	setl	[A0StP++], D0Ar2, D1Ar1
+.endm
+
+! Save retrun, frame pointer and other regs
+.macro SAVE_REGS regs=
+	.text
+	.balign 4
+	setl	[A0StP++], D0FrT, D1RtP
+	! Needs to be a pair of regs
+	.ifnc "\regs",""
+	setl	[A0StP++], \regs
+	.endif
+.endm
+
+! Declare a global function
+.macro METAG_FUNC_START name
+	.text
+	.balign 4
+	ENTRY(\name)
+.endm
+
+! Return registers from the stack. Reverse SAVE_REGS operation
+.macro RET_REGS regs=, cond=
+	.ifnc "\regs", ""
+	getl	\regs, [--A0StP]
+	.endif
+	getl	D0FrT, D1RtP, [--A0StP]
+.endm
+
+! Return arguments
+.macro RET_ARGS
+	getl	D0Ar2, D1Ar1, [--A0StP]
+	getl	D0Ar4, D1Ar3, [--A0StP]
+	getl	D0Ar6, D1Ar5, [--A0StP]
+.endm
+
+
+	! D1Ar1:	fn
+	! D0Ar2:	&ecif
+	! D1Ar3:	cif->bytes
+	! D0Ar4:	fig->flags
+	! D1Ar5:	ecif.rvalue
+
+	! This assumes we are using GNU as
+METAG_FUNC_START ffi_call_SYSV
+	! Save argument registers
+
+	SAVE_ARGS
+
+	! new frame
+	mov	D0FrT, A0FrP
+	add     A0FrP, A0StP, #0
+
+	! Preserve the old frame pointer
+	SAVE_REGS "D1.5, D0.5"
+
+	! Make room for new args. cifs->bytes is the total space for input
+	! and return arguments
+
+	add	A0StP, A0StP, D1Ar3
+
+	! Preserve cifs->bytes & fn
+	mov	D0.5, D1Ar3
+	mov	D1.5, D1Ar1
+
+	! Place all of the ffi_prep_args in position
+	mov	D1Ar1, A0StP
+
+	! Call ffi_prep_args(stack, &ecif)
+#ifdef __PIC__
+	callr  D1RtP, CNAME(ffi_prep_args at PLT)
+#else
+	callr  D1RtP, CNAME(ffi_prep_args)
+#endif
+
+	! Restore fn pointer
+
+	! The foreign stack should look like this
+	! XXXXX XXXXXX <--- stack pointer
+	! FnArgN rvalue
+	! FnArgN+2 FnArgN+1
+	! FnArgN+4 FnArgN+3
+	! ....
+	!
+
+	! A0StP now points to the first (or return) argument + 4
+
+	! Preserve cif->bytes
+	getl	D0Ar2, D1Ar1, [--A0StP]
+	getl	D0Ar4, D1Ar3, [--A0StP]
+	getl	D0Ar6, D1Ar5, [--A0StP]
+
+	! Place A0StP to the first argument again
+	add	A0StP, A0StP, #24 ! That's because we loaded 6 regs x 4 byte each
+
+	! A0FrP points to the initial stack without the reserved space for the
+	! cifs->bytes, whilst A0StP points to the stack after the space allocation
+
+	! fn was the first argument of ffi_call_SYSV.
+	! The stack at this point looks like this:
+	!
+	! A0StP(on entry to _SYSV) ->	Arg6	Arg5     | low
+	!				Arg4	Arg3     |
+	! 				Arg2	Arg1     |
+	! A0FrP ---->			D0FrtP	D1RtP    |
+	!				D1.5	D0.5	 |
+	! A0StP(bf prep_args) ->	FnArgn	FnArgn-1 |
+	!				FnArgn-2FnArgn-3 |
+	!				................ | <= cifs->bytes
+	!				FnArg4  FnArg3	 |
+	! A0StP (prv_A0StP+cifs->bytes) FnArg2  FnArg1   | high
+	!
+	! fn was in Arg1 so it's located in in A0FrP+#-0xC
+	!
+
+	! D0Re0 contains the size of arguments stored in registers
+	sub	A0StP, A0StP, D0Re0
+
+	! Arg1 is the function pointer for the foreign call. This has been
+	! preserved in D1.5
+
+	! Time to call (fn). Arguments should be like this:
+	! Arg1-Arg6 are loaded to regs
+	! The rest of the arguments are stored in stack pointed by A0StP
+
+	call_reg D1.5
+
+	! Reset stack.
+
+	mov	A0StP, A0FrP
+
+	! Load Arg1 with the pointer to storage for the return type
+	! This was stored in Arg5
+
+	getd	D1Ar1, [A0FrP+#-20]
+
+	! Load D0Ar2 with the return type code. This was stored in Arg4 (flags)
+
+	getd	D0Ar2, [A0FrP+#-16]
+
+	! We are ready to start processing the return value
+	! D0Re0 (and D1Re0) hold the return value
+
+	! If the return value is NULL, assume no return value
+	cmp	D1Ar1, #0
+	beq	LSYM(Lepilogue)
+
+	! return INT
+	cmp		D0Ar2, #FFI_TYPE_INT
+	! Sadly, there is no setd{cc} instruction so we need to workaround that
+	bne	.INT64
+	setd	[D1Ar1], D0Re0
+	b	LSYM(Lepilogue)
+
+	! return INT64
+.INT64:
+	cmp	D0Ar2, #FFI_TYPE_SINT64
+	setleq	[D1Ar1], D0Re0, D1Re0
+
+	! return DOUBLE
+	cmp	D0Ar2, #FFI_TYPE_DOUBLE
+	setl	[D1AR1++], D0Re0, D1Re0
+
+LSYM(Lepilogue):
+	! At this point, the stack pointer points right after the argument
+	! saved area. We need to restore 4 regs, therefore we need to move
+	! 16 bytes ahead.
+	add     A0StP, A0StP, #16
+	RET_REGS "D1.5, D0.5"
+	RET_ARGS
+	getd	D0Re0, [A0StP]
+	mov     A0FrP, D0FrT
+	swap	D1RtP, PC
+
+.ffi_call_SYSV_end:
+       .size   CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV)
+
+
+/*
+	(called by ffi_metag_trampoline)
+	void ffi_closure_SYSV (ffi_closure*)
+
+	(called by ffi_closure_SYSV)
+	unsigned int FFI_HIDDEN
+	ffi_closure_SYSV_inner (closure,respp, args)
+		ffi_closure *closure;
+		void **respp;
+		void *args;
+*/
+
+METAG_FUNC_START ffi_closure_SYSV
+	! We assume that D1Ar1 holds the address of the
+	! ffi_closure struct. We will use that to fetch the
+	! arguments. The stack pointer points to an empty space
+	! and it is ready to store more data.
+
+	! D1Ar1 is ready
+	! Allocate stack space for return value
+	add A0StP, A0StP, #8
+	! Store it to D0Ar2
+	sub D0Ar2, A0StP, #8
+
+	sub D1Ar3, A0FrP, #4
+
+	! D1Ar3 contains the address of the original D1Ar1 argument
+	! We need to subtract #4 later on
+
+	! Preverve D0Ar2
+	mov D0.5, D0Ar2
+
+#ifdef __PIC__
+	callr D1RtP, CNAME(ffi_closure_SYSV_inner at PLT)
+#else
+	callr D1RtP, CNAME(ffi_closure_SYSV_inner)
+#endif
+
+	! Check the return value and store it to D0.5
+	cmp D0Re0, #FFI_TYPE_INT
+	beq .Lretint
+	cmp D0Re0, #FFI_TYPE_DOUBLE
+	beq .Lretdouble
+.Lclosure_epilogue:
+	sub A0StP, A0StP, #8
+	RET_REGS "D1.5, D0.5"
+	RET_ARGS
+	swap	D1RtP, PC
+
+.Lretint:
+	setd [D0.5], D0Re0
+	b .Lclosure_epilogue
+.Lretdouble:
+	setl [D0.5++], D0Re0, D1Re0
+	b .Lclosure_epilogue
+.ffi_closure_SYSV_end:
+.size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV)
+
+
+ENTRY(ffi_metag_trampoline)
+	SAVE_ARGS
+	! New frame
+	mov A0FrP, A0StP
+	SAVE_REGS "D1.5, D0.5"
+	mov D0.5, PC
+	! Load D1Ar1 the value of ffi_metag_trampoline
+	getd D1Ar1, [D0.5 + #8]
+	! Jump to ffi_closure_SYSV
+	getd PC, [D0.5 + #12]
diff --git a/Modules/_ctypes/libffi/src/mips/ffi.c b/Modules/_ctypes/libffi/src/mips/ffi.c
--- a/Modules/_ctypes/libffi/src/mips/ffi.c
+++ b/Modules/_ctypes/libffi/src/mips/ffi.c
@@ -670,16 +670,9 @@
   if (cif->abi != FFI_O32 && cif->abi != FFI_O32_SOFT_FLOAT)
     return FFI_BAD_ABI;
   fn = ffi_closure_O32;
-#else
-#if _MIPS_SIM ==_ABIN32
-  if (cif->abi != FFI_N32
-      && cif->abi != FFI_N32_SOFT_FLOAT)
+#else /* FFI_MIPS_N32 */
+  if (cif->abi != FFI_N32 && cif->abi != FFI_N64)
     return FFI_BAD_ABI;
-#else
-  if (cif->abi != FFI_N64
-      && cif->abi != FFI_N64_SOFT_FLOAT)
-    return FFI_BAD_ABI;
-#endif
   fn = ffi_closure_N32;
 #endif /* FFI_MIPS_O32 */
 
diff --git a/Modules/_ctypes/libffi/src/powerpc/ffi.c b/Modules/_ctypes/libffi/src/powerpc/ffi.c
--- a/Modules/_ctypes/libffi/src/powerpc/ffi.c
+++ b/Modules/_ctypes/libffi/src/powerpc/ffi.c
@@ -48,11 +48,6 @@
 
   FLAG_RETURNS_128BITS  = 1 << (31-27), /* cr6  */
 
-  FLAG_SYSV_SMST_R4     = 1 << (31-26), /* use r4 for FFI_SYSV 8 byte
-					   structs.  */
-  FLAG_SYSV_SMST_R3     = 1 << (31-25), /* use r3 for FFI_SYSV 4 byte
-					   structs.  */
-
   FLAG_ARG_NEEDS_COPY   = 1 << (31- 7),
 #ifndef __NO_FPRS__
   FLAG_FP_ARGUMENTS     = 1 << (31- 6), /* cr1.eq; specified by ABI */
@@ -372,12 +367,6 @@
   /* Check that we didn't overrun the stack...  */
   FFI_ASSERT (copy_space.c >= next_arg.c);
   FFI_ASSERT (gpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS);
-  /* The assert below is testing that the number of integer arguments agrees
-     with the number found in ffi_prep_cif_machdep().  However, intarg_count
-     is incremeneted whenever we place an FP arg on the stack, so account for
-     that before our assert test.  */
-  if (fparg_count > NUM_FPR_ARG_REGISTERS)
-    intarg_count -= fparg_count - NUM_FPR_ARG_REGISTERS;
 #ifndef __NO_FPRS__
   FFI_ASSERT (fpr_base.u
 	      <= stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS);
@@ -675,11 +664,9 @@
   switch (type)
     {
 #ifndef __NO_FPRS__
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
     case FFI_TYPE_LONGDOUBLE:
       flags |= FLAG_RETURNS_128BITS;
       /* Fall through.  */
-#endif
     case FFI_TYPE_DOUBLE:
       flags |= FLAG_RETURNS_64BITS;
       /* Fall through.  */
@@ -697,35 +684,18 @@
       break;
 
     case FFI_TYPE_STRUCT:
-      if (cif->abi == FFI_SYSV)
-	{
-	  /* The final SYSV ABI says that structures smaller or equal 8 bytes
-	     are returned in r3/r4. The FFI_GCC_SYSV ABI instead returns them
-	     in memory.  */
-
-	  /* Treat structs with size <= 8 bytes.  */
-	  if (size <= 8)
-	    {
-	      flags |= FLAG_RETURNS_SMST;
-	      /* These structs are returned in r3. We pack the type and the
-		 precalculated shift value (needed in the sysv.S) into flags.
-		 The same applies for the structs returned in r3/r4.  */
-	      if (size <= 4)
-		{
-		  flags |= FLAG_SYSV_SMST_R3;
-		  flags |= 8 * (4 - size) << 8;
-		  break;
-		}
-	      /* These structs are returned in r3 and r4. See above.   */
-	      if  (size <= 8)
-		{
-		  flags |= FLAG_SYSV_SMST_R3 | FLAG_SYSV_SMST_R4;
-		  flags |= 8 * (8 - size) << 8;
-		  break;
-		}
-	    }
-	}
-
+      /*
+       * The final SYSV ABI says that structures smaller or equal 8 bytes
+       * are returned in r3/r4. The FFI_GCC_SYSV ABI instead returns them
+       * in memory.
+       *
+       * NOTE: The assembly code can safely assume that it just needs to
+       *       store both r3 and r4 into a 8-byte word-aligned buffer, as
+       *       we allocate a temporary buffer in ffi_call() if this flag is
+       *       set.
+       */
+      if (cif->abi == FFI_SYSV && size <= 8)
+	flags |= FLAG_RETURNS_SMST;
       intarg_count++;
       flags |= FLAG_RETVAL_REFERENCE;
       /* Fall through.  */
diff --git a/Modules/_ctypes/libffi/src/sparc/ffi.c b/Modules/_ctypes/libffi/src/sparc/ffi.c
--- a/Modules/_ctypes/libffi/src/sparc/ffi.c
+++ b/Modules/_ctypes/libffi/src/sparc/ffi.c
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------
-   ffi.c - Copyright (c) 2011, 2013 Anthony Green
+   ffi.c - Copyright (c) 2011 Anthony Green
            Copyright (c) 1996, 2003-2004, 2007-2008 Red Hat, Inc.
    
    SPARC Foreign Function Interface 
@@ -376,10 +376,6 @@
 		       unsigned, unsigned *, void (*fn)(void));
 #endif
 
-#ifndef __GNUC__
-void ffi_flush_icache (void *, size_t);
-#endif
-
 void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
 {
   extended_cif ecif;
@@ -421,7 +417,7 @@
 	  /* behind "call", so we alloc some executable space for it. */
 	  /* l7 is used, we need to make sure v8.S doesn't use %l7.   */
 	  unsigned int *call_struct = NULL;
-	  ffi_closure_alloc(32, (void **)&call_struct);
+	  ffi_closure_alloc(32, &call_struct);
 	  if (call_struct)
 	    {
 	      unsigned long f = (unsigned long)fn;
@@ -436,14 +432,10 @@
 		call_struct[5] = 0x01000000;	     	 /* nop			 */
 	      call_struct[6] = 0x81c7e008;		 /* ret			 */
 	      call_struct[7] = 0xbe100017;		 /* mov   %l7, %i7	 */
-#ifdef __GNUC__
 	      asm volatile ("iflush %0; iflush %0+8; iflush %0+16; iflush %0+24" : :
 			    "r" (call_struct) : "memory");
 	      /* SPARC v8 requires 5 instructions for flush to be visible */
 	      asm volatile ("nop; nop; nop; nop; nop");
-#else
-	      ffi_flush_icache (call_struct, 32);
-#endif
 	      ffi_call_v8(ffi_prep_args_v8, &ecif, cif->bytes,
 			  cif->flags, rvalue, call_struct);
 	      ffi_closure_free(call_struct);
@@ -521,7 +513,6 @@
   closure->user_data = user_data;
 
   /* Flush the Icache.  closure is 8 bytes aligned.  */
-#ifdef __GNUC__
 #ifdef SPARC64
   asm volatile ("flush	%0; flush %0+8" : : "r" (closure) : "memory");
 #else
@@ -529,9 +520,6 @@
   /* SPARC v8 requires 5 instructions for flush to be visible */
   asm volatile ("nop; nop; nop; nop; nop");
 #endif
-#else
-  ffi_flush_icache (closure, 16);
-#endif
 
   return FFI_OK;
 }
diff --git a/Modules/_ctypes/libffi/src/x86/ffi.c b/Modules/_ctypes/libffi/src/x86/ffi.c
--- a/Modules/_ctypes/libffi/src/x86/ffi.c
+++ b/Modules/_ctypes/libffi/src/x86/ffi.c
@@ -315,9 +315,7 @@
   cif->bytes += 4 * sizeof(ffi_arg);
 #endif
 
-#ifdef X86_DARWIN
   cif->bytes = (cif->bytes + 15) & ~0xF;
-#endif
 
   return FFI_OK;
 }
diff --git a/Modules/_ctypes/libffi/src/x86/ffi64.c b/Modules/_ctypes/libffi/src/x86/ffi64.c
--- a/Modules/_ctypes/libffi/src/x86/ffi64.c
+++ b/Modules/_ctypes/libffi/src/x86/ffi64.c
@@ -1,6 +1,5 @@
 /* -----------------------------------------------------------------------
-   ffi64.c - Copyright (c) 2013  The Written Word, Inc.
-             Copyright (c) 2011  Anthony Green
+   ffi64.c - Copyright (c) 20011  Anthony Green
              Copyright (c) 2008, 2010  Red Hat, Inc.
              Copyright (c) 2002, 2007  Bo Thorsen <bo at suse.de>
              
@@ -38,29 +37,17 @@
 #define MAX_GPR_REGS 6
 #define MAX_SSE_REGS 8
 
-#if defined(__INTEL_COMPILER)
+#ifdef __INTEL_COMPILER
 #define UINT128 __m128
 #else
-#if defined(__SUNPRO_C)
-#include <sunmedia_types.h>
-#define UINT128 __m128i
-#else
 #define UINT128 __int128_t
 #endif
-#endif
-
-union big_int_union
-{
-  UINT32 i32;
-  UINT64 i64;
-  UINT128 i128;
-};
 
 struct register_args
 {
   /* Registers for argument passing.  */
   UINT64 gpr[MAX_GPR_REGS];
-  union big_int_union sse[MAX_SSE_REGS]; 
+  UINT128 sse[MAX_SSE_REGS];
 };
 
 extern void ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags,
@@ -484,33 +471,16 @@
 		{
 		case X86_64_INTEGER_CLASS:
 		case X86_64_INTEGERSI_CLASS:
-		  /* Sign-extend integer arguments passed in general
-		     purpose registers, to cope with the fact that
-		     LLVM incorrectly assumes that this will be done
-		     (the x86-64 PS ABI does not specify this). */
-		  switch (arg_types[i]->type)
-		    {
-		    case FFI_TYPE_SINT8:
-		      *(SINT64 *)&reg_args->gpr[gprcount] = (SINT64) *((SINT8 *) a);
-		      break;
-		    case FFI_TYPE_SINT16:
-		      *(SINT64 *)&reg_args->gpr[gprcount] = (SINT64) *((SINT16 *) a);
-		      break;
-		    case FFI_TYPE_SINT32:
-		      *(SINT64 *)&reg_args->gpr[gprcount] = (SINT64) *((SINT32 *) a);
-		      break;
-		    default:
-		      reg_args->gpr[gprcount] = 0;
-		      memcpy (&reg_args->gpr[gprcount], a, size < 8 ? size : 8);
-		    }
+		  reg_args->gpr[gprcount] = 0;
+		  memcpy (&reg_args->gpr[gprcount], a, size < 8 ? size : 8);
 		  gprcount++;
 		  break;
 		case X86_64_SSE_CLASS:
 		case X86_64_SSEDF_CLASS:
-		  reg_args->sse[ssecount++].i64 = *(UINT64 *) a;
+		  reg_args->sse[ssecount++] = *(UINT64 *) a;
 		  break;
 		case X86_64_SSESF_CLASS:
-		  reg_args->sse[ssecount++].i32 = *(UINT32 *) a;
+		  reg_args->sse[ssecount++] = *(UINT32 *) a;
 		  break;
 		default:
 		  abort();
diff --git a/Modules/_ctypes/libffi/src/x86/ffitarget.h b/Modules/_ctypes/libffi/src/x86/ffitarget.h
--- a/Modules/_ctypes/libffi/src/x86/ffitarget.h
+++ b/Modules/_ctypes/libffi/src/x86/ffitarget.h
@@ -61,9 +61,8 @@
 typedef long long              ffi_sarg;
 #endif
 #else
-#if defined __x86_64__ && defined __ILP32__
+#if defined __x86_64__ && !defined __LP64__
 #define FFI_SIZEOF_ARG 8
-#define FFI_SIZEOF_JAVA_RAW  4
 typedef unsigned long long     ffi_arg;
 typedef long long              ffi_sarg;
 #else
diff --git a/Modules/_ctypes/libffi/src/x86/sysv.S b/Modules/_ctypes/libffi/src/x86/sysv.S
--- a/Modules/_ctypes/libffi/src/x86/sysv.S
+++ b/Modules/_ctypes/libffi/src/x86/sysv.S
@@ -1,6 +1,5 @@
 /* -----------------------------------------------------------------------
-   sysv.S - Copyright (c) 2013  The Written Word, Inc.
-	  - Copyright (c) 1996,1998,2001-2003,2005,2008,2010  Red Hat, Inc.
+   sysv.S - Copyright (c) 1996, 1998, 2001-2003, 2005, 2008, 2010  Red Hat, Inc.
    
    X86 Foreign Function Interface 
 
@@ -182,19 +181,9 @@
 	leal	-24(%ebp), %edx
 	movl	%edx, -12(%ebp)	/* resp */
 	leal	8(%ebp), %edx
-#ifdef __SUNPRO_C
-	/* The SUNPRO compiler doesn't support GCC's regparm function
-  	   attribute, so we have to pass all three arguments to
-	   ffi_closure_SYSV_inner on the stack.  */
-	movl	%edx, 8(%esp)	/* args = __builtin_dwarf_cfa () */
-	leal	-12(%ebp), %edx
-	movl	%edx, 4(%esp)	/* &resp */
-	movl    %eax, (%esp)    /* closure */
-#else
 	movl	%edx, 4(%esp)	/* args = __builtin_dwarf_cfa () */
 	leal	-12(%ebp), %edx
 	movl	%edx, (%esp)	/* &resp */
-#endif
 #if defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE || !defined __PIC__
 	call	ffi_closure_SYSV_inner
 #else
@@ -339,9 +328,6 @@
 	.size	ffi_closure_raw_SYSV, .-ffi_closure_raw_SYSV
 #endif
 
-#if defined __GNUC__
-/* Only emit dwarf unwind info when building with GNU toolchain.  */
-
 #if defined __PIC__
 # if defined __sun__ && defined __svr4__
 /* 32-bit Solaris 2/x86 uses datarel encoding for PIC.  GNU ld before 2.22
@@ -474,7 +460,6 @@
 .LEFDE3:
 
 #endif
-#endif
 
 #endif /* ifndef __x86_64__ */
 
diff --git a/Modules/_ctypes/libffi/src/x86/unix64.S b/Modules/_ctypes/libffi/src/x86/unix64.S
--- a/Modules/_ctypes/libffi/src/x86/unix64.S
+++ b/Modules/_ctypes/libffi/src/x86/unix64.S
@@ -1,7 +1,6 @@
 /* -----------------------------------------------------------------------
-   unix64.S - Copyright (c) 2013  The Written Word, Inc.
-	    - Copyright (c) 2008  Red Hat, Inc
-	    - Copyright (c) 2002  Bo Thorsen <bo at suse.de>
+   unix64.S - Copyright (c) 2002  Bo Thorsen <bo at suse.de>
+	      Copyright (c) 2008  Red Hat, Inc
 
    x86-64 Foreign Function Interface 
 
@@ -325,9 +324,6 @@
 .LUW9:
 	.size	ffi_closure_unix64,.-ffi_closure_unix64
 
-#ifdef __GNUC__
-/* Only emit DWARF unwind info when building with the GNU toolchain.  */
-
 #ifdef HAVE_AS_X86_64_UNWIND_SECTION_TYPE
 	.section	.eh_frame,"a", at unwind
 #else
@@ -423,8 +419,6 @@
 	.align 8
 .LEFDE3:
 
-#endif /* __GNUC__ */
-	
 #endif /* __x86_64__ */
 
 #if defined __ELF__ && defined __linux__
diff --git a/Modules/_ctypes/libffi/stamp-h.in b/Modules/_ctypes/libffi/stamp-h.in
new file mode 100644
--- /dev/null
+++ b/Modules/_ctypes/libffi/stamp-h.in
@@ -0,0 +1,1 @@
+timestamp
diff --git a/Modules/_ctypes/libffi/testsuite/Makefile.am b/Modules/_ctypes/libffi/testsuite/Makefile.am
--- a/Modules/_ctypes/libffi/testsuite/Makefile.am
+++ b/Modules/_ctypes/libffi/testsuite/Makefile.am
@@ -13,82 +13,73 @@
 
 AM_RUNTESTFLAGS =
 
-EXTRA_DEJAGNU_SITE_CONFIG=../local.exp
-
 CLEANFILES = *.exe core* *.log *.sum
 
-EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c		\
-libffi.call/cls_align_longdouble_split.c				\
-libffi.call/closure_loc_fn0.c libffi.call/cls_schar.c			\
-libffi.call/closure_fn1.c libffi.call/many2_win32.c			\
-libffi.call/return_ul.c libffi.call/cls_align_double.c			\
-libffi.call/return_fl2.c libffi.call/cls_1_1byte.c			\
-libffi.call/cls_64byte.c libffi.call/nested_struct7.c			\
-libffi.call/cls_align_sint32.c libffi.call/nested_struct2.c		\
-libffi.call/ffitest.h libffi.call/nested_struct4.c			\
-libffi.call/cls_multi_ushort.c libffi.call/struct3.c			\
-libffi.call/cls_3byte1.c libffi.call/cls_16byte.c			\
-libffi.call/struct8.c libffi.call/nested_struct8.c			\
-libffi.call/cls_multi_sshort.c libffi.call/cls_3byte2.c			\
-libffi.call/fastthis2_win32.c libffi.call/cls_pointer.c			\
-libffi.call/err_bad_typedef.c libffi.call/cls_4_1byte.c			\
-libffi.call/cls_9byte2.c libffi.call/cls_multi_schar.c			\
-libffi.call/stret_medium2.c libffi.call/cls_5_1_byte.c			\
-libffi.call/call.exp libffi.call/cls_double.c				\
-libffi.call/cls_align_sint16.c libffi.call/cls_uint.c			\
-libffi.call/return_ll1.c libffi.call/nested_struct3.c			\
-libffi.call/cls_20byte1.c libffi.call/closure_fn4.c			\
-libffi.call/cls_uchar.c libffi.call/struct2.c libffi.call/cls_7byte.c	\
-libffi.call/strlen.c libffi.call/many.c libffi.call/testclosure.c	\
-libffi.call/return_fl.c libffi.call/struct5.c				\
-libffi.call/cls_12byte.c libffi.call/cls_multi_sshortchar.c		\
-libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c	\
-libffi.call/return_fl3.c libffi.call/stret_medium.c			\
-libffi.call/nested_struct6.c libffi.call/closure_fn3.c			\
-libffi.call/float3.c libffi.call/many2.c				\
-libffi.call/closure_stdcall.c libffi.call/cls_align_uint16.c		\
-libffi.call/cls_9byte1.c libffi.call/closure_fn6.c			\
-libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c		\
-libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c		\
-libffi.call/cls_sshort.c libffi.call/many_win32.c			\
-libffi.call/nested_struct.c libffi.call/cls_20byte.c			\
-libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c		\
-libffi.call/return_uc.c libffi.call/closure_thiscall.c			\
-libffi.call/cls_18byte.c libffi.call/cls_8byte.c			\
-libffi.call/promotion.c libffi.call/struct1_win32.c			\
-libffi.call/return_dbl.c libffi.call/cls_24byte.c			\
-libffi.call/struct4.c libffi.call/cls_6byte.c				\
-libffi.call/cls_align_uint32.c libffi.call/float.c			\
-libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c	\
-libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c			\
-libffi.call/cls_align_float.c libffi.call/return_fl1.c			\
-libffi.call/nested_struct10.c libffi.call/nested_struct5.c		\
-libffi.call/fastthis1_win32.c libffi.call/cls_align_sint64.c		\
-libffi.call/stret_large2.c libffi.call/return_sl.c			\
-libffi.call/closure_fn0.c libffi.call/cls_5byte.c			\
-libffi.call/cls_2byte.c libffi.call/float2.c				\
-libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c			\
-libffi.call/stret_large.c libffi.call/cls_ulonglong.c			\
-libffi.call/cls_ushort.c libffi.call/nested_struct1.c			\
-libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c		\
-libffi.call/cls_float.c libffi.call/cls_pointer_stack.c		\
-libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c		\
-libffi.call/struct1.c libffi.call/nested_struct9.c			\
-libffi.call/huge_struct.c libffi.call/problem1.c			\
-libffi.call/float4.c libffi.call/fastthis3_win32.c			\
-libffi.call/return_ldl.c libffi.call/strlen2_win32.c			\
-libffi.call/closure_fn5.c libffi.call/struct2_win32.c			\
-libffi.call/struct6.c libffi.call/return_ll.c libffi.call/struct9.c	\
-libffi.call/return_sc.c libffi.call/struct7.c				\
-libffi.call/cls_align_uint64.c libffi.call/cls_4byte.c			\
-libffi.call/strlen_win32.c libffi.call/cls_6_1_byte.c			\
-libffi.call/cls_7_1_byte.c libffi.special/unwindtest.cc			\
-libffi.special/special.exp libffi.special/unwindtest_ffi_call.cc	\
-libffi.special/ffitestcxx.h lib/wrapper.exp lib/target-libpath.exp	\
-lib/libffi.exp libffi.call/cls_struct_va1.c				\
-libffi.call/cls_uchar_va.c libffi.call/cls_uint_va.c			\
-libffi.call/cls_ulong_va.c libffi.call/cls_ushort_va.c			\
-libffi.call/nested_struct11.c libffi.call/uninitialized.c		\
-libffi.call/va_1.c libffi.call/va_struct1.c libffi.call/va_struct2.c	\
-libffi.call/va_struct3.c
-
+EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \
+libffi.call/cls_align_longdouble_split.c libffi.call/closure_loc_fn0.c \
+libffi.call/cls_schar.c libffi.call/closure_fn1.c \
+libffi.call/many2_win32.c libffi.call/return_ul.c \
+libffi.call/cls_align_double.c libffi.call/return_fl2.c \
+libffi.call/cls_1_1byte.c libffi.call/cls_64byte.c \
+libffi.call/nested_struct7.c libffi.call/cls_align_sint32.c \
+libffi.call/nested_struct2.c libffi.call/ffitest.h \
+libffi.call/nested_struct4.c libffi.call/cls_multi_ushort.c \
+libffi.call/struct3.c libffi.call/cls_3byte1.c \
+libffi.call/cls_16byte.c libffi.call/struct8.c \
+libffi.call/nested_struct8.c libffi.call/cls_multi_sshort.c \
+libffi.call/cls_3byte2.c libffi.call/fastthis2_win32.c \
+libffi.call/cls_pointer.c libffi.call/err_bad_typedef.c \
+libffi.call/cls_4_1byte.c libffi.call/cls_9byte2.c \
+libffi.call/cls_multi_schar.c libffi.call/stret_medium2.c \
+libffi.call/cls_5_1_byte.c libffi.call/call.exp \
+libffi.call/cls_double.c libffi.call/cls_align_sint16.c \
+libffi.call/cls_uint.c libffi.call/return_ll1.c \
+libffi.call/nested_struct3.c libffi.call/cls_20byte1.c \
+libffi.call/closure_fn4.c libffi.call/cls_uchar.c \
+libffi.call/struct2.c libffi.call/cls_7byte.c libffi.call/strlen.c \
+libffi.call/many.c libffi.call/testclosure.c libffi.call/return_fl.c \
+libffi.call/struct5.c libffi.call/cls_12byte.c \
+libffi.call/cls_multi_sshortchar.c \
+libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c \
+libffi.call/return_fl3.c libffi.call/stret_medium.c \
+libffi.call/nested_struct6.c libffi.call/a.out \
+libffi.call/closure_fn3.c libffi.call/float3.c libffi.call/many2.c \
+libffi.call/closure_stdcall.c libffi.call/cls_align_uint16.c \
+libffi.call/cls_9byte1.c libffi.call/closure_fn6.c \
+libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c \
+libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c \
+libffi.call/cls_sshort.c libffi.call/many_win32.c \
+libffi.call/nested_struct.c libffi.call/cls_20byte.c \
+libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c \
+libffi.call/return_uc.c libffi.call/closure_thiscall.c \
+libffi.call/cls_18byte.c libffi.call/cls_8byte.c \
+libffi.call/promotion.c libffi.call/struct1_win32.c \
+libffi.call/return_dbl.c libffi.call/cls_24byte.c \
+libffi.call/struct4.c libffi.call/cls_6byte.c \
+libffi.call/cls_align_uint32.c libffi.call/float.c \
+libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c \
+libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c \
+libffi.call/cls_align_float.c libffi.call/return_fl1.c \
+libffi.call/nested_struct10.c libffi.call/nested_struct5.c \
+libffi.call/fastthis1_win32.c libffi.call/cls_align_sint64.c \
+libffi.call/stret_large2.c libffi.call/return_sl.c \
+libffi.call/closure_fn0.c libffi.call/cls_5byte.c \
+libffi.call/cls_2byte.c libffi.call/float2.c \
+libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c \
+libffi.call/stret_large.c libffi.call/cls_ulonglong.c \
+libffi.call/cls_ushort.c libffi.call/nested_struct1.c \
+libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c \
+libffi.call/cls_float.c libffi.call/cls_pointer_stack.c \
+libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c \
+libffi.call/struct1.c libffi.call/nested_struct9.c \
+libffi.call/huge_struct.c libffi.call/problem1.c libffi.call/float4.c \
+libffi.call/fastthis3_win32.c libffi.call/return_ldl.c \
+libffi.call/strlen2_win32.c libffi.call/closure_fn5.c \
+libffi.call/struct2_win32.c libffi.call/struct6.c \
+libffi.call/return_ll.c libffi.call/struct9.c libffi.call/return_sc.c \
+libffi.call/struct7.c libffi.call/cls_align_uint64.c \
+libffi.call/cls_4byte.c libffi.call/strlen_win32.c \
+libffi.call/cls_6_1_byte.c libffi.call/cls_7_1_byte.c \
+libffi.special/unwindtest.cc libffi.special/special.exp \
+libffi.special/unwindtest_ffi_call.cc libffi.special/ffitestcxx.h \
+lib/wrapper.exp lib/target-libpath.exp lib/libffi.exp
diff --git a/Modules/_ctypes/libffi/testsuite/Makefile.in b/Modules/_ctypes/libffi/testsuite/Makefile.in
--- a/Modules/_ctypes/libffi/testsuite/Makefile.in
+++ b/Modules/_ctypes/libffi/testsuite/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.12.2 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2012 Free Software Foundation, Inc.
-
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -14,23 +15,6 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
-    case $$MAKEFLAGS in \
-      *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
-    esac; \
-    test $$am__dry = yes; \
-  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -53,19 +37,7 @@
 subdir = testsuite
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/asmcfi.m4 \
-	$(top_srcdir)/m4/ax_append_flag.m4 \
-	$(top_srcdir)/m4/ax_cc_maxopt.m4 \
-	$(top_srcdir)/m4/ax_cflags_warn_all.m4 \
-	$(top_srcdir)/m4/ax_check_compile_flag.m4 \
-	$(top_srcdir)/m4/ax_compiler_vendor.m4 \
-	$(top_srcdir)/m4/ax_configure_args.m4 \
-	$(top_srcdir)/m4/ax_enable_builddir.m4 \
-	$(top_srcdir)/m4/ax_gcc_archflag.m4 \
-	$(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \
-	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
-	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
-	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
 	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
@@ -75,11 +47,6 @@
 CONFIG_CLEAN_VPATH_FILES =
 SOURCES =
 DIST_SOURCES =
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
 DEJATOOL = $(PACKAGE)
 RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -147,7 +114,6 @@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
-PRTDIAG = @PRTDIAG@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
@@ -168,7 +134,6 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
-ax_enable_builddir_sed = @ax_enable_builddir_sed@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -204,7 +169,6 @@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
-sys_symbol_underscore = @sys_symbol_underscore@
 sysconfdir = @sysconfdir@
 target = @target@
 target_alias = @target_alias@
@@ -227,82 +191,75 @@
 	       echo $(top_srcdir)/../dejagnu/runtest ; \
 	    else echo runtest; fi`
 
-EXTRA_DEJAGNU_SITE_CONFIG = ../local.exp
 CLEANFILES = *.exe core* *.log *.sum
-EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c		\
-libffi.call/cls_align_longdouble_split.c				\
-libffi.call/closure_loc_fn0.c libffi.call/cls_schar.c			\
-libffi.call/closure_fn1.c libffi.call/many2_win32.c			\
-libffi.call/return_ul.c libffi.call/cls_align_double.c			\
-libffi.call/return_fl2.c libffi.call/cls_1_1byte.c			\
-libffi.call/cls_64byte.c libffi.call/nested_struct7.c			\
-libffi.call/cls_align_sint32.c libffi.call/nested_struct2.c		\
-libffi.call/ffitest.h libffi.call/nested_struct4.c			\
-libffi.call/cls_multi_ushort.c libffi.call/struct3.c			\
-libffi.call/cls_3byte1.c libffi.call/cls_16byte.c			\
-libffi.call/struct8.c libffi.call/nested_struct8.c			\
-libffi.call/cls_multi_sshort.c libffi.call/cls_3byte2.c			\
-libffi.call/fastthis2_win32.c libffi.call/cls_pointer.c			\
-libffi.call/err_bad_typedef.c libffi.call/cls_4_1byte.c			\
-libffi.call/cls_9byte2.c libffi.call/cls_multi_schar.c			\
-libffi.call/stret_medium2.c libffi.call/cls_5_1_byte.c			\
-libffi.call/call.exp libffi.call/cls_double.c				\
-libffi.call/cls_align_sint16.c libffi.call/cls_uint.c			\
-libffi.call/return_ll1.c libffi.call/nested_struct3.c			\
-libffi.call/cls_20byte1.c libffi.call/closure_fn4.c			\
-libffi.call/cls_uchar.c libffi.call/struct2.c libffi.call/cls_7byte.c	\
-libffi.call/strlen.c libffi.call/many.c libffi.call/testclosure.c	\
-libffi.call/return_fl.c libffi.call/struct5.c				\
-libffi.call/cls_12byte.c libffi.call/cls_multi_sshortchar.c		\
-libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c	\
-libffi.call/return_fl3.c libffi.call/stret_medium.c			\
-libffi.call/nested_struct6.c libffi.call/closure_fn3.c			\
-libffi.call/float3.c libffi.call/many2.c				\
-libffi.call/closure_stdcall.c libffi.call/cls_align_uint16.c		\
-libffi.call/cls_9byte1.c libffi.call/closure_fn6.c			\
-libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c		\
-libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c		\
-libffi.call/cls_sshort.c libffi.call/many_win32.c			\
-libffi.call/nested_struct.c libffi.call/cls_20byte.c			\
-libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c		\
-libffi.call/return_uc.c libffi.call/closure_thiscall.c			\
-libffi.call/cls_18byte.c libffi.call/cls_8byte.c			\
-libffi.call/promotion.c libffi.call/struct1_win32.c			\
-libffi.call/return_dbl.c libffi.call/cls_24byte.c			\
-libffi.call/struct4.c libffi.call/cls_6byte.c				\
-libffi.call/cls_align_uint32.c libffi.call/float.c			\
-libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c	\
-libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c			\
-libffi.call/cls_align_float.c libffi.call/return_fl1.c			\
-libffi.call/nested_struct10.c libffi.call/nested_struct5.c		\
-libffi.call/fastthis1_win32.c libffi.call/cls_align_sint64.c		\
-libffi.call/stret_large2.c libffi.call/return_sl.c			\
-libffi.call/closure_fn0.c libffi.call/cls_5byte.c			\
-libffi.call/cls_2byte.c libffi.call/float2.c				\
-libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c			\
-libffi.call/stret_large.c libffi.call/cls_ulonglong.c			\
-libffi.call/cls_ushort.c libffi.call/nested_struct1.c			\
-libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c		\
-libffi.call/cls_float.c libffi.call/cls_pointer_stack.c		\
-libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c		\
-libffi.call/struct1.c libffi.call/nested_struct9.c			\
-libffi.call/huge_struct.c libffi.call/problem1.c			\
-libffi.call/float4.c libffi.call/fastthis3_win32.c			\
-libffi.call/return_ldl.c libffi.call/strlen2_win32.c			\
-libffi.call/closure_fn5.c libffi.call/struct2_win32.c			\
-libffi.call/struct6.c libffi.call/return_ll.c libffi.call/struct9.c	\
-libffi.call/return_sc.c libffi.call/struct7.c				\
-libffi.call/cls_align_uint64.c libffi.call/cls_4byte.c			\
-libffi.call/strlen_win32.c libffi.call/cls_6_1_byte.c			\
-libffi.call/cls_7_1_byte.c libffi.special/unwindtest.cc			\
-libffi.special/special.exp libffi.special/unwindtest_ffi_call.cc	\
-libffi.special/ffitestcxx.h lib/wrapper.exp lib/target-libpath.exp	\
-lib/libffi.exp libffi.call/cls_struct_va1.c				\
-libffi.call/cls_uchar_va.c libffi.call/cls_uint_va.c			\
-libffi.call/cls_ulong_va.c libffi.call/cls_ushort_va.c			\
-libffi.call/nested_struct11.c libffi.call/uninitialized.c		\
-libffi.call/va_1.c libffi.call/va_struct1.c libffi.call/va_struct2.c	\
-libffi.call/va_struct3.c
+EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \
+libffi.call/cls_align_longdouble_split.c libffi.call/closure_loc_fn0.c \
+libffi.call/cls_schar.c libffi.call/closure_fn1.c \
+libffi.call/many2_win32.c libffi.call/return_ul.c \
+libffi.call/cls_align_double.c libffi.call/return_fl2.c \
+libffi.call/cls_1_1byte.c libffi.call/cls_64byte.c \
+libffi.call/nested_struct7.c libffi.call/cls_align_sint32.c \
+libffi.call/nested_struct2.c libffi.call/ffitest.h \
+libffi.call/nested_struct4.c libffi.call/cls_multi_ushort.c \
+libffi.call/struct3.c libffi.call/cls_3byte1.c \
+libffi.call/cls_16byte.c libffi.call/struct8.c \
+libffi.call/nested_struct8.c libffi.call/cls_multi_sshort.c \
+libffi.call/cls_3byte2.c libffi.call/fastthis2_win32.c \
+libffi.call/cls_pointer.c libffi.call/err_bad_typedef.c \
+libffi.call/cls_4_1byte.c libffi.call/cls_9byte2.c \
+libffi.call/cls_multi_schar.c libffi.call/stret_medium2.c \
+libffi.call/cls_5_1_byte.c libffi.call/call.exp \
+libffi.call/cls_double.c libffi.call/cls_align_sint16.c \
+libffi.call/cls_uint.c libffi.call/return_ll1.c \
+libffi.call/nested_struct3.c libffi.call/cls_20byte1.c \
+libffi.call/closure_fn4.c libffi.call/cls_uchar.c \
+libffi.call/struct2.c libffi.call/cls_7byte.c libffi.call/strlen.c \
+libffi.call/many.c libffi.call/testclosure.c libffi.call/return_fl.c \
+libffi.call/struct5.c libffi.call/cls_12byte.c \
+libffi.call/cls_multi_sshortchar.c \
+libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c \
+libffi.call/return_fl3.c libffi.call/stret_medium.c \
+libffi.call/nested_struct6.c libffi.call/a.out \
+libffi.call/closure_fn3.c libffi.call/float3.c libffi.call/many2.c \
+libffi.call/closure_stdcall.c libffi.call/cls_align_uint16.c \
+libffi.call/cls_9byte1.c libffi.call/closure_fn6.c \
+libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c \
+libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c \
+libffi.call/cls_sshort.c libffi.call/many_win32.c \
+libffi.call/nested_struct.c libffi.call/cls_20byte.c \
+libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c \
+libffi.call/return_uc.c libffi.call/closure_thiscall.c \
+libffi.call/cls_18byte.c libffi.call/cls_8byte.c \
+libffi.call/promotion.c libffi.call/struct1_win32.c \
+libffi.call/return_dbl.c libffi.call/cls_24byte.c \
+libffi.call/struct4.c libffi.call/cls_6byte.c \
+libffi.call/cls_align_uint32.c libffi.call/float.c \
+libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c \
+libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c \
+libffi.call/cls_align_float.c libffi.call/return_fl1.c \
+libffi.call/nested_struct10.c libffi.call/nested_struct5.c \
+libffi.call/fastthis1_win32.c libffi.call/cls_align_sint64.c \
+libffi.call/stret_large2.c libffi.call/return_sl.c \
+libffi.call/closure_fn0.c libffi.call/cls_5byte.c \
+libffi.call/cls_2byte.c libffi.call/float2.c \
+libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c \
+libffi.call/stret_large.c libffi.call/cls_ulonglong.c \
+libffi.call/cls_ushort.c libffi.call/nested_struct1.c \
+libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c \
+libffi.call/cls_float.c libffi.call/cls_pointer_stack.c \
+libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c \
+libffi.call/struct1.c libffi.call/nested_struct9.c \
+libffi.call/huge_struct.c libffi.call/problem1.c libffi.call/float4.c \
+libffi.call/fastthis3_win32.c libffi.call/return_ldl.c \
+libffi.call/strlen2_win32.c libffi.call/closure_fn5.c \
+libffi.call/struct2_win32.c libffi.call/struct6.c \
+libffi.call/return_ll.c libffi.call/struct9.c libffi.call/return_sc.c \
+libffi.call/struct7.c libffi.call/cls_align_uint64.c \
+libffi.call/cls_4byte.c libffi.call/strlen_win32.c \
+libffi.call/cls_6_1_byte.c libffi.call/cls_7_1_byte.c \
+libffi.special/unwindtest.cc libffi.special/special.exp \
+libffi.special/unwindtest_ffi_call.cc libffi.special/ffitestcxx.h \
+lib/wrapper.exp lib/target-libpath.exp lib/libffi.exp
 
 all: all-am
 
@@ -349,8 +306,6 @@
 ctags: CTAGS
 CTAGS:
 
-cscope cscopelist:
-
 
 check-DEJAGNU: site.exp
 	srcdir='$(srcdir)'; export srcdir; \
@@ -361,11 +316,11 @@
 	    if $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \
 	    then :; else exit_status=1; fi; \
 	  done; \
-	else echo "WARNING: could not find 'runtest'" 1>&2; :;\
+	else echo "WARNING: could not find \`runtest'" 1>&2; :;\
 	fi; \
 	exit $$exit_status
 site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
-	@echo 'Making a new site.exp file ...'
+	@echo 'Making a new site.exp file...'
 	@echo '## these variables are automatically generated by make ##' >site.tmp
 	@echo '# Do not edit here.  If you wish to override these values' >>site.tmp
 	@echo '# edit the last section' >>site.tmp
diff --git a/Modules/_ctypes/libffi/testsuite/lib/libffi.exp b/Modules/_ctypes/libffi/testsuite/lib/libffi.exp
--- a/Modules/_ctypes/libffi/testsuite/lib/libffi.exp
+++ b/Modules/_ctypes/libffi/testsuite/lib/libffi.exp
@@ -101,17 +101,9 @@
     global tool_root_dir
     global ld_library_path
 
-    global using_gcc
-
     set blddirffi [pwd]/.. 
     verbose "libffi $blddirffi"
 
-    # Are we building with GCC?
-    set tmp [grep ../config.status "GCC='yes'"]
-    if { [string match $tmp "GCC='yes'"] } {
-
-      set using_gcc "yes"
-
     set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
     if {$gccdir != ""} {
 	set gccdir [file dirname $gccdir]
@@ -135,13 +127,6 @@
 	    }
 	}
     }
- 
-    } else {
-
-      set using_gcc "no"
-
-    }
-
     # add the library path for libffi.
     append ld_library_path ":${blddirffi}/.libs"
 
@@ -218,10 +203,6 @@
 
     lappend options "libs= -lffi"
 
-    if { [string match "aarch64*-*-linux*" $target_triplet] } {
-	lappend options "libs= -lpthread"
-    }
-
     verbose "options: $options"
     return [target_compile $source $dest $type $options]
 }
diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c
--- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c
+++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c
@@ -5,9 +5,7 @@
    Originator:	Blake Chaffin	*/
 
 /* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
-/* This test is known to PASS on armv7l-unknown-linux-gnueabihf, so I have
-   remove the xfail for arm*-*-* below, until we know more.  */
-/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
+/* { dg-do run { xfail arm*-*-* strongarm*-*-* xscale*-*-* } } */
 /* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */
 /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
 
diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/ffitest.h b/Modules/_ctypes/libffi/testsuite/libffi.call/ffitest.h
--- a/Modules/_ctypes/libffi/testsuite/libffi.call/ffitest.h
+++ b/Modules/_ctypes/libffi/testsuite/libffi.call/ffitest.h
@@ -15,7 +15,7 @@
 
 #define MAX_ARGS 256
 
-#define CHECK(x) !(x) ? (abort(), 1) : 0
+#define CHECK(x) !(x) ? abort() : 0
 
 /* Define __UNUSED__ that also other compilers than gcc can run the tests.  */
 #undef __UNUSED__
@@ -127,6 +127,44 @@
 #define PRId64 "I64d"
 #endif
 
-#ifndef PRIuPTR
-#define PRIuPTR "u"
+#ifdef USING_MMAP
+static inline void *
+allocate_mmap (size_t size)
+{
+  void *page;
+#if defined (HAVE_MMAP_DEV_ZERO)
+  static int dev_zero_fd = -1;
 #endif
+
+#ifdef HAVE_MMAP_DEV_ZERO
+  if (dev_zero_fd == -1)
+    {
+      dev_zero_fd = open ("/dev/zero", O_RDONLY);
+      if (dev_zero_fd == -1)
+	{
+	  perror ("open /dev/zero: %m");
+	  exit (1);
+	}
+    }
+#endif
+
+
+#ifdef HAVE_MMAP_ANON
+  page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,
+	       MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+#endif
+#ifdef HAVE_MMAP_DEV_ZERO
+  page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,
+	       MAP_PRIVATE, dev_zero_fd, 0);
+#endif
+
+  if (page == (void *) MAP_FAILED)
+    {
+      perror ("virtual memory exhausted");
+      exit (1);
+    }
+
+  return page;
+}
+
+#endif
diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/float_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/float_va.c
--- a/Modules/_ctypes/libffi/testsuite/libffi.call/float_va.c
+++ b/Modules/_ctypes/libffi/testsuite/libffi.call/float_va.c
@@ -56,9 +56,9 @@
    * different. */
   /* Call it statically and then via ffi */
   resfp=float_va_fn(0,2.0);
-  /* { dg-output "0: 2.0 : total: 2.0" } */
+  // { dg-output "0: 2.0 : total: 2.0" }
   printf("compiled: %.1f\n", resfp);
-  /* { dg-output "\ncompiled: 2.0" } */
+  // { dg-output "\ncompiled: 2.0" }
 
   arg_types[0] = &ffi_type_uint;
   arg_types[1] = &ffi_type_double;
@@ -71,16 +71,16 @@
   values[0] = &firstarg;
   values[1] = &doubles[0];
   ffi_call(&cif, FFI_FN(float_va_fn), &resfp, values);
-  /* { dg-output "\n0: 2.0 : total: 2.0" } */
+  // { dg-output "\n0: 2.0 : total: 2.0" }
   printf("ffi: %.1f\n", resfp);
-  /* { dg-output "\nffi: 2.0" } */
+  // { dg-output "\nffi: 2.0" }
 
   /* Second test, float_va_fn(2,2.0,3.0,4.0), now with variadic params */
   /* Call it statically and then via ffi */
   resfp=float_va_fn(2,2.0,3.0,4.0);
-  /* { dg-output "\n2: 2.0 : 0:3.0  1:4.0  total: 11.0" } */
+  // { dg-output "\n2: 2.0 : 0:3.0  1:4.0  total: 11.0" }
   printf("compiled: %.1f\n", resfp);
-  /* { dg-output "\ncompiled: 11.0" } */
+  // { dg-output "\ncompiled: 11.0" }
 
   arg_types[0] = &ffi_type_uint;
   arg_types[1] = &ffi_type_double;
@@ -99,9 +99,9 @@
   values[2] = &doubles[1];
   values[3] = &doubles[2];
   ffi_call(&cif, FFI_FN(float_va_fn), &resfp, values);
-  /* { dg-output "\n2: 2.0 : 0:3.0  1:4.0  total: 11.0" } */
+  // { dg-output "\n2: 2.0 : 0:3.0  1:4.0  total: 11.0" }
   printf("ffi: %.1f\n", resfp);
-  /* { dg-output "\nffi: 11.0" } */
+  // { dg-output "\nffi: 11.0" }
 
   exit(0);
 }
diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/huge_struct.c b/Modules/_ctypes/libffi/testsuite/libffi.call/huge_struct.c
--- a/Modules/_ctypes/libffi/testsuite/libffi.call/huge_struct.c
+++ b/Modules/_ctypes/libffi/testsuite/libffi.call/huge_struct.c
@@ -8,7 +8,6 @@
 /* { dg-excess-errors "" { target x86_64-*-mingw* x86_64-*-cygwin* } } */
 /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
 /* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */
-/* { dg-options -Wformat=0 { target moxie*-*-elf } } */
 /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
 
 #include "ffitest.h"
@@ -296,7 +295,7 @@
 	CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 50, &ret_struct_type, argTypes) == FFI_OK);
 
 	ffi_call(&cif, FFI_FN(test_large_fn), &retVal, argValues);
-	/* { dg-output "1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */
+	// { dg-output "1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" }
 	printf("res: %" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx "
 		"%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx "
 		"%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx "
@@ -309,7 +308,7 @@
 	       retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj,
 		retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp,
 	       retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx);
-	/* { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */
+	// { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" }
 
 	CHECK(ffi_prep_closure_loc(pcl, &cif, cls_large_fn, NULL, code) == FFI_OK);
 
@@ -324,7 +323,7 @@
 		ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p,
 		ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p,
 		ui8, si8);
-	/* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */
+	// { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" }
 	printf("res: %" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx "
 		"%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx "
 		"%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx "
@@ -337,7 +336,7 @@
 	       retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj,
 		retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp,
 	       retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx);
-	/* { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */
+	// { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" }
 
     return 0;
 }
diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/many2.c b/Modules/_ctypes/libffi/testsuite/libffi.call/many2.c
--- a/Modules/_ctypes/libffi/testsuite/libffi.call/many2.c
+++ b/Modules/_ctypes/libffi/testsuite/libffi.call/many2.c
@@ -12,10 +12,7 @@
 
 typedef unsigned char u8;
 
-#ifdef __GNUC__
-__attribute__((noinline))
-#endif
-uint8_t
+__attribute__((noinline)) uint8_t
 foo (uint8_t a, uint8_t b, uint8_t c, uint8_t d,
      uint8_t e, uint8_t f, uint8_t g)
 {

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list