From bb66a627d0b84ec3ec30849691d5ed16ffe91f5b Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 30 Nov 2012 04:47:08 +0000 Subject: [PATCH] * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK. (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_ value if it already exists. --- gold/ChangeLog | 7 +++++++ gold/powerpc.cc | 27 +++++++++++++++++---------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/gold/ChangeLog b/gold/ChangeLog index 9a2868e055..8b44555a1b 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,10 @@ +2012-11-30 Alan Modra + + * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL + _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK. + (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_ + value if it already exists. + 2012-11-19 H.J. Lu PR gold/14858 diff --git a/gold/powerpc.cc b/gold/powerpc.cc index fd7931227a..e4aef132f3 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -1391,8 +1391,8 @@ Powerpc_relobj::do_scan_relocs(Symbol_table* symtab, { if (size == 32) { - // Define a weak hidden _GLOBAL_OFFSET_TABLE_ to ensure it isn't - // seen as undefined when scanning relocs (and thus requires + // Define _GLOBAL_OFFSET_TABLE_ to ensure it isn't seen as + // undefined when scanning relocs (and thus requires // non-relative dynamic relocs). The proper value will be // updated later. Symbol *gotsym = symtab->lookup("_GLOBAL_OFFSET_TABLE_", NULL); @@ -1407,7 +1407,7 @@ Powerpc_relobj::do_scan_relocs(Symbol_table* symtab, Symbol_table::PREDEFINED, got, 0, 0, elfcpp::STT_OBJECT, - elfcpp::STB_WEAK, + elfcpp::STB_LOCAL, elfcpp::STV_HIDDEN, 0, false, false); } @@ -1574,13 +1574,20 @@ private: Output_data_got::add_constant(0); // Define _GLOBAL_OFFSET_TABLE_ at the header - this->symtab_->define_in_output_data("_GLOBAL_OFFSET_TABLE_", NULL, - Symbol_table::PREDEFINED, - this, this->g_o_t(), 0, - elfcpp::STT_OBJECT, - elfcpp::STB_LOCAL, - elfcpp::STV_HIDDEN, - 0, false, false); + Symbol *gotsym = this->symtab_->lookup("_GLOBAL_OFFSET_TABLE_", NULL); + if (gotsym != NULL) + { + Sized_symbol* sym = static_cast*>(gotsym); + sym->set_value(this->g_o_t()); + } + else + this->symtab_->define_in_output_data("_GLOBAL_OFFSET_TABLE_", NULL, + Symbol_table::PREDEFINED, + this, this->g_o_t(), 0, + elfcpp::STT_OBJECT, + elfcpp::STB_LOCAL, + elfcpp::STV_HIDDEN, 0, + false, false); } else Output_data_got::add_constant(0); -- 2.34.1