[Python-checkins] r61231 - in python/branches/libffi3-branch/Modules/_ctypes/libffi: README configure configure.ac fficonfig.h.in fficonfig.py.in src/cris/ffi.c src/m68k/ffi.c src/powerpc/darwin.S src/powerpc/darwin_closure.S src/powerpc/ffi_darwin.c src/x86/darwin.S src/x86/ffi_darwin.c

thomas.heller python-checkins at python.org
Tue Mar 4 15:26:32 CET 2008


Author: thomas.heller
Date: Tue Mar  4 15:26:31 2008
New Revision: 61231

Removed:
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/x86/ffi_darwin.c
Modified:
   python/branches/libffi3-branch/Modules/_ctypes/libffi/README
   python/branches/libffi3-branch/Modules/_ctypes/libffi/configure
   python/branches/libffi3-branch/Modules/_ctypes/libffi/configure.ac
   python/branches/libffi3-branch/Modules/_ctypes/libffi/fficonfig.h.in
   python/branches/libffi3-branch/Modules/_ctypes/libffi/fficonfig.py.in
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/cris/ffi.c
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/m68k/ffi.c
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/powerpc/darwin.S
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/powerpc/darwin_closure.S
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/x86/darwin.S
Log:
Apart from some small changes to configure.ac, these files
are in sync now with libffi3.0.4.

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/README
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/README	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/README	Tue Mar  4 15:26:31 2008
@@ -1,7 +1,7 @@
 Status
 ======
 
-libffi-3.0.2 was released on February 21, 2008. Check the libffi web
+libffi-3.0.4 was released on February 24, 2008. Check the libffi web
 page for updates: <URL:http://sourceware.org/libffi/>.
 
 
@@ -48,13 +48,17 @@
      mips o32 linux (little endian)
      powerpc darwin
      powerpc64 linux
-     sparc solaris (SPARC V9 ABI)
+     sparc solaris
+     sparc64 solaris
      x86 cygwin
      x86 darwin
      x86 freebsd
      x86 linux
+     x86 openbsd
+     x86-64 darwin
      x86-64 linux
      x86-64 OS X
+     x86-64 freebsd
      
 Please send additional platform test results to
 libffi-discuss at sourceware.org.
@@ -89,6 +93,7 @@
 GNU make.  You can ftp GNU make from prep.ai.mit.edu:/pub/gnu.
 
 To ensure that libffi is working as advertised, type "make check".
+This will require that you have DejaGNU installed.
 
 To install the library and header files, type "make install".
 
@@ -153,6 +158,14 @@
 History
 =======
 
+3.0.4 Feb-24-08
+        Fix x86 OpenBSD configury.
+
+3.0.3 Feb-22-08
+        Enable x86 OpenBSD thanks to Thomas Heller, and
+	x86-64 FreeBSD thanks to Björn König and Andreas Tobler.
+	Clean up test instruction in README.
+
 3.0.2 Feb-21-08
         Improved x86 FreeBSD support.
 	Thanks to Björn König.

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/configure
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/configure	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/configure	Tue Mar  4 15:26:31 2008
@@ -937,7 +937,6 @@
 HAVE_LONG_DOUBLE
 TARGET
 TARGETDIR
-MKTARGET
 toolexecdir
 toolexeclibdir
 LIBOBJS
@@ -4691,7 +4690,7 @@
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 4694 "configure"' > conftest.$ac_ext
+  echo '#line 4693 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -7434,11 +7433,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7437: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7436: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7441: \$? = $ac_status" >&5
+   echo "$as_me:7440: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7724,11 +7723,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7727: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7726: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7731: \$? = $ac_status" >&5
+   echo "$as_me:7730: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7828,11 +7827,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7831: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7830: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7835: \$? = $ac_status" >&5
+   echo "$as_me:7834: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -10179,7 +10178,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 10182 "configure"
+#line 10181 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10279,7 +10278,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 10282 "configure"
+#line 10281 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12699,11 +12698,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12702: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12701: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:12706: \$? = $ac_status" >&5
+   echo "$as_me:12705: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -12803,11 +12802,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12806: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12805: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:12810: \$? = $ac_status" >&5
+   echo "$as_me:12809: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -14367,11 +14366,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14370: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14369: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:14374: \$? = $ac_status" >&5
+   echo "$as_me:14373: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -14471,11 +14470,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14474: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14473: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:14478: \$? = $ac_status" >&5
+   echo "$as_me:14477: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -16660,11 +16659,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16663: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16662: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16667: \$? = $ac_status" >&5
+   echo "$as_me:16666: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -16950,11 +16949,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16953: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16952: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16957: \$? = $ac_status" >&5
+   echo "$as_me:16956: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -17054,11 +17053,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:17057: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:17056: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:17061: \$? = $ac_status" >&5
+   echo "$as_me:17060: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -20482,8 +20481,6 @@
    { (exit 1); exit 1; }; }
 fi
 
