diff mbox

[build] Correctly detect native TLS support with 64-bit gas on Solaris/x86 (PR target/60817)

Message ID yddbnw28vpl.fsf@lokon.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth April 15, 2014, 3:21 p.m. UTC
As reported in the PR, gcc/configure currently fails to detect native
TLS support on x86_64-*-solaris2* with a 64-bit gas since it feeds it
32-bit TLS code.  I haden't noticed this so far since I've been using a
32-bit gas here (no idea why).

The following patch fixes this by making sure 64-bit code is both used
for 64-bit-default configurations and the necessary assembler flags
passed.  I've chosen to merge the i?86 and x86_64 cases to avoid
duplicating considerable amounts of code.  When using the native Solaris
assembler, the relocs need to be in lower case as already done for
32-bit.

Tested by configuring for x86_64-pc-solaris2.11 with 32-bit gas, 64-bit
gas, /bin/as, i386-pc-solaris2.11 with 32-bit gas and /bin/as,
x86_64-unknown-linux-gnu, and i686-unknown-linux-gnu and checking that
native TLS support is detected correctly.

Ok for mainline or should I rather bootstrap the change on a couple of
those configurations?

Thanks.
        Rainer


2014-04-15  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR target/60817
	* configure.ac (set_have_as_tls): Merge i[34567]86-*-* and
	x86_64-*-* cases.
	Pass necessary as flags on 64-bit Solaris/x86.
	Use lowercase relocs for x86_64-*-*.
	* configure: Regenerate.

Comments

Uros Bizjak April 15, 2014, 5:50 p.m. UTC | #1
On Tue, Apr 15, 2014 at 5:21 PM, Rainer Orth
<ro@cebitec.uni-bielefeld.de> wrote:
> As reported in the PR, gcc/configure currently fails to detect native
> TLS support on x86_64-*-solaris2* with a 64-bit gas since it feeds it
> 32-bit TLS code.  I haden't noticed this so far since I've been using a
> 32-bit gas here (no idea why).
>
> The following patch fixes this by making sure 64-bit code is both used
> for 64-bit-default configurations and the necessary assembler flags
> passed.  I've chosen to merge the i?86 and x86_64 cases to avoid
> duplicating considerable amounts of code.  When using the native Solaris
> assembler, the relocs need to be in lower case as already done for
> 32-bit.
>
> Tested by configuring for x86_64-pc-solaris2.11 with 32-bit gas, 64-bit
> gas, /bin/as, i386-pc-solaris2.11 with 32-bit gas and /bin/as,
> x86_64-unknown-linux-gnu, and i686-unknown-linux-gnu and checking that
> native TLS support is detected correctly.
>
> Ok for mainline or should I rather bootstrap the change on a couple of
> those configurations?
>
> Thanks.
>         Rainer
>
>
> 2014-04-15  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>
>         PR target/60817
>         * configure.ac (set_have_as_tls): Merge i[34567]86-*-* and
>         x86_64-*-* cases.
>         Pass necessary as flags on 64-bit Solaris/x86.
>         Use lowercase relocs for x86_64-*-*.
>         * configure: Regenerate.

OK.

Thanks,
Uros.
diff mbox

Patch

diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2959,7 +2959,7 @@  foo:	.long	25
 	tls_first_major=2
 	tls_first_minor=17
 	;;
-  i[34567]86-*-* | x86_64-*-solaris2.1[0-9]*)
+  i[34567]86-*-* | x86_64-*-*)
     case "$target" in
       i[34567]86-*-solaris2.*)
 	on_solaris=yes
@@ -2991,6 +2991,8 @@  changequote(,)dnl
       tls_section_flag=T
       tls_as_opt="--fatal-warnings"
     fi
+    case "$target" in
+      i[34567]86-*-*)
     conftest_s="$conftest_s
 foo:	.long	25
 	.text
@@ -3007,20 +3009,23 @@  foo:	.long	25
 	leal	foo@ntpoff(%ecx), %eax"
     ;;
   x86_64-*-*)
-    conftest_s='
-	.section ".tdata","awT",@progbits
+	if test x$on_solaris = xyes; then
+	  case $gas_flag in
+	    yes) tls_as_opt="$tls_as_opt --64" ;;
+	    no)	 tls_as_opt="$tls_as_opt -xarch=amd64" ;;
+	  esac	  
+	fi
+	conftest_s="$conftest_s
 foo:	.long	25
 	.text
 	movq	%fs:0, %rax
-	leaq	foo@TLSGD(%rip), %rdi
-	leaq	foo@TLSLD(%rip), %rdi
-	leaq	foo@DTPOFF(%rax), %rdx
-	movq	foo@GOTTPOFF(%rip), %rax
-	movq	$foo@TPOFF, %rax'
-	tls_first_major=2
-	tls_first_minor=14
-	tls_section_flag=T
-	tls_as_opt=--fatal-warnings
+	leaq	foo@tlsgd(%rip), %rdi
+	leaq	foo@tlsld(%rip), %rdi
+	leaq	foo@dtpoff(%rax), %rdx
+	movq	foo@gottpoff(%rip), %rax
+	movq	\$foo@tpoff, %rax"
+        ;;
+    esac
 	;;
   ia64-*-*)
     conftest_s='