summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorro <ro@138bc75d-0d04-0410-961f-82ee72b054a4>2008-12-19 14:59:42 +0000
committerro <ro@138bc75d-0d04-0410-961f-82ee72b054a4>2008-12-19 14:59:42 +0000
commit95ff4d7de8badd910fbb3342f2287cda0e4696a9 (patch)
tree0015f236039dc18cb0d69c465abfae9a5714bac7
parent1c10b9d7f78f9b93f87081076d9f9526f90d5b29 (diff)
downloadppe42-gcc-95ff4d7de8badd910fbb3342f2287cda0e4696a9.tar.gz
ppe42-gcc-95ff4d7de8badd910fbb3342f2287cda0e4696a9.zip
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142835 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libffi/ChangeLog14
-rwxr-xr-xlibffi/configure25
-rw-r--r--libffi/configure.ac15
-rw-r--r--libffi/fficonfig.h.in3
-rw-r--r--libffi/src/x86/sysv.S28
-rw-r--r--libffi/src/x86/unix64.S14
6 files changed, 89 insertions, 10 deletions
diff --git a/libffi/ChangeLog b/libffi/ChangeLog
index 802b88c0f1d..52ab411bda7 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-12-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* configure: Regenerate.
diff --git a/libffi/configure b/libffi/configure
index aaf3b81e824..c40a859ddd5 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -13263,6 +13263,31 @@ _ACEOF
fi
fi
+if test x$TARGET = xX86 || test x$TARGET = xX86_64; then
+ echo "$as_me:$LINENO: checking assembler supports pc related relocs" >&5
+echo $ECHO_N "checking assembler supports pc related relocs... $ECHO_C" >&6
+if test "${libffi_cv_as_x86_pcrel+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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
+echo "$as_me:$LINENO: result: $libffi_cv_as_x86_pcrel" >&5
+echo "${ECHO_T}$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
+
echo "$as_me:$LINENO: checking whether .eh_frame section should be read-only" >&5
echo $ECHO_N "checking whether .eh_frame section should be read-only... $ECHO_C" >&6
if test "${libffi_cv_ro_eh_frame+set}" = set; then
diff --git a/libffi/configure.ac b/libffi/configure.ac
index b99ebd7db65..2dff35c060f 100644
--- a/libffi/configure.ac
+++ b/libffi/configure.ac
@@ -240,6 +240,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/fficonfig.h.in b/libffi/fficonfig.h.in
index e93cf8ae77b..90c8990eb19 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/src/x86/sysv.S b/libffi/src/x86/sysv.S
index 4e652207edf..04564db9caa 100644
--- a/libffi/src/x86/sysv.S
+++ b/libffi/src/x86/sysv.S
@@ -1,5 +1,6 @@
/* -----------------------------------------------------------------------
- sysv.S - Copyright (c) 1996, 1998, 2001, 2002, 2003, 2005 Red Hat, Inc.
+ sysv.S - Copyright (c) 1996, 1998, 2001, 2002, 2003, 2005, 2008
+ Red Hat, Inc.
X86 Foreign Function Interface
@@ -241,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
@@ -342,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__
@@ -367,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
@@ -401,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 a33888180bd..ec6030484ea 100644
--- a/libffi/src/x86/unix64.S
+++ b/libffi/src/x86/unix64.S
@@ -1,5 +1,5 @@
/* -----------------------------------------------------------------------
- unix64.S - Copyright (c) 2002 Bo Thorsen <bo@suse.de>
+ unix64.S - Copyright (c) 2002, 2008 Bo Thorsen <bo@suse.de>
x86-64 Foreign Function Interface
@@ -87,7 +87,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 */
@@ -105,7 +104,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
@@ -238,7 +236,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 */
@@ -256,7 +253,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
@@ -349,7 +345,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 */
@@ -387,7 +387,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 */
OpenPOWER on IntegriCloud