This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

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

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?


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

	PR target/60817
	* (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.

diff --git a/gcc/ b/gcc/
--- a/gcc/
+++ b/gcc/
@@ -2959,7 +2959,7 @@ foo:	.long	25
-  i[34567]86-*-* | x86_64-*-solaris2.1[0-9]*)
+  i[34567]86-*-* | x86_64-*-*)
     case "$target" in
@@ -2991,6 +2991,8 @@ changequote(,)dnl
+    case "$target" in
+      i[34567]86-*-*)
 foo:	.long	25
@@ -3007,20 +3009,23 @@ foo:	.long	25
 	leal	foo@ntpoff(%ecx), %eax"
-    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
 	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
Rainer Orth, Center for Biotechnology, Bielefeld University

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]