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
I submitted a patch for this to the mailing list a week ago - https://sourceware.org/ml/binutils/2017-04/msg00276.html
I can confirm that James' patch fixes the issue and systemd builds fine with the binutils patch applied.
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.
Fixed on trunk.
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.
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.