Patchwork [libitm] Support Solaris 8 and 9/x86 with Sun as

login
register
mail settings
Submitter Rainer Orth
Date Nov. 18, 2011, 4:17 p.m.
Message ID <yddehx5mmm6.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/126442/
State New
Headers show

Comments

Rainer Orth - Nov. 18, 2011, 4:17 p.m.
Richard Henderson <rth@redhat.com> writes:

> On 11/16/2011 08:38 AM, Rainer Orth wrote:
>> 	* config/generic/asmcfi.h: Fix comment.
>> 	* config/x86/sjlj.S (_ITM_beginTransaction): Provide PIC code
>> 	sequence without .hidden support.
>> 	(GTM_longjmp) [__ELF__]: Only use .hidden if
>> 	HAVE_ATTRIBUTE_VISIBILITY.
>
> Nearly ok.
>
>> +	subl	$4, %esp
>> +	movl	%ebx, 24(%esp)
>> +	call	1f
>> +1:	popl	%ebx
>> +	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
>> +	call	GTM_begin_transaction@PLT
>> +	movl	24(%esp), %ebx
>> +	addl	$4, %esp
>
> This is overly complicated.  We've saved %ebx at 12(%esp) above.
> This should be as simple as
>
> 	call	1f
> 1:	popl	%ebx
> 	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
> 	call	GTM_begin_transaction@PLT
> 	movl	12(%esp), %ebx
>
> It also needs wrapping like
>
> #elif defined(__ELF__)
> 	...
> #else
> # error "Unsupported PIC sequence"
> #endif
>
> ... which will almost certainly immediately fail on Darwin, but
> at least not with some reference to @PLT.

Here's what I've installed after re-bootstrapping on
i386-pc-solaris2.{8, 9, 10, 11} with both Sun as and gas.

	Rainer


2011-11-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* config/generic/asmcfi.h: Fix comment.
	* config/x86/sjlj.S (_ITM_beginTransaction): Provide ELF PIC code
	sequence without .hidden support, error for non-ELF targets.
	(GTM_longjmp) [__ELF__]: Only use .hidden if
	HAVE_ATTRIBUTE_VISIBILITY.

Patch

# HG changeset patch
# Parent 3173fc5da3ec7582cb682ba14d4acc6bcc44a0e0
Support Solaris 8 and 9/x86 with Sun as

diff --git a/libitm/config/generic/asmcfi.h b/libitm/config/generic/asmcfi.h
--- a/libitm/config/generic/asmcfi.h
+++ b/libitm/config/generic/asmcfi.h
@@ -41,4 +41,4 @@ 
 #define cfi_def_cfa(r,n)
 #define cfi_register(o,n)
 
-#endif /* HAVE_ASM_CFI */
+#endif /* HAVE_AS_CFI_PSEUDO_OP */
diff --git a/libitm/config/x86/sjlj.S b/libitm/config/x86/sjlj.S
--- a/libitm/config/x86/sjlj.S
+++ b/libitm/config/x86/sjlj.S
@@ -60,7 +60,17 @@  _ITM_beginTransaction:
 	movl	%edi, 20(%esp)
 	movl	%ebp, 24(%esp)
 	leal	8(%esp), %edx
+#if defined HAVE_ATTRIBUTE_VISIBILITY || !defined __PIC__
 	call	GTM_begin_transaction
+#elif defined __ELF__
+	call	1f
+1:	popl	%ebx
+	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
+	call	GTM_begin_transaction@PLT
+	movl	12(%esp), %ebx
+#else
+# error "Unsupported PIC sequence"
+#endif
 	addl	$28, %esp
 	cfi_def_cfa_offset(4)
 	ret
@@ -108,7 +118,9 @@  GTM_longjmp:
 
 #ifdef __ELF__
 	.type	GTM_longjmp, @function
+#ifdef HAVE_ATTRIBUTE_VISIBILITY
 	.hidden	GTM_longjmp
+#endif
 	.size	GTM_longjmp, .-GTM_longjmp
 #endif