This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gold commit] PR 20216: Fix extraneous complaints about missing expected TLS relocation

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.


2016-08-10  Cary Coutant  <>

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

diff --git a/gold/testsuite/ b/gold/testsuite/
index 39f9e9e..739458c 100644
--- a/gold/testsuite/
+++ b/gold/testsuite/
@@ -1193,10 +1193,10 @@ 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

diff --git a/gold/ b/gold/
index 6aa489a..8d494ea 100644
--- a/gold/
+++ b/gold/
@@ -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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]