Commit 8406f5f48f7f58a1c982a93a95d521cf82b3241f

green 2008-04-03T18:57:34

3.0.5

diff --git a/libffi/ChangeLog.libffi b/libffi/ChangeLog.libffi
index b4ec63f..6ebdbaa 100644
--- a/libffi/ChangeLog.libffi
+++ b/libffi/ChangeLog.libffi
@@ -1,3 +1,24 @@
+2008-04-03  Anthony Green  <green@redhat.com>
+
+	* libffi.pc.in (Libs): Add -L${libdir}.
+	* configure.ac: Bump version to 3.0.5.
+	* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
+	* libtool-version: Increment revision.
+	* README: Update for new release.
+
+2008-04-03  Anthony Green  <green@redhat.com>
+	    Xerces Ranby  <xerxes@zafena.se>
+
+	* include/ffi.h.in: Wrap definition of target architecture to
+	protect from double definitions.
+
+2008-03-22  Moriyoshi Koizumi  <moriyoshi@gmail.com>
+
+	* src/x86/ffi.c (ffi_prep_closure_loc): Fix for bug revealed in
+	closure_loc_fn0.c.
+	* testsuite/libffi.call/closure_loc_fn0.c (closure_loc_test_fn0):
+	New test.
+
 2008-03-04  Anthony Green  <green@redhat.com>
 	    Blake Chaffin
 	    hos@tamanegi.org
diff --git a/libffi/README b/libffi/README
index 924a284..a936962 100644
--- a/libffi/README
+++ b/libffi/README
@@ -1,7 +1,7 @@
 Status
 ======
 
-libffi-3.0.4 was released on February 24, 2008. Check the libffi web
+libffi-3.0.5 was released on April 3, 2008. Check the libffi web
 page for updates: <URL:http://sourceware.org/libffi/>.
 
 
@@ -158,6 +158,11 @@ arguments' test).
 History
 =======
 
+3.0.5 Apr-3-08
+        Fix libffi.pc file.
+	Fix #define ARM for IcedTea users.
+	Fix x86 closure bug.
+
 3.0.4 Feb-24-08
         Fix x86 OpenBSD configury.
 
diff --git a/libffi/TODO b/libffi/TODO
new file mode 100644
index 0000000..0606d0d
--- /dev/null
+++ b/libffi/TODO
@@ -0,0 +1 @@
+- Merge with GCC tree.
diff --git a/libffi/configure b/libffi/configure
index f199574..cc8963d 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for libffi 3.0.4.
+# Generated by GNU Autoconf 2.61 for libffi 3.0.5.
 #
 # Report bugs to <http://gcc.gnu.org/bugs.html>.
 #
@@ -728,8 +728,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='libffi'
 PACKAGE_TARNAME='libffi'
-PACKAGE_VERSION='3.0.4'
-PACKAGE_STRING='libffi 3.0.4'
+PACKAGE_VERSION='3.0.5'
+PACKAGE_STRING='libffi 3.0.5'
 PACKAGE_BUGREPORT='http://gcc.gnu.org/bugs.html'
 
 # Factoring default headers for most tests.
@@ -1459,7 +1459,7 @@ if test "$ac_init_help" = "long"; then
   # 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.4 to adapt to many kinds of systems.
