diff mbox

[libffi] Provide unwind info for Tru64 UNIX in osf.S

Message ID ydd4o5i8dlz.fsf@manam.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth April 28, 2011, 5:55 p.m. UTC
While investigating the remaining testsuite failures on Tru64 UNIX, I
found that both two libffi failures and several libjava failures had a
common cause: libffi/src/alpha/osf.S lacks unwind info that is usable on
Tru64 UNIX.

The following patch fixes this, along the same lines of what was done in
src/x86/sysv.S for Solaris/x86.

Tested by rebuilding libffi and running make check and relinking the
java libraries and also running make check.

In libffi, only

FAIL: libffi.call/huge_struct.c -O0 -W -Wall execution test

and variants remains which has a different cause (still investigating),
but many libjava failures are now gone.  The remaining ones are unrelated:

FAIL: Throw_2 execution - source compiled test

SEGVs here:

java.lang.String.length()int (this=null)
    at /vol/gcc/src/hg/trunk/local/libjava/java/lang/String.java:451
451         return count;

FAIL: md5test output - source compiled test

java.lang.ArrayIndexOutOfBoundsException

gdb is no help investigating.

FAIL: shatest execution - source compiled test

Probably same issue.

Ok for mainline and the 4.5 and 4.6 branches after testing there?

I cannot test the Alpha/Linux side, though.

Thanks.
	Rainer


2011-04-28  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* src/alpha/osf.S (UA_SI, FDE_ENCODING, FDE_ENCODE, FDE_ARANGE):
	Define.
	Use them to handle ELF vs. ECOFF differences.
	[__osf__] (_GLOBAL__F_ffi_call_osf): Define.

Comments

Richard Henderson April 28, 2011, 8:57 p.m. UTC | #1
On 04/28/2011 10:55 AM, Rainer Orth wrote:
> I cannot test the Alpha/Linux side, though.

Neither can I, at the moment.

> 2011-04-28  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
> 
> 	* src/alpha/osf.S (UA_SI, FDE_ENCODING, FDE_ENCODE, FDE_ARANGE):
> 	Define.
> 	Use them to handle ELF vs. ECOFF differences.
> 	[__osf__] (_GLOBAL__F_ffi_call_osf): Define.

Looks good.  If there are any hidden Linux problems, we can
fix them up with another patch.


r~
Rainer Orth April 29, 2011, 8:53 a.m. UTC | #2
Richard Henderson <rth@redhat.com> writes:

>> 2011-04-28  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>> 
>> 	* src/alpha/osf.S (UA_SI, FDE_ENCODING, FDE_ENCODE, FDE_ARANGE):
>> 	Define.
>> 	Use them to handle ELF vs. ECOFF differences.
>> 	[__osf__] (_GLOBAL__F_ffi_call_osf): Define.
>
> Looks good.  If there are any hidden Linux problems, we can
> fix them up with another patch.

I've installed it on mainline now.  Unless 4.5 and 4.6 testing over the
weekend shows any problems, I'll install there, too.  The 4.5 branch
shouldn't be affected by the bug Uros mentioned, so the Linux side could
be tested there.

Thanks.
	Rainer
diff mbox

Patch

diff --git a/libffi/src/alpha/osf.S b/libffi/src/alpha/osf.S
--- a/libffi/src/alpha/osf.S
+++ b/libffi/src/alpha/osf.S
@@ -1,5 +1,5 @@ 
 /* -----------------------------------------------------------------------
-   osf.S - Copyright (c) 1998, 2001, 2007, 2008 Red Hat
+   osf.S - Copyright (c) 1998, 2001, 2007, 2008, 2011 Red Hat
    
    Alpha/OSF Foreign Function Interface 
 
@@ -299,33 +299,51 @@  ffi_closure_osf:
 #endif
 
 #ifdef __ELF__
+# define UA_SI		.4byte
+# define FDE_ENCODING	0x1b	/* pcrel sdata4 */
+# define FDE_ENCODE(X)	.4byte X-.
+# define FDE_ARANGE(X)	.4byte X
+#elif defined __osf__
+# define UA_SI		.align 0; .long
+# define FDE_ENCODING	0x50	/* aligned absolute */
+# define FDE_ENCODE(X)	.align 3; .quad X
+# define FDE_ARANGE(X)	.align 0; .quad X
+#endif
+
+#ifdef __ELF__
 	.section	.eh_frame,EH_FRAME_FLAGS,@progbits
