binutilsthread-local-storagegold-linker

error: missing expected TLS relocation in binutils-2.27/gold/testsuite


I'm compiling binutils-2.27 with gcc 5.3.0. Here are the configure options:

../binutils-2.27/configure --prefix=$FOO --build=x86_64-redhat-linux --disable-multilib --with-gmp=$FOO --with-mpfr=$FOO --with-mpc=$FOO --with-isl=$FOO --with-system-zlib --enable-lto --enable-ld --enable-gold --enable-plugins

When I run make check, I get

gcc -Bgcctestdir/ -fPIE -g -O2 -Bgcctestdir/ -Wl,-R,.  -o pr20216a_test pr20216a_test-pr20216_main.o pr20216a_test-pr20216_def.o pr20216_gd.o pr20216_ld.o -ldl 
../../../binutils-2.27/gold/testsuite/pr20216_gd.S:13: error: missing expected TLS relocation
../../../binutils-2.27/gold/testsuite/pr20216_gd.S:27: error: missing expected TLS relocation
../../../binutils-2.27/gold/testsuite/pr20216_gd.S:48: error: missing expected TLS relocation
gcctestdir/ld: error: missing expected TLS relocation
../../../binutils-2.27/gold/testsuite/pr20216_ld.S:21: error: missing expected TLS relocation
../../../binutils-2.27/gold/testsuite/pr20216_ld.S:22: error: missing expected TLS relocation
../../../binutils-2.27/gold/testsuite/pr20216_ld.S:33: error: missing expected TLS relocation
../../../binutils-2.27/gold/testsuite/pr20216_ld.S:34: error: missing expected TLS relocation
../../../binutils-2.27/gold/testsuite/pr20216_ld.S:35: error: missing expected TLS relocation
gcctestdir/ld: error: missing expected TLS relocation
collect2: error: ld returned 1 exit status

Solution

  • This was caused by a bug in the test suite, where it was accidentally using the system assembler instead of the latest assembler in the build tree. The test was written to expect a relocation that is only produced by a more recent version of gas. It was fixed on Aug. 10 and backported to the 2.27 branch. See the discussion for PR 20216 for more info.