Fix internal error when applying TLSDESC relocations with no TLS segment.
authorCary Coutant <ccoutant@gmail.com>
Tue, 12 Jan 2016 07:57:44 +0000 (23:57 -0800)
committerCary Coutant <ccoutant@gmail.com>
Tue, 12 Jan 2016 07:58:28 +0000 (23:58 -0800)
gold/
PR gold/19353
* aarch64.cc (Target_aarch64::relocate_tls): Don't insist that
we have a TLS segment for GD-to-IE optimization.
* i386.cc (Target_i386::tls_gd_to_ie): Remove tls_segment parameter.
Adjust all calls.
(Target_i386::tls_desc_gd_to_ie): Likewise.
(Target_i386::relocate_tls): Don't insist that we have a TLS segment
for TLSDESC GD-to-IE optimizations.
* x86_64.cc (Target_x86_64::tls_gd_to_ie): Remove tls_segment parameter.
Adjust all calls.
(Target_x86_64::tls_desc_gd_to_ie): Likewise.
(Target_x86_64::relocate_tls): Don't insist that we have a TLS segment
for TLSDESC GD-to-IE optimizations.

gold/ChangeLog
gold/aarch64.cc
gold/i386.cc
gold/x86_64.cc

index 42c428bbb82fe82ab627506f738465a37d18058a..c49ec6c9deb7ece3a7157696b48fd7cdd39a3ec1 100644 (file)
@@ -1,3 +1,19 @@
+2016-01-11  Cary Coutant  <ccoutant@gmail.com>
+
+       PR gold/19353
+       * aarch64.cc (Target_aarch64::relocate_tls): Don't insist that
+       we have a TLS segment for GD-to-IE optimization.
+       * i386.cc (Target_i386::tls_gd_to_ie): Remove tls_segment parameter.
+       Adjust all calls.
+       (Target_i386::tls_desc_gd_to_ie): Likewise.
+       (Target_i386::relocate_tls): Don't insist that we have a TLS segment
+       for TLSDESC GD-to-IE optimizations.
+       * x86_64.cc (Target_x86_64::tls_gd_to_ie): Remove tls_segment parameter.
+       Adjust all calls.
+       (Target_x86_64::tls_desc_gd_to_ie): Likewise.
+       (Target_x86_64::relocate_tls): Don't insist that we have a TLS segment
+       for TLSDESC GD-to-IE optimizations.
+
 2016-01-11  Cary Coutant  <ccoutant@gmail.com>
 
        Refactor gold to enable support for MIPS-64 relocation format.
