Commit 7063d9996f742576095c7b0eb5016c0f9a670aec

green 2008-12-19T16:13:46

Version 3.0.8 with x86-solaris support

diff --git a/libffi/ChangeLog b/libffi/ChangeLog
index 7026706..b63463e 100644
--- a/libffi/ChangeLog
+++ b/libffi/ChangeLog
@@ -1,3 +1,17 @@
+2008-12-18  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+	PR libffi/26048
+	* configure.ac (HAVE_AS_X86_PCREL): New test.
+	* configure: Regenerate.
+	* fficonfig.h.in: Regenerate.
+	* src/x86/sysv.S [!FFI_NO_RAW_API]: Precalculate
+	RAW_CLOSURE_CIF_OFFSET, RAW_CLOSURE_FUN_OFFSET,
+	RAW_CLOSURE_USER_DATA_OFFSET for the Solaris 10/x86 assembler.
+	(.eh_frame): Only use SYMBOL-. iff HAVE_AS_X86_PCREL.
+	* src/x86/unix64.S (.Lstore_table): Move to .text section.
+	(.Lload_table): Likewise.
+	(.eh_frame): Only use SYMBOL-. iff HAVE_AS_X86_PCREL.
+
 2008-01-24  David Edelsohn  <edelsohn@gnu.org>
 
 	* configure: Regenerate.
diff --git a/libffi/ChangeLog.libffi b/libffi/ChangeLog.libffi
index 7ba5118..cdc9115 100644
--- a/libffi/ChangeLog.libffi
+++ b/libffi/ChangeLog.libffi
@@ -1,3 +1,10 @@
+2008-12-19  Anthony Green  <green@redhat.com>
+
+	* configure.ac: Bump version to 3.0.8.
+	* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
+	* libtool-version: Increment revision.
+	* README: Update for new release.
+
 2008-11-11  Anthony Green  <green@redhat.com>
 
 	* configure.ac: Bump version to 3.0.7.
diff --git a/libffi/README b/libffi/README
index 36611b0..0d9c8fa 100644
--- a/libffi/README
+++ b/libffi/README
@@ -1,7 +1,7 @@
 Status
 ======
 
-libffi-3.0.7 was released on November 11, 2008. Check the libffi web
+libffi-3.0.8 was released on December 19, 2008. Check the libffi web
 page for updates: <URL:http://sourceware.org/libffi/>.
 
 
@@ -57,10 +57,12 @@ release was only tested on:
      x86 freebsd
      x86 linux
      x86 openbsd
+     x86 solaris
      x86-64 darwin
      x86-64 linux
      x86-64 OS X
      x86-64 freebsd
+     x86-64 solaris
      
 Please send additional platform test results to
 libffi-discuss@sourceware.org.
diff --git a/libffi/configure b/libffi/configure
index d0ada88..a3280bc 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.63 for libffi 3.0.7.
+# Generated by GNU Autoconf 2.63 for libffi 3.0.8.
 #
 # Report bugs to <http://gcc.gnu.org/bugs.html>.
 #
@@ -750,8 +750,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='libffi'
 PACKAGE_TARNAME='libffi'
-PACKAGE_VERSION='3.0.7'
-PACKAGE_STRING='libffi 3.0.7'
+PACKAGE_VERSION='3.0.8'
+PACKAGE_STRING='libffi 3.0.8'
 PACKAGE_BUGREPORT='http://gcc.gnu.org/bugs.html'
 
 # Factoring default headers for most tests.
