]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR gold/12392
authorIan Lance Taylor <ian@airs.com>
Wed, 6 Jul 2011 05:12:03 +0000 (05:12 +0000)
committerIan Lance Taylor <ian@airs.com>
Wed, 6 Jul 2011 05:12:03 +0000 (05:12 +0000)
* i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
symbols if necessary.
* x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.

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

index ec1f3eac57f551dddf318c2a147c4a2472ec97d7..65b0bb3cc053394b2bc992be4474f46d47e8f2e7 100644 (file)
@@ -1,3 +1,10 @@
+2011-07-05  Ian Lance Taylor  <iant@google.com>
+
+       PR gold/12392
+       * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
+       symbols if necessary.
+       * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
+
 2011-07-05  Ian Lance Taylor  <iant@google.com>
 
        PR gold/12952
index 65ff05f5f56a3c9c03c848239a0f423c106ea9fc..afb9c31f0aef8cebec9a159c6807f2c9243b750a 100644 (file)
@@ -2181,6 +2181,46 @@ Target_i386::do_finalize_sections(
       uint32_t data_size = this->got_plt_->current_data_size();
       symtab->get_sized_symbol<32>(sym)->set_symsize(data_size);
     }
+
+  if (parameters->doing_static_link() && this->plt_ == NULL)
+    {
+      // If linking statically, make sure that the __rel_iplt symbols
+      // were defined if necessary, even if we didn't create a PLT.
+      static const Define_symbol_in_segment syms[] =
+       {
+         {
+           "__rel_iplt_start",         // name
+           elfcpp::PT_LOAD,            // segment_type
+           elfcpp::PF_W,               // segment_flags_set
+           elfcpp::PF(0),              // segment_flags_clear
+           0,                          // value
+           0,                          // size
+           elfcpp::STT_NOTYPE,         // type
+           elfcpp::STB_GLOBAL,         // binding
+           elfcpp::STV_HIDDEN,         // visibility
+           0,                          // nonvis
+           Symbol::SEGMENT_START,      // offset_from_base
+           true                        // only_if_ref
+         },
+         {
+           "__rel_iplt_end",           // name
+           elfcpp::PT_LOAD,            // segment_type
+           elfcpp::PF_W,               // segment_flags_set
+           elfcpp::PF(0),              // segment_flags_clear
+           0,                          // value
+           0,                          // size
+           elfcpp::STT_NOTYPE,         // type
+           elfcpp::STB_GLOBAL,         // binding
+           elfcpp::STV_HIDDEN,         // visibility
+           0,                          // nonvis
+           Symbol::SEGMENT_START,      // offset_from_base
+           true                        // only_if_ref
+         }
+       };
+
+      symtab->define_symbols(layout, 2, syms,
+                            layout->script_options()->saw_sections_clause());
+    }
 }
 
 // Return whether a direct absolute static relocation needs to be applied.
index 8308bf4ba7a52340e06d1f40fe71c7c63d09e1b2..adcfd42d94cd3c10cb3f264cbfd3f55cbc3c1631 100644 (file)
@@ -2599,6 +2599,46 @@ Target_x86_64::do_finalize_sections(
       uint64_t data_size = this->got_plt_->current_data_size();
       symtab->get_sized_symbol<64>(sym)->set_symsize(data_size);
     }
+
+  if (parameters->doing_static_link() && this->plt_ == NULL)
+    {
+      // If linking statically, make sure that the __rela_iplt symbols
+      // were defined if necessary, even if we didn't create a PLT.
+      static const Define_symbol_in_segment syms[] =
+       {
+         {
+           "__rela_iplt_start",        // name
+           elfcpp::PT_LOAD,            // segment_type
+           elfcpp::PF_W,               // segment_flags_set
+           elfcpp::PF(0),              // segment_flags_clear
+           0,                          // value
+           0,                          // size
+           elfcpp::STT_NOTYPE,         // type
+           elfcpp::STB_GLOBAL,         // binding
+           elfcpp::STV_HIDDEN,         // visibility
+           0,                          // nonvis
+           Symbol::SEGMENT_START,      // offset_from_base
+           true                        // only_if_ref
+         },
+         {
+           "__rela_iplt_end",          // name
+           elfcpp::PT_LOAD,            // segment_type
+           elfcpp::PF_W,               // segment_flags_set
+           elfcpp::PF(0),              // segment_flags_clear
+           0,                          // value
+           0,                          // size
+           elfcpp::STT_NOTYPE,         // type
+           elfcpp::STB_GLOBAL,         // binding
+           elfcpp::STV_HIDDEN,         // visibility
+           0,                          // nonvis
+           Symbol::SEGMENT_START,      // offset_from_base
+           true                        // only_if_ref
+         }
+       };
+
+      symtab->define_symbols(layout, 2, syms,
+                            layout->script_options()->saw_sections_clause());
+    }
 }
 
 // Perform a relocation.