(elf_hppa_final_link_relocate) Fix handling of branches.
authorAlan Modra <amodra@gmail.com>
Wed, 31 May 2000 09:00:00 +0000 (09:00 +0000)
committerAlan Modra <amodra@gmail.com>
Wed, 31 May 2000 09:00:00 +0000 (09:00 +0000)
bfd/ChangeLog
bfd/elf-hppa.h

index 12fb552..20526a4 100644 (file)
@@ -1,3 +1,9 @@
+2000-05-31  Alan Modra  <alan@linuxcare.com.au>
+
+       * 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  <nickc@cygnus.com>
 
        * cpu-i960.c (scan_960_mach): Accept 80960KA, 80960KB,
index dab039b..0a4dc64 100644 (file)
@@ -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;
       }