diff options
author | Nick Clifton <nickc@redhat.com> | 1998-12-08 15:44:06 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 1998-12-08 15:44:06 +0000 |
commit | 811c57ffa1fd6dcb78bfc5065dc9eefae99b456f (patch) | |
tree | 98839216c0c2738db29b9a8288b33a38b19c7c0e /bfd/elf32-fr30.c | |
parent | 8ecd559a563f80c84562ccc1633059f5437678bf (diff) | |
download | gdb-811c57ffa1fd6dcb78bfc5065dc9eefae99b456f.zip gdb-811c57ffa1fd6dcb78bfc5065dc9eefae99b456f.tar.gz gdb-811c57ffa1fd6dcb78bfc5065dc9eefae99b456f.tar.bz2 |
Fix pc relative relocs.
Diffstat (limited to 'bfd/elf32-fr30.c')
-rw-r--r-- | bfd/elf32-fr30.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c index 0e4171f..17bcc98 100644 --- a/bfd/elf32-fr30.c +++ b/bfd/elf32-fr30.c @@ -383,8 +383,10 @@ fr30_final_link_relocate (howto, input_bfd, input_section, contents, rel, reloca case R_FR30_9_PCREL: contents += rel->r_offset + 1; - relocation += rel->r_addend; srel = (bfd_signed_vma) relocation; + srel += rel->r_addend; + srel -= rel->r_offset; + srel -= 2; /* Branch instructions add 2 to the PC... */ srel -= (input_section->output_section->vma + input_section->output_offset); @@ -392,14 +394,16 @@ fr30_final_link_relocate (howto, input_bfd, input_section, contents, rel, reloca return bfd_reloc_outofrange; if (srel > ((1 << 8) - 1) || (srel < - (1 << 8))) return bfd_reloc_overflow; - + bfd_put_8 (input_bfd, srel >> 1, contents); break; case R_FR30_12_PCREL: contents += rel->r_offset; - relocation += rel->r_addend; srel = (bfd_signed_vma) relocation; + srel += rel->r_addend; + srel -= rel->r_offset; + srel -= 2; /* Branch instructions add 2 to the PC... */ srel -= (input_section->output_section->vma + input_section->output_offset); |