+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,
 
                  + 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;
     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);
        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;
       }