Back to index

cell-binutils  2.17cvs20070401
elf-hppa.h
Go to the documentation of this file.
00001 /* Common code for PA ELF implementations.
00002    Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
00003    Free Software Foundation, Inc.
00004 
00005    This file is part of BFD, the Binary File Descriptor library.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program; if not, write to the Free Software
00019    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00020 
00021 #define ELF_HOWTO_TABLE_SIZE       R_PARISC_UNIMPLEMENTED + 1
00022 
00023 /* This file is included by multiple PA ELF BFD backends with different
00024    sizes.
00025 
00026    Most of the routines are written to be size independent, but sometimes
00027    external constraints require 32 or 64 bit specific code.  We remap
00028    the definitions/functions as necessary here.  */
00029 #if ARCH_SIZE == 64
00030 #define ELF_R_TYPE(X)                 ELF64_R_TYPE(X)
00031 #define ELF_R_SYM(X)                  ELF64_R_SYM(X)
00032 #define elf_hppa_reloc_final_type     elf64_hppa_reloc_final_type
00033 #define _bfd_elf_hppa_gen_reloc_type  _bfd_elf64_hppa_gen_reloc_type
00034 #define elf_hppa_relocate_section     elf64_hppa_relocate_section
00035 #define elf_hppa_final_link           elf64_hppa_final_link
00036 #endif
00037 #if ARCH_SIZE == 32
00038 #define ELF_R_TYPE(X)                 ELF32_R_TYPE(X)
00039 #define ELF_R_SYM(X)                  ELF32_R_SYM(X)
00040 #define elf_hppa_reloc_final_type     elf32_hppa_reloc_final_type
00041 #define _bfd_elf_hppa_gen_reloc_type  _bfd_elf32_hppa_gen_reloc_type
00042 #define elf_hppa_relocate_section     elf32_hppa_relocate_section
00043 #define elf_hppa_final_link           elf32_hppa_final_link
00044 #endif
00045 
00046 /* ELF/PA relocation howto entries.  */
00047 
00048 static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
00049 {
00050   { R_PARISC_NONE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00051     bfd_elf_generic_reloc, "R_PARISC_NONE", FALSE, 0, 0, FALSE },
00052 
00053   /* The values in DIR32 are to placate the check in
00054      _bfd_stab_section_find_nearest_line.  */
00055   { R_PARISC_DIR32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
00056     bfd_elf_generic_reloc, "R_PARISC_DIR32", FALSE, 0, 0xffffffff, FALSE },
00057   { R_PARISC_DIR21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
00058     bfd_elf_generic_reloc, "R_PARISC_DIR21L", FALSE, 0, 0, FALSE },
00059   { R_PARISC_DIR17R, 0, 2, 17, FALSE, 0, complain_overflow_bitfield,
00060     bfd_elf_generic_reloc, "R_PARISC_DIR17R", FALSE, 0, 0, FALSE },
00061   { R_PARISC_DIR17F, 0, 2, 17, FALSE, 0, complain_overflow_bitfield,
00062     bfd_elf_generic_reloc, "R_PARISC_DIR17F", FALSE, 0, 0, FALSE },
00063   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00064     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00065   { R_PARISC_DIR14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00066     bfd_elf_generic_reloc, "R_PARISC_DIR14R", FALSE, 0, 0, FALSE },
00067   { R_PARISC_DIR14F, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00068     bfd_elf_generic_reloc, "R_PARISC_DIR14F", FALSE, 0, 0, FALSE },
00069   /* 8 */
00070   { R_PARISC_PCREL12F, 0, 2, 12, TRUE, 0, complain_overflow_bitfield,
00071     bfd_elf_generic_reloc, "R_PARISC_PCREL12F", FALSE, 0, 0, FALSE },
00072   { R_PARISC_PCREL32, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
00073     bfd_elf_generic_reloc, "R_PARISC_PCREL32", FALSE, 0, 0, FALSE },
00074   { R_PARISC_PCREL21L, 0, 2, 21, TRUE, 0, complain_overflow_bitfield,
00075     bfd_elf_generic_reloc, "R_PARISC_PCREL21L", FALSE, 0, 0, FALSE },
00076   { R_PARISC_PCREL17R, 0, 2, 17, TRUE, 0, complain_overflow_bitfield,
00077     bfd_elf_generic_reloc, "R_PARISC_PCREL17R", FALSE, 0, 0, FALSE },
00078   { R_PARISC_PCREL17F, 0, 2, 17, TRUE, 0, complain_overflow_bitfield,
00079     bfd_elf_generic_reloc, "R_PARISC_PCREL17F", FALSE, 0, 0, FALSE },
00080   { R_PARISC_PCREL17C, 0, 2, 17, TRUE, 0, complain_overflow_bitfield,
00081     bfd_elf_generic_reloc, "R_PARISC_PCREL17C", FALSE, 0, 0, FALSE },
00082   { R_PARISC_PCREL14R, 0, 2, 14, TRUE, 0, complain_overflow_bitfield,
00083     bfd_elf_generic_reloc, "R_PARISC_PCREL14R", FALSE, 0, 0, FALSE },
00084   { R_PARISC_PCREL14F, 0, 2, 14, TRUE, 0, complain_overflow_bitfield,
00085     bfd_elf_generic_reloc, "R_PARISC_PCREL14F", FALSE, 0, 0, FALSE },
00086   /* 16 */
00087   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00088     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00089   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00090     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00091   { R_PARISC_DPREL21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
00092     bfd_elf_generic_reloc, "R_PARISC_DPREL21L", FALSE, 0, 0, FALSE },
00093   { R_PARISC_DPREL14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00094     bfd_elf_generic_reloc, "R_PARISC_DPREL14WR", FALSE, 0, 0, FALSE },
00095   { R_PARISC_DPREL14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00096     bfd_elf_generic_reloc, "R_PARISC_DPREL14DR", FALSE, 0, 0, FALSE },
00097   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00098     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00099   { R_PARISC_DPREL14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00100     bfd_elf_generic_reloc, "R_PARISC_DPREL14R", FALSE, 0, 0, FALSE },
00101   { R_PARISC_DPREL14F, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00102     bfd_elf_generic_reloc, "R_PARISC_DPREL14F", FALSE, 0, 0, FALSE },
00103   /* 24 */
00104   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00105     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00106   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00107     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00108   { R_PARISC_DLTREL21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
00109     bfd_elf_generic_reloc, "R_PARISC_DLTREL21L", FALSE, 0, 0, FALSE },
00110   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00111     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00112   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00113     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00114   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00115     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00116   { R_PARISC_DLTREL14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00117     bfd_elf_generic_reloc, "R_PARISC_DLTREL14R", FALSE, 0, 0, FALSE },
00118   { R_PARISC_DLTREL14F, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00119     bfd_elf_generic_reloc, "R_PARISC_DLTREL14F", FALSE, 0, 0, FALSE },
00120   /* 32 */
00121   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00122     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00123   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00124     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00125   { R_PARISC_DLTIND21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
00126     bfd_elf_generic_reloc, "R_PARISC_DLTIND21L", FALSE, 0, 0, FALSE },
00127   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00128     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00129   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00130     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00131   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00132     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00133   { R_PARISC_DLTIND14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00134     bfd_elf_generic_reloc, "R_PARISC_DLTIND14R", FALSE, 0, 0, FALSE },
00135   { R_PARISC_DLTIND14F, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00136     bfd_elf_generic_reloc, "R_PARISC_DLTIND14F", FALSE, 0, 0, FALSE },
00137   /* 40 */
00138   { R_PARISC_SETBASE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00139     bfd_elf_generic_reloc, "R_PARISC_SETBASE", FALSE, 0, 0, FALSE },
00140   { R_PARISC_SECREL32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
00141     bfd_elf_generic_reloc, "R_PARISC_SECREL32", FALSE, 0, 0xffffffff, FALSE },
00142   { R_PARISC_BASEREL21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
00143     bfd_elf_generic_reloc, "R_PARISC_BASEREL21L", FALSE, 0, 0, FALSE },
00144   { R_PARISC_BASEREL17R, 0, 2, 17, FALSE, 0, complain_overflow_bitfield,
00145     bfd_elf_generic_reloc, "R_PARISC_BASEREL17R", FALSE, 0, 0, FALSE },
00146   { R_PARISC_BASEREL17F, 0, 2, 17, FALSE, 0, complain_overflow_bitfield,
00147     bfd_elf_generic_reloc, "R_PARISC_BASEREL17F", FALSE, 0, 0, FALSE },
00148   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00149     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00150   { R_PARISC_BASEREL14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00151     bfd_elf_generic_reloc, "R_PARISC_BASEREL14R", FALSE, 0, 0, FALSE },
00152   { R_PARISC_BASEREL14F, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00153     bfd_elf_generic_reloc, "R_PARISC_BASEREL14F", FALSE, 0, 0, FALSE },
00154   /* 48 */
00155   { R_PARISC_SEGBASE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00156     bfd_elf_generic_reloc, "R_PARISC_SEGBASE", FALSE, 0, 0, FALSE },
00157   { R_PARISC_SEGREL32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
00158     bfd_elf_generic_reloc, "R_PARISC_SEGREL32", FALSE, 0, 0, FALSE },
00159   { R_PARISC_PLTOFF21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
00160     bfd_elf_generic_reloc, "R_PARISC_PLTOFF21L", FALSE, 0, 0, FALSE },
00161   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00162     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00163   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00164     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00165   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00166     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00167   { R_PARISC_PLTOFF14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00168     bfd_elf_generic_reloc, "R_PARISC_PLTOFF14R", FALSE, 0, 0, FALSE },
00169   { R_PARISC_PLTOFF14F, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00170     bfd_elf_generic_reloc, "R_PARISC_PLTOFF14F", FALSE, 0, 0, FALSE },
00171   /* 56 */
00172   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00173     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00174   { R_PARISC_LTOFF_FPTR32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
00175     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR32", FALSE, 0, 0, FALSE },
00176   { R_PARISC_LTOFF_FPTR21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
00177     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR21L", FALSE, 0, 0, FALSE },
00178   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00179     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00180   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00181     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00182   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00183     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00184   { R_PARISC_LTOFF_FPTR14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00185     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14R", FALSE, 0, 0, FALSE },
00186   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00187     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00188   /* 64 */
00189   { R_PARISC_FPTR64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
00190     bfd_elf_generic_reloc, "R_PARISC_FPTR64", FALSE, 0, 0, FALSE },
00191   { R_PARISC_PLABEL32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
00192     bfd_elf_generic_reloc, "R_PARISC_PLABEL32", FALSE, 0, 0, FALSE },
00193   { R_PARISC_PLABEL21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
00194     bfd_elf_generic_reloc, "R_PARISC_PLABEL21L", FALSE, 0, 0, FALSE },
00195   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00196     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00197   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00198     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00199   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00200     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00201   { R_PARISC_PLABEL14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00202     bfd_elf_generic_reloc, "R_PARISC_PLABEL14R", FALSE, 0, 0, FALSE },
00203   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00204     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00205   /* 72 */
00206   { R_PARISC_PCREL64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
00207     bfd_elf_generic_reloc, "R_PARISC_PCREL64", FALSE, 0, 0, FALSE },
00208   { R_PARISC_PCREL22C, 0, 2, 22, FALSE, 0, complain_overflow_bitfield,
00209     bfd_elf_generic_reloc, "R_PARISC_PCREL22C", FALSE, 0, 0, FALSE },
00210   { R_PARISC_PCREL22F, 0, 2, 22, FALSE, 0, complain_overflow_bitfield,
00211     bfd_elf_generic_reloc, "R_PARISC_PCREL22F", FALSE, 0, 0, FALSE },
00212   { R_PARISC_PCREL14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00213     bfd_elf_generic_reloc, "R_PARISC_PCREL14WR", FALSE, 0, 0, FALSE },
00214   { R_PARISC_PCREL14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00215     bfd_elf_generic_reloc, "R_PARISC_PCREL14DR", FALSE, 0, 0, FALSE },
00216   { R_PARISC_PCREL16F, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00217     bfd_elf_generic_reloc, "R_PARISC_PCREL16F", FALSE, 0, 0, FALSE },
00218   { R_PARISC_PCREL16WF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00219     bfd_elf_generic_reloc, "R_PARISC_PCREL16WF", FALSE, 0, 0, FALSE },
00220   { R_PARISC_PCREL16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00221     bfd_elf_generic_reloc, "R_PARISC_PCREL16DF", FALSE, 0, 0, FALSE },
00222   /* 80 */
00223   { R_PARISC_DIR64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
00224     bfd_elf_generic_reloc, "R_PARISC_DIR64", FALSE, 0, 0, FALSE },
00225   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00226     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00227   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00228     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00229   { R_PARISC_DIR14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00230     bfd_elf_generic_reloc, "R_PARISC_DIR14WR", FALSE, 0, 0, FALSE },
00231   { R_PARISC_DIR14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00232     bfd_elf_generic_reloc, "R_PARISC_DIR14DR", FALSE, 0, 0, FALSE },
00233   { R_PARISC_DIR16F, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00234     bfd_elf_generic_reloc, "R_PARISC_DIR16F", FALSE, 0, 0, FALSE },
00235   { R_PARISC_DIR16WF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00236     bfd_elf_generic_reloc, "R_PARISC_DIR16WF", FALSE, 0, 0, FALSE },
00237   { R_PARISC_DIR16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00238     bfd_elf_generic_reloc, "R_PARISC_DIR16DF", FALSE, 0, 0, FALSE },
00239   /* 88 */
00240   { R_PARISC_GPREL64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
00241     bfd_elf_generic_reloc, "R_PARISC_GPREL64", FALSE, 0, 0, FALSE },
00242   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00243     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00244   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00245     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00246   { R_PARISC_DLTREL14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00247     bfd_elf_generic_reloc, "R_PARISC_DLTREL14WR", FALSE, 0, 0, FALSE },
00248   { R_PARISC_DLTREL14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00249     bfd_elf_generic_reloc, "R_PARISC_DLTREL14DR", FALSE, 0, 0, FALSE },
00250   { R_PARISC_GPREL16F, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00251     bfd_elf_generic_reloc, "R_PARISC_GPREL16F", FALSE, 0, 0, FALSE },
00252   { R_PARISC_GPREL16WF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00253     bfd_elf_generic_reloc, "R_PARISC_GPREL16WF", FALSE, 0, 0, FALSE },
00254   { R_PARISC_GPREL16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00255     bfd_elf_generic_reloc, "R_PARISC_GPREL16DF", FALSE, 0, 0, FALSE },
00256   /* 96 */
00257   { R_PARISC_LTOFF64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
00258     bfd_elf_generic_reloc, "R_PARISC_LTOFF64", FALSE, 0, 0, FALSE },
00259   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00260     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00261   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00262     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00263   { R_PARISC_DLTIND14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00264     bfd_elf_generic_reloc, "R_PARISC_DLTIND14WR", FALSE, 0, 0, FALSE },
00265   { R_PARISC_DLTIND14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00266     bfd_elf_generic_reloc, "R_PARISC_DLTIND14DR", FALSE, 0, 0, FALSE },
00267   { R_PARISC_LTOFF16F, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00268     bfd_elf_generic_reloc, "R_PARISC_LTOFF16F", FALSE, 0, 0, FALSE },
00269   { R_PARISC_LTOFF16WF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00270     bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", FALSE, 0, 0, FALSE },
00271   { R_PARISC_LTOFF16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00272     bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", FALSE, 0, 0, FALSE },
00273   /* 104 */
00274   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00275     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00276   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00277     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00278   { R_PARISC_BASEREL14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00279     bfd_elf_generic_reloc, "R_PARISC_BASEREL14WR", FALSE, 0, 0, FALSE },
00280   { R_PARISC_BASEREL14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00281     bfd_elf_generic_reloc, "R_PARISC_BASEREL14DR", FALSE, 0, 0, FALSE },
00282   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00283     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00284   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00285     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00286   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00287     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00288   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00289     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00290   /* 112 */
00291   { R_PARISC_SEGREL64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
00292     bfd_elf_generic_reloc, "R_PARISC_SEGREL64", FALSE, 0, 0, FALSE },
00293   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00294     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00295   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00296     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00297   { R_PARISC_PLTOFF14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00298     bfd_elf_generic_reloc, "R_PARISC_PLTOFF14WR", FALSE, 0, 0, FALSE },
00299   { R_PARISC_PLTOFF14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00300     bfd_elf_generic_reloc, "R_PARISC_PLTOFF14DR", FALSE, 0, 0, FALSE },
00301   { R_PARISC_PLTOFF16F, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00302     bfd_elf_generic_reloc, "R_PARISC_PLTOFF16F", FALSE, 0, 0, FALSE },
00303   { R_PARISC_PLTOFF16WF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00304     bfd_elf_generic_reloc, "R_PARISC_PLTOFF16WF", FALSE, 0, 0, FALSE },
00305   { R_PARISC_PLTOFF16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00306     bfd_elf_generic_reloc, "R_PARISC_PLTOFF16DF", FALSE, 0, 0, FALSE },
00307   /* 120 */
00308   { R_PARISC_LTOFF_FPTR64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
00309     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00310   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00311     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00312   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00313     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00314   { R_PARISC_LTOFF_FPTR14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00315     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14WR", FALSE, 0, 0, FALSE },
00316   { R_PARISC_LTOFF_FPTR14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00317     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14DR", FALSE, 0, 0, FALSE },
00318   { R_PARISC_LTOFF_FPTR16F, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00319     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16F", FALSE, 0, 0, FALSE },
00320   { R_PARISC_LTOFF_FPTR16WF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00321     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16WF", FALSE, 0, 0, FALSE },
00322   { R_PARISC_LTOFF_FPTR16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00323     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00324   /* 128 */
00325   { R_PARISC_COPY, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00326     bfd_elf_generic_reloc, "R_PARISC_COPY", FALSE, 0, 0, FALSE },
00327   { R_PARISC_IPLT, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00328     bfd_elf_generic_reloc, "R_PARISC_IPLT", FALSE, 0, 0, FALSE },
00329   { R_PARISC_EPLT, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00330     bfd_elf_generic_reloc, "R_PARISC_EPLT", FALSE, 0, 0, FALSE },
00331   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00332     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00333   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00334     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00335   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00336     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00337   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00338     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00339   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00340     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00341   /* 136 */
00342   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00343     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00344   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00345     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00346   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00347     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00348   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00349     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00350   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00351     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00352   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00353     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00354   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00355     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00356   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00357     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00358   /* 144 */
00359   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00360     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00361   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00362     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00363   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00364     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00365   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00366     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00367   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00368     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00369   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00370     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00371   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00372     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00373   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00374     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00375   /* 152 */
00376   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00377     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00378   { R_PARISC_TPREL32, 0, 2, 32, FALSE, 0, complain_overflow_dont,
00379     bfd_elf_generic_reloc, "R_PARISC_TPREL32", FALSE, 0, 0, FALSE },
00380   { R_PARISC_TPREL21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
00381     bfd_elf_generic_reloc, "R_PARISC_TPREL21L", FALSE, 0, 0, FALSE },
00382   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00383     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00384   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00385     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00386   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00387     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00388   { R_PARISC_TPREL14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00389     bfd_elf_generic_reloc, "R_PARISC_TPREL14R", FALSE, 0, 0, FALSE },
00390   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00391     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00392   /* 160 */
00393   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00394     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00395   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00396     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00397   { R_PARISC_LTOFF_TP21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
00398     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP21L", FALSE, 0, 0, FALSE },
00399   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00400     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00401   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00402     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00403   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00404     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00405   { R_PARISC_LTOFF_TP14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00406     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14R", FALSE, 0, 0, FALSE },
00407   { R_PARISC_LTOFF_TP14F, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00408     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14F", FALSE, 0, 0, FALSE },
00409   /* 168 */
00410   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00411     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00412   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00413     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00414   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00415     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00416   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00417     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00418   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00419     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00420   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00421     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00422   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00423     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00424   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00425     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00426   /* 176 */
00427   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00428     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00429   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00430     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00431   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00432     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00433   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00434     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00435   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00436     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00437   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00438     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00439   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00440     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00441   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00442     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00443   /* 184 */
00444   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00445     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00446   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00447     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00448   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00449     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00450   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00451     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00452   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00453     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00454   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00455     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00456   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00457     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00458   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00459     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00460   /* 192 */
00461   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00462     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00463   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00464     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00465   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00466     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00467   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00468     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00469   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00470     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00471   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00472     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00473   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00474     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00475   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00476     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00477   /* 200 */
00478   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00479     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00480   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00481     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00482   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00483     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00484   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00485     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00486   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00487     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00488   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00489     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00490   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00491     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00492   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00493     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00494   /* 208 */
00495   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00496     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00497   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00498     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00499   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00500     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00501   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00502     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00503   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00504     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00505   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00506     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00507   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00508     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00509   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00510     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00511   /* 216 */
00512   { R_PARISC_TPREL64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
00513     bfd_elf_generic_reloc, "R_PARISC_TPREL64", FALSE, 0, 0, FALSE },
00514   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00515     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00516   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00517     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00518   { R_PARISC_TPREL14WR, 0, 2, 14, FALSE, 0, complain_overflow_dont,
00519     bfd_elf_generic_reloc, "R_PARISC_TPREL14WR", FALSE, 0, 0, FALSE },
00520   { R_PARISC_TPREL14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00521     bfd_elf_generic_reloc, "R_PARISC_TPREL14DR", FALSE, 0, 0, FALSE },
00522   { R_PARISC_TPREL16F, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00523     bfd_elf_generic_reloc, "R_PARISC_TPREL16F", FALSE, 0, 0, FALSE },
00524   { R_PARISC_TPREL16WF, 0, 2, 16, FALSE, 0, complain_overflow_dont,
00525     bfd_elf_generic_reloc, "R_PARISC_TPREL16WF", FALSE, 0, 0, FALSE },
00526   { R_PARISC_TPREL16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00527     bfd_elf_generic_reloc, "R_PARISC_TPREL16DF", FALSE, 0, 0, FALSE },
00528   /* 224 */
00529   { R_PARISC_LTOFF_TP64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
00530     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP64", FALSE, 0, 0, FALSE },
00531   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00532     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00533   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
00534     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
00535   { R_PARISC_LTOFF_TP14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00536     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14WR", FALSE, 0, 0, FALSE },
00537   { R_PARISC_LTOFF_TP14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00538     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14DR", FALSE, 0, 0, FALSE },
00539   { R_PARISC_LTOFF_TP16F, 0, 2, 16, FALSE, 0, complain_overflow_dont,
00540     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16F", FALSE, 0, 0, FALSE },
00541   { R_PARISC_LTOFF_TP16WF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00542     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16WF", FALSE, 0, 0, FALSE },
00543   { R_PARISC_LTOFF_TP16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
00544     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16DF", FALSE, 0, 0, FALSE },
00545   /* 232 */
00546   { R_PARISC_GNU_VTENTRY, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00547     bfd_elf_generic_reloc, "R_PARISC_GNU_VTENTRY", FALSE, 0, 0, FALSE },
00548   { R_PARISC_GNU_VTINHERIT, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00549     bfd_elf_generic_reloc, "R_PARISC_GNU_VTINHERIT", FALSE, 0, 0, FALSE },
00550   { R_PARISC_TLS_GD21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
00551     bfd_elf_generic_reloc, "R_PARISC_TLS_GD21L", FALSE, 0, 0, FALSE },
00552   { R_PARISC_TLS_GD14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00553     bfd_elf_generic_reloc, "R_PARISC_TLS_GD14R", FALSE, 0, 0, FALSE },
00554   { R_PARISC_TLS_GDCALL, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00555     bfd_elf_generic_reloc, "R_PARISC_TLS_GDCALL", FALSE, 0, 0, FALSE },
00556   { R_PARISC_TLS_LDM21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
00557     bfd_elf_generic_reloc, "R_PARISC_TLS_LDM21L", FALSE, 0, 0, FALSE },
00558   { R_PARISC_TLS_LDM14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00559     bfd_elf_generic_reloc, "R_PARISC_TLS_LDM14R", FALSE, 0, 0, FALSE },
00560   { R_PARISC_TLS_LDMCALL, 0, 0, 0, FALSE, 0, complain_overflow_dont,
00561     bfd_elf_generic_reloc, "R_PARISC_TLS_LDMCALL", FALSE, 0, 0, FALSE },
00562   /* 240 */
00563   { R_PARISC_TLS_LDO21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
00564     bfd_elf_generic_reloc, "R_PARISC_TLS_LDO21L", FALSE, 0, 0, FALSE },
00565   { R_PARISC_TLS_LDO14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
00566     bfd_elf_generic_reloc, "R_PARISC_TLS_LDO14R", FALSE, 0, 0, FALSE },
00567   { R_PARISC_TLS_DTPMOD32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
00568     bfd_elf_generic_reloc, "R_PARISC_TLS_DTPMOD32", FALSE, 0, 0, FALSE },
00569   { R_PARISC_TLS_DTPMOD64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
00570     bfd_elf_generic_reloc, "R_PARISC_TLS_DTPMOD64", FALSE, 0, 0, FALSE },
00571   { R_PARISC_TLS_DTPOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
00572     bfd_elf_generic_reloc, "R_PARISC_TLS_DTPOFF32", FALSE, 0, 0, FALSE },
00573   { R_PARISC_TLS_DTPOFF64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
00574     bfd_elf_generic_reloc, "R_PARISC_TLS_DTPOFF64", FALSE, 0, 0, FALSE },
00575 };
00576 
00577 #define OFFSET_14R_FROM_21L 4
00578 #define OFFSET_14F_FROM_21L 5
00579 
00580 /* Return the final relocation type for the given base type, instruction
00581    format, and field selector.  */
00582 
00583 elf_hppa_reloc_type
00584 elf_hppa_reloc_final_type (bfd *abfd,
00585                         elf_hppa_reloc_type base_type,
00586                         int format,
00587                         unsigned int field)
00588 {
00589   elf_hppa_reloc_type final_type = base_type;
00590 
00591   /* Just a tangle of nested switch statements to deal with the braindamage
00592      that a different field selector means a completely different relocation
00593      for PA ELF.  */
00594   switch (base_type)
00595     {
00596       /* We have been using generic relocation types.  However, that may not
00597         really make sense.  Anyway, we need to support both R_PARISC_DIR64
00598         and R_PARISC_DIR32 here.  */
00599     case R_PARISC_DIR32:
00600     case R_PARISC_DIR64:
00601     case R_HPPA_ABS_CALL:
00602       switch (format)
00603        {
00604        case 14:
00605          switch (field)
00606            {
00607            case e_fsel:
00608              final_type = R_PARISC_DIR14F;
00609              break;
00610            case e_rsel:
00611            case e_rrsel:
00612            case e_rdsel:
00613              final_type = R_PARISC_DIR14R;
00614              break;
00615            case e_rtsel:
00616              final_type = R_PARISC_DLTIND14R;
00617              break;
00618            case e_rtpsel:
00619              final_type = R_PARISC_LTOFF_FPTR14DR;
00620              break;
00621            case e_tsel:
00622              final_type = R_PARISC_DLTIND14F;
00623              break;
00624            case e_rpsel:
00625              final_type = R_PARISC_PLABEL14R;
00626              break;
00627            default:
00628              return R_PARISC_NONE;
00629            }
00630          break;
00631 
00632        case 17:
00633          switch (field)
00634            {
00635            case e_fsel:
00636              final_type = R_PARISC_DIR17F;
00637              break;
00638            case e_rsel:
00639            case e_rrsel:
00640            case e_rdsel:
00641              final_type = R_PARISC_DIR17R;
00642              break;
00643            default:
00644              return R_PARISC_NONE;
00645            }
00646          break;
00647 
00648        case 21:
00649          switch (field)
00650            {
00651            case e_lsel:
00652            case e_lrsel:
00653            case e_ldsel:
00654            case e_nlsel:
00655            case e_nlrsel:
00656              final_type = R_PARISC_DIR21L;
00657              break;
00658            case e_ltsel:
00659              final_type = R_PARISC_DLTIND21L;
00660              break;
00661            case e_ltpsel:
00662              final_type = R_PARISC_LTOFF_FPTR21L;
00663              break;
00664            case e_lpsel:
00665              final_type = R_PARISC_PLABEL21L;
00666              break;
00667            default:
00668              return R_PARISC_NONE;
00669            }
00670          break;
00671 
00672        case 32:
00673          switch (field)
00674            {
00675            case e_fsel:
00676              final_type = R_PARISC_DIR32;
00677              /* When in 64bit mode, a 32bit relocation is supposed to
00678                be a section relative relocation.  Dwarf2 (for example)
00679                uses 32bit section relative relocations.  */
00680              if (bfd_get_arch_info (abfd)->bits_per_address != 32)
00681               final_type = R_PARISC_SECREL32;
00682              break;
00683            case e_psel:
00684              final_type = R_PARISC_PLABEL32;
00685              break;
00686            default:
00687              return R_PARISC_NONE;
00688            }
00689          break;
00690 
00691        case 64:
00692          switch (field)
00693            {
00694            case e_fsel:
00695              final_type = R_PARISC_DIR64;
00696              break;
00697            case e_psel:
00698              final_type = R_PARISC_FPTR64;
00699              break;
00700            default:
00701              return R_PARISC_NONE;
00702            }
00703          break;
00704 
00705        default:
00706          return R_PARISC_NONE;
00707        }
00708       break;
00709 
00710     case R_HPPA_GOTOFF:
00711       switch (format)
00712        {
00713        case 14:
00714          switch (field)
00715            {
00716            case e_rsel:
00717            case e_rrsel:
00718            case e_rdsel:
00719              /* R_PARISC_DLTREL14R for elf64, R_PARISC_DPREL14R for elf32.  */
00720              final_type = base_type + OFFSET_14R_FROM_21L;
00721              break;
00722            case e_fsel:
00723              /* R_PARISC_DLTREL14F for elf64, R_PARISC_DPREL14F for elf32.  */
00724              final_type = base_type + OFFSET_14F_FROM_21L;
00725              break;
00726            default:
00727              return R_PARISC_NONE;
00728            }
00729          break;
00730 
00731        case 21:
00732          switch (field)
00733            {
00734            case e_lsel:
00735            case e_lrsel:
00736            case e_ldsel:
00737            case e_nlsel:
00738            case e_nlrsel:
00739              /* R_PARISC_DLTREL21L for elf64, R_PARISC_DPREL21L for elf32.  */
00740              final_type = base_type;
00741              break;
00742            default:
00743              return R_PARISC_NONE;
00744            }
00745          break;
00746 
00747        default:
00748          return R_PARISC_NONE;
00749        }
00750       break;
00751 
00752     case R_HPPA_PCREL_CALL:
00753       switch (format)
00754        {
00755        case 12:
00756          switch (field)
00757            {
00758            case e_fsel:
00759              final_type = R_PARISC_PCREL12F;
00760              break;
00761            default:
00762              return R_PARISC_NONE;
00763            }
00764          break;
00765 
00766        case 14:
00767          /* Contrary to appearances, these are not calls of any sort.
00768             Rather, they are loads/stores with a pcrel reloc.  */
00769          switch (field)
00770            {
00771            case e_rsel:
00772            case e_rrsel:
00773            case e_rdsel:
00774              final_type = R_PARISC_PCREL14R;
00775              break;
00776            case e_fsel:
00777              if (bfd_get_mach (abfd) < 25)
00778               final_type = R_PARISC_PCREL14F;
00779              else
00780               final_type = R_PARISC_PCREL16F;
00781              break;
00782            default:
00783              return R_PARISC_NONE;
00784            }
00785          break;
00786 
00787        case 17:
00788          switch (field)
00789            {
00790            case e_rsel:
00791            case e_rrsel:
00792            case e_rdsel:
00793              final_type = R_PARISC_PCREL17R;
00794              break;
00795            case e_fsel:
00796              final_type = R_PARISC_PCREL17F;
00797              break;
00798            default:
00799              return R_PARISC_NONE;
00800            }
00801          break;
00802 
00803        case 21:
00804          switch (field)
00805            {
00806            case e_lsel:
00807            case e_lrsel:
00808            case e_ldsel:
00809            case e_nlsel:
00810            case e_nlrsel:
00811              final_type = R_PARISC_PCREL21L;
00812              break;
00813            default:
00814              return R_PARISC_NONE;
00815            }
00816          break;
00817 
00818        case 22:
00819          switch (field)
00820            {
00821            case e_fsel:
00822              final_type = R_PARISC_PCREL22F;
00823              break;
00824            default:
00825              return R_PARISC_NONE;
00826            }
00827          break;
00828 
00829        case 32:
00830          switch (field)
00831            {
00832            case e_fsel:
00833              final_type = R_PARISC_PCREL32;
00834              break;
00835            default:
00836              return R_PARISC_NONE;
00837            }
00838          break;
00839 
00840        case 64:
00841          switch (field)
00842            {
00843            case e_fsel:
00844              final_type = R_PARISC_PCREL64;
00845              break;
00846            default:
00847              return R_PARISC_NONE;
00848            }
00849          break;
00850 
00851        default:
00852          return R_PARISC_NONE;
00853        }
00854       break;
00855 
00856     case R_PARISC_TLS_GD21L:
00857       switch (field)
00858        {
00859          case e_ltsel:
00860          case e_lrsel:
00861            final_type = R_PARISC_TLS_GD21L;
00862            break;
00863          case e_rtsel:
00864          case e_rrsel:
00865            final_type = R_PARISC_TLS_GD14R;
00866            break;
00867          default:
00868            return R_PARISC_NONE;
00869        }
00870       break;
00871 
00872     case R_PARISC_TLS_LDM21L:
00873       switch (field)
00874        {
00875          case e_ltsel:
00876          case e_lrsel:
00877            final_type = R_PARISC_TLS_LDM21L;
00878            break;
00879          case e_rtsel:
00880          case e_rrsel:
00881            final_type = R_PARISC_TLS_LDM14R;
00882            break;
00883          default:
00884            return R_PARISC_NONE;
00885        }
00886       break;
00887 
00888     case R_PARISC_TLS_LDO21L:
00889       switch (field)
00890        {
00891          case e_lrsel:
00892            final_type = R_PARISC_TLS_LDO21L;
00893            break;
00894          case e_rrsel:
00895            final_type = R_PARISC_TLS_LDO14R;
00896            break;
00897          default:
00898            return R_PARISC_NONE;
00899        }
00900       break;
00901 
00902     case R_PARISC_TLS_IE21L:
00903       switch (field)
00904        {
00905          case e_ltsel:
00906          case e_lrsel:
00907            final_type = R_PARISC_TLS_IE21L;
00908            break;
00909          case e_rtsel:
00910          case e_rrsel:
00911            final_type = R_PARISC_TLS_IE14R;
00912            break;
00913          default:
00914            return R_PARISC_NONE;
00915        }
00916       break;
00917 
00918     case R_PARISC_TLS_LE21L:
00919       switch (field)
00920        {
00921          case e_lrsel:
00922            final_type = R_PARISC_TLS_LE21L;
00923            break;
00924          case e_rrsel:
00925            final_type = R_PARISC_TLS_LE14R;
00926            break;
00927          default:
00928            return R_PARISC_NONE;
00929        }
00930       break;
00931 
00932     case R_PARISC_GNU_VTENTRY:
00933     case R_PARISC_GNU_VTINHERIT:
00934     case R_PARISC_SEGREL32:
00935     case R_PARISC_SEGBASE:
00936       /* The defaults are fine for these cases.  */
00937       break;
00938 
00939     default:
00940       return R_PARISC_NONE;
00941     }
00942 
00943   return final_type;
00944 }
00945 
00946 /* Return one (or more) BFD relocations which implement the base
00947    relocation with modifications based on format and field.  */
00948 
00949 elf_hppa_reloc_type **
00950 _bfd_elf_hppa_gen_reloc_type (bfd *abfd,
00951                            elf_hppa_reloc_type base_type,
00952                            int format,
00953                            unsigned int field,
00954                            int ignore ATTRIBUTE_UNUSED,
00955                            asymbol *sym ATTRIBUTE_UNUSED)
00956 {
00957   elf_hppa_reloc_type *finaltype;
00958   elf_hppa_reloc_type **final_types;
00959   bfd_size_type amt = sizeof (elf_hppa_reloc_type *) * 2;
00960 
00961   /* Allocate slots for the BFD relocation.  */
00962   final_types = bfd_alloc (abfd, amt);
00963   if (final_types == NULL)
00964     return NULL;
00965 
00966   /* Allocate space for the relocation itself.  */
00967   amt = sizeof (elf_hppa_reloc_type);
00968   finaltype = bfd_alloc (abfd, amt);
00969   if (finaltype == NULL)
00970     return NULL;
00971 
00972   /* Some reasonable defaults.  */
00973   final_types[0] = finaltype;
00974   final_types[1] = NULL;
00975 
00976   *finaltype = elf_hppa_reloc_final_type (abfd, base_type, format, field);
00977 
00978   return final_types;
00979 }
00980 
00981 /* Translate from an elf into field into a howto relocation pointer.  */
00982 
00983 static void
00984 elf_hppa_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
00985                      arelent *bfd_reloc,
00986                      Elf_Internal_Rela *elf_reloc)
00987 {
00988   BFD_ASSERT (ELF_R_TYPE (elf_reloc->r_info)
00989              < (unsigned int) R_PARISC_UNIMPLEMENTED);
00990   bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
00991 }
00992 
00993 /* Translate from an elf into field into a howto relocation pointer.  */
00994 
00995 static void
00996 elf_hppa_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
00997                          arelent *bfd_reloc,
00998                          Elf_Internal_Rela *elf_reloc)
00999 {
01000   BFD_ASSERT (ELF_R_TYPE (elf_reloc->r_info)
01001              < (unsigned int) R_PARISC_UNIMPLEMENTED);
01002   bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
01003 }
01004 
01005 /* Return the address of the howto table entry to perform the CODE
01006    relocation for an ARCH machine.  */
01007 
01008 static reloc_howto_type *
01009 elf_hppa_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
01010                          bfd_reloc_code_real_type code)
01011 {
01012   if ((int) code < (int) R_PARISC_UNIMPLEMENTED)
01013     {
01014       BFD_ASSERT ((int) elf_hppa_howto_table[(int) code].type == (int) code);
01015       return &elf_hppa_howto_table[(int) code];
01016     }
01017   return NULL;
01018 }
01019 
01020 static reloc_howto_type *
01021 elf_hppa_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
01022                          const char *r_name)
01023 {
01024   unsigned int i;
01025 
01026   for (i = 0;
01027        i < sizeof (elf_hppa_howto_table) / sizeof (elf_hppa_howto_table[0]);
01028        i++)
01029     if (elf_hppa_howto_table[i].name != NULL
01030        && strcasecmp (elf_hppa_howto_table[i].name, r_name) == 0)
01031       return &elf_hppa_howto_table[i];
01032 
01033   return NULL;
01034 }
01035 
01036 /* Return TRUE if SYM represents a local label symbol.  */
01037 
01038 static bfd_boolean
01039 elf_hppa_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name)
01040 {
01041   if (name[0] == 'L' && name[1] == '$')
01042     return TRUE;
01043   return _bfd_elf_is_local_label_name (abfd, name);
01044 }
01045 
01046 /* Set the correct type for an ELF section.  We do this by the
01047    section name, which is a hack, but ought to work.  */
01048 
01049 static bfd_boolean
01050 elf_hppa_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
01051 {
01052   const char *name;
01053 
01054   name = bfd_get_section_name (abfd, sec);
01055 
01056   if (strcmp (name, ".PARISC.unwind") == 0)
01057     {
01058       int indx;
01059       asection *asec;
01060 
01061 #if ARCH_SIZE == 64
01062       hdr->sh_type = SHT_LOPROC + 1;
01063 #else
01064       hdr->sh_type = 1;
01065 #endif
01066       /* ?!? How are unwinds supposed to work for symbols in arbitrary
01067         sections?  Or what if we have multiple .text sections in a single
01068         .o file?  HP really messed up on this one.
01069 
01070         Ugh.  We can not use elf_section_data (sec)->this_idx at this
01071         point because it is not initialized yet.
01072 
01073         So we (gasp) recompute it here.  Hopefully nobody ever changes the
01074         way sections are numbered in elf.c!  */
01075       for (asec = abfd->sections, indx = 1; asec; asec = asec->next, indx++)
01076        {
01077          if (asec->name && strcmp (asec->name, ".text") == 0)
01078            {
01079              hdr->sh_info = indx;
01080              break;
01081            }
01082        }
01083 
01084       /* I have no idea if this is really necessary or what it means.  */
01085       hdr->sh_entsize = 4;
01086     }
01087   return TRUE;
01088 }
01089 
01090 static void
01091 elf_hppa_final_write_processing (bfd *abfd,
01092                              bfd_boolean linker ATTRIBUTE_UNUSED)
01093 {
01094   int mach = bfd_get_mach (abfd);
01095 
01096   elf_elfheader (abfd)->e_flags &= ~(EF_PARISC_ARCH | EF_PARISC_TRAPNIL
01097                                  | EF_PARISC_EXT | EF_PARISC_LSB
01098                                  | EF_PARISC_WIDE | EF_PARISC_NO_KABP
01099                                  | EF_PARISC_LAZYSWAP);
01100 
01101   if (mach == 10)
01102     elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_0;
01103   else if (mach == 11)
01104     elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_1;
01105   else if (mach == 20)
01106     elf_elfheader (abfd)->e_flags |= EFA_PARISC_2_0;
01107   else if (mach == 25)
01108     elf_elfheader (abfd)->e_flags |= (EF_PARISC_WIDE
01109                                   | EFA_PARISC_2_0
01110                                   /* The GNU tools have trapped without
01111                                     option since 1993, so need to take
01112                                     a step backwards with the ELF
01113                                     based toolchains.  */
01114                                   | EF_PARISC_TRAPNIL);
01115 }
01116 
01117 /* Comparison function for qsort to sort unwind section during a
01118    final link.  */
01119 
01120 static int
01121 hppa_unwind_entry_compare (const void *a, const void *b)
01122 {
01123   const bfd_byte *ap, *bp;
01124   unsigned long av, bv;
01125 
01126   ap = a;
01127   av = (unsigned long) ap[0] << 24;
01128   av |= (unsigned long) ap[1] << 16;
01129   av |= (unsigned long) ap[2] << 8;
01130   av |= (unsigned long) ap[3];
01131 
01132   bp = b;
01133   bv = (unsigned long) bp[0] << 24;
01134   bv |= (unsigned long) bp[1] << 16;
01135   bv |= (unsigned long) bp[2] << 8;
01136   bv |= (unsigned long) bp[3];
01137 
01138   return av < bv ? -1 : av > bv ? 1 : 0;
01139 }
01140 
01141 static bfd_boolean
01142 elf_hppa_sort_unwind (bfd *abfd)
01143 {
01144   asection *s;
01145 
01146   /* Magic section names, but this is much safer than having
01147      relocate_section remember where SEGREL32 relocs occurred.
01148      Consider what happens if someone inept creates a linker script
01149      that puts unwind information in .text.  */
01150   s = bfd_get_section_by_name (abfd, ".PARISC.unwind");
01151   if (s != NULL)
01152     {
01153       bfd_size_type size;
01154       bfd_byte *contents;
01155 
01156       if (!bfd_malloc_and_get_section (abfd, s, &contents))
01157        return FALSE;
01158 
01159       size = s->size;
01160       qsort (contents, (size_t) (size / 16), 16, hppa_unwind_entry_compare);
01161 
01162       if (! bfd_set_section_contents (abfd, s, contents, (file_ptr) 0, size))
01163        return FALSE;
01164     }
01165 
01166   return TRUE;
01167 }
01168 
01169 /* What to do when ld finds relocations against symbols defined in
01170    discarded sections.  */
01171 
01172 static unsigned int
01173 elf_hppa_action_discarded (asection *sec)
01174 {
01175   if (strcmp (".PARISC.unwind", sec->name) == 0)
01176     return 0;
01177 
01178   return _bfd_elf_default_action_discarded (sec);
01179 }
01180 
01181 #if ARCH_SIZE == 64
01182 /* Hook called by the linker routine which adds symbols from an object
01183    file.  HP's libraries define symbols with HP specific section
01184    indices, which we have to handle.  */
01185 
01186 static bfd_boolean
01187 elf_hppa_add_symbol_hook (bfd *abfd,
01188                        struct bfd_link_info *info ATTRIBUTE_UNUSED,
01189                        Elf_Internal_Sym *sym,
01190                        const char **namep ATTRIBUTE_UNUSED,
01191                        flagword *flagsp ATTRIBUTE_UNUSED,
01192                        asection **secp,
01193                        bfd_vma *valp)
01194 {
01195   int index = sym->st_shndx;
01196 
01197   switch (index)
01198     {
01199     case SHN_PARISC_ANSI_COMMON:
01200       *secp = bfd_make_section_old_way (abfd, ".PARISC.ansi.common");
01201       (*secp)->flags |= SEC_IS_COMMON;
01202       *valp = sym->st_size;
01203       break;
01204 
01205     case SHN_PARISC_HUGE_COMMON:
01206       *secp = bfd_make_section_old_way (abfd, ".PARISC.huge.common");
01207       (*secp)->flags |= SEC_IS_COMMON;
01208       *valp = sym->st_size;
01209       break;
01210     }
01211 
01212   return TRUE;
01213 }
01214 
01215 static bfd_boolean
01216 elf_hppa_unmark_useless_dynamic_symbols (struct elf_link_hash_entry *h,
01217                                     void *data)
01218 {
01219   struct bfd_link_info *info = data;
01220 
01221   if (h->root.type == bfd_link_hash_warning)
01222     h = (struct elf_link_hash_entry *) h->root.u.i.link;
01223 
01224   /* If we are not creating a shared library, and this symbol is
01225      referenced by a shared library but is not defined anywhere, then
01226      the generic code will warn that it is undefined.
01227 
01228      This behavior is undesirable on HPs since the standard shared
01229      libraries contain references to undefined symbols.
01230 
01231      So we twiddle the flags associated with such symbols so that they
01232      will not trigger the warning.  ?!? FIXME.  This is horribly fragile.
01233 
01234      Ultimately we should have better controls over the generic ELF BFD
01235      linker code.  */
01236   if (! info->relocatable
01237       && info->unresolved_syms_in_shared_libs != RM_IGNORE
01238       && h->root.type == bfd_link_hash_undefined
01239       && h->ref_dynamic
01240       && !h->ref_regular)
01241     {
01242       h->ref_dynamic = 0;
01243       h->pointer_equality_needed = 1;
01244     }
01245 
01246   return TRUE;
01247 }
01248 
01249 static bfd_boolean
01250 elf_hppa_remark_useless_dynamic_symbols (struct elf_link_hash_entry *h,
01251                                     void *data)
01252 {
01253   struct bfd_link_info *info = data;
01254 
01255   if (h->root.type == bfd_link_hash_warning)
01256     h = (struct elf_link_hash_entry *) h->root.u.i.link;
01257 
01258   /* If we are not creating a shared library, and this symbol is
01259      referenced by a shared library but is not defined anywhere, then
01260      the generic code will warn that it is undefined.
01261 
01262      This behavior is undesirable on HPs since the standard shared
01263      libraries contain references to undefined symbols.
01264 
01265      So we twiddle the flags associated with such symbols so that they
01266      will not trigger the warning.  ?!? FIXME.  This is horribly fragile.
01267 
01268      Ultimately we should have better controls over the generic ELF BFD
01269      linker code.  */
01270   if (! info->relocatable
01271       && info->unresolved_syms_in_shared_libs != RM_IGNORE
01272       && h->root.type == bfd_link_hash_undefined
01273       && !h->ref_dynamic
01274       && !h->ref_regular
01275       && h->pointer_equality_needed)
01276     {
01277       h->ref_dynamic = 1;
01278       h->pointer_equality_needed = 0;
01279     }
01280 
01281   return TRUE;
01282 }
01283 
01284 static bfd_boolean
01285 elf_hppa_is_dynamic_loader_symbol (const char *name)
01286 {
01287   return (! strcmp (name, "__CPU_REVISION")
01288          || ! strcmp (name, "__CPU_KEYBITS_1")
01289          || ! strcmp (name, "__SYSTEM_ID_D")
01290          || ! strcmp (name, "__FPU_MODEL")
01291          || ! strcmp (name, "__FPU_REVISION")
01292          || ! strcmp (name, "__ARGC")
01293          || ! strcmp (name, "__ARGV")
01294          || ! strcmp (name, "__ENVP")
01295          || ! strcmp (name, "__TLS_SIZE_D")
01296          || ! strcmp (name, "__LOAD_INFO")
01297          || ! strcmp (name, "__systab"));
01298 }
01299 
01300 /* Record the lowest address for the data and text segments.  */
01301 static void
01302 elf_hppa_record_segment_addrs (bfd *abfd ATTRIBUTE_UNUSED,
01303                             asection *section,
01304                             void *data)
01305 {
01306   struct elf64_hppa_link_hash_table *hppa_info;
01307   bfd_vma value;
01308 
01309   hppa_info = data;
01310 
01311   value = section->vma - section->filepos;
01312 
01313   if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
01314        == (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
01315       && value < hppa_info->text_segment_base)
01316     hppa_info->text_segment_base = value;
01317   else if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
01318            == (SEC_ALLOC | SEC_LOAD))
01319           && value < hppa_info->data_segment_base)
01320     hppa_info->data_segment_base = value;
01321 }
01322 
01323 /* Called after we have seen all the input files/sections, but before
01324    final symbol resolution and section placement has been determined.
01325 
01326    We use this hook to (possibly) provide a value for __gp, then we
01327    fall back to the generic ELF final link routine.  */
01328 
01329 static bfd_boolean
01330 elf_hppa_final_link (bfd *abfd, struct bfd_link_info *info)
01331 {
01332   bfd_boolean retval;
01333   struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
01334 
01335   if (! info->relocatable)
01336     {
01337       struct elf_link_hash_entry *gp;
01338       bfd_vma gp_val;
01339 
01340       /* The linker script defines a value for __gp iff it was referenced
01341         by one of the objects being linked.  First try to find the symbol
01342         in the hash table.  If that fails, just compute the value __gp
01343         should have had.  */
01344       gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", FALSE,
01345                              FALSE, FALSE);
01346 
01347       if (gp)
01348        {
01349 
01350          /* Adjust the value of __gp as we may want to slide it into the
01351             .plt section so that the stubs can access PLT entries without
01352             using an addil sequence.  */
01353          gp->root.u.def.value += hppa_info->gp_offset;
01354 
01355          gp_val = (gp->root.u.def.section->output_section->vma
01356                   + gp->root.u.def.section->output_offset
01357                   + gp->root.u.def.value);
01358        }
01359       else
01360        {
01361          asection *sec;
01362 
01363          /* First look for a .plt section.  If found, then __gp is the
01364             address of the .plt + gp_offset.
01365 
01366             If no .plt is found, then look for .dlt, .opd and .data (in
01367             that order) and set __gp to the base address of whichever
01368             section is found first.  */
01369 
01370          sec = hppa_info->plt_sec;
01371          if (sec && ! (sec->flags & SEC_EXCLUDE))
01372            gp_val = (sec->output_offset
01373                     + sec->output_section->vma
01374                     + hppa_info->gp_offset);
01375          else
01376            {
01377              sec = hppa_info->dlt_sec;
01378              if (!sec || (sec->flags & SEC_EXCLUDE))
01379               sec = hppa_info->opd_sec;
01380              if (!sec || (sec->flags & SEC_EXCLUDE))
01381               sec = bfd_get_section_by_name (abfd, ".data");
01382              if (!sec || (sec->flags & SEC_EXCLUDE))
01383               gp_val = 0;
01384              else
01385               gp_val = sec->output_offset + sec->output_section->vma;
01386            }
01387        }
01388 
01389       /* Install whatever value we found/computed for __gp.  */
01390       _bfd_set_gp_value (abfd, gp_val);
01391     }
01392 
01393   /* We need to know the base of the text and data segments so that we
01394      can perform SEGREL relocations.  We will record the base addresses
01395      when we encounter the first SEGREL relocation.  */
01396   hppa_info->text_segment_base = (bfd_vma)-1;
01397   hppa_info->data_segment_base = (bfd_vma)-1;
01398 
01399   /* HP's shared libraries have references to symbols that are not
01400      defined anywhere.  The generic ELF BFD linker code will complain
01401      about such symbols.
01402 
01403      So we detect the losing case and arrange for the flags on the symbol
01404      to indicate that it was never referenced.  This keeps the generic
01405      ELF BFD link code happy and appears to not create any secondary
01406      problems.  Ultimately we need a way to control the behavior of the
01407      generic ELF BFD link code better.  */
01408   elf_link_hash_traverse (elf_hash_table (info),
01409                        elf_hppa_unmark_useless_dynamic_symbols,
01410                        info);
01411 
01412   /* Invoke the regular ELF backend linker to do all the work.  */
01413   retval = bfd_elf_final_link (abfd, info);
01414 
01415   elf_link_hash_traverse (elf_hash_table (info),
01416                        elf_hppa_remark_useless_dynamic_symbols,
01417                        info);
01418 
01419   /* If we're producing a final executable, sort the contents of the
01420      unwind section. */
01421   if (retval)
01422     retval = elf_hppa_sort_unwind (abfd);
01423 
01424   return retval;
01425 }
01426 
01427 /* Relocate the given INSN.  VALUE should be the actual value we want
01428    to insert into the instruction, ie by this point we should not be
01429    concerned with computing an offset relative to the DLT, PC, etc.
01430    Instead this routine is meant to handle the bit manipulations needed
01431    to insert the relocation into the given instruction.  */
01432 
01433 static int
01434 elf_hppa_relocate_insn (int insn, int sym_value, unsigned int r_type)
01435 {
01436   switch (r_type)
01437     {
01438     /* This is any 22 bit branch.  In PA2.0 syntax it corresponds to
01439        the "B" instruction.  */
01440     case R_PARISC_PCREL22F:
01441     case R_PARISC_PCREL22C:
01442       return (insn & ~0x3ff1ffd) | re_assemble_22 (sym_value);
01443 
01444       /* This is any 12 bit branch.  */
01445     case R_PARISC_PCREL12F:
01446       return (insn & ~0x1ffd) | re_assemble_12 (sym_value);
01447 
01448     /* This is any 17 bit branch.  In PA2.0 syntax it also corresponds
01449        to the "B" instruction as well as BE.  */
01450     case R_PARISC_PCREL17F:
01451     case R_PARISC_DIR17F:
01452     case R_PARISC_DIR17R:
01453     case R_PARISC_PCREL17C:
01454     case R_PARISC_PCREL17R:
01455       return (insn & ~0x1f1ffd) | re_assemble_17 (sym_value);
01456 
01457     /* ADDIL or LDIL instructions.  */
01458     case R_PARISC_DLTREL21L:
01459     case R_PARISC_DLTIND21L:
01460     case R_PARISC_LTOFF_FPTR21L:
01461     case R_PARISC_PCREL21L:
01462     case R_PARISC_LTOFF_TP21L:
01463     case R_PARISC_DPREL21L:
01464     case R_PARISC_PLTOFF21L:
01465     case R_PARISC_DIR21L:
01466       return (insn & ~0x1fffff) | re_assemble_21 (sym_value);
01467 
01468     /* LDO and integer loads/stores with 14 bit displacements.  */
01469     case R_PARISC_DLTREL14R:
01470     case R_PARISC_DLTREL14F:
01471     case R_PARISC_DLTIND14R:
01472     case R_PARISC_DLTIND14F:
01473     case R_PARISC_LTOFF_FPTR14R:
01474     case R_PARISC_PCREL14R:
01475     case R_PARISC_PCREL14F:
01476     case R_PARISC_LTOFF_TP14R:
01477     case R_PARISC_LTOFF_TP14F:
01478     case R_PARISC_DPREL14R:
01479     case R_PARISC_DPREL14F:
01480     case R_PARISC_PLTOFF14R:
01481     case R_PARISC_PLTOFF14F:
01482     case R_PARISC_DIR14R:
01483     case R_PARISC_DIR14F:
01484       return (insn & ~0x3fff) | low_sign_unext (sym_value, 14);
01485 
01486     /* PA2.0W LDO and integer loads/stores with 16 bit displacements.  */
01487     case R_PARISC_LTOFF_FPTR16F:
01488     case R_PARISC_PCREL16F:
01489     case R_PARISC_LTOFF_TP16F:
01490     case R_PARISC_GPREL16F:
01491     case R_PARISC_PLTOFF16F:
01492     case R_PARISC_DIR16F:
01493     case R_PARISC_LTOFF16F:
01494       return (insn & ~0xffff) | re_assemble_16 (sym_value);
01495 
01496     /* Doubleword loads and stores with a 14 bit displacement.  */
01497     case R_PARISC_DLTREL14DR:
01498     case R_PARISC_DLTIND14DR:
01499     case R_PARISC_LTOFF_FPTR14DR:
01500     case R_PARISC_LTOFF_FPTR16DF:
01501     case R_PARISC_PCREL14DR:
01502     case R_PARISC_PCREL16DF:
01503     case R_PARISC_LTOFF_TP14DR:
01504     case R_PARISC_LTOFF_TP16DF:
01505     case R_PARISC_DPREL14DR:
01506     case R_PARISC_GPREL16DF:
01507     case R_PARISC_PLTOFF14DR:
01508     case R_PARISC_PLTOFF16DF:
01509     case R_PARISC_DIR14DR:
01510     case R_PARISC_DIR16DF:
01511     case R_PARISC_LTOFF16DF:
01512       return (insn & ~0x3ff1) | (((sym_value & 0x2000) >> 13)
01513                              | ((sym_value & 0x1ff8) << 1));
01514 
01515     /* Floating point single word load/store instructions.  */
01516     case R_PARISC_DLTREL14WR:
01517     case R_PARISC_DLTIND14WR:
01518     case R_PARISC_LTOFF_FPTR14WR:
01519     case R_PARISC_LTOFF_FPTR16WF:
01520     case R_PARISC_PCREL14WR:
01521     case R_PARISC_PCREL16WF:
01522     case R_PARISC_LTOFF_TP14WR:
01523     case R_PARISC_LTOFF_TP16WF:
01524     case R_PARISC_DPREL14WR:
01525     case R_PARISC_GPREL16WF:
01526     case R_PARISC_PLTOFF14WR:
01527     case R_PARISC_PLTOFF16WF:
01528     case R_PARISC_DIR16WF:
01529     case R_PARISC_DIR14WR:
01530     case R_PARISC_LTOFF16WF:
01531       return (insn & ~0x3ff9) | (((sym_value & 0x2000) >> 13)
01532                              | ((sym_value & 0x1ffc) << 1));
01533 
01534     default:
01535       return insn;
01536     }
01537 }
01538 
01539 /* Compute the value for a relocation (REL) during a final link stage,
01540    then insert the value into the proper location in CONTENTS.
01541 
01542    VALUE is a tentative value for the relocation and may be overridden
01543    and modified here based on the specific relocation to be performed.
01544 
01545    For example we do conversions for PC-relative branches in this routine
01546    or redirection of calls to external routines to stubs.
01547 
01548    The work of actually applying the relocation is left to a helper
01549    routine in an attempt to reduce the complexity and size of this
01550    function.  */
01551 
01552 static bfd_reloc_status_type
01553 elf_hppa_final_link_relocate (Elf_Internal_Rela *rel,
01554                            bfd *input_bfd,
01555                            bfd *output_bfd,
01556                            asection *input_section,
01557                            bfd_byte *contents,
01558                            bfd_vma value,
01559                            struct bfd_link_info *info,
01560                            asection *sym_sec,
01561                            struct elf_link_hash_entry *h ATTRIBUTE_UNUSED,
01562                            struct elf64_hppa_dyn_hash_entry *dyn_h)
01563 {
01564   int insn;
01565   bfd_vma offset = rel->r_offset;
01566   bfd_signed_vma addend = rel->r_addend;
01567   reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
01568   unsigned int r_type = howto->type;
01569   bfd_byte *hit_data = contents + offset;
01570   struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
01571 
01572   insn = bfd_get_32 (input_bfd, hit_data);
01573 
01574   switch (r_type)
01575     {
01576     case R_PARISC_NONE:
01577       break;
01578 
01579     /* Basic function call support.
01580 
01581        Note for a call to a function defined in another dynamic library
01582        we want to redirect the call to a stub.  */
01583 
01584     /* Random PC relative relocs.  */
01585     case R_PARISC_PCREL21L:
01586     case R_PARISC_PCREL14R:
01587     case R_PARISC_PCREL14F:
01588     case R_PARISC_PCREL14WR:
01589     case R_PARISC_PCREL14DR:
01590     case R_PARISC_PCREL16F:
01591     case R_PARISC_PCREL16WF:
01592     case R_PARISC_PCREL16DF:
01593       {
01594        /* If this is a call to a function defined in another dynamic
01595           library, then redirect the call to the local stub for this
01596           function.  */
01597        if (sym_sec == NULL || sym_sec->output_section == NULL)
01598          value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
01599                  + hppa_info->stub_sec->output_section->vma);
01600 
01601        /* Turn VALUE into a proper PC relative address.  */
01602        value -= (offset + input_section->output_offset
01603                 + input_section->output_section->vma);
01604 
01605        /* Adjust for any field selectors.  */
01606        if (r_type == R_PARISC_PCREL21L)
01607          value = hppa_field_adjust (value, -8 + addend, e_lsel);
01608        else if (r_type == R_PARISC_PCREL14F
01609                || r_type == R_PARISC_PCREL16F
01610                || r_type == R_PARISC_PCREL16WF
01611                || r_type == R_PARISC_PCREL16DF)
01612          value = hppa_field_adjust (value, -8 + addend, e_fsel);
01613        else
01614          value = hppa_field_adjust (value, -8 + addend, e_rsel);
01615 
01616        /* Apply the relocation to the given instruction.  */
01617        insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
01618        break;
01619       }
01620 
01621     case R_PARISC_PCREL12F:
01622     case R_PARISC_PCREL22F:
01623     case R_PARISC_PCREL17F:
01624     case R_PARISC_PCREL22C:
01625     case R_PARISC_PCREL17C:
01626     case R_PARISC_PCREL17R:
01627       {
01628        /* If this is a call to a function defined in another dynamic
01629           library, then redirect the call to the local stub for this
01630           function.  */
01631        if (sym_sec == NULL || sym_sec->output_section == NULL)
01632          value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
01633                  + hppa_info->stub_sec->output_section->vma);
01634 
01635        /* Turn VALUE into a proper PC relative address.  */
01636        value -= (offset + input_section->output_offset
01637                 + input_section->output_section->vma);
01638 
01639        /* Adjust for any field selectors.  */
01640        if (r_type == R_PARISC_PCREL17R)
01641          value = hppa_field_adjust (value, -8 + addend, e_rsel);
01642        else
01643          value = hppa_field_adjust (value, -8 + addend, e_fsel);
01644 
01645        /* All branches are implicitly shifted by 2 places.  */
01646        value >>= 2;
01647 
01648        /* Apply the relocation to the given instruction.  */
01649        insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
01650        break;
01651       }
01652 
01653     /* Indirect references to data through the DLT.  */
01654     case R_PARISC_DLTIND14R:
01655     case R_PARISC_DLTIND14F:
01656     case R_PARISC_DLTIND14DR:
01657     case R_PARISC_DLTIND14WR:
01658     case R_PARISC_DLTIND21L:
01659     case R_PARISC_LTOFF_FPTR14R:
01660     case R_PARISC_LTOFF_FPTR14DR:
01661     case R_PARISC_LTOFF_FPTR14WR:
01662     case R_PARISC_LTOFF_FPTR21L:
01663     case R_PARISC_LTOFF_FPTR16F:
01664     case R_PARISC_LTOFF_FPTR16WF:
01665     case R_PARISC_LTOFF_FPTR16DF:
01666     case R_PARISC_LTOFF_TP21L:
01667     case R_PARISC_LTOFF_TP14R:
01668     case R_PARISC_LTOFF_TP14F:
01669     case R_PARISC_LTOFF_TP14WR:
01670     case R_PARISC_LTOFF_TP14DR:
01671     case R_PARISC_LTOFF_TP16F:
01672     case R_PARISC_LTOFF_TP16WF:
01673     case R_PARISC_LTOFF_TP16DF:
01674     case R_PARISC_LTOFF16F:
01675     case R_PARISC_LTOFF16WF:
01676     case R_PARISC_LTOFF16DF:
01677       {
01678        /* If this relocation was against a local symbol, then we still
01679           have not set up the DLT entry (it's not convenient to do so
01680           in the "finalize_dlt" routine because it is difficult to get
01681           to the local symbol's value).
01682 
01683           So, if this is a local symbol (h == NULL), then we need to
01684           fill in its DLT entry.
01685 
01686           Similarly we may still need to set up an entry in .opd for
01687           a local function which had its address taken.  */
01688        if (dyn_h->h == NULL)
01689          {
01690            /* Now do .opd creation if needed.  */
01691            if (r_type == R_PARISC_LTOFF_FPTR14R
01692               || r_type == R_PARISC_LTOFF_FPTR14DR
01693               || r_type == R_PARISC_LTOFF_FPTR14WR
01694               || r_type == R_PARISC_LTOFF_FPTR21L
01695               || r_type == R_PARISC_LTOFF_FPTR16F
01696               || r_type == R_PARISC_LTOFF_FPTR16WF
01697               || r_type == R_PARISC_LTOFF_FPTR16DF)
01698              {
01699               /* The first two words of an .opd entry are zero.  */
01700               memset (hppa_info->opd_sec->contents + dyn_h->opd_offset,
01701                      0, 16);
01702 
01703               /* The next word is the address of the function.  */
01704               bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
01705                          (hppa_info->opd_sec->contents
01706                           + dyn_h->opd_offset + 16));
01707 
01708               /* The last word is our local __gp value.  */
01709               value = _bfd_get_gp_value
01710                        (hppa_info->opd_sec->output_section->owner);
01711               bfd_put_64 (hppa_info->opd_sec->owner, value,
01712                          (hppa_info->opd_sec->contents
01713                           + dyn_h->opd_offset + 24));
01714 
01715               /* The DLT value is the address of the .opd entry.  */
01716               value = (dyn_h->opd_offset
01717                       + hppa_info->opd_sec->output_offset
01718                       + hppa_info->opd_sec->output_section->vma);
01719               addend = 0;
01720              }
01721 
01722            bfd_put_64 (hppa_info->dlt_sec->owner,
01723                      value + addend,
01724                      hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
01725          }
01726 
01727        /* We want the value of the DLT offset for this symbol, not
01728           the symbol's actual address.  Note that __gp may not point
01729           to the start of the DLT, so we have to compute the absolute
01730           address, then subtract out the value of __gp.  */
01731        value = (dyn_h->dlt_offset
01732                + hppa_info->dlt_sec->output_offset
01733                + hppa_info->dlt_sec->output_section->vma);
01734        value -= _bfd_get_gp_value (output_bfd);
01735 
01736        /* All DLTIND relocations are basically the same at this point,
01737           except that we need different field selectors for the 21bit
01738           version vs the 14bit versions.  */
01739        if (r_type == R_PARISC_DLTIND21L
01740            || r_type == R_PARISC_LTOFF_FPTR21L
01741            || r_type == R_PARISC_LTOFF_TP21L)
01742          value = hppa_field_adjust (value, 0, e_lsel);
01743        else if (r_type == R_PARISC_DLTIND14F
01744                || r_type == R_PARISC_LTOFF_FPTR16F
01745                || r_type == R_PARISC_LTOFF_FPTR16WF
01746                || r_type == R_PARISC_LTOFF_FPTR16DF
01747                || r_type == R_PARISC_LTOFF16F
01748                || r_type == R_PARISC_LTOFF16DF
01749                || r_type == R_PARISC_LTOFF16WF
01750                || r_type == R_PARISC_LTOFF_TP16F
01751                || r_type == R_PARISC_LTOFF_TP16WF
01752                || r_type == R_PARISC_LTOFF_TP16DF)
01753          value = hppa_field_adjust (value, 0, e_fsel);
01754        else
01755          value = hppa_field_adjust (value, 0, e_rsel);
01756 
01757        insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
01758        break;
01759       }
01760 
01761     case R_PARISC_DLTREL14R:
01762     case R_PARISC_DLTREL14F:
01763     case R_PARISC_DLTREL14DR:
01764     case R_PARISC_DLTREL14WR:
01765     case R_PARISC_DLTREL21L:
01766     case R_PARISC_DPREL21L:
01767     case R_PARISC_DPREL14WR:
01768     case R_PARISC_DPREL14DR:
01769     case R_PARISC_DPREL14R:
01770     case R_PARISC_DPREL14F:
01771     case R_PARISC_GPREL16F:
01772     case R_PARISC_GPREL16WF:
01773     case R_PARISC_GPREL16DF:
01774       {
01775        /* Subtract out the global pointer value to make value a DLT
01776           relative address.  */
01777        value -= _bfd_get_gp_value (output_bfd);
01778 
01779        /* All DLTREL relocations are basically the same at this point,
01780           except that we need different field selectors for the 21bit
01781           version vs the 14bit versions.  */
01782        if (r_type == R_PARISC_DLTREL21L
01783            || r_type == R_PARISC_DPREL21L)
01784          value = hppa_field_adjust (value, addend, e_lrsel);
01785        else if (r_type == R_PARISC_DLTREL14F
01786                || r_type == R_PARISC_DPREL14F
01787                || r_type == R_PARISC_GPREL16F
01788                || r_type == R_PARISC_GPREL16WF
01789                || r_type == R_PARISC_GPREL16DF)
01790          value = hppa_field_adjust (value, addend, e_fsel);
01791        else
01792          value = hppa_field_adjust (value, addend, e_rrsel);
01793 
01794        insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
01795        break;
01796       }
01797 
01798     case R_PARISC_DIR21L:
01799     case R_PARISC_DIR17R:
01800     case R_PARISC_DIR17F:
01801     case R_PARISC_DIR14R:
01802     case R_PARISC_DIR14F:
01803     case R_PARISC_DIR14WR:
01804     case R_PARISC_DIR14DR:
01805     case R_PARISC_DIR16F:
01806     case R_PARISC_DIR16WF:
01807     case R_PARISC_DIR16DF:
01808       {
01809        /* All DIR relocations are basically the same at this point,
01810           except that branch offsets need to be divided by four, and
01811           we need different field selectors.  Note that we don't
01812           redirect absolute calls to local stubs.  */
01813 
01814        if (r_type == R_PARISC_DIR21L)
01815          value = hppa_field_adjust (value, addend, e_lrsel);
01816        else if (r_type == R_PARISC_DIR17F
01817                || r_type == R_PARISC_DIR16F
01818                || r_type == R_PARISC_DIR16WF
01819                || r_type == R_PARISC_DIR16DF
01820                || r_type == R_PARISC_DIR14F)
01821          value = hppa_field_adjust (value, addend, e_fsel);
01822        else
01823          value = hppa_field_adjust (value, addend, e_rrsel);
01824 
01825        if (r_type == R_PARISC_DIR17R || r_type == R_PARISC_DIR17F)
01826          /* All branches are implicitly shifted by 2 places.  */
01827          value >>= 2;
01828 
01829        insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
01830        break;
01831       }
01832 
01833     case R_PARISC_PLTOFF21L:
01834     case R_PARISC_PLTOFF14R:
01835     case R_PARISC_PLTOFF14F:
01836     case R_PARISC_PLTOFF14WR:
01837     case R_PARISC_PLTOFF14DR:
01838     case R_PARISC_PLTOFF16F:
01839     case R_PARISC_PLTOFF16WF:
01840     case R_PARISC_PLTOFF16DF:
01841       {
01842        /* We want the value of the PLT offset for this symbol, not
01843           the symbol's actual address.  Note that __gp may not point
01844           to the start of the DLT, so we have to compute the absolute
01845           address, then subtract out the value of __gp.  */
01846        value = (dyn_h->plt_offset
01847                + hppa_info->plt_sec->output_offset
01848                + hppa_info->plt_sec->output_section->vma);
01849        value -= _bfd_get_gp_value (output_bfd);
01850 
01851        /* All PLTOFF relocations are basically the same at this point,
01852           except that we need different field selectors for the 21bit
01853           version vs the 14bit versions.  */
01854        if (r_type == R_PARISC_PLTOFF21L)
01855          value = hppa_field_adjust (value, addend, e_lrsel);
01856        else if (r_type == R_PARISC_PLTOFF14F
01857                || r_type == R_PARISC_PLTOFF16F
01858                || r_type == R_PARISC_PLTOFF16WF
01859                || r_type == R_PARISC_PLTOFF16DF)
01860          value = hppa_field_adjust (value, addend, e_fsel);
01861        else
01862          value = hppa_field_adjust (value, addend, e_rrsel);
01863 
01864        insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
01865        break;
01866       }
01867 
01868     case R_PARISC_LTOFF_FPTR32:
01869       {
01870        /* We may still need to create the FPTR itself if it was for
01871           a local symbol.  */
01872        if (dyn_h->h == NULL)
01873          {
01874            /* The first two words of an .opd entry are zero.  */
01875            memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
01876 
01877            /* The next word is the address of the function.  */
01878            bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
01879                      (hppa_info->opd_sec->contents
01880                       + dyn_h->opd_offset + 16));
01881 
01882            /* The last word is our local __gp value.  */
01883            value = _bfd_get_gp_value
01884                     (hppa_info->opd_sec->output_section->owner);
01885            bfd_put_64 (hppa_info->opd_sec->owner, value,
01886                      hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
01887 
01888            /* The DLT value is the address of the .opd entry.  */
01889            value = (dyn_h->opd_offset
01890                    + hppa_info->opd_sec->output_offset
01891                    + hppa_info->opd_sec->output_section->vma);
01892 
01893            bfd_put_64 (hppa_info->dlt_sec->owner,
01894                      value,
01895                      hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
01896          }
01897 
01898        /* We want the value of the DLT offset for this symbol, not
01899           the symbol's actual address.  Note that __gp may not point
01900           to the start of the DLT, so we have to compute the absolute
01901           address, then subtract out the value of __gp.  */
01902        value = (dyn_h->dlt_offset
01903                + hppa_info->dlt_sec->output_offset
01904                + hppa_info->dlt_sec->output_section->vma);
01905        value -= _bfd_get_gp_value (output_bfd);
01906        bfd_put_32 (input_bfd, value, hit_data);
01907        return bfd_reloc_ok;
01908       }
01909 
01910     case R_PARISC_LTOFF_FPTR64:
01911     case R_PARISC_LTOFF_TP64:
01912       {
01913        /* We may still need to create the FPTR itself if it was for
01914           a local symbol.  */
01915        if (dyn_h->h == NULL && r_type == R_PARISC_LTOFF_FPTR64)
01916          {
01917            /* The first two words of an .opd entry are zero.  */
01918            memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
01919 
01920            /* The next word is the address of the function.  */
01921            bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
01922                      (hppa_info->opd_sec->contents
01923                       + dyn_h->opd_offset + 16));
01924 
01925            /* The last word is our local __gp value.  */
01926            value = _bfd_get_gp_value
01927                     (hppa_info->opd_sec->output_section->owner);
01928            bfd_put_64 (hppa_info->opd_sec->owner, value,
01929                      hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
01930 
01931            /* The DLT value is the address of the .opd entry.  */
01932            value = (dyn_h->opd_offset
01933                    + hppa_info->opd_sec->output_offset
01934                    + hppa_info->opd_sec->output_section->vma);
01935 
01936            bfd_put_64 (hppa_info->dlt_sec->owner,
01937                      value,
01938                      hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
01939          }
01940 
01941        /* We want the value of the DLT offset for this symbol, not
01942           the symbol's actual address.  Note that __gp may not point
01943           to the start of the DLT, so we have to compute the absolute
01944           address, then subtract out the value of __gp.  */
01945        value = (dyn_h->dlt_offset
01946                + hppa_info->dlt_sec->output_offset
01947                + hppa_info->dlt_sec->output_section->vma);
01948        value -= _bfd_get_gp_value (output_bfd);
01949        bfd_put_64 (input_bfd, value, hit_data);
01950        return bfd_reloc_ok;
01951       }
01952 
01953     case R_PARISC_DIR32:
01954       bfd_put_32 (input_bfd, value + addend, hit_data);
01955       return bfd_reloc_ok;
01956 
01957     case R_PARISC_DIR64:
01958       bfd_put_64 (input_bfd, value + addend, hit_data);
01959       return bfd_reloc_ok;
01960 
01961     case R_PARISC_GPREL64:
01962       /* Subtract out the global pointer value to make value a DLT
01963         relative address.  */
01964       value -= _bfd_get_gp_value (output_bfd);
01965 
01966       bfd_put_64 (input_bfd, value + addend, hit_data);
01967       return bfd_reloc_ok;
01968 
01969     case R_PARISC_LTOFF64:
01970        /* We want the value of the DLT offset for this symbol, not
01971           the symbol's actual address.  Note that __gp may not point
01972           to the start of the DLT, so we have to compute the absolute
01973           address, then subtract out the value of __gp.  */
01974       value = (dyn_h->dlt_offset
01975               + hppa_info->dlt_sec->output_offset
01976               + hppa_info->dlt_sec->output_section->vma);
01977       value -= _bfd_get_gp_value (output_bfd);
01978 
01979       bfd_put_64 (input_bfd, value + addend, hit_data);
01980       return bfd_reloc_ok;
01981 
01982     case R_PARISC_PCREL32:
01983       {
01984        /* If this is a call to a function defined in another dynamic
01985           library, then redirect the call to the local stub for this
01986           function.  */
01987        if (sym_sec == NULL || sym_sec->output_section == NULL)
01988          value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
01989                  + hppa_info->stub_sec->output_section->vma);
01990 
01991        /* Turn VALUE into a proper PC relative address.  */
01992        value -= (offset + input_section->output_offset
01993                 + input_section->output_section->vma);
01994 
01995        value += addend;
01996        value -= 8;
01997        bfd_put_32 (input_bfd, value, hit_data);
01998        return bfd_reloc_ok;
01999       }
02000 
02001     case R_PARISC_PCREL64:
02002       {
02003        /* If this is a call to a function defined in another dynamic
02004           library, then redirect the call to the local stub for this
02005           function.  */
02006        if (sym_sec == NULL || sym_sec->output_section == NULL)
02007          value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
02008                  + hppa_info->stub_sec->output_section->vma);
02009 
02010        /* Turn VALUE into a proper PC relative address.  */
02011        value -= (offset + input_section->output_offset
02012                 + input_section->output_section->vma);
02013 
02014        value += addend;
02015        value -= 8;
02016        bfd_put_64 (input_bfd, value, hit_data);
02017        return bfd_reloc_ok;
02018       }
02019 
02020     case R_PARISC_FPTR64:
02021       {
02022        /* We may still need to create the FPTR itself if it was for
02023           a local symbol.  */
02024        if (dyn_h->h == NULL)
02025          {
02026            /* The first two words of an .opd entry are zero.  */
02027            memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
02028 
02029            /* The next word is the address of the function.  */
02030            bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
02031                      (hppa_info->opd_sec->contents
02032                       + dyn_h->opd_offset + 16));
02033 
02034            /* The last word is our local __gp value.  */
02035            value = _bfd_get_gp_value
02036                     (hppa_info->opd_sec->output_section->owner);
02037            bfd_put_64 (hppa_info->opd_sec->owner, value,
02038                      hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
02039          }
02040 
02041        if (dyn_h->want_opd)
02042          /* We want the value of the OPD offset for this symbol.  */
02043          value = (dyn_h->opd_offset
02044                  + hppa_info->opd_sec->output_offset
02045                  + hppa_info->opd_sec->output_section->vma);
02046        else
02047          /* We want the address of the symbol.  */
02048          value += addend;
02049 
02050        bfd_put_64 (input_bfd, value, hit_data);
02051        return bfd_reloc_ok;
02052       }
02053 
02054     case R_PARISC_SECREL32:
02055       bfd_put_32 (input_bfd,
02056                 value + addend - sym_sec->output_section->vma,
02057                 hit_data);
02058       return bfd_reloc_ok;
02059 
02060     case R_PARISC_SEGREL32:
02061     case R_PARISC_SEGREL64:
02062       {
02063        /* If this is the first SEGREL relocation, then initialize
02064           the segment base values.  */
02065        if (hppa_info->text_segment_base == (bfd_vma) -1)
02066          bfd_map_over_sections (output_bfd, elf_hppa_record_segment_addrs,
02067                              hppa_info);
02068 
02069        /* VALUE holds the absolute address.  We want to include the
02070           addend, then turn it into a segment relative address.
02071 
02072           The segment is derived from SYM_SEC.  We assume that there are
02073           only two segments of note in the resulting executable/shlib.
02074           A readonly segment (.text) and a readwrite segment (.data).  */
02075        value += addend;
02076 
02077        if (sym_sec->flags & SEC_CODE)
02078          value -= hppa_info->text_segment_base;
02079        else
02080          value -= hppa_info->data_segment_base;
02081 
02082        if (r_type == R_PARISC_SEGREL32)
02083          bfd_put_32 (input_bfd, value, hit_data);
02084        else
02085          bfd_put_64 (input_bfd, value, hit_data);
02086        return bfd_reloc_ok;
02087       }
02088 
02089     /* Something we don't know how to handle.  */
02090     default:
02091       return bfd_reloc_notsupported;
02092     }
02093 
02094   /* Update the instruction word.  */
02095   bfd_put_32 (input_bfd, (bfd_vma) insn, hit_data);
02096   return bfd_reloc_ok;
02097 }
02098 
02099 /* Relocate an HPPA ELF section.  */
02100 
02101 static bfd_boolean
02102 elf_hppa_relocate_section (bfd *output_bfd,
02103                         struct bfd_link_info *info,
02104                         bfd *input_bfd,
02105                         asection *input_section,
02106                         bfd_byte *contents,
02107                         Elf_Internal_Rela *relocs,
02108                         Elf_Internal_Sym *local_syms,
02109                         asection **local_sections)
02110 {
02111   Elf_Internal_Shdr *symtab_hdr;
02112   Elf_Internal_Rela *rel;
02113   Elf_Internal_Rela *relend;
02114   struct elf64_hppa_link_hash_table *hppa_info;
02115 
02116   hppa_info = elf64_hppa_hash_table (info);
02117   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
02118 
02119   rel = relocs;
02120   relend = relocs + input_section->reloc_count;
02121   for (; rel < relend; rel++)
02122     {
02123       int r_type;
02124       reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
02125       unsigned long r_symndx;
02126       struct elf_link_hash_entry *h;
02127       Elf_Internal_Sym *sym;
02128       asection *sym_sec;
02129       bfd_vma relocation;
02130       bfd_reloc_status_type r;
02131       const char *dyn_name;
02132       char *dynh_buf = NULL;
02133       size_t dynh_buflen = 0;
02134       struct elf64_hppa_dyn_hash_entry *dyn_h = NULL;
02135 
02136       r_type = ELF_R_TYPE (rel->r_info);
02137       if (r_type < 0 || r_type >= (int) R_PARISC_UNIMPLEMENTED)
02138        {
02139          bfd_set_error (bfd_error_bad_value);
02140          return FALSE;
02141        }
02142 
02143       /* This is a final link.  */
02144       r_symndx = ELF_R_SYM (rel->r_info);
02145       h = NULL;
02146       sym = NULL;
02147       sym_sec = NULL;
02148       if (r_symndx < symtab_hdr->sh_info)
02149        {
02150          /* This is a local symbol.  */
02151          sym = local_syms + r_symndx;
02152          sym_sec = local_sections[r_symndx];
02153          relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rel);
02154 
02155          /* If this symbol has an entry in the PA64 dynamic hash
02156             table, then get it.  */
02157          dyn_name = get_dyn_name (input_bfd, h, rel,
02158                                &dynh_buf, &dynh_buflen);
02159          dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
02160                                          dyn_name, FALSE, FALSE);
02161 
02162        }
02163       else
02164        {
02165          /* This is not a local symbol.  */
02166          long indx;
02167 
02168          relocation = 0;
02169          indx = r_symndx - symtab_hdr->sh_info;
02170          h = elf_sym_hashes (input_bfd)[indx];
02171          while (h->root.type == bfd_link_hash_indirect
02172                || h->root.type == bfd_link_hash_warning)
02173            h = (struct elf_link_hash_entry *) h->root.u.i.link;
02174          if (h->root.type == bfd_link_hash_defined
02175              || h->root.type == bfd_link_hash_defweak)
02176            {
02177              sym_sec = h->root.u.def.section;
02178 
02179              /* If this symbol has an entry in the PA64 dynamic hash
02180                table, then get it.  */
02181              dyn_name = get_dyn_name (input_bfd, h, rel,
02182                                    &dynh_buf, &dynh_buflen);
02183              dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
02184                                             dyn_name, FALSE, FALSE);
02185 
02186              /* If we have a relocation against a symbol defined in a
02187                shared library and we have not created an entry in the
02188                PA64 dynamic symbol hash table for it, then we lose.  */
02189              if (!info->relocatable
02190                 && sym_sec->output_section == NULL && dyn_h == NULL)
02191               {
02192                 (*_bfd_error_handler)
02193                   (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
02194                    input_bfd,
02195                    input_section,
02196                    (long) rel->r_offset,
02197                    howto->name,
02198                    h->root.root.string);
02199               }
02200              else if (sym_sec->output_section)
02201               relocation = (h->root.u.def.value
02202                            + sym_sec->output_offset
02203                            + sym_sec->output_section->vma);
02204            }
02205          else if (info->unresolved_syms_in_objects == RM_IGNORE
02206                  && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
02207            {
02208              /* If this symbol has an entry in the PA64 dynamic hash
02209                table, then get it.  */
02210              dyn_name = get_dyn_name (input_bfd, h, rel,
02211                                    &dynh_buf, &dynh_buflen);
02212              dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
02213                                             dyn_name, FALSE, FALSE);
02214 
02215              if (!info->relocatable && dyn_h == NULL)
02216               {
02217                 (*_bfd_error_handler)
02218                   (_("%B(%A): warning: unresolvable relocation against symbol `%s'"),
02219                    input_bfd, input_section, h->root.root.string);
02220               }
02221            }
02222          else if (h->root.type == bfd_link_hash_undefweak)
02223             {
02224              dyn_name = get_dyn_name (input_bfd, h, rel,
02225                                    &dynh_buf, &dynh_buflen);
02226              dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
02227                                             dyn_name, FALSE, FALSE);
02228 
02229              if (!info->relocatable && dyn_h == NULL)
02230               {
02231                 (*_bfd_error_handler)
02232                   (_("%B(%A): warning: unresolvable relocation against symbol `%s'"),
02233                    input_bfd, input_section, h->root.root.string);
02234               }
02235            }
02236          else if (!info->relocatable)
02237            {
02238              /* Ignore dynamic loader defined symbols.  */
02239              if (!elf_hppa_is_dynamic_loader_symbol (h->root.root.string))
02240               {
02241                 if (!((*info->callbacks->undefined_symbol)
02242                      (info, h->root.root.string, input_bfd,
02243                       input_section, rel->r_offset,
02244                       (info->unresolved_syms_in_objects == RM_GENERATE_ERROR
02245                        || ELF_ST_VISIBILITY (h->other)))))
02246                   return FALSE;
02247                 break;
02248               }
02249            }
02250        }
02251 
02252       if (sym_sec != NULL && elf_discarded_section (sym_sec))
02253        {
02254          /* For relocs against symbols from removed linkonce sections,
02255             or sections discarded by a linker script, we just want the
02256             section contents zeroed.  Avoid any special processing.  */
02257          _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
02258          rel->r_info = 0;
02259          rel->r_addend = 0;
02260          continue;
02261        }
02262 
02263       if (info->relocatable)
02264        continue;
02265 
02266       r = elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
02267                                    input_section, contents,
02268                                    relocation, info, sym_sec,
02269                                    h, dyn_h);
02270 
02271       if (r != bfd_reloc_ok)
02272        {
02273          switch (r)
02274            {
02275            default:
02276              abort ();
02277            case bfd_reloc_overflow:
02278              {
02279               const char *sym_name;
02280 
02281               if (h != NULL)
02282                 sym_name = NULL;
02283               else
02284                 {
02285                   sym_name = bfd_elf_string_from_elf_section (input_bfd,
02286                                                         symtab_hdr->sh_link,
02287                                                         sym->st_name);
02288                   if (sym_name == NULL)
02289                     return FALSE;
02290                   if (*sym_name == '\0')
02291                     sym_name = bfd_section_name (input_bfd, sym_sec);
02292                 }
02293 
02294               if (!((*info->callbacks->reloc_overflow)
02295                     (info, (h ? &h->root : NULL), sym_name,
02296                      howto->name, (bfd_vma) 0, input_bfd,
02297                      input_section, rel->r_offset)))
02298                 return FALSE;
02299              }
02300              break;
02301            }
02302        }
02303     }
02304   return TRUE;
02305 }
02306 
02307 #endif /* ARCH_SIZE == 64 */