diff mbox series

build: Fix 32-bit TLS detection with 64-bit-default gas on Solaris/x86

Message ID ydd368fg7ml.fsf@CeBiTec.Uni-Bielefeld.DE
State New
Headers show
Series build: Fix 32-bit TLS detection with 64-bit-default gas on Solaris/x86 | expand

Commit Message

Rainer Orth May 4, 2020, 1:19 p.m. UTC
I've recently tested i386-pc-solaris2.11 bootstrap on Solaris 11/x86
with only the bundled tools (using /usr/gnu/bin/as from binutils 2.30 in
this case).  It failed compiling libgo/runtime/proc.c, creating invalid
assembly:

proc.s: Assembler messages:
proc.s:2092: Error: junk at end of line, first unrecognized character is `*'

        .globl  __emutls_v.*runtime.g

and several more errors.  This is completely unexpected since Solaris
does support TLS.  It turned out that 32-bit TLS detection in
gcc/configure had failed:

configure:25145: checking assembler for thread-local storage support
configure:25158: /usr/gnu/bin/as   --fatal-warnings -o conftest.o conftest.s >&5
conftest.s: Assembler messages:
conftest.s:6: Error: relocated field and relocation type differ in signedness
conftest.s:7: Error: @TLSLDM reloc is not supported with 64-bit output format
conftest.s:7: Error: junk `@tlsldm' after expression

which isn't unexpected given that the bundled gas has been configured
for x86_64-pc-solaris2.11, i.e. 64-bit-default.

This is easily fixed by explicitly passing --32 for the 32-bit case,
matching what is done for the 64-bit test.

Tested on i386-pc-solaris2.11 with 32-bit-default and 64-bit-default gas
as well as with /usr/bin/as, always correctly detecting TLS support.

I'm going to commit this to master shortly.  Ok for the gcc-10 branch,
too, given that it fixes a bootstrap failure?

I wonder if it's worth pursuing or even properly reporting the libgo
failure with emutls, though.  Ian?

Thanks.
	Rainer

Comments

Jakub Jelinek May 4, 2020, 1:24 p.m. UTC | #1
On Mon, May 04, 2020 at 03:19:30PM +0200, Rainer Orth wrote:
> I'm going to commit this to master shortly.  Ok for the gcc-10 branch,
> too, given that it fixes a bootstrap failure?

Ok, but see below.

> 2020-05-02  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
> 
> 	* configure.ac <i[34567]86-*-*>: Add --32 to tls_as_opt on Solaris.
> 	* configure: Regenerate.
> 

> # HG changeset patch
> # Parent  536b6b3f48b6668fa1724b8675b1cceadaab5632
> build: Fix 32-bit TLS detection with 64-bit-default gas on Solaris/x86
> 
> diff --git a/gcc/configure.ac b/gcc/configure.ac
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> @@ -3562,6 +3562,11 @@ changequote(,)dnl
>      fi
>      case "$target" in
>        i[34567]86-*-*)
> +	if test x$on_solaris = xyes; then
> +	  case $gas_flag in
> +	    yes) tls_as_opt="$tls_as_opt --32" ;;
> +	  esac
> +	fi

Why not following instead?
	if test x$on_solaris = xyes && test x$gas_flag = xyes; then
	  tls_as_opt="$tls_as_opt --32"
	fi

	Jakub
Rainer Orth May 4, 2020, 1:27 p.m. UTC | #2
Hi Jakub,

> On Mon, May 04, 2020 at 03:19:30PM +0200, Rainer Orth wrote:
>> I'm going to commit this to master shortly.  Ok for the gcc-10 branch,
>> too, given that it fixes a bootstrap failure?
>
> Ok, but see below.

>> diff --git a/gcc/configure.ac b/gcc/configure.ac
>> --- a/gcc/configure.ac
>> +++ b/gcc/configure.ac
>> @@ -3562,6 +3562,11 @@ changequote(,)dnl
>>      fi
>>      case "$target" in
>>        i[34567]86-*-*)
>> +	if test x$on_solaris = xyes; then
>> +	  case $gas_flag in
>> +	    yes) tls_as_opt="$tls_as_opt --32" ;;
>> +	  esac
>> +	fi
>
> Why not following instead?
> 	if test x$on_solaris = xyes && test x$gas_flag = xyes; then
> 	  tls_as_opt="$tls_as_opt --32"
> 	fi

That would work, of course.  I simply meant to follow the style of the
64-bit test as closely as possible.

	Rainer
diff mbox series

Patch

# HG changeset patch
# Parent  536b6b3f48b6668fa1724b8675b1cceadaab5632
build: Fix 32-bit TLS detection with 64-bit-default gas on Solaris/x86

diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3562,6 +3562,11 @@  changequote(,)dnl
     fi
     case "$target" in
       i[34567]86-*-*)
+	if test x$on_solaris = xyes; then
+	  case $gas_flag in
+	    yes) tls_as_opt="$tls_as_opt --32" ;;
+	  esac
+	fi
 	conftest_s="$conftest_s
 foo:	.long	25
 	.text