-MKTARGET=$TARGET
-
  if test x$TARGET = xMIPS; then
   MIPS_TRUE=
   MIPS_FALSE='#'
@@ -22369,8 +22366,6 @@
 esac
 
 
-
-
 { echo "$as_me:$LINENO: checking assembler .cfi pseudo-op support" >&5
 echo $ECHO_N "checking assembler .cfi pseudo-op support... $ECHO_C" >&6; }
 if test "${libffi_cv_as_cfi_pseudo_op+set}" = set; then
@@ -22639,7 +22634,6 @@
 
 
 
-
 # Check whether --enable-debug was given.
 if test "${enable_debug+set}" = set; then
   enableval=$enable_debug; if test "$enable_debug" = "yes"; then
@@ -22715,12 +22709,6 @@
 ac_config_commands="$ac_config_commands src"
 
 
-TARGETINCDIR=$TARGETDIR
-case $host in
-*-*-darwin*)
-   TARGETINCDIR="darwin"
-   ;;
-esac
 ac_config_links="$ac_config_links include/ffitarget.h:src/$TARGETDIR/ffitarget.h"
 
 
@@ -23792,14 +23780,13 @@
 HAVE_LONG_DOUBLE!$HAVE_LONG_DOUBLE$ac_delim
 TARGET!$TARGET$ac_delim
 TARGETDIR!$TARGETDIR$ac_delim
-MKTARGET!$MKTARGET$ac_delim
 toolexecdir!$toolexecdir$ac_delim
 toolexeclibdir!$toolexeclibdir$ac_delim
 LIBOBJS!$LIBOBJS$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 77; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 76; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/configure.ac
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/configure.ac	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/configure.ac	Tue Mar  4 15:26:31 2008
@@ -156,12 +156,6 @@
   AC_MSG_ERROR(["libffi has not been ported to $host."])
 fi
 
-dnl  libffi changes TARGET for MIPS to define a such macro in the header
-dnl  while MIPS_IRIX or MIPS_LINUX is separatedly used to decide which
-dnl  files will be compiled.  So, we need to keep the original decision
-dnl  of TARGET to use in fficonfig.py.in.
-MKTARGET=$TARGET
-
 AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS)
 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
 AM_CONDITIONAL(X86, test x$TARGET = xX86)
@@ -207,23 +201,6 @@
 AC_SUBST(HAVE_LONG_DOUBLE)
 
 AC_C_BIGENDIAN
