From 28a13fec147af8768d92f44d5d6e7ac10b918e82 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 6 Jul 2011 05:12:03 +0000 Subject: 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. --- gold/i386.cc | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'gold/i386.cc') diff --git a/gold/i386.cc b/gold/i386.cc index 65ff05f..afb9c31 100644 --- a/gold/i386.cc +++ b/gold/i386.cc @@ -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. -- cgit v1.1