for (rent = hh->reloc_entries; rent; rent = rent->next)
{
/* Allocate one iff we are building a shared library, the relocation
- isn't a R_PARISC_FPTR64, or we don't want an opd entry. */
- if (!shared && rent->type == R_PARISC_FPTR64 && hh->want_opd)
+ isn't a R_PARISC_FPTR64, and we want an opd entry. */
+ if (!shared && rent->type == R_PARISC_FPTR64 && !hh->want_opd)
continue;
if (!discarded_section (hppa_info->other_rel_sec))
/* Compute the base address of the segment with this symbol. */
sec = hppa_info->text_hash_entry->root.u.def.section;
- value2 = sec->output_section->vma;
+ value2 = sec->output_offset + sec->output_section->vma;
/* Compute the difference between the symbol and the text segment
base address. */
if (eh->root.u.def.section->flags & SEC_READONLY)
{
sec = hppa_info->text_hash_entry->root.u.def.section;
- value2 = sec->output_section->vma;
+ value2 = sec->output_offset + sec->output_section->vma;
dynindx = hppa_info->text_hash_entry->dynindx;
}
else
{
sec = hppa_info->data_hash_entry->root.u.def.section;
- value2 = sec->output_section->vma;
+ value2 = sec->output_offset + sec->output_section->vma;
dynindx = hppa_info->data_hash_entry->dynindx;
}
rel.r_addend = value - value2;
bfd_byte *loc;
/* Allocate one iff we are building a shared library, the relocation
- isn't a R_PARISC_FPTR64, or we don't want an opd entry. */
+ isn't a R_PARISC_FPTR64, or we want an opd entry. */
if (!bfd_link_pic (info)
- && rent->type == R_PARISC_FPTR64 && hh->want_opd)
+ && rent->type == R_PARISC_FPTR64 && !hh->want_opd)
continue;
/* Create a dynamic relocation for this entry.
asection *sec;
bfd_vma value, value2;
- /* First compute the address of the opd entry for this symbol. */
- value = (hh->opd_offset
- + hppa_info->opd_sec->output_section->vma
- + hppa_info->opd_sec->output_offset);
+ /* Compute the address of the symbol. */
+ value = (eh->root.u.def.value
+ + eh->root.u.def.section->output_section->vma
+ + eh->root.u.def.section->output_offset);
if (hh->eh.dynindx != -1)
{
else if (rent->sec->flags & SEC_READONLY)
{
sec = hppa_info->text_hash_entry->root.u.def.section;
- value2 = sec->output_section->vma;
+ value2 = sec->output_offset + sec->output_section->vma;
dynindx = hppa_info->text_hash_entry->dynindx;
}
else
{
sec = hppa_info->data_hash_entry->root.u.def.section;
- value2 = sec->output_section->vma;
+ value2 = sec->output_offset + sec->output_section->vma;
dynindx = hppa_info->data_hash_entry->dynindx;
}
if (eh->root.u.def.section->flags & SEC_READONLY)
{
sec = hppa_info->text_hash_entry->root.u.def.section;
- value2 = sec->output_section->vma;
+ value2 = sec->output_offset + sec->output_section->vma;
dynindx = hppa_info->text_hash_entry->dynindx;
}
else
{
sec = hppa_info->data_hash_entry->root.u.def.section;
- value2 = sec->output_section->vma;
+ value2 = sec->output_offset + sec->output_section->vma;
dynindx = hppa_info->data_hash_entry->dynindx;
}
rel.r_addend = value - value2 + rent->addend;
dynindx = hppa_info->data_hash_entry->dynindx;
}
- /* Adjust the value with the difference between the
+ /* Adjust the addend with the difference between the
symbol's address and the base segment's address. */
- value += (relocation + addend
- - sec->output_offset
- - sec->output_section->vma);
+ value = (relocation + addend
+ - sec->output_offset
+ - sec->output_section->vma);
/* The result becomes the addend of the relocation. */
rela.r_addend = value;
dynindx = hppa_info->data_hash_entry->dynindx;
}
- /* Adjust value using the difference of the symbol's
+ /* Adjust addend using the difference of the symbol's
location and the section symbol's address. */
- value += (relocation + addend
- - sec->output_offset
- - sec->output_section->vma);
+ value = (relocation + addend
+ - sec->output_offset
+ - sec->output_section->vma);
/* The result becomes the addend of the relocation. */
rela.r_addend = value;
/* Compute the difference between the symbol's address
and the base segment's address. */
- value += (relocation + addend
- - sec->output_offset
- - sec->output_section->vma);
+ value = (relocation + addend
+ - sec->output_offset
+ - sec->output_section->vma);
/* The result becomes the addend of the relocation. */
rela.r_addend = value;