+#elif defined __osf__
+	.data
+	.align 3
+	.globl _GLOBAL__F_ffi_call_osf
+_GLOBAL__F_ffi_call_osf:
+#endif
 __FRAME_BEGIN__:
-	.4byte	$LECIE1-$LSCIE1	# Length of Common Information Entry
+	UA_SI	$LECIE1-$LSCIE1	# Length of Common Information Entry
 $LSCIE1:
-	.4byte	0x0		# CIE Identifier Tag
+	UA_SI	0x0		# CIE Identifier Tag
 	.byte	0x1		# CIE Version
 	.ascii "zR\0"		# CIE Augmentation
 	.byte	0x1		# uleb128 0x1; CIE Code Alignment Factor
 	.byte	0x78		# sleb128 -8; CIE Data Alignment Factor
 	.byte	26		# CIE RA Column
 	.byte	0x1		# uleb128 0x1; Augmentation size
-	.byte	0x1b		# FDE Encoding (pcrel sdata4)
+	.byte	FDE_ENCODING	# FDE Encoding
 	.byte	0xc		# DW_CFA_def_cfa
 	.byte	30		# uleb128 column 30
 	.byte	0		# uleb128 offset 0
 	.align 3
 $LECIE1:
 $LSFDE1:
-	.4byte	$LEFDE1-$LASFDE1		# FDE Length
+	UA_SI	$LEFDE1-$LASFDE1		# FDE Length
 $LASFDE1:
-	.4byte	$LASFDE1-__FRAME_BEGIN__	# FDE CIE offset
-	.4byte	$LFB1-.		# FDE initial location
-	.4byte	$LFE1-$LFB1	# FDE address range
+	UA_SI	$LASFDE1-__FRAME_BEGIN__	# FDE CIE offset
+	FDE_ENCODE($LFB1)			# FDE initial location
+	FDE_ARANGE($LFE1-$LFB1)			# FDE address range
 	.byte	0x0		# uleb128 0x0; Augmentation size
 
 	.byte	0x4		# DW_CFA_advance_loc4
-	.4byte	$LCFI1-$LFB1
+	UA_SI	$LCFI1-$LFB1
 	.byte	0x9a		# DW_CFA_offset, column 26
 	.byte	4		# uleb128 4*-8
 	.byte	0x8f		# DW_CFA_offset, column 15
@@ -335,32 +353,35 @@  __FRAME_BEGIN__:
 	.byte	32		# uleb128 offset 32
 
 	.byte	0x4		# DW_CFA_advance_loc4
-	.4byte	$LCFI2-$LCFI1
+	UA_SI	$LCFI2-$LCFI1
 	.byte	0xda		# DW_CFA_restore, column 26
 	.align 3
 $LEFDE1:
 
 $LSFDE3:
-	.4byte	$LEFDE3-$LASFDE3		# FDE Length
+	UA_SI	$LEFDE3-$LASFDE3		# FDE Length
 $LASFDE3:
-	.4byte	$LASFDE3-__FRAME_BEGIN__	# FDE CIE offset
-	.4byte	$LFB2-.		# FDE initial location
-	.4byte	$LFE2-$LFB2	# FDE address range
+	UA_SI	$LASFDE3-__FRAME_BEGIN__	# FDE CIE offset
+	FDE_ENCODE($LFB2)			# FDE initial location
+	FDE_ARANGE($LFE2-$LFB2)			# FDE address range
 	.byte	0x0		# uleb128 0x0; Augmentation size
 
 	.byte	0x4		# DW_CFA_advance_loc4
-	.4byte	$LCFI5-$LFB2
+	UA_SI	$LCFI5-$LFB2
 	.byte	0xe		# DW_CFA_def_cfa_offset
 	.byte	0x80,0x1	# uleb128 128
 
 	.byte	0x4		# DW_CFA_advance_loc4
-	.4byte	$LCFI6-$LCFI5
+	UA_SI	$LCFI6-$LCFI5
 	.byte	0x9a		# DW_CFA_offset, column 26
 	.byte	16		# uleb128 offset 16*-8
 	.align 3
 $LEFDE3:
+#if defined __osf__
+	.align 0
+	.long	0		# End of Table
+#endif
 
-#ifdef __linux__
+#if defined __ELF__ && defined __linux__
 	.section	.note.GNU-stack,"",@progbits
 #endif
-#endif