+\`configure' configures libffi 3.0.5 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1530,7 +1530,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libffi 3.0.4:";;
+     short | recursive ) echo "Configuration of libffi 3.0.5:";;
    esac
   cat <<\_ACEOF
 
@@ -1640,7 +1640,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-libffi configure 3.0.4
+libffi configure 3.0.5
 generated by GNU Autoconf 2.61
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1654,7 +1654,7 @@ cat >config.log <<_ACEOF
 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.4, which was
+It was created by libffi $as_me 3.0.5, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   $ $0 $@
@@ -2477,7 +2477,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='libffi'
- VERSION='3.0.4'
+ VERSION='3.0.5'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -23321,7 +23321,7 @@ exec 6>&1
 # 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.4, which was
+This file was extended by libffi $as_me 3.0.5, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -23378,7 +23378,7 @@ Report bugs to <bug-autoconf@gnu.org>."
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-libffi config.status 3.0.4
+libffi config.status 3.0.5
 configured by $0, generated by GNU Autoconf 2.61,
   with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
diff --git a/libffi/configure.ac b/libffi/configure.ac
index ee397c1..3eac92d 100644
--- a/libffi/configure.ac
+++ b/libffi/configure.ac
@@ -2,7 +2,7 @@ dnl Process this with autoconf to create configure
 
 AC_PREREQ(2.59)
 
-AC_INIT([libffi], [3.0.4], [http://gcc.gnu.org/bugs.html])
+AC_INIT([libffi], [3.0.5], [http://gcc.gnu.org/bugs.html])
 AC_CONFIG_HEADERS([fficonfig.h])
 
 AC_CANONICAL_SYSTEM
diff --git a/libffi/doc/stamp-vti b/libffi/doc/stamp-vti
index 5e3e8a2..3768fae 100644
--- a/libffi/doc/stamp-vti
+++ b/libffi/doc/stamp-vti
@@ -1,4 +1,4 @@
 @set UPDATED 14 February 2008
 @set UPDATED-MONTH February 2008
-@set EDITION 3.0.4
-@set VERSION 3.0.4
+@set EDITION 3.0.5
+@set VERSION 3.0.5
diff --git a/libffi/doc/version.texi b/libffi/doc/version.texi
index 5e3e8a2..3768fae 100644
--- a/libffi/doc/version.texi
+++ b/libffi/doc/version.texi
@@ -1,4 +1,4 @@
 @set UPDATED 14 February 2008
 @set UPDATED-MONTH February 2008
-@set EDITION 3.0.4
-@set VERSION 3.0.4
+@set EDITION 3.0.5
+@set VERSION 3.0.5
diff --git a/libffi/include/ffi.h.in b/libffi/include/ffi.h.in
index 1a015ae..7df3b06 100644
--- a/libffi/include/ffi.h.in
+++ b/libffi/include/ffi.h.in
@@ -57,7 +57,9 @@ extern "C" {
 #endif
 
 /* Specify which architecture libffi is configured for. */
+#ifndef @TARGET@
 #define @TARGET@
+#endif
 
 /* ---- System configuration information --------------------------------- */
 
diff --git a/libffi/libffi.pc.in b/libffi/libffi.pc.in
index 9e2dcfe..c2e1c7b 100644
--- a/libffi/libffi.pc.in
+++ b/libffi/libffi.pc.in
@@ -6,5 +6,5 @@ includedir=${libdir}/@PACKAGE_NAME@-@PACKAGE_VERSION@/include
 Name: @PACKAGE_NAME@
 Description: Library supporting Foreign Function Interfaces
 Version: @PACKAGE_VERSION@
-Libs: -lffi
+Libs: -L${libdir} -lffi
 Cflags: -I${includedir}
diff --git a/libffi/libtool-version b/libffi/libtool-version
index 9f939d1..55aa09c 100644
--- a/libffi/libtool-version
+++ b/libffi/libtool-version
@@ -3,4 +3,4 @@
 # a separate file so that version updates don't involve re-running
 # automake.
 # CURRENT:REVISION:AGE
-5:5:0
+5:6:0
diff --git a/libffi/src/x86/ffi.c b/libffi/src/x86/ffi.c
index 63c9999..767effb 100644
--- a/libffi/src/x86/ffi.c
+++ b/libffi/src/x86/ffi.c
@@ -349,14 +349,14 @@ ffi_prep_closure_loc (ffi_closure* closure,
     {
       FFI_INIT_TRAMPOLINE (&closure->tramp[0],
                            &ffi_closure_SYSV,
-                           (void*)closure);
+                           (void*)codeloc);
     }
 #ifdef X86_WIN32
   else if (cif->abi == FFI_STDCALL)
     {
       FFI_INIT_TRAMPOLINE_STDCALL (&closure->tramp[0],
                                    &ffi_closure_STDCALL,
-                                   (void*)closure, cif->bytes);
+                                   (void*)codeloc, cif->bytes);
     }
 #endif
   else
diff --git a/libffi/testsuite/libffi.call/closure_loc_fn0.c b/libffi/testsuite/libffi.call/closure_loc_fn0.c
new file mode 100644
index 0000000..43f28e4
--- /dev/null
+++ b/libffi/testsuite/libffi.call/closure_loc_fn0.c
@@ -0,0 +1,95 @@
+/* Area:	closure_call
+   Purpose:	Check multiple values passing from different type.
+		Also, exceed the limit of gpr and fpr registers on PowerPC
+		Darwin.
+   Limitations:	none.
+   PR:		none.
+   Originator:	<andreast@gcc.gnu.org> 20030828	 */
+
+
+
+
+/* { dg-do run } */
+#include "ffitest.h"
+
+static void
+closure_loc_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args,
+		 void* userdata)
+{
+  *(ffi_arg*)resp =
+    (int)*(unsigned long long *)args[0] + (int)(*(int *)args[1]) +
+    (int)(*(unsigned long long *)args[2]) + (int)*(int *)args[3] +
+    (int)(*(signed short *)args[4]) +
+    (int)(*(unsigned long long *)args[5]) +
+    (int)*(int *)args[6] + (int)(*(int *)args[7]) +
+    (int)(*(double *)args[8]) + (int)*(int *)args[9] +
+    (int)(*(int *)args[10]) + (int)(*(float *)args[11]) +
+    (int)*(int *)args[12] + (int)(*(int *)args[13]) +
+    (int)(*(int *)args[14]) +  *(int *)args[15] + (int)(long)userdata;
+
+  printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
+	 (int)*(unsigned long long *)args[0], (int)(*(int *)args[1]),
+	 (int)(*(unsigned long long *)args[2]),
+	 (int)*(int *)args[3], (int)(*(signed short *)args[4]),
+	 (int)(*(unsigned long long *)args[5]),
+	 (int)*(int *)args[6], (int)(*(int *)args[7]),
+	 (int)(*(double *)args[8]), (int)*(int *)args[9],
+	 (int)(*(int *)args[10]), (int)(*(float *)args[11]),
+	 (int)*(int *)args[12], (int)(*(int *)args[13]),
+	 (int)(*(int *)args[14]),*(int *)args[15],
+	 (int)(long)userdata, (int)*(ffi_arg *)resp);
+
+}
+
+typedef int (*closure_loc_test_type0)(unsigned long long, int, unsigned long long,
+				  int, signed short, unsigned long long, int,
+				  int, double, int, int, float, int, int,
+				  int, int);
+
+int main (void)
+{
+  ffi_cif cif;
+  ffi_closure *pcl;
+  ffi_type * cl_arg_types[17];
+  int res;
+  void *codeloc;
+
+  cl_arg_types[0] = &ffi_type_uint64;
+  cl_arg_types[1] = &ffi_type_sint;
+  cl_arg_types[2] = &ffi_type_uint64;
+  cl_arg_types[3] = &ffi_type_sint;
+  cl_arg_types[4] = &ffi_type_sshort;
+  cl_arg_types[5] = &ffi_type_uint64;
+  cl_arg_types[6] = &ffi_type_sint;
+  cl_arg_types[7] = &ffi_type_sint;
+  cl_arg_types[8] = &ffi_type_double;
+  cl_arg_types[9] = &ffi_type_sint;
+  cl_arg_types[10] = &ffi_type_sint;
+  cl_arg_types[11] = &ffi_type_float;
+  cl_arg_types[12] = &ffi_type_sint;
+  cl_arg_types[13] = &ffi_type_sint;
+  cl_arg_types[14] = &ffi_type_sint;
+  cl_arg_types[15] = &ffi_type_sint;
+  cl_arg_types[16] = NULL;
+
+  /* Initialize the cif */
+  CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16,
+		     &ffi_type_sint, cl_arg_types) == FFI_OK);
+
+  pcl = ffi_closure_alloc(sizeof(ffi_closure), &codeloc);
+  CHECK(pcl != NULL);
+  CHECK(codeloc != NULL);
+
+  CHECK(ffi_prep_closure_loc(pcl, &cif, closure_loc_test_fn0,
+			 (void *) 3 /* userdata */, codeloc) == FFI_OK);
+  
+  CHECK(memcmp(pcl, codeloc, sizeof(*pcl)) == 0);
+
+  res = (*((closure_loc_test_type0)codeloc))
+    (1LL, 2, 3LL, 4, 127, 429LL, 7, 8, 9.5, 10, 11, 12, 13,
+     19, 21, 1);
+  /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */
+  printf("res: %d\n",res);
+  /* { dg-output "\nres: 680" } */
+     exit(0);
+}