@@ -1550,7 +1550,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.7 to adapt to many kinds of systems.
+\`configure' configures libffi 3.0.8 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1621,7 +1621,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libffi 3.0.7:";;
+     short | recursive ) echo "Configuration of libffi 3.0.8:";;
    esac
   cat <<\_ACEOF
 
@@ -1734,7 +1734,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-libffi configure 3.0.7
+libffi configure 3.0.8
 generated by GNU Autoconf 2.63
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1748,7 +1748,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.7, which was
+It was created by libffi $as_me 3.0.8, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   $ $0 $@
@@ -2597,7 +2597,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='libffi'
- VERSION='3.0.7'
+ VERSION='3.0.8'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -23260,6 +23260,31 @@ _ACEOF
     fi
 fi
 
+if test x$TARGET = xX86 || test x$TARGET = xX86_64; then
+    { $as_echo "$as_me:$LINENO: checking assembler supports pc related relocs" >&5
+$as_echo_n "checking assembler supports pc related relocs... " >&6; }
+if test "${libffi_cv_as_x86_pcrel+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+
+	libffi_cv_as_x86_pcrel=yes
+	echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s
+	if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then
+	    libffi_cv_as_x86_pcrel=no
+	fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $libffi_cv_as_x86_pcrel" >&5
+$as_echo "$libffi_cv_as_x86_pcrel" >&6; }
+    if test "x$libffi_cv_as_x86_pcrel" = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_AS_X86_PCREL 1
+_ACEOF
+
+    fi
+fi
+
 { $as_echo "$as_me:$LINENO: checking whether .eh_frame section should be read-only" >&5
 $as_echo_n "checking whether .eh_frame section should be read-only... " >&6; }
 if test "${libffi_cv_ro_eh_frame+set}" = set; then
@@ -24050,7 +24075,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.7, which was
+This file was extended by libffi $as_me 3.0.8, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -24117,7 +24142,7 @@ Report bugs to <bug-autoconf@gnu.org>."
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_version="\\
-libffi config.status 3.0.7
+libffi config.status 3.0.8
 configured by $0, generated by GNU Autoconf 2.63,
   with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
diff --git a/libffi/configure.ac b/libffi/configure.ac
index e5ce63b..052a77b 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.7], [http://gcc.gnu.org/bugs.html])
+AC_INIT([libffi], [3.0.8], [http://gcc.gnu.org/bugs.html])
 AC_CONFIG_HEADERS([fficonfig.h])
 
 AC_CANONICAL_SYSTEM
@@ -245,6 +245,21 @@ if test x$TARGET = xSPARC; then
     fi
 fi
 
+if test x$TARGET = xX86 || test x$TARGET = xX86_64; then
+    AC_CACHE_CHECK([assembler supports pc related relocs],
+	libffi_cv_as_x86_pcrel, [
+	libffi_cv_as_x86_pcrel=yes
+	echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s
+	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
+	AC_DEFINE(HAVE_AS_X86_PCREL, 1,
+		  [Define if your assembler supports PC relative relocs.])
+    fi
+fi
+
 AC_CACHE_CHECK([whether .eh_frame section should be read-only],
     libffi_cv_ro_eh_frame, [
 	libffi_cv_ro_eh_frame=no
diff --git a/libffi/doc/stamp-vti b/libffi/doc/stamp-vti
index f04e3db..81d0b79 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.7
-@set VERSION 3.0.7
+@set EDITION 3.0.8
+@set VERSION 3.0.8
diff --git a/libffi/doc/version.texi b/libffi/doc/version.texi
index f04e3db..81d0b79 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.7
-@set VERSION 3.0.7
+@set EDITION 3.0.8
+@set VERSION 3.0.8
diff --git a/libffi/fficonfig.h.in b/libffi/fficonfig.h.in
index 07fa537..32ae5eb 100644
--- a/libffi/fficonfig.h.in
+++ b/libffi/fficonfig.h.in
@@ -37,6 +37,9 @@
    */
 #undef HAVE_AS_SPARC_UA_PCREL
 
+/* Define if your assembler supports PC relative relocs. */
+#undef HAVE_AS_X86_PCREL
+
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
diff --git a/libffi/libtool-version b/libffi/libtool-version
index faa2f61..bf2988a 100644
--- a/libffi/libtool-version
+++ b/libffi/libtool-version
@@ -26,4 +26,4 @@
 #    release, then set age to 0.
 #
 # CURRENT:REVISION:AGE
-5:8:0
+5:9:0
diff --git a/libffi/src/x86/sysv.S b/libffi/src/x86/sysv.S
index 2711fde..f4b6c1e 100644
--- a/libffi/src/x86/sysv.S
+++ b/libffi/src/x86/sysv.S
@@ -242,9 +242,20 @@ ffi_closure_SYSV:
 
 #if !FFI_NO_RAW_API
 
+/* Precalculate for e.g. the Solaris 10/x86 assembler.  */
+#if FFI_TRAMPOLINE_SIZE == 10
+#define RAW_CLOSURE_CIF_OFFSET 12
+#define RAW_CLOSURE_FUN_OFFSET 16
+#define RAW_CLOSURE_USER_DATA_OFFSET 20
+#elif FFI_TRAMPOLINE_SIZE == 24
+#define RAW_CLOSURE_CIF_OFFSET 24
+#define RAW_CLOSURE_FUN_OFFSET 28
+#define RAW_CLOSURE_USER_DATA_OFFSET 32
+#else
 #define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3)
 #define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4)
 #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4)
+#endif
 #define CIF_FLAGS_OFFSET 20
 
 	.align	4
@@ -343,10 +354,12 @@ ffi_closure_raw_SYSV:
 	.long	.LEFDE1-.LASFDE1	/* FDE Length */
 .LASFDE1:
 	.long	.LASFDE1-.Lframe1	/* FDE CIE offset */
-#ifdef __PIC__
+#if defined __PIC__ && defined HAVE_AS_X86_PCREL
 	.long	.LFB1-.	/* FDE initial location */
+#elif defined __PIC__
+	.long	.LFB1@rel
 #else
-	.long	.LFB1	/* FDE initial location */
+	.long	.LFB1
 #endif
 	.long	.LFE1-.LFB1	/* FDE address range */
 #ifdef __PIC__
@@ -368,8 +381,10 @@ ffi_closure_raw_SYSV:
 	.long	.LEFDE2-.LASFDE2	/* FDE Length */
 .LASFDE2:
 	.long	.LASFDE2-.Lframe1	/* FDE CIE offset */
-#ifdef __PIC__
+#if defined __PIC__ && defined HAVE_AS_X86_PCREL
 	.long	.LFB2-.	/* FDE initial location */
+#elif defined __PIC__
+	.long	.LFB2@rel
 #else
 	.long	.LFB2
 #endif
@@ -402,8 +417,10 @@ ffi_closure_raw_SYSV:
 	.long	.LEFDE3-.LASFDE3	/* FDE Length */
 .LASFDE3:
 	.long	.LASFDE3-.Lframe1	/* FDE CIE offset */
-#ifdef __PIC__
+#if defined __PIC__ && defined HAVE_AS_X86_PCREL
 	.long	.LFB3-.	/* FDE initial location */
+#elif defined __PIC__
+	.long	.LFB3@rel
 #else
 	.long	.LFB3
 #endif
diff --git a/libffi/src/x86/unix64.S b/libffi/src/x86/unix64.S
index 046564d..fe3f4fd 100644
--- a/libffi/src/x86/unix64.S
+++ b/libffi/src/x86/unix64.S
@@ -89,7 +89,6 @@ ffi_call_unix64:
 	addq	%r11, %r10
 	jmp	*%r10
 
-	.section .rodata
 .Lstore_table:
 	.long	.Lst_void-.Lstore_table		/* FFI_TYPE_VOID */
 	.long	.Lst_sint32-.Lstore_table	/* FFI_TYPE_INT */
@@ -107,7 +106,6 @@ ffi_call_unix64:
 	.long	.Lst_struct-.Lstore_table	/* FFI_TYPE_STRUCT */
 	.long	.Lst_int64-.Lstore_table	/* FFI_TYPE_POINTER */
 
-	.text
 	.align 2
 .Lst_void:
 	ret
@@ -240,7 +238,6 @@ ffi_closure_unix64:
 	addq	%r11, %r10
 	jmp	*%r10
 
-	.section .rodata
 .Lload_table:
 	.long	.Lld_void-.Lload_table		/* FFI_TYPE_VOID */
 	.long	.Lld_int32-.Lload_table		/* FFI_TYPE_INT */
@@ -258,7 +255,6 @@ ffi_closure_unix64:
 	.long	.Lld_struct-.Lload_table	/* FFI_TYPE_STRUCT */
 	.long	.Lld_int64-.Lload_table		/* FFI_TYPE_POINTER */
 
-	.text
 	.align 2
 .Lld_void:
 	ret
@@ -351,7 +347,11 @@ ffi_closure_unix64:
 	.long	.LEFDE1-.LASFDE1	/* FDE Length */
 .LASFDE1:
 	.long	.LASFDE1-.Lframe1	/* FDE CIE offset */
+#if HAVE_AS_X86_PCREL
 	.long	.LUW0-.			/* FDE initial location */
+#else
+	.long	.LUW0@rel
+#endif
 	.long	.LUW4-.LUW0		/* FDE address range */
 	.uleb128 0x0			/* Augmentation size */
 
@@ -389,7 +389,11 @@ ffi_closure_unix64:
 	.long	.LEFDE3-.LASFDE3	/* FDE Length */
 .LASFDE3:
 	.long	.LASFDE3-.Lframe1	/* FDE CIE offset */
+#if HAVE_AS_X86_PCREL
 	.long	.LUW5-.			/* FDE initial location */
+#else
+	.long	.LUW5@rel
+#endif
 	.long	.LUW9-.LUW5		/* FDE address range */
 	.uleb128 0x0			/* Augmentation size */