From 70d72e0eecedce2273b1ed400ecb86e8137878d2 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 31 May 2000 09:00:00 +0000 Subject: [PATCH] (elf_hppa_final_link_relocate) Fix handling of branches. --- bfd/ChangeLog | 6 ++++++ bfd/elf-hppa.h | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 12fb552..20526a4 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2000-05-31 Alan Modra + + * elf-hppa.h: (elf_hppa_final_link_relocate): Use e_rsel field + selector for R_PARISC_PCREL17R. R_PARISC_DIR17R and + R_PARISC_DIR17F are for absolute branches; Handle them as such. + 2000-05-30 Nick Clifton * cpu-i960.c (scan_960_mach): Accept 80960KA, 80960KB, 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; } -- 2.7.4