diff options
author | Alan Modra <amodra@gmail.com> | 2000-05-31 09:00:00 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2000-05-31 09:00:00 +0000 |
commit | 70d72e0eecedce2273b1ed400ecb86e8137878d2 (patch) | |
tree | 667251bb6b84f4c60b9506f3c8ab8a4bf09efdbc /bfd/elf-hppa.h | |
parent | 96f6d4c4e0961d0170d871d91106d09d03ff869a (diff) | |
download | gdb-70d72e0eecedce2273b1ed400ecb86e8137878d2.zip gdb-70d72e0eecedce2273b1ed400ecb86e8137878d2.tar.gz gdb-70d72e0eecedce2273b1ed400ecb86e8137878d2.tar.bz2 |
(elf_hppa_final_link_relocate) Fix handling of branches.
Diffstat (limited to 'bfd/elf-hppa.h')
-rw-r--r-- | bfd/elf-hppa.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h index dab039b..0a4dc64 100644 --- a/bfd/elf-hppa.h +++ b/bfd/elf-hppa.h @@ -1521,7 +1521,10 @@ elf_hppa_final_link_relocate (rel, input_bfd, output_bfd, + input_section->output_section->vma); /* Adjust for any field selectors. */ - value = hppa_field_adjust (value, -8 + addend, e_fsel); + if (r_type == R_PARISC_PCREL17R) + value = hppa_field_adjust (value, -8 + addend, e_rsel); + else + value = hppa_field_adjust (value, -8 + addend, e_fsel); /* All branches are implicitly shifted by 2 places. */ value >>= 2; @@ -1681,8 +1684,9 @@ elf_hppa_final_link_relocate (rel, input_bfd, output_bfd, case R_PARISC_DIR16DF: { /* All DIR relocations are basically the same at this point, - except that we need different field selectors for the 21bit - version vs the 14bit versions. */ + except that branch offsets need to be divided by four, and + we need different field selectors. Note that we don't + redirect absolute calls to local stubs. */ if (r_type == R_PARISC_DIR21L) value = hppa_field_adjust (value, addend, e_lrsel); @@ -1694,6 +1698,12 @@ elf_hppa_final_link_relocate (rel, input_bfd, output_bfd, else value = hppa_field_adjust (value, addend, e_rrsel); + if (r_type == R_PARISC_DIR17R || r_type == R_PARISC_DIR17F) + { + /* All branches are implicitly shifted by 2 places. */ + value >>= 2; + } + insn = elf_hppa_relocate_insn (insn, value, r_type); break; } |