+2015-08-20 Alan Modra <amodra@gmail.com>
+
+ PR gold/18846
+ * target-reloc.h (relocate_relocs <RELOC_ADJUST_FOR_SECTION_RELA>):
+ Subtract os->address() from addend.
+ * powerpc.cc (relocate_relocs): Likewise.
+
2015-08-12 Simon Dardis <simon.dardis@imgtec.com>
* mips.cc (plt0_entry_o32, plt0_entry_n32, plt0_entry_n64,
}
// Get the new symbol index.
+ Output_section* os = NULL;
if (r_sym < local_count)
{
switch (strategy)
unsigned int shndx =
object->local_symbol_input_shndx(r_sym, &is_ordinary);
gold_assert(is_ordinary);
- Output_section* os = object->output_section(shndx);
+ os = object->output_section(shndx);
gold_assert(os != NULL);
gold_assert(os->needs_symtab_index());
r_sym = os->symtab_index();
else if (strategy == Relocatable_relocs::RELOC_ADJUST_FOR_SECTION_RELA)
{
const Symbol_value<size>* psymval = object->local_symbol(orig_r_sym);
- addend = psymval->value(object, addend);
+ gold_assert(os != NULL);
+ addend = psymval->value(object, addend) - os->address();
}
else if (strategy == Relocatable_relocs::RELOC_SPECIAL)
{
// Get the new symbol index.
+ Output_section* os = NULL;
unsigned int new_symndx;
if (r_sym < local_count)
{
unsigned int shndx =
object->local_symbol_input_shndx(r_sym, &is_ordinary);
gold_assert(is_ordinary);
- Output_section* os = object->output_section(shndx);
+ os = object->output_section(shndx);
gold_assert(os != NULL);
gold_assert(os->needs_symtab_index());
new_symndx = os->symtab_index();
typename elfcpp::Elf_types<size>::Elf_Swxword addend;
addend = Reloc_types<sh_type, size, big_endian>::
get_reloc_addend(&reloc);
- addend = psymval->value(object, addend);
+ gold_assert(os != NULL);
+ addend = psymval->value(object, addend) - os->address();
Reloc_types<sh_type, size, big_endian>::
set_reloc_addend(&reloc_write, addend);
}