Fix extraneous complaints about missing expected TLS relocation.
authorCary Coutant <ccoutant@gmail.com>
Wed, 10 Aug 2016 17:57:42 +0000 (10:57 -0700)
committerCary Coutant <ccoutant@gmail.com>
Wed, 10 Aug 2016 17:57:42 +0000 (10:57 -0700)
With some versions of gas, the call to tls_get_addr uses a GOTPCREL
relocation instead of a GOTPCRELX relocation. We should allow for that
when skip_call_tls_get_addr_ is true. We should also build the test
objects with the in-tree assembler.

This patch also fixes some cascading error messages caused by not
resetting the skip_call_tls_get_addr_ flag after printing the error.

gold/
PR gold/20216
* x86_64.cc (Target_x86_64::Relocate::relocate): Add check for
R_X86_64_GOTPCREL. Reset skip_call_tls_get_addr_ after printing
error message.
* testsuite/Makefile.am (pr20216_gd.o): Add -Bgcctestdir/.
(pr20216_ld.o): Likewise.
* testsuite/Makefile.in: Regenerate.

gold/ChangeLog
gold/testsuite/Makefile.am
gold/testsuite/Makefile.in
gold/x86_64.cc

index 10677c762c2249370b109534c5c7284a23732ec0..687e56e2821c375f6d9fbc423e743eece28aebe0 100644 (file)
@@ -1,3 +1,13 @@
+2016-08-10  Cary Coutant  <ccoutant@gmail.com>
+
+       PR gold/20216
+       * x86_64.cc (Target_x86_64::Relocate::relocate): Add check for
+       R_X86_64_GOTPCREL. Reset skip_call_tls_get_addr_ after printing
+       error message.
+       * testsuite/Makefile.am (pr20216_gd.o): Add -Bgcctestdir/.
+       (pr20216_ld.o): Likewise.
+       * testsuite/Makefile.in: Regenerate.
+
 2016-08-10  James Clarke  <jrtc27@jrtc27.com>
 
        PR gold/20443
index 39f9e9efcdbfe319174b73da7b2dc58d035a971a..739458cd23ae38205188569bf00bee5152b0da04 100644 (file)
@@ -1193,10 +1193,10 @@ pr20216b.so: pr20216_def.o gcctestdir/ld
        $(LINK) -Bgcctestdir/ -shared pr20216_def.o
 
 pr20216_gd.o: pr20216_gd.S
-       $(COMPILE) -c -o $@ $<
+       $(COMPILE) -Bgcctestdir/ -c -o $@ $<
 
 pr20216_ld.o: pr20216_ld.S
-       $(COMPILE) -c -o $@ $<
+       $(COMPILE) -Bgcctestdir/ -c -o $@ $<
 
 endif DEFAULT_TARGET_X86_64_OR_X32
 
index bd58d134420f846dd9f6d88500d5ed5afb15ab34..15844e2b5a12fd1487c7d2614ee7e55b1bd5211f 100644 (file)
@@ -6151,10 +6151,10 @@ uninstall-am:
 @DEFAULT_TARGET_X86_64_OR_X32_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@      $(LINK) -Bgcctestdir/ -shared pr20216_def.o
 
 @DEFAULT_TARGET_X86_64_OR_X32_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@pr20216_gd.o: pr20216_gd.S
-@DEFAULT_TARGET_X86_64_OR_X32_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@      $(COMPILE) -c -o $@ $<
+@DEFAULT_TARGET_X86_64_OR_X32_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@      $(COMPILE) -Bgcctestdir/ -c -o $@ $<
 
 @DEFAULT_TARGET_X86_64_OR_X32_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@pr20216_ld.o: pr20216_ld.S
-@DEFAULT_TARGET_X86_64_OR_X32_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@      $(COMPILE) -c -o $@ $<
+@DEFAULT_TARGET_X86_64_OR_X32_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@      $(COMPILE) -Bgcctestdir/ -c -o $@ $<
 
 @DEFAULT_TARGET_I386_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@i386_mov_to_lea1.o: i386_mov_to_lea1.s
 @DEFAULT_TARGET_I386_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@       $(TEST_AS) --32 -o $@ $<
index 6aa489a7a74929eb1319341bb79d4cd5bdf6adc0..8d494ea175531b00ab4ab3979045c579062f053e 100644 (file)
@@ -3505,6 +3505,7 @@ Target_x86_64<size>::Relocate::relocate(
   if (this->skip_call_tls_get_addr_)
     {
       if ((r_type != elfcpp::R_X86_64_PLT32
+          && r_type != elfcpp::R_X86_64_GOTPCREL
           && r_type != elfcpp::R_X86_64_GOTPCRELX
           && r_type != elfcpp::R_X86_64_PLT32_BND
           && r_type != elfcpp::R_X86_64_PC32_BND
@@ -3514,6 +3515,7 @@ Target_x86_64<size>::Relocate::relocate(
        {
          gold_error_at_location(relinfo, relnum, rela.get_r_offset(),
                                 _("missing expected TLS relocation"));
+         this->skip_call_tls_get_addr_ = false;
        }
       else
        {