aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2003-05-17 00:09:22 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2003-05-17 00:09:22 +0200
commita733b15e510bf45335f9b5dc345117d4741ae743 (patch)
tree0263f96916c31cb329b80472caf4f2a3a0ffa797
parentf5a1c99c633d3cc9a3f3c4ee4c34094f0369bbac (diff)
downloadgcc-a733b15e510bf45335f9b5dc345117d4741ae743.zip
gcc-a733b15e510bf45335f9b5dc345117d4741ae743.tar.gz
gcc-a733b15e510bf45335f9b5dc345117d4741ae743.tar.bz2
configure.in (HAVE_RO_EH_FRAME): Check whether .eh_frame section should be read-only.
* configure.in (HAVE_RO_EH_FRAME): Check whether .eh_frame section should be read-only. * configure: Rebuilt. * fficonfig.h.in: Rebuilt. * include/ffi.h.in (EH_FRAME_FLAGS): Define. * src/alpha/osf.S: Use EH_FRAME_FLAGS. * src/powerpc/linux64.S: Likewise. * src/powerpc/linux64_closure.S: Likewise. Include ffi.h. * src/powerpc/sysv.S: Use EH_FRAME_FLAGS. Use pcrel encoding if -fpic/-fPIC/-mrelocatable. * src/powerpc/powerpc_closure.S: Likewise. * src/sparc/v8.S: If HAVE_RO_EH_FRAME is defined, don't include #write in .eh_frame flags. * src/sparc/v9.S: Likewise. * src/x86/unix64.S: Use EH_FRAME_FLAGS. * src/x86/sysv.S: Likewise. Use pcrel encoding if -fpic/-fPIC. * src/s390/sysv.S: Use EH_FRAME_FLAGS. Include ffi.h. From-SVN: r66887
-rw-r--r--libffi/ChangeLog20
-rwxr-xr-xlibffi/configure28
-rw-r--r--libffi/configure.in19
-rw-r--r--libffi/fficonfig.h.in2
-rw-r--r--libffi/include/ffi.h.in10
-rw-r--r--libffi/src/alpha/osf.S2
-rw-r--r--libffi/src/powerpc/linux64.S2
-rw-r--r--libffi/src/powerpc/linux64_closure.S5
-rw-r--r--libffi/src/powerpc/ppc_closure.S35
-rw-r--r--libffi/src/powerpc/sysv.S47
-rw-r--r--libffi/src/s390/sysv.S7
-rw-r--r--libffi/src/sparc/v8.S4
-rw-r--r--libffi/src/sparc/v9.S4
-rw-r--r--libffi/src/x86/sysv.S74
-rw-r--r--libffi/src/x86/unix64.S2
15 files changed, 198 insertions, 63 deletions
diff --git a/libffi/ChangeLog b/libffi/ChangeLog
index b609f1d..5da773a 100644
--- a/libffi/ChangeLog
+++ b/libffi/ChangeLog
@@ -1,3 +1,23 @@
+2003-05-16 Jakub Jelinek <jakub@redhat.com>
+
+ * configure.in (HAVE_RO_EH_FRAME): Check whether .eh_frame section
+ should be read-only.
+ * configure: Rebuilt.
+ * fficonfig.h.in: Rebuilt.
+ * include/ffi.h.in (EH_FRAME_FLAGS): Define.
+ * src/alpha/osf.S: Use EH_FRAME_FLAGS.
+ * src/powerpc/linux64.S: Likewise.
+ * src/powerpc/linux64_closure.S: Likewise. Include ffi.h.
+ * src/powerpc/sysv.S: Use EH_FRAME_FLAGS. Use pcrel encoding
+ if -fpic/-fPIC/-mrelocatable.
+ * src/powerpc/powerpc_closure.S: Likewise.
+ * src/sparc/v8.S: If HAVE_RO_EH_FRAME is defined, don't include
+ #write in .eh_frame flags.
+ * src/sparc/v9.S: Likewise.
+ * src/x86/unix64.S: Use EH_FRAME_FLAGS.
+ * src/x86/sysv.S: Likewise. Use pcrel encoding if -fpic/-fPIC.
+ * src/s390/sysv.S: Use EH_FRAME_FLAGS. Include ffi.h.
+
2003-05-07 Jeff Sturm <jsturm@one-point.com>
Fixes PR bootstrap/10656
diff --git a/libffi/configure b/libffi/configure
index 5cbef7a..9c2550d 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -3638,6 +3638,34 @@ EOF
fi
fi
+echo $ac_n "checking whether .eh_frame section should be read-only""... $ac_c" 1>&6
+echo "configure:3495: checking whether .eh_frame section should be read-only" >&5
+if eval "test \"`echo '$''{'libffi_cv_ro_eh_frame'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+ libffi_cv_ro_eh_frame=no
+ echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c
+ if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then
+ if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then
+ libffi_cv_ro_eh_frame=yes
+ elif grep '.section.*eh_frame.*#alloc' conftest.c \
+ | grep -v '#write' > /dev/null; then
+ libffi_cv_ro_eh_frame=yes
+ fi
+ fi
+ rm -f conftest.*
+
+fi
+
+echo "$ac_t""$libffi_cv_ro_eh_frame" 1>&6
+if test "x$libffi_cv_ro_eh_frame" = xyes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_RO_EH_FRAME 1
+EOF
+
+fi
+
diff --git a/libffi/configure.in b/libffi/configure.in
index e71f673..0048439 100644
--- a/libffi/configure.in
+++ b/libffi/configure.in
@@ -149,6 +149,25 @@ if test x$TARGET = xSPARC; then
fi
fi
+AC_CACHE_CHECK([whether .eh_frame section should be read-only],
+ libffi_cv_ro_eh_frame, [
+ libffi_cv_ro_eh_frame=no
+ echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c
+ if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then
+ if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then
+ libffi_cv_ro_eh_frame=yes
+ elif grep '.section.*eh_frame.*#alloc' conftest.c \
+ | grep -v '#write' > /dev/null; then
+ libffi_cv_ro_eh_frame=yes
+ fi
+ fi
+ rm -f conftest.*
+ ])
+if test "x$libffi_cv_ro_eh_frame" = xyes; then
+ AC_DEFINE(HAVE_RO_EH_FRAME, 1,
+ [Define if .eh_frame sections should be read-only.])
+fi
+
AC_SUBST(TARGET)
AC_SUBST(TARGETDIR)
diff --git a/libffi/fficonfig.h.in b/libffi/fficonfig.h.in
index 2b6f581..636110c 100644
--- a/libffi/fficonfig.h.in
+++ b/libffi/fficonfig.h.in
@@ -77,3 +77,5 @@
/* Define if your assembler supports .register. */
#undef HAVE_AS_REGISTER_PSEUDO_OP
+/* Define if .eh_frame sections should be read-only. */
+#undef HAVE_RO_EH_FRAME
diff --git a/libffi/include/ffi.h.in b/libffi/include/ffi.h.in
index c51a809..b37307c 100644
--- a/libffi/include/ffi.h.in
+++ b/libffi/include/ffi.h.in
@@ -183,7 +183,15 @@ extern "C" {
#endif
#endif
-#ifndef LIBFFI_ASM
+#ifdef LIBFFI_ASM
+
+#ifdef HAVE_RO_EH_FRAME
+#define EH_FRAME_FLAGS "a"
+#else
+#define EH_FRAME_FLAGS "aw"
+#endif
+
+#else
/* ---- Generic type definitions ----------------------------------------- */
diff --git a/libffi/src/alpha/osf.S b/libffi/src/alpha/osf.S
index 75beab8..1f6b405 100644
--- a/libffi/src/alpha/osf.S
+++ b/libffi/src/alpha/osf.S
@@ -292,7 +292,7 @@ $load_table:
#endif
#ifdef __ELF__
- .section .eh_frame,"aw",@progbits
+ .section .eh_frame,EH_FRAME_FLAGS,@progbits
__FRAME_BEGIN__:
.4byte $LECIE1-$LSCIE1 # Length of Common Information Entry
$LSCIE1:
diff --git a/libffi/src/powerpc/linux64.S b/libffi/src/powerpc/linux64.S
index 9619c53..28727cd 100644
--- a/libffi/src/powerpc/linux64.S
+++ b/libffi/src/powerpc/linux64.S
@@ -141,7 +141,7 @@ ffi_call_LINUX64:
.byte 0,12,0,1,128,4,0,0
.size .ffi_call_LINUX64,.-.ffi_call_LINUX64
- .section .eh_frame,"aw",@progbits
+ .section .eh_frame,EH_FRAME_FLAGS,@progbits
.Lframe1:
.4byte .LECIE1-.LSCIE1 # Length of Common Information Entry
.LSCIE1:
diff --git a/libffi/src/powerpc/linux64_closure.S b/libffi/src/powerpc/linux64_closure.S
index d435e58..1159c1e 100644
--- a/libffi/src/powerpc/linux64_closure.S
+++ b/libffi/src/powerpc/linux64_closure.S
@@ -1,3 +1,6 @@
+#define LIBFFI_ASM
+#include <ffi.h>
+
.file "linux64_closure.S"
#ifdef __powerpc64__
@@ -174,7 +177,7 @@ ffi_closure_LINUX64:
.byte 0,12,0,1,128,0,0,0
.size .ffi_closure_LINUX64,.-.ffi_closure_LINUX64
- .section .eh_frame,"aw",@progbits
+ .section .eh_frame,EH_FRAME_FLAGS,@progbits
.Lframe1:
.4byte .LECIE1-.LSCIE1 # Length of Common Information Entry
.LSCIE1:
diff --git a/libffi/src/powerpc/ppc_closure.S b/libffi/src/powerpc/ppc_closure.S
index 4cfc8fd..391f318 100644
--- a/libffi/src/powerpc/ppc_closure.S
+++ b/libffi/src/powerpc/ppc_closure.S
@@ -197,36 +197,51 @@ ENTRY(ffi_closure_SYSV)
blr
END(ffi_closure_SYSV)
- .section ".eh_frame","aw"
-__FRAME_BEGIN__:
+ .section ".eh_frame",EH_FRAME_FLAGS,@progbits
+.Lframe1:
.4byte .LECIE1-.LSCIE1 # Length of Common Information Entry
.LSCIE1:
.4byte 0x0 # CIE Identifier Tag
.byte 0x1 # CIE Version
+#if defined _RELOCATABLE || defined __PIC__
+ .ascii "zR\0" # CIE Augmentation
+#else
.ascii "\0" # CIE Augmentation
- .byte 0x1 # uleb128 0x1; CIE Code Alignment Factor
- .byte 0x7c # sleb128 -4; CIE Data Alignment Factor
+#endif
+ .uleb128 0x1 # CIE Code Alignment Factor
+ .sleb128 -4 # CIE Data Alignment Factor
.byte 0x41 # CIE RA Column
+#if defined _RELOCATABLE || defined __PIC__
+ .uleb128 0x1 # Augmentation size
+ .byte 0x1b # FDE Encoding (pcrel sdata4)
+#endif
.byte 0xc # DW_CFA_def_cfa
- .byte 0x1 # uleb128 0x1
- .byte 0x0 # uleb128 0x0
+ .uleb128 0x1
+ .uleb128 0x0
.align 2
.LECIE1:
.LSFDE1:
.4byte .LEFDE1-.LASFDE1 # FDE Length
.LASFDE1:
- .4byte .LASFDE1-__FRAME_BEGIN__ # FDE CIE offset
+ .4byte .LASFDE1-.Lframe1 # FDE CIE offset
+#if defined _RELOCATABLE || defined __PIC__
+ .4byte .LFB1-. # FDE initial location
+#else
.4byte .LFB1 # FDE initial location
+#endif
.4byte .LFE1-.LFB1 # FDE address range
+#if defined _RELOCATABLE || defined __PIC__
+ .uleb128 0x0 # Augmentation size
+#endif
.byte 0x4 # DW_CFA_advance_loc4
.4byte .LCFI0-.LFB1
.byte 0xe # DW_CFA_def_cfa_offset
- .byte 144,1 # uleb128 144
+ .uleb128 144
.byte 0x4 # DW_CFA_advance_loc4
.4byte .LCFI1-.LCFI0
.byte 0x2f # DW_CFA_GNU_negative_offset_extended
- .byte 0x41 # uleb128 0x41
- .byte 0x1 # uleb128 0x1
+ .uleb128 0x41
+ .uleb128 0x1
.align 2
.LEFDE1:
diff --git a/libffi/src/powerpc/sysv.S b/libffi/src/powerpc/sysv.S
index c1e0d18..c045c77 100644
--- a/libffi/src/powerpc/sysv.S
+++ b/libffi/src/powerpc/sysv.S
@@ -128,48 +128,63 @@ L(float_return_value):
.LFE1:
END(ffi_call_SYSV)
- .section ".eh_frame","aw"
-__FRAME_BEGIN__:
+ .section ".eh_frame",EH_FRAME_FLAGS,@progbits
+.Lframe1:
.4byte .LECIE1-.LSCIE1 /* Length of Common Information Entry */
.LSCIE1:
.4byte 0x0 /* CIE Identifier Tag */
.byte 0x1 /* CIE Version */
- .ascii "\0" /* CIE Augmentation */
- .byte 0x1 /* uleb128 0x1; CIE Code Alignment Factor */
- .byte 0x7c /* sleb128 -4; CIE Data Alignment Factor */
+#if defined _RELOCATABLE || defined __PIC__
+ .ascii "zR\0" /* CIE Augmentation */
+#else
+ .ascii "\0" /* CIE Augmentation */
+#endif
+ .uleb128 0x1 /* CIE Code Alignment Factor */
+ .sleb128 -4 /* CIE Data Alignment Factor */
.byte 0x41 /* CIE RA Column */
+#if defined _RELOCATABLE || defined __PIC__
+ .uleb128 0x1 /* Augmentation size */
+ .byte 0x1b /* FDE Encoding (pcrel sdata4) */
+#endif
.byte 0xc /* DW_CFA_def_cfa */
- .byte 0x1 /* uleb128 0x1 */
- .byte 0x0 /* uleb128 0x0 */
+ .uleb128 0x1
+ .uleb128 0x0
.align 2
.LECIE1:
.LSFDE1:
.4byte .LEFDE1-.LASFDE1 /* FDE Length */
.LASFDE1:
- .4byte .LASFDE1-__FRAME_BEGIN__ /* FDE CIE offset */
+ .4byte .LASFDE1-.Lframe1 /* FDE CIE offset */
+#if defined _RELOCATABLE || defined __PIC__
+ .4byte .LFB1-. /* FDE initial location */
+#else
.4byte .LFB1 /* FDE initial location */
+#endif
.4byte .LFE1-.LFB1 /* FDE address range */
+#if defined _RELOCATABLE || defined __PIC__
+ .uleb128 0x0 /* Augmentation size */
+#endif
.byte 0x4 /* DW_CFA_advance_loc4 */
.4byte .LCFI0-.LFB1
.byte 0xd /* DW_CFA_def_cfa_register */
- .byte 0x08 /* uleb128 0x08 */
+ .uleb128 0x08
.byte 0x4 /* DW_CFA_advance_loc4 */
.4byte .LCFI5-.LCFI0
.byte 0x2f /* DW_CFA_GNU_negative_offset_extended */
- .byte 0x41 /* uleb128 0x41 */
- .byte 0x1 /* uleb128 0x1 */
+ .uleb128 0x41
+ .uleb128 0x1
.byte 0x9f /* DW_CFA_offset, column 0x1f */
- .byte 0x1 /* uleb128 0x1 */
+ .uleb128 0x1
.byte 0x9e /* DW_CFA_offset, column 0x1e */
- .byte 0x2 /* uleb128 0x2 */
+ .uleb128 0x2
.byte 0x9d /* DW_CFA_offset, column 0x1d */
- .byte 0x3 /* uleb128 0x3 */
+ .uleb128 0x3
.byte 0x9c /* DW_CFA_offset, column 0x1c */
- .byte 0x4 /* uleb128 0x4 */
+ .uleb128 0x4
.byte 0x4 /* DW_CFA_advance_loc4 */
.4byte .LCFI6-.LCFI5
.byte 0xd /* DW_CFA_def_cfa_register */
- .byte 0x1c /* uleb128 0x1c */
+ .uleb128 0x1c
.align 2
.LEFDE1:
#endif
diff --git a/libffi/src/s390/sysv.S b/libffi/src/s390/sysv.S
index fc1482a..ac14fa7 100644
--- a/libffi/src/s390/sysv.S
+++ b/libffi/src/s390/sysv.S
@@ -23,6 +23,9 @@
OTHER DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
+#define LIBFFI_ASM
+#include <ffi.h>
+
#ifndef __s390x__
.text
@@ -146,7 +149,7 @@ ffi_closure_SYSV:
.size ffi_closure_SYSV,.ffi_closure_SYSV_end-ffi_closure_SYSV
- .section .eh_frame,"a",@progbits
+ .section .eh_frame,EH_FRAME_FLAGS,@progbits
.Lframe1:
.4byte .LECIE1-.LSCIE1 # Length of Common Information Entry
.LSCIE1:
@@ -345,7 +348,7 @@ ffi_closure_SYSV:
- .section .eh_frame,"a",@progbits
+ .section .eh_frame,EH_FRAME_FLAGS,@progbits
.Lframe1:
.4byte .LECIE1-.LSCIE1 # Length of Common Information Entry
.LSCIE1:
diff --git a/libffi/src/sparc/v8.S b/libffi/src/sparc/v8.S
index 53374de..e9db51b 100644
--- a/libffi/src/sparc/v8.S
+++ b/libffi/src/sparc/v8.S
@@ -172,7 +172,11 @@ done1:
#define uanword uaword
#endif
+#ifdef HAVE_RO_EH_FRAME
+ .section ".eh_frame",#alloc
+#else
.section ".eh_frame",#alloc,#write
+#endif
.LLframe1:
.uaword .LLECIE1-.LLSCIE1 ! Length of Common Information Entry
.LLSCIE1:
diff --git a/libffi/src/sparc/v9.S b/libffi/src/sparc/v9.S
index 8dc9c90..e2eeb43 100644
--- a/libffi/src/sparc/v9.S
+++ b/libffi/src/sparc/v9.S
@@ -207,7 +207,11 @@ longdouble1:
.ffi_closure_v9_end:
.size ffi_closure_v9,.ffi_closure_v9_end-ffi_closure_v9
+#ifdef HAVE_RO_EH_FRAME
+ .section ".eh_frame",#alloc
+#else
.section ".eh_frame",#alloc,#write
+#endif
.LLframe1:
.uaword .LLECIE1-.LLSCIE1 ! Length of Common Information Entry
.LLSCIE1:
diff --git a/libffi/src/x86/sysv.S b/libffi/src/x86/sysv.S
index ad898ad..b4bcbba 100644
--- a/libffi/src/x86/sysv.S
+++ b/libffi/src/x86/sysv.S
@@ -129,41 +129,55 @@ epilogue:
.ffi_call_SYSV_end:
.size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV
-.section .eh_frame,"aw",@progbits
-__FRAME_BEGIN__:
- .4byte .LLCIE1
+ .section .eh_frame,EH_FRAME_FLAGS,@progbits
+.Lframe1:
+ .long .LECIE1-.LSCIE1 # Length of Common Information Entry
.LSCIE1:
- .4byte 0x0
- .byte 0x1
- .byte 0x0
- .byte 0x1
- .byte 0x7c
- .byte 0x8
- .byte 0xc
- .byte 0x4
- .byte 0x4
- .byte 0x88
- .byte 0x1
+ .long 0x0 # CIE Identifier Tag
+ .byte 0x1 # CIE Version
+#ifdef __PIC__
+ .ascii "zR\0" # CIE Augmentation
+#else
+ .ascii "\0" # CIE Augmentation
+#endif
+ .uleb128 0x1 # CIE Code Alignment Factor
+ .sleb128 -4 # CIE Data Alignment Factor
+ .byte 0x8 # CIE RA Column
+#ifdef __PIC__
+ .uleb128 0x1 # Augmentation size
+ .byte 0x1b # FDE Encoding (pcrel sdata4)
+#endif
+ .byte 0xc # DW_CFA_def_cfa
+ .uleb128 0x4
+ .uleb128 0x4
+ .byte 0x88 # DW_CFA_offset, column 0x8
+ .uleb128 0x1
.align 4
.LECIE1:
- .set .LLCIE1,.LECIE1-.LSCIE1
- .4byte .LLFDE1
.LSFDE1:
- .4byte .LSFDE1-__FRAME_BEGIN__
- .4byte .LFB1
- .4byte .LFE1-.LFB1
- .byte 0x4
- .4byte .LCFI0-.LFB1
- .byte 0xe
- .byte 0x8
- .byte 0x85
- .byte 0x2
- .byte 0x4
- .4byte .LCFI1-.LCFI0
- .byte 0xd
- .byte 0x5
+ .long .LEFDE1-.LASFDE1 # FDE Length
+.LASFDE1:
+ .long .LASFDE1-.Lframe1 # FDE CIE offset
+#ifdef __PIC__
+ .long .LFB1-. # FDE initial location
+#else
+ .long .LFB1 # FDE initial location
+#endif
+ .long .LFE1-.LFB1 # FDE address range
+#ifdef __PIC__
+ .uleb128 0x0 # Augmentation size
+#endif
+ .byte 0x4 # DW_CFA_advance_loc4
+ .long .LCFI0-.LFB1
+ .byte 0xe # DW_CFA_def_cfa_offset
+ .uleb128 0x8
+ .byte 0x85 # DW_CFA_offset, column 0x5
+ .uleb128 0x2
+ .byte 0x4 # DW_CFA_advance_loc4
+ .long .LCFI1-.LCFI0
+ .byte 0xd # DW_CFA_def_cfa_register
+ .uleb128 0x5
.align 4
.LEFDE1:
- .set .LLFDE1,.LEFDE1-.LSFDE1
#endif /* ifndef __x86_64__ */
diff --git a/libffi/src/x86/unix64.S b/libffi/src/x86/unix64.S
index f0cd3c9..e39d604 100644
--- a/libffi/src/x86/unix64.S
+++ b/libffi/src/x86/unix64.S
@@ -237,7 +237,7 @@ ffi_closure_UNIX64:
ret
.LFE2:
- .section .eh_frame,"a",@progbits
+ .section .eh_frame,EH_FRAME_FLAGS,@progbits
.Lframe0:
.long .LECIE1-.LSCIE1
.LSCIE1: