Bug 21444 - internal error in relocate_tls, at ../../gold/sparc.cc:3789
Summary: internal error in relocate_tls, at ../../gold/sparc.cc:3789
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.28
: P2 normal
Target Milestone: ---
Assignee: Cary Coutant
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-28 09:51 UTC by John Paul Adrian Glaubitz
Modified: 2017-05-13 15:31 UTC (History)
6 users (show)

See Also:
Host:
Target: sparc*-*-*
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Paul Adrian Glaubitz 2017-04-28 09:51:26 UTC
Trying to build systemd with meson on linux-sparc fails with:

[1006/1775] Linking target test-dlopen
FAILED: test-dlopen 
ccache cc  -o test-dlopen 'test-dlopen@exe/test-dlopen.c.o' '-L/lib64' '-Wl,--no-undefined' '-Wl,--as-needed' '-Wl,-z,relro' '-Wl,-z,now' '-pie' '-Wl,-fuse-ld=gold' '-g' '-O0' '-ftrapv' 'src/basic/libbasic.a' '-ldl' '-lcap' '-lblkid' '-lselinux'  
/usr/bin/ld.gold: internal error in relocate_tls, at ../../gold/sparc.cc:3789
collect2: error: ld returned 1 exit status
[1071/1775] Compiling c object 'systemd-resolved@exe/resolved-llmnr.c.o'
ninja: build stopped: subcommand failed.

To reproduce:

$ git clone https://github.com/systemd/systemd.git
$ cd systemd
$ meson build
$ cd build
$ ninja
Comment 1 Jessica Clarke 2017-05-06 15:44:49 UTC
I submitted a patch for this to the mailing list a week ago - https://sourceware.org/ml/binutils/2017-04/msg00276.html
Comment 2 John Paul Adrian Glaubitz 2017-05-09 19:45:14 UTC
I can confirm that James' patch fixes the issue and systemd builds fine with the binutils patch applied.
Comment 3 Sourceware Commits 2017-05-13 15:01:57 UTC
The master branch has been updated by Cary Coutant <ccoutant@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=67f46fed806465c005b15c97d33947f4c0abb25c

commit 67f46fed806465c005b15c97d33947f4c0abb25c
Author: James Clarke <jrtc27@jrtc27.com>
Date:   Sat May 13 08:01:15 2017 -0700

    Fix assertion failure relaxing TLS for position-independent executables.
    
    gold/
    	PR gold/21444
    	* gold.cc (Target_sparc::Relocate::relocate_tls): Local
    	variables are final for position-independent executables. This
    	has to be consistent with Target_sparc::Scan::local otherwise
    	they will disagree as to whether local-exec is used.
Comment 4 Cary Coutant 2017-05-13 15:03:07 UTC
Fixed on trunk.
Comment 5 Jessica Clarke 2017-05-13 15:05:19 UTC
This applies to 2.28 too (in fact this has existed for as long as gold has supported TLS relaxation on sparc). Could you please backport it? Thanks.
Comment 6 Sourceware Commits 2017-05-13 15:31:19 UTC
The binutils-2_28-branch branch has been updated by Cary Coutant <ccoutant@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2346a98c797e69d0d10b7935ac8d8772365f2ca2

commit 2346a98c797e69d0d10b7935ac8d8772365f2ca2
Author: James Clarke <jrtc27@jrtc27.com>
Date:   Sat May 13 08:01:15 2017 -0700

    Fix assertion failure relaxing TLS for position-independent executables.
    
    gold/
    	PR gold/21444
    	* gold.cc (Target_sparc::Relocate::relocate_tls): Local
    	variables are final for position-independent executables. This
    	has to be consistent with Target_sparc::Scan::local otherwise
    	they will disagree as to whether local-exec is used.