index 20f2f4f0099d5a25ee927ca10dfd19d285825b7c..5ad061b8979e3528346bc91c38bb5bbdd7240ada 100644 (file)
@@ -7422,12 +7422,6 @@ Target_aarch64<size, big_endian>::Relocate::relocate_tls(
              }
            if (tlsopt == tls::TLSOPT_TO_IE)
              {
-               if (tls_segment == NULL)
-                 {
-                   gold_assert(parameters->errors()->error_count() > 0
-                               || issue_undefined_symbol_error(gsym));
-                   return aarch64_reloc_funcs::STATUS_BAD_RELOC;
-                 }
                return tls_desc_gd_to_ie(relinfo, target, rela, r_type,
                                         view, psymval, got_entry_address,
                                         address);
index 82886d4b8a9e8e9ff33955b7ae458722fc5f38af..a7168a8f1f4345685c52ea5b80436d1a443cd1db 100644 (file)
@@ -668,7 +668,6 @@ class Target_i386 : public Sized_target<32, false>
     // Do a TLS General-Dynamic to Initial-Exec transition.
     inline void
     tls_gd_to_ie(const Relocate_info<32, false>*, size_t relnum,
-                Output_segment* tls_segment,
                 const elfcpp::Rel<32, false>&, unsigned int r_type,
                 elfcpp::Elf_types<32>::Elf_Addr value,
                 unsigned char* view,
@@ -687,7 +686,6 @@ class Target_i386 : public Sized_target<32, false>
     // transition.
     inline void
     tls_desc_gd_to_ie(const Relocate_info<32, false>*, size_t relnum,
-                     Output_segment* tls_segment,
                      const elfcpp::Rel<32, false>&, unsigned int r_type,
                      elfcpp::Elf_types<32>::Elf_Addr value,
                      unsigned char* view,
@@ -3054,7 +3052,7 @@ Target_i386::Relocate::relocate_tls(const Relocate_info<32, false>* relinfo,
            }
          if (optimized_type == tls::TLSOPT_TO_IE)
            {
-             this->tls_gd_to_ie(relinfo, relnum, tls_segment, rel, r_type,
+             this->tls_gd_to_ie(relinfo, relnum, rel, r_type,
                                 got_offset, view, view_size);
              break;
            }
@@ -3116,13 +3114,7 @@ Target_i386::Relocate::relocate_tls(const Relocate_info<32, false>* relinfo,
            }
          if (optimized_type == tls::TLSOPT_TO_IE)
            {
-             if (tls_segment == NULL)
-               {
-                 gold_assert(parameters->errors()->error_count() > 0
-                             || issue_undefined_symbol_error(gsym));
-                 return;
-               }
-             this->tls_desc_gd_to_ie(relinfo, relnum, tls_segment, rel, r_type,
+             this->tls_desc_gd_to_ie(relinfo, relnum, rel, r_type,
                                      got_offset, view, view_size);
              break;
            }
@@ -3354,7 +3346,6 @@ Target_i386::Relocate::tls_gd_to_le(const Relocate_info<32, false>* relinfo,
 inline void
 Target_i386::Relocate::tls_gd_to_ie(const Relocate_info<32, false>* relinfo,
                                    size_t relnum,
-                                   Output_segment*,
                                    const elfcpp::Rel<32, false>& rel,
                                    unsigned int,
                                    elfcpp::Elf_types<32>::Elf_Addr value,
@@ -3449,7 +3440,6 @@ inline void
 Target_i386::Relocate::tls_desc_gd_to_ie(
     const Relocate_info<32, false>* relinfo,
     size_t relnum,
-    Output_segment*,
     const elfcpp::Rel<32, false>& rel,
     unsigned int r_type,
     elfcpp::Elf_types<32>::Elf_Addr value,
index 3cfc064d4b467de85c2c30dd1ac6dfbb4cfe9959..4ad5afc7e0e8af3a639ddf1dfe7e7f6d51d61ce5 100644 (file)
@@ -816,7 +816,6 @@ class Target_x86_64 : public Sized_target<size, false>
     // Do a TLS General-Dynamic to Initial-Exec transition.
     inline void
     tls_gd_to_ie(const Relocate_info<size, false>*, size_t relnum,
-                Output_segment* tls_segment,
                 const elfcpp::Rela<size, false>&, unsigned int r_type,
                 typename elfcpp::Elf_types<size>::Elf_Addr value,
                 unsigned char* view,
@@ -835,7 +834,6 @@ class Target_x86_64 : public Sized_target<size, false>
     // Do a TLSDESC-style General-Dynamic to Initial-Exec transition.
     inline void
     tls_desc_gd_to_ie(const Relocate_info<size, false>*, size_t relnum,
-                     Output_segment* tls_segment,
                      const elfcpp::Rela<size, false>&, unsigned int r_type,
                      typename elfcpp::Elf_types<size>::Elf_Addr value,
                      unsigned char* view,
@@ -3733,7 +3731,7 @@ Target_x86_64<size>::Relocate::relocate_tls(
          if (optimized_type == tls::TLSOPT_TO_IE)
            {
              value = target->got_plt_section()->address() + got_offset;
-             this->tls_gd_to_ie(relinfo, relnum, tls_segment, rela, r_type,
+             this->tls_gd_to_ie(relinfo, relnum, rela, r_type,
                                 value, view, address, view_size);
              break;
            }
@@ -3800,14 +3798,8 @@ Target_x86_64<size>::Relocate::relocate_tls(
            }
          if (optimized_type == tls::TLSOPT_TO_IE)
            {
-             if (tls_segment == NULL)
-               {
-                 gold_assert(parameters->errors()->error_count() > 0
-                             || issue_undefined_symbol_error(gsym));
-                 return;
-               }
              value = target->got_plt_section()->address() + got_offset;
-             this->tls_desc_gd_to_ie(relinfo, relnum, tls_segment,
+             this->tls_desc_gd_to_ie(relinfo, relnum,
                                      rela, r_type, value, view, address,
                                      view_size);
              break;
@@ -3973,7 +3965,6 @@ inline void
 Target_x86_64<size>::Relocate::tls_gd_to_ie(
     const Relocate_info<size, false>* relinfo,
     size_t relnum,
-    Output_segment*,
     const elfcpp::Rela<size, false>& rela,
     unsigned int,
     typename elfcpp::Elf_types<size>::Elf_Addr value,
@@ -4085,7 +4076,6 @@ inline void
 Target_x86_64<size>::Relocate::tls_desc_gd_to_ie(
     const Relocate_info<size, false>* relinfo,
     size_t relnum,
-    Output_segment*,
     const elfcpp::Rela<size, false>& rela,
     unsigned int r_type,
     typename elfcpp::Elf_types<size>::Elf_Addr value,