This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[libffi] Use datarel encoding in libffi .eh_frame on Solaris 2/x86
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: gcc-patches at gcc dot gnu dot org
- Cc: java-patches at gcc dot gnu dot org, Anthony Green <green at redhat dot com>, Jakub Jelinek <jakub at redhat dot com>
- Date: Fri, 26 Nov 2010 19:45:15 +0100
- Subject: [libffi] Use datarel encoding in libffi .eh_frame on Solaris 2/x86
While trying to make the libgcc unwinder use dl_iterate_phdr on Solaris
11, I ran into a gld bug (PR ld/12253) that broke libffi unwind tests
and all libjava execution tests: while Solaris 2/x86 uses
DW_EH_PE_datarel encoding for .eh_frame in 32-bit PIC code,
src/x86/sysv.S uses DW_EH_PE_pcrel. Due to the above bug, .eh_frame_hdr
isn't sorted correctly with gld before 2.22. To work around this issue
for older gld versions, I'd like to use the following workaround to
avoid the issue, namely also use datarel encoding on Solaris 2/x86.
Bootstrapped on i386-pc-solaris2.11 with CVS gas and gld (before the
fix) and i386-pc-solaris2.10 with Sun as and ld. It fixes all the
testsuite regressions with gld and works without issues with Sun ld.
Ok for mainline?
Rainer
2010-01-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* src/x86/sysv.S (.eh_frame) [__PIC__ && __sun__ && __svr4__]: Use
datarel encoding.
(.LASFDE1) [__PIC__ && __sun__ && __svr4__]: Use @GOTOFF for FDE
initial location.
(.LASFDE2, LASFDE3): Likewise.
diff -r 36d43c8e1be5 libffi/src/x86/sysv.S
--- a/libffi/src/x86/sysv.S Sat Nov 20 22:10:07 2010 +0100
+++ b/libffi/src/x86/sysv.S Sat Nov 20 22:10:57 2010 +0100
@@ -354,8 +354,15 @@
.byte 0x8 /* CIE RA Column */
#ifdef __PIC__
.byte 0x1 /* .uleb128 0x1; Augmentation size */
+#ifdef __sun__ && __svr4__
+ /* 32-bit Solaris 2/x86 uses datarel encoding for PIC. GNU ld
+ doesn't correctly sort .eh_frame_hdr with mixed encodings, so
+ match this. */
+ .byte 0x30 /* FDE Encoding (datarel) */
+#else
.byte 0x1b /* FDE Encoding (pcrel sdata4) */
#endif
+#endif
.byte 0xc /* DW_CFA_def_cfa */
.byte 0x4 /* .uleb128 0x4 */
.byte 0x4 /* .uleb128 0x4 */
@@ -367,10 +374,14 @@
.long .LEFDE1-.LASFDE1 /* FDE Length */
.LASFDE1:
.long .LASFDE1-.Lframe1 /* FDE CIE offset */
-#if defined __PIC__ && defined HAVE_AS_X86_PCREL
- .long .LFB1-. /* FDE initial location */
-#elif defined __PIC__
- .long .LFB1@rel
+#ifdef __PIC__
+#if defined __sun__ && defined __svr4__
+ .long .LFB1@GOTOFF /* FDE initial location */
+#elif defined HAVE_AS_X86_PCREL
+ .long .LFB1-. /* FDE initial location */
+#else
+ .long .LFB1@rel /* FDE initial location */
+#endif
#else
.long .LFB1
#endif
@@ -394,10 +405,14 @@
.long .LEFDE2-.LASFDE2 /* FDE Length */
.LASFDE2:
.long .LASFDE2-.Lframe1 /* FDE CIE offset */
-#if defined __PIC__ && defined HAVE_AS_X86_PCREL
- .long .LFB2-. /* FDE initial location */
-#elif defined __PIC__
- .long .LFB2@rel
+#ifdef __PIC__
+#if defined __sun__ && defined __svr4__
+ .long .LFB2@GOTOFF /* FDE initial location */
+#elif defined HAVE_AS_X86_PCREL
+ .long .LFB2-. /* FDE initial location */
+#else
+ .long .LFB2@rel /* FDE initial location */
+#endif
#else
.long .LFB2
#endif
@@ -430,10 +445,14 @@
.long .LEFDE3-.LASFDE3 /* FDE Length */
.LASFDE3:
.long .LASFDE3-.Lframe1 /* FDE CIE offset */
-#if defined __PIC__ && defined HAVE_AS_X86_PCREL
- .long .LFB3-. /* FDE initial location */
-#elif defined __PIC__
- .long .LFB3@rel
+#ifdef __PIC__
+#if defined __sun__ && defined __svr4__
+ .long .LFB3@GOTOFF /* FDE initial location */
+#elif defined HAVE_AS_X86_PCREL
+ .long .LFB3-. /* FDE initial location */
+#else
+ .long .LFB3@rel /* FDE initial location */
+#endif
#else
.long .LFB3
#endif
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University