-AH_VERBATIM([WORDS_BIGENDIAN],
-[
-/* Define to 1 if your processor stores words with the most significant byte
-   first (like Motorola and SPARC, unlike Intel and VAX). 
- 
-   The block below does compile-time checking for endianness on platforms
-   that use GCC and therefore allows compiling fat binaries on OSX by using
-   '-arch ppc -arch i386' as the compile flags. The phrasing was choosen
-   such that the configure-result is used on systems that don't use GCC.
-*/
-#ifdef __BIG_ENDIAN__
-#define WORDS_BIGENDIAN 1
-#else
-#ifndef __LITTLE_ENDIAN__
-#undef WORDS_BIGENDIAN
-#endif
-#endif])
 
 AC_CACHE_CHECK([assembler .cfi pseudo-op support],
     libffi_cv_as_cfi_pseudo_op, [
@@ -326,7 +303,6 @@
 
 AC_SUBST(TARGET)
 AC_SUBST(TARGETDIR)
-AC_SUBST(MKTARGET)
 
 AC_SUBST(SHELL)
 
@@ -382,12 +358,6 @@
 test -d src/$TARGETDIR || mkdir src/$TARGETDIR
 ], [TARGETDIR="$TARGETDIR"])
 
-TARGETINCDIR=$TARGETDIR
-case $host in
-*-*-darwin*)
-   TARGETINCDIR="darwin"
-   ;;
-esac
 AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h)
 
 AC_CONFIG_FILES(include/ffi.h)

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/fficonfig.h.in
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/fficonfig.h.in	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/fficonfig.h.in	Tue Mar  4 15:26:31 2008
@@ -140,20 +140,8 @@
 #undef VERSION
 
 /* Define to 1 if your processor stores words with the most significant byte
-   first (like Motorola and SPARC, unlike Intel and VAX). 
-
-   The block below does compile-time checking for endianness on platforms
-   that use GCC and therefore allows compiling fat binaries on OSX by using
-   '-arch ppc -arch i386' as the compile flags. The phrasing was choosen
-   such that the configure-result is used on systems that don't use GCC.
-*/
-#ifdef __BIG_ENDIAN__
-#define WORDS_BIGENDIAN 1
-#else
-#ifndef __LITTLE_ENDIAN__
+   first (like Motorola and SPARC, unlike Intel and VAX). */
 #undef WORDS_BIGENDIAN
-#endif
-#endif
 
 
 #ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/fficonfig.py.in
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/fficonfig.py.in	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/fficonfig.py.in	Tue Mar  4 15:26:31 2008
@@ -6,7 +6,6 @@
     'MIPS_IRIX': ['src/mips/ffi.c', 'src/mips/o32.S', 'src/mips/n32.S'],
     'MIPS_LINUX': ['src/mips/ffi.c', 'src/mips/o32.S'],
     'X86': ['src/x86/ffi.c', 'src/x86/sysv.S'],
-    'X86_DARWIN': ['src/x86/ffi_darwin.c', 'src/x86/darwin.S'],
     'X86_FREEBSD': ['src/x86/ffi.c', 'src/x86/sysv.S'],
     'X86_WIN32': ['src/x86/ffi.c', 'src/x86/win32.S'],
     'SPARC': ['src/sparc/ffi.c', 'src/sparc/v8.S', 'src/sparc/v9.S'],
@@ -15,8 +14,7 @@
     'M32R': ['src/m32r/sysv.S', 'src/m32r/ffi.c'],
     'M68K': ['src/m68k/ffi.c', 'src/m68k/sysv.S'],
     'POWERPC': ['src/powerpc/ffi.c', 'src/powerpc/sysv.S', 'src/powerpc/ppc_closure.S', 'src/powerpc/linux64.S', 'src/powerpc/linux64_closure.S'],
-    'POWERPC_AIX': ['src/powerpc/ffi_darwin.c', 'src/powerpc/aix.S', 'src/powerpc/aix_closure.S'],
-    'POWERPC_DARWIN': ['src/powerpc/ffi_darwin.c', 'src/powerpc/darwin.S', 'src/powerpc/darwin_closure.S'],
+    'POWERPC_AIX': ['src/powerpc/ffi.c', 'src/powerpc/aix.S', 'src/powerpc/aix_closure.S'],
     'POWERPC_FREEBSD': ['src/powerpc/ffi.c', 'src/powerpc/sysv.S', 'src/powerpc/ppc_closure.S'],
     'ARM': ['src/arm/sysv.S', 'src/arm/ffi.c'],
     'LIBFFI_CRIS': ['src/cris/sysv.S', 'src/cris/ffi.c'],
@@ -28,19 +26,8 @@
     'PA': ['src/pa/linux.S', 'src/pa/ffi.c'],
 }
 
-# Build all darwin related files on all supported darwin architectures, this
-# makes it easier to build universal binaries.
-if 1:
-    all_darwin = ('X86_DARWIN', 'POWERPC_DARWIN')
-    all_darwin_files = []
-    for pn in all_darwin:
-        all_darwin_files.extend(ffi_platforms[pn])
-    for pn in all_darwin:
-        ffi_platforms[pn] = all_darwin_files
-    del all_darwin, all_darwin_files, pn
-
 ffi_srcdir = '@srcdir@'
-ffi_sources += ffi_platforms['@MKTARGET@']
+ffi_sources += ffi_platforms['@TARGET@']
 ffi_sources = [os.path.join('@srcdir@', f) for f in ffi_sources]
 
 ffi_cflags = '@CFLAGS@'

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/cris/ffi.c
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/cris/ffi.c	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/cris/ffi.c	Tue Mar  4 15:26:31 2008
@@ -236,11 +236,11 @@
 
 extern void ffi_call_SYSV (int (*)(char *, extended_cif *),
 			   extended_cif *,
-			   unsigned, unsigned, unsigned *, void (*fn)(void))
+			   unsigned, unsigned, unsigned *, void (*fn) ())
      __attribute__ ((__visibility__ ("hidden")));
 
 void
-ffi_call (ffi_cif * cif, void (*fn)(void), void *rvalue, void **avalue)
+ffi_call (ffi_cif * cif, void (*fn) (), void *rvalue, void **avalue)
 {
   extended_cif ecif;
 

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/m68k/ffi.c
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/m68k/ffi.c	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/m68k/ffi.c	Tue Mar  4 15:26:31 2008
@@ -14,7 +14,7 @@
 
 void ffi_call_SYSV (extended_cif *,
 		    unsigned, unsigned,
-		    void *, void (*fn)(void));
+		    void *, void (*fn) ());
 void *ffi_prep_args (void *stack, extended_cif *ecif);
 void ffi_closure_SYSV (ffi_closure *);
 void ffi_closure_struct_SYSV (ffi_closure *);
@@ -166,7 +166,7 @@
 }
 
 void
-ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
+ffi_call (ffi_cif *cif, void (*fn) (), void *rvalue, void **avalue)
 {
   extended_cif ecif;
 

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/powerpc/darwin.S
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/powerpc/darwin.S	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/powerpc/darwin.S	Tue Mar  4 15:26:31 2008
@@ -1,4 +1,3 @@
-#ifdef __ppc__
 /* -----------------------------------------------------------------------
    darwin.S - Copyright (c) 2000 John Hornkvist
 	      Copyright (c) 2004 Free Software Foundation, Inc.
@@ -244,4 +243,3 @@
 	.align LOG2_GPR_BYTES
 LLFB0$non_lazy_ptr:
 	.g_long LFB0
-#endif

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/powerpc/darwin_closure.S
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/powerpc/darwin_closure.S	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/powerpc/darwin_closure.S	Tue Mar  4 15:26:31 2008
@@ -1,4 +1,3 @@
-#ifdef __ppc__
 /* -----------------------------------------------------------------------
    darwin_closure.S - Copyright (c) 2002, 2003, 2004, Free Software Foundation,
    Inc. based on ppc_closure.S
@@ -247,7 +246,7 @@
 /* END(ffi_closure_ASM)  */
 
 .data
-.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms
+.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
 EH_frame1:
 	.set	L$set$0,LECIE1-LSCIE1
 	.long	L$set$0	; Length of Common Information Entry
@@ -316,4 +315,3 @@
 	.align LOG2_GPR_BYTES
 LLFB1$non_lazy_ptr:
 	.g_long LFB1
-#endif

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c	Tue Mar  4 15:26:31 2008
@@ -1,4 +1,3 @@
-#if !(defined(__APPLE__) && !defined(__ppc__))
 /* -----------------------------------------------------------------------
    ffi_darwin.c
 
@@ -799,4 +798,3 @@
   /* Tell ffi_closure_ASM to perform return type promotions.  */
   return cif->rtype->type;
 }
-#endif

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/x86/darwin.S
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/x86/darwin.S	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/x86/darwin.S	Tue Mar  4 15:26:31 2008
@@ -1,4 +1,3 @@
-#ifdef __i386__
 /* -----------------------------------------------------------------------
    darwin.S - Copyright (c) 1996, 1998, 2001, 2002, 2003, 2005  Red Hat, Inc.
 	Copyright (C) 2008  Free Software Foundation, Inc.
@@ -442,5 +441,3 @@
 #endif
 
 #endif /* ifndef __x86_64__ */
-
-#endif /* defined __i386__ */

Deleted: /python/branches/libffi3-branch/Modules/_ctypes/libffi/src/x86/ffi_darwin.c
==============================================================================
--- /python/branches/libffi3-branch/Modules/_ctypes/libffi/src/x86/ffi_darwin.c	Tue Mar  4 15:26:31 2008
+++ (empty file)
@@ -1,596 +0,0 @@
-# ifdef __i386__
-/* -----------------------------------------------------------------------
-   ffi.c - Copyright (c) 1996, 1998, 1999, 2001  Red Hat, Inc.
-           Copyright (c) 2002  Ranjit Mathew
-           Copyright (c) 2002  Bo Thorsen
-           Copyright (c) 2002  Roger Sayle
-   
-   x86 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 CYGNUS SOLUTIONS 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 __x86_64__
-
-#include <ffi.h>
-#include <ffi_common.h>
-
-#include <stdlib.h>
-
-/* ffi_prep_args is called by the assembly routine once stack space
-   has been allocated for the function's arguments */
-
-/*@-exportheader@*/
-void ffi_prep_args(char *stack, extended_cif *ecif);
-
-static inline int retval_on_stack(ffi_type* tp)
-{
-	if (tp->type == FFI_TYPE_STRUCT) {
-		int sz = tp->size;
-		if (sz > 8) {
-			return 1;
-		}
-		switch (sz) {
-		case 1: case 2: case 4: case 8: return 0;
-		default: return 1;
-		}
-	}
-	return 0;
-}
-
-
-void ffi_prep_args(char *stack, extended_cif *ecif)
-/*@=exportheader@*/
-{
-  register unsigned int i;
-  register void **p_argv;
-  register char *argp;
-  register ffi_type **p_arg;
-
-  argp = stack;
-
-  if (retval_on_stack(ecif->cif->rtype)) {
-      *(void **) argp = ecif->rvalue;
-      argp += 4;
-  }
-
-
-  p_argv = ecif->avalue;
-
-  for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
-       i != 0;
-       i--, p_arg++)
-    {
-      size_t z;
-
-      /* Align if necessary */
-      if ((sizeof(int) - 1) & (unsigned) argp)
-	      argp = (char *) ALIGN(argp, sizeof(int));
-
-      z = (*p_arg)->size;
-      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);
-	      break;
-
-	    case FFI_TYPE_SINT32:
-	      *(signed int *) argp = (signed int)*(SINT32 *)(* p_argv);
-	      break;
-
-	    case FFI_TYPE_UINT32:
-	      *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
-	      break;
-
-	    case FFI_TYPE_STRUCT:
-	      *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
-	      break;
-
-	    default:
-	      FFI_ASSERT(0);
-	    }
-	}
-      else
-	{
-	  memcpy(argp, *p_argv, z);
-	}
-      p_argv++;
-      argp += z;
-    }
-  
-  return;
-}
-
-/* Perform machine dependent cif processing */
-ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
-{
-  /* Set the return type flag */
-  switch (cif->rtype->type)
-    {
-    case FFI_TYPE_VOID:
-#if !defined(X86_WIN32)  && !defined(X86_DARWIN)
-    case FFI_TYPE_STRUCT:
-#endif
-    case FFI_TYPE_SINT64:
-    case FFI_TYPE_FLOAT:
-    case FFI_TYPE_DOUBLE:
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
-    case FFI_TYPE_LONGDOUBLE:
-#endif
-      cif->flags = (unsigned) cif->rtype->type;
-      break;
-
-    case FFI_TYPE_UINT64:
-      cif->flags = FFI_TYPE_SINT64;
-      break;
-
-#if defined(X86_WIN32) || defined(X86_DARWIN)
-
-    case FFI_TYPE_STRUCT:
-      if (cif->rtype->size == 1)
-        {
-          cif->flags = FFI_TYPE_SINT8; /* same as char size */
-        }
-      else if (cif->rtype->size == 2)
-        {
-          cif->flags = FFI_TYPE_SINT16; /* same as short size */
-        }
-      else if (cif->rtype->size == 4)
-        {
-          cif->flags = FFI_TYPE_INT; /* same as int type */
-        }
-      else if (cif->rtype->size == 8)
-        {
-          cif->flags = FFI_TYPE_SINT64; /* same as int64 type */
-        }
-      else
-        {
-          cif->flags = FFI_TYPE_STRUCT;
-        }
-      break;
-#endif
-
-    default:
-      cif->flags = FFI_TYPE_INT;
-      break;
-    }
-
-  /* Darwin: The stack needs to be aligned to a multiple of 16 bytes */
-#if 1
-  cif->bytes = (cif->bytes + 15) & ~0xF;
-#endif
-
-
-  return FFI_OK;
-}
-
-/*@-declundef@*/
-/*@-exportheader@*/
-extern void ffi_call_SYSV(void (*)(char *, extended_cif *), 
-			  /*@out@*/ extended_cif *, 
-			  unsigned, unsigned, 
-			  /*@out@*/ unsigned *, 
-			  void (*fn)(void));
-/*@=declundef@*/
-/*@=exportheader@*/
-
-#ifdef X86_WIN32
-/*@-declundef@*/
-/*@-exportheader@*/
-extern void ffi_call_STDCALL(void (*)(char *, extended_cif *),
-			  /*@out@*/ extended_cif *,
-			  unsigned, unsigned,
-			  /*@out@*/ unsigned *,
-			  void (*fn)(void));
-/*@=declundef@*/
-/*@=exportheader@*/
-#endif /* X86_WIN32 */
-
-void ffi_call(/*@dependent@*/ ffi_cif *cif, 
-	      void (*fn)(void), 
-	      /*@out@*/ void *rvalue, 
-	      /*@dependent@*/ void **avalue)
-{
-  extended_cif ecif;
-
-  ecif.cif = cif;
-  ecif.avalue = avalue;
-  
-  /* 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) && retval_on_stack(cif->rtype))
-    {
-      /*@-sysunrecog@*/
-      ecif.rvalue = alloca(cif->rtype->size);
-      /*@=sysunrecog@*/
-    }
-  else
-    ecif.rvalue = rvalue;
-
-  switch (cif->abi) 
-    {
-    case FFI_SYSV:
-      /*@-usedef@*/
-      /* To avoid changing the assembly code make sure the size of the argument 
-       * block is a multiple of 16. Then add 8 to compensate for local variables
-       * in ffi_call_SYSV.
-       */
-      ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, 
-		    cif->flags, ecif.rvalue, fn);
-      /*@=usedef@*/
-      break;
-#ifdef X86_WIN32
-    case FFI_STDCALL:
-      /*@-usedef@*/
-      ffi_call_STDCALL(ffi_prep_args, &ecif, cif->bytes,
-		    cif->flags, ecif.rvalue, fn);
-      /*@=usedef@*/
-      break;
-#endif /* X86_WIN32 */
-    default:
-      FFI_ASSERT(0);
-      break;
-    }
-}
-
-
-/** private members **/
-
-static void ffi_closure_SYSV (ffi_closure *)
-     __attribute__ ((regparm(1)));
-#if !FFI_NO_RAW_API
-static void ffi_closure_raw_SYSV (ffi_raw_closure *)
-     __attribute__ ((regparm(1)));
-#endif
-
-/*@-exportheader@*/
-static inline void 
-ffi_prep_incoming_args_SYSV(char *stack, void **rvalue,
-			    void **avalue, ffi_cif *cif)
-/*@=exportheader@*/
-{
-  register unsigned int i;
-  register void **p_argv;
-  register char *argp;
-  register ffi_type **p_arg;
-
-  argp = stack;
-
-  if (retval_on_stack(cif->rtype)) {
-    *rvalue = *(void **) argp;
-    argp += 4;
-  }
-
-  p_argv = avalue;
-
-  for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++)
-    {
-      size_t z;
-
-      /* Align if necessary */
-      if ((sizeof(int) - 1) & (unsigned) argp) {
-	argp = (char *) ALIGN(argp, sizeof(int));
-      }
-
-      z = (*p_arg)->size;
-
-      /* because we're little endian, this is what it turns into.   */
-
-      *p_argv = (void*) argp;
-
-      p_argv++;
-      argp += z;
-    }
-  
-  return;
-}
-
-/* This function is jumped to by the trampoline */
-
-static void
-ffi_closure_SYSV (closure)
-     ffi_closure *closure;
-{
-  // this is our return value storage
-  long double  res;
-
-  // our various things...
-  ffi_cif       *cif;
-  void         **arg_area;
-  void          *resp = (void*)&res;
-  void *args = __builtin_dwarf_cfa ();
-
-
-  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, (void**)&resp, arg_area, cif);
-  
-  (closure->fun) (cif, resp, arg_area, closure->user_data);
-
-  /* now, do a generic return based on the value of rtype */
-  if (cif->flags == FFI_TYPE_INT)
-    {
-      asm ("movl (%0),%%eax" : : "r" (resp) : "eax");
-    }
-  else if (cif->flags == FFI_TYPE_FLOAT)
-    {
-      asm ("flds (%0)" : : "r" (resp) : "st" );
-    }
-  else if (cif->flags == FFI_TYPE_DOUBLE)
-    {
-      asm ("fldl (%0)" : : "r" (resp) : "st", "st(1)" );
-    }
-  else if (cif->flags == FFI_TYPE_LONGDOUBLE)
-    {
-      asm ("fldt (%0)" : : "r" (resp) : "st", "st(1)" );
-    }
-  else if (cif->flags == FFI_TYPE_SINT64)
-    {
-      asm ("movl 0(%0),%%eax;"
-	   "movl 4(%0),%%edx" 
-	   : : "r"(resp)
-	   : "eax", "edx");
-    }
-#if defined(X86_WIN32) || defined(X86_DARWIN)
-  else if (cif->flags == FFI_TYPE_SINT8) /* 1-byte struct  */
-    {
-      asm ("movsbl (%0),%%eax" : : "r" (resp) : "eax");
-    }
-  else if (cif->flags == FFI_TYPE_SINT16) /* 2-bytes struct */
-    {
-      asm ("movswl (%0),%%eax" : : "r" (resp) : "eax");
-    }
-#endif
-
-  else if (cif->flags == FFI_TYPE_STRUCT)
-    {
-      asm ("lea -8(%ebp),%esp;"
-	   "pop %esi;"
-	   "pop %edi;"
-	   "pop %ebp;"
-	   "ret $4"); 
-    }
-}
-
-
-/* How to make a trampoline.  Derived from gcc/config/i386/i386.c. */
-
-#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \
-({ unsigned char *__tramp = (unsigned char*)(TRAMP); \
-   unsigned int  __fun = (unsigned int)(FUN); \
-   unsigned int  __ctx = (unsigned int)(CTX); \
-   unsigned int  __dis = __fun - ((unsigned int) __tramp + FFI_TRAMPOLINE_SIZE); \
-   *(unsigned char*) &__tramp[0] = 0xb8; \
-   *(unsigned int*)  &__tramp[1] = __ctx; /* movl __ctx, %eax */ \
-   *(unsigned char *)  &__tramp[5] = 0xe9; \
-   *(unsigned int*)  &__tramp[6] = __dis; /* jmp __fun  */ \
- })
-
-
-/* the cif must already be prep'ed */
-
-ffi_status
-ffi_prep_closure (ffi_closure* closure,
-		  ffi_cif* cif,
-		  void (*fun)(ffi_cif*,void*,void**,void*),
-		  void *user_data)
-{
-  FFI_ASSERT (cif->abi == FFI_SYSV);
-
-  FFI_INIT_TRAMPOLINE (&closure->tramp[0], \
-		       &ffi_closure_SYSV,  \
-		       (void*)closure);
-    
-  closure->cif  = cif;
-  closure->user_data = user_data;
-  closure->fun  = fun;
-
-  return FFI_OK;
-}
-
-/* ------- Native raw API support -------------------------------- */
-
-#if !FFI_NO_RAW_API
-
-static void
-ffi_closure_raw_SYSV (closure)
-     ffi_raw_closure *closure;
-{
-  // this is our return value storage
-  long double    res;
-
-  // our various things...
-  ffi_raw         *raw_args;
-  ffi_cif         *cif;
-  unsigned short   rtype;
-  void            *resp = (void*)&res;
-
-  /* get the cif */
-  cif = closure->cif;
-
-  /* the SYSV/X86 abi matches the RAW API exactly, well.. almost */
-  raw_args = (ffi_raw*) __builtin_dwarf_cfa ();
-
-  (closure->fun) (cif, resp, raw_args, closure->user_data);
-
-  rtype = cif->flags;
-
-  /* now, do a generic return based on the value of rtype */
-  if (rtype == FFI_TYPE_INT)
-    {
-      asm ("movl (%0),%%eax" : : "r" (resp) : "eax");
-    }
-  else if (rtype == FFI_TYPE_FLOAT)
-    {
-      asm ("flds (%0)" : : "r" (resp) : "st" );
-    }
-  else if (rtype == FFI_TYPE_DOUBLE)
-    {
-      asm ("fldl (%0)" : : "r" (resp) : "st", "st(1)" );
-    }
-  else if (rtype == FFI_TYPE_LONGDOUBLE)
-    {
-      asm ("fldt (%0)" : : "r" (resp) : "st", "st(1)" );
-    }
-  else if (rtype == FFI_TYPE_SINT64)
-    {
-      asm ("movl 0(%0),%%eax; movl 4(%0),%%edx" 
-	   : : "r"(resp)
-	   : "eax", "edx");
-    }
-}
-
- 
-
-
-ffi_status
-ffi_prep_raw_closure (ffi_raw_closure* closure,
-		      ffi_cif* cif,
-		      void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
-		      void *user_data)
-{
-  int i;
-
-  FFI_ASSERT (cif->abi == FFI_SYSV);
-
-  // we currently don't support certain kinds of arguments for raw
-  // closures.  This should be implemented by a separate assembly language
-  // routine, since it would require argument processing, something we
-  // don't do now for performance.
-
-  for (i = cif->nargs-1; i >= 0; i--)
-    {
-      FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_STRUCT);
-      FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_LONGDOUBLE);
-    }
-  
-
-  FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_raw_SYSV,
-		       (void*)closure);
-    
-  closure->cif  = cif;
-  closure->user_data = user_data;
-  closure->fun  = fun;
-
-  return FFI_OK;
-}
-
-static void 
-ffi_prep_args_raw(char *stack, extended_cif *ecif)
-{
-  memcpy (stack, ecif->avalue, ecif->cif->bytes);
-}
-
-/* we borrow this routine from libffi (it must be changed, though, to
- * actually call the function passed in the first argument.  as of
- * libffi-1.20, this is not the case.)
- */
-
-extern void 
-ffi_call_SYSV(void (*)(char *, extended_cif *), 
-	      /*@out@*/ extended_cif *, 
-	      unsigned, unsigned, 
-	      /*@out@*/ unsigned *, 
-	      void (*fn)());
-
-#ifdef X86_WIN32
-extern void
-ffi_call_STDCALL(void (*)(char *, extended_cif *),
-	      /*@out@*/ extended_cif *,
-	      unsigned, unsigned,
-	      /*@out@*/ unsigned *,
-	      void (*fn)());
-#endif /* X86_WIN32 */
-
-void
-ffi_raw_call(/*@dependent@*/ ffi_cif *cif, 
-	     void (*fn)(), 
-	     /*@out@*/ void *rvalue, 
-	     /*@dependent@*/ ffi_raw *fake_avalue)
-{
-  extended_cif ecif;
-  void **avalue = (void **)fake_avalue;
-
-  ecif.cif = cif;
-  ecif.avalue = avalue;
-  
-  /* 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) && retval_on_stack(cif->rtype)) 
-    {
-      /*@-sysunrecog@*/
-      ecif.rvalue = alloca(cif->rtype->size);
-      /*@=sysunrecog@*/
-    }
-  else
-    ecif.rvalue = rvalue;
-    
-  
-  switch (cif->abi) 
-    {
-    case FFI_SYSV:
-      /*@-usedef@*/
-      ffi_call_SYSV(ffi_prep_args_raw, &ecif, cif->bytes, 
-		    cif->flags, ecif.rvalue, fn);
-      /*@=usedef@*/
-      break;
-#ifdef X86_WIN32
-    case FFI_STDCALL:
-      /*@-usedef@*/
-      ffi_call_STDCALL(ffi_prep_args_raw, &ecif, cif->bytes,
-		    cif->flags, ecif.rvalue, fn);
-      /*@=usedef@*/
-      break;
-#endif /* X86_WIN32 */
-    default:
-      FFI_ASSERT(0);
-      break;
-    }
-}
-
-#endif
-
-#endif /* __x86_64__  */
-
-#endif /* __i386__ */


More information about the Python-checkins mailing list