aboutsummaryrefslogtreecommitdiff
path: root/gold/sparc.cc
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2012-10-05 00:45:54 +0000
committerAlan Modra <amodra@gmail.com>2012-10-05 00:45:54 +0000
commit19fec8c1d313c6757a53dc7f09776dc9770ee2ef (patch)
treee330d3c2414ede0d1e0b37e4bb238811cc6c11e3 /gold/sparc.cc
parentfda1189bbcdf6b9c384bf5befee3e3ff6e647711 (diff)
downloadgdb-19fec8c1d313c6757a53dc7f09776dc9770ee2ef.zip
gdb-19fec8c1d313c6757a53dc7f09776dc9770ee2ef.tar.gz
gdb-19fec8c1d313c6757a53dc7f09776dc9770ee2ef.tar.bz2
* i386.cc (Output_data_plt_i386::address_for_global,
address_for_local): Add plt offset to returned value. Adjust uses. * sparc.cc (Output_data_plt_sparc::address_for_global, address_for_local): Likewise. * tilegx.cc (Output_data_plt_tilegx::address_for_global, address_for_local): Likewise. * x86_64.cc (Output_data_plt_x86_64::address_for_global, address_for_local): Likewise. * target.h (Target::plt_address_for_global, plt_address_for_local): Update comment. * output.cc (Output_reloc::symbol_value): Don't add plt offset here. (Output_data_got::Got_entry::write): Nor here. * output.h: Comment fix.
Diffstat (limited to 'gold/sparc.cc')
-rw-r--r--gold/sparc.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/gold/sparc.cc b/gold/sparc.cc
index 71dd3d5..4ec3037 100644
--- a/gold/sparc.cc
+++ b/gold/sparc.cc
@@ -1619,7 +1619,7 @@ Output_data_plt_sparc<size, big_endian>::address_for_global(const Symbol* gsym)
if (gsym->type() == elfcpp::STT_GNU_IFUNC
&& gsym->can_use_relative_reloc(false))
offset = plt_index_to_offset(this->count_ + 4);
- return this->address() + offset;
+ return this->address() + offset + gsym->plt_offset();
}
// Return the PLT address to use for a local symbol. These are always
@@ -1628,10 +1628,12 @@ Output_data_plt_sparc<size, big_endian>::address_for_global(const Symbol* gsym)
template<int size, bool big_endian>
uint64_t
Output_data_plt_sparc<size, big_endian>::address_for_local(
- const Relobj*,
- unsigned int)
+ const Relobj* object,
+ unsigned int r_sym)
{
- return this->address() + plt_index_to_offset(this->count_ + 4);
+ return (this->address()
+ + plt_index_to_offset(this->count_ + 4)
+ + object->local_plt_offset(r_sym));
}
static const unsigned int sparc_nop = 0x01000000;
@@ -3199,7 +3201,7 @@ Target_sparc<size, big_endian>::Relocate::relocate(
{
elfcpp::Elf_Xword value;
- value = target->plt_address_for_global(gsym) + gsym->plt_offset();
+ value = target->plt_address_for_global(gsym);
symval.set_output_value(value);
@@ -3210,8 +3212,7 @@ Target_sparc<size, big_endian>::Relocate::relocate(
unsigned int r_sym = elfcpp::elf_r_sym<size>(rela.get_r_info());
if (object->local_has_plt_offset(r_sym))
{
- symval.set_output_value(target->plt_address_for_local(object, r_sym)
- + object->local_plt_offset(r_sym));
+ symval.set_output_value(target->plt_address_for_local(object, r_sym));
psymval = &symval;
}
}