* elf-hppa.h (elf_hppa_reloc_final_type): Handle selectors for
[external/binutils.git] / bfd / elf-hppa.h
1 /* Common code for PA ELF implementations.
2    Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
3
4 This file is part of BFD, the Binary File Descriptor library.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
19
20 #define ELF_HOWTO_TABLE_SIZE       R_PARISC_UNIMPLEMENTED + 1
21
22 /* This file is included by multiple PA ELF BFD backends with different
23    sizes.
24
25    Most of the routines are written to be size independent, but sometimes
26    external constraints require 32 or 64 bit specific code.  We remap
27    the definitions/functions as necessary here.  */
28 #if ARCH_SIZE == 64
29 #define ELF_R_TYPE(X)   ELF64_R_TYPE(X)
30 #define ELF_R_SYM(X)   ELF64_R_SYM(X)
31 #define elf_hppa_reloc_final_type elf64_hppa_reloc_final_type
32 #define _bfd_elf_hppa_gen_reloc_type _bfd_elf64_hppa_gen_reloc_type
33 #define elf_hppa_relocate_section elf64_hppa_relocate_section
34 #define bfd_elf_bfd_final_link bfd_elf64_bfd_final_link
35 #define elf_hppa_final_link elf64_hppa_final_link
36 #endif
37 #if ARCH_SIZE == 32
38 #define ELF_R_TYPE(X)   ELF32_R_TYPE(X)
39 #define ELF_R_SYM(X)   ELF32_R_SYM(X)
40 #define elf_hppa_reloc_final_type elf32_hppa_reloc_final_type
41 #define _bfd_elf_hppa_gen_reloc_type _bfd_elf32_hppa_gen_reloc_type
42 #define elf_hppa_relocate_section elf32_hppa_relocate_section
43 #define bfd_elf_bfd_final_link bfd_elf32_bfd_final_link
44 #define elf_hppa_final_link elf32_hppa_final_link
45 #endif
46
47 #if ARCH_SIZE == 64
48 static bfd_reloc_status_type elf_hppa_final_link_relocate
49   (Elf_Internal_Rela *, bfd *, bfd *, asection *, bfd_byte *, bfd_vma,
50    struct bfd_link_info *, asection *, struct elf_link_hash_entry *,
51    struct elf64_hppa_dyn_hash_entry *);
52
53 static int elf_hppa_relocate_insn
54   (int, int, unsigned int);
55 #endif
56
57 /* ELF/PA relocation howto entries.  */
58
59 static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
60 {
61   { R_PARISC_NONE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
62     bfd_elf_generic_reloc, "R_PARISC_NONE", FALSE, 0, 0, FALSE },
63
64   /* The values in DIR32 are to placate the check in
65      _bfd_stab_section_find_nearest_line.  */
66   { R_PARISC_DIR32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
67     bfd_elf_generic_reloc, "R_PARISC_DIR32", FALSE, 0, 0xffffffff, FALSE },
68   { R_PARISC_DIR21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
69     bfd_elf_generic_reloc, "R_PARISC_DIR21L", FALSE, 0, 0, FALSE },
70   { R_PARISC_DIR17R, 0, 0, 17, FALSE, 0, complain_overflow_bitfield,
71     bfd_elf_generic_reloc, "R_PARISC_DIR17R", FALSE, 0, 0, FALSE },
72   { R_PARISC_DIR17F, 0, 0, 17, FALSE, 0, complain_overflow_bitfield,
73     bfd_elf_generic_reloc, "R_PARISC_DIR17F", FALSE, 0, 0, FALSE },
74   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
75     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
76   { R_PARISC_DIR14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
77     bfd_elf_generic_reloc, "R_PARISC_DIR14R", FALSE, 0, 0, FALSE },
78   { R_PARISC_DIR14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
79     bfd_elf_generic_reloc, "R_PARISC_DIR14F", FALSE, 0, 0, FALSE },
80   /* 8 */
81   { R_PARISC_PCREL12F, 0, 0, 12, TRUE, 0, complain_overflow_bitfield,
82     bfd_elf_generic_reloc, "R_PARISC_PCREL12F", FALSE, 0, 0, FALSE },
83   { R_PARISC_PCREL32, 0, 0, 32, TRUE, 0, complain_overflow_bitfield,
84     bfd_elf_generic_reloc, "R_PARISC_PCREL32", FALSE, 0, 0, FALSE },
85   { R_PARISC_PCREL21L, 0, 0, 21, TRUE, 0, complain_overflow_bitfield,
86     bfd_elf_generic_reloc, "R_PARISC_PCREL21L", FALSE, 0, 0, FALSE },
87   { R_PARISC_PCREL17R, 0, 0, 17, TRUE, 0, complain_overflow_bitfield,
88     bfd_elf_generic_reloc, "R_PARISC_PCREL17R", FALSE, 0, 0, FALSE },
89   { R_PARISC_PCREL17F, 0, 0, 17, TRUE, 0, complain_overflow_bitfield,
90     bfd_elf_generic_reloc, "R_PARISC_PCREL17F", FALSE, 0, 0, FALSE },
91   { R_PARISC_PCREL17C, 0, 0, 17, TRUE, 0, complain_overflow_bitfield,
92     bfd_elf_generic_reloc, "R_PARISC_PCREL17C", FALSE, 0, 0, FALSE },
93   { R_PARISC_PCREL14R, 0, 0, 14, TRUE, 0, complain_overflow_bitfield,
94     bfd_elf_generic_reloc, "R_PARISC_PCREL14R", FALSE, 0, 0, FALSE },
95   { R_PARISC_PCREL14F, 0, 0, 14, TRUE, 0, complain_overflow_bitfield,
96     bfd_elf_generic_reloc, "R_PARISC_PCREL14F", FALSE, 0, 0, FALSE },
97   /* 16 */
98   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
99     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
100   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
101     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
102   { R_PARISC_DPREL21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
103     bfd_elf_generic_reloc, "R_PARISC_DPREL21L", FALSE, 0, 0, FALSE },
104   { R_PARISC_DPREL14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
105     bfd_elf_generic_reloc, "R_PARISC_DPREL14WR", FALSE, 0, 0, FALSE },
106   { R_PARISC_DPREL14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
107     bfd_elf_generic_reloc, "R_PARISC_DPREL14DR", FALSE, 0, 0, FALSE },
108   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
109     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
110   { R_PARISC_DPREL14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
111     bfd_elf_generic_reloc, "R_PARISC_DPREL14R", FALSE, 0, 0, FALSE },
112   { R_PARISC_DPREL14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
113     bfd_elf_generic_reloc, "R_PARISC_DPREL14F", FALSE, 0, 0, FALSE },
114   /* 24 */
115   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
116     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
117   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
118     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
119   { R_PARISC_DLTREL21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
120     bfd_elf_generic_reloc, "R_PARISC_DLTREL21L", FALSE, 0, 0, FALSE },
121   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
122     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
123   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
124     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
125   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
126     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
127   { R_PARISC_DLTREL14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
128     bfd_elf_generic_reloc, "R_PARISC_DLTREL14R", FALSE, 0, 0, FALSE },
129   { R_PARISC_DLTREL14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
130     bfd_elf_generic_reloc, "R_PARISC_DLTREL14F", FALSE, 0, 0, FALSE },
131   /* 32 */
132   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
133     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
134   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
135     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
136   { R_PARISC_DLTIND21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
137     bfd_elf_generic_reloc, "R_PARISC_DLTIND21L", FALSE, 0, 0, FALSE },
138   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
139     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
140   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
141     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
142   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
143     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
144   { R_PARISC_DLTIND14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
145     bfd_elf_generic_reloc, "R_PARISC_DLTIND14R", FALSE, 0, 0, FALSE },
146   { R_PARISC_DLTIND14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
147     bfd_elf_generic_reloc, "R_PARISC_DLTIND14F", FALSE, 0, 0, FALSE },
148   /* 40 */
149   { R_PARISC_SETBASE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
150     bfd_elf_generic_reloc, "R_PARISC_SETBASE", FALSE, 0, 0, FALSE },
151   { R_PARISC_SECREL32, 0, 0, 32, FALSE, 0, complain_overflow_bitfield,
152     bfd_elf_generic_reloc, "R_PARISC_SECREL32", FALSE, 0, 0, FALSE },
153   { R_PARISC_BASEREL21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
154     bfd_elf_generic_reloc, "R_PARISC_BASEREL21L", FALSE, 0, 0, FALSE },
155   { R_PARISC_BASEREL17R, 0, 0, 17, FALSE, 0, complain_overflow_bitfield,
156     bfd_elf_generic_reloc, "R_PARISC_BASEREL17R", FALSE, 0, 0, FALSE },
157   { R_PARISC_BASEREL17F, 0, 0, 17, FALSE, 0, complain_overflow_bitfield,
158     bfd_elf_generic_reloc, "R_PARISC_BASEREL17F", FALSE, 0, 0, FALSE },
159   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
160     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
161   { R_PARISC_BASEREL14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
162     bfd_elf_generic_reloc, "R_PARISC_BASEREL14R", FALSE, 0, 0, FALSE },
163   { R_PARISC_BASEREL14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
164     bfd_elf_generic_reloc, "R_PARISC_BASEREL14F", FALSE, 0, 0, FALSE },
165   /* 48 */
166   { R_PARISC_SEGBASE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
167     bfd_elf_generic_reloc, "R_PARISC_SEGBASE", FALSE, 0, 0, FALSE },
168   { R_PARISC_SEGREL32, 0, 0, 32, FALSE, 0, complain_overflow_bitfield,
169     bfd_elf_generic_reloc, "R_PARISC_SEGREL32", FALSE, 0, 0, FALSE },
170   { R_PARISC_PLTOFF21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
171     bfd_elf_generic_reloc, "R_PARISC_PLTOFF21L", FALSE, 0, 0, FALSE },
172   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
173     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
174   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
175     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
176   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
177     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
178   { R_PARISC_PLTOFF14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
179     bfd_elf_generic_reloc, "R_PARISC_PLTOFF14R", FALSE, 0, 0, FALSE },
180   { R_PARISC_PLTOFF14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
181     bfd_elf_generic_reloc, "R_PARISC_PLTOFF14F", FALSE, 0, 0, FALSE },
182   /* 56 */
183   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
184     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
185   { R_PARISC_LTOFF_FPTR32, 0, 0, 32, FALSE, 0, complain_overflow_bitfield,
186     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR32", FALSE, 0, 0, FALSE },
187   { R_PARISC_LTOFF_FPTR21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
188     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR21L", FALSE, 0, 0, FALSE },
189   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
190     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
191   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
192     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
193   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
194     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
195   { R_PARISC_LTOFF_FPTR14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
196     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14R", FALSE, 0, 0, FALSE },
197   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
198     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
199   /* 64 */
200   { R_PARISC_FPTR64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
201     bfd_elf_generic_reloc, "R_PARISC_FPTR64", FALSE, 0, 0, FALSE },
202   { R_PARISC_PLABEL32, 0, 0, 32, FALSE, 0, complain_overflow_bitfield,
203     bfd_elf_generic_reloc, "R_PARISC_PLABEL32", FALSE, 0, 0, FALSE },
204   { R_PARISC_PLABEL21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
205     bfd_elf_generic_reloc, "R_PARISC_PLABEL21L", FALSE, 0, 0, FALSE },
206   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
207     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
208   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
209     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
210   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
211     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
212   { R_PARISC_PLABEL14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
213     bfd_elf_generic_reloc, "R_PARISC_PLABEL14R", FALSE, 0, 0, FALSE },
214   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
215     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
216   /* 72 */
217   { R_PARISC_PCREL64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
218     bfd_elf_generic_reloc, "R_PARISC_PCREL64", FALSE, 0, 0, FALSE },
219   { R_PARISC_PCREL22C, 0, 0, 22, FALSE, 0, complain_overflow_bitfield,
220     bfd_elf_generic_reloc, "R_PARISC_PCREL22C", FALSE, 0, 0, FALSE },
221   { R_PARISC_PCREL22F, 0, 0, 22, FALSE, 0, complain_overflow_bitfield,
222     bfd_elf_generic_reloc, "R_PARISC_PCREL22F", FALSE, 0, 0, FALSE },
223   { R_PARISC_PCREL14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
224     bfd_elf_generic_reloc, "R_PARISC_PCREL14WR", FALSE, 0, 0, FALSE },
225   { R_PARISC_PCREL14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
226     bfd_elf_generic_reloc, "R_PARISC_PCREL14DR", FALSE, 0, 0, FALSE },
227   { R_PARISC_PCREL16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
228     bfd_elf_generic_reloc, "R_PARISC_PCREL16F", FALSE, 0, 0, FALSE },
229   { R_PARISC_PCREL16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
230     bfd_elf_generic_reloc, "R_PARISC_PCREL16WF", FALSE, 0, 0, FALSE },
231   { R_PARISC_PCREL16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
232     bfd_elf_generic_reloc, "R_PARISC_PCREL16DF", FALSE, 0, 0, FALSE },
233   /* 80 */
234   { R_PARISC_DIR64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
235     bfd_elf_generic_reloc, "R_PARISC_DIR64", FALSE, 0, 0, FALSE },
236   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
237     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
238   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
239     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
240   { R_PARISC_DIR14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
241     bfd_elf_generic_reloc, "R_PARISC_DIR14WR", FALSE, 0, 0, FALSE },
242   { R_PARISC_DIR14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
243     bfd_elf_generic_reloc, "R_PARISC_DIR14DR", FALSE, 0, 0, FALSE },
244   { R_PARISC_DIR16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
245     bfd_elf_generic_reloc, "R_PARISC_DIR16F", FALSE, 0, 0, FALSE },
246   { R_PARISC_DIR16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
247     bfd_elf_generic_reloc, "R_PARISC_DIR16WF", FALSE, 0, 0, FALSE },
248   { R_PARISC_DIR16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
249     bfd_elf_generic_reloc, "R_PARISC_DIR16DF", FALSE, 0, 0, FALSE },
250   /* 88 */
251   { R_PARISC_GPREL64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
252     bfd_elf_generic_reloc, "R_PARISC_GPREL64", FALSE, 0, 0, FALSE },
253   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
254     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
255   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
256     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
257   { R_PARISC_DLTREL14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
258     bfd_elf_generic_reloc, "R_PARISC_DLTREL14WR", FALSE, 0, 0, FALSE },
259   { R_PARISC_DLTREL14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
260     bfd_elf_generic_reloc, "R_PARISC_DLTREL14DR", FALSE, 0, 0, FALSE },
261   { R_PARISC_GPREL16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
262     bfd_elf_generic_reloc, "R_PARISC_GPREL16F", FALSE, 0, 0, FALSE },
263   { R_PARISC_GPREL16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
264     bfd_elf_generic_reloc, "R_PARISC_GPREL16WF", FALSE, 0, 0, FALSE },
265   { R_PARISC_GPREL16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
266     bfd_elf_generic_reloc, "R_PARISC_GPREL16DF", FALSE, 0, 0, FALSE },
267   /* 96 */
268   { R_PARISC_LTOFF64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
269     bfd_elf_generic_reloc, "R_PARISC_LTOFF64", FALSE, 0, 0, FALSE },
270   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
271     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
272   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
273     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
274   { R_PARISC_DLTIND14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
275     bfd_elf_generic_reloc, "R_PARISC_DLTIND14WR", FALSE, 0, 0, FALSE },
276   { R_PARISC_DLTIND14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
277     bfd_elf_generic_reloc, "R_PARISC_DLTIND14DR", FALSE, 0, 0, FALSE },
278   { R_PARISC_LTOFF16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
279     bfd_elf_generic_reloc, "R_PARISC_LTOFF16F", FALSE, 0, 0, FALSE },
280   { R_PARISC_LTOFF16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
281     bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", FALSE, 0, 0, FALSE },
282   { R_PARISC_LTOFF16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
283     bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", FALSE, 0, 0, FALSE },
284   /* 104 */
285   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
286     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
287   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
288     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
289   { R_PARISC_BASEREL14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
290     bfd_elf_generic_reloc, "R_PARISC_BASEREL14WR", FALSE, 0, 0, FALSE },
291   { R_PARISC_BASEREL14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
292     bfd_elf_generic_reloc, "R_PARISC_BASEREL14DR", FALSE, 0, 0, FALSE },
293   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
294     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
295   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
296     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
297   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
298     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
299   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
300     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
301   /* 112 */
302   { R_PARISC_SEGREL64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
303     bfd_elf_generic_reloc, "R_PARISC_SEGREL64", FALSE, 0, 0, FALSE },
304   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
305     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
306   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
307     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
308   { R_PARISC_PLTOFF14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
309     bfd_elf_generic_reloc, "R_PARISC_PLTOFF14WR", FALSE, 0, 0, FALSE },
310   { R_PARISC_PLTOFF14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
311     bfd_elf_generic_reloc, "R_PARISC_PLTOFF14DR", FALSE, 0, 0, FALSE },
312   { R_PARISC_PLTOFF16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
313     bfd_elf_generic_reloc, "R_PARISC_PLTOFF16F", FALSE, 0, 0, FALSE },
314   { R_PARISC_PLTOFF16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
315     bfd_elf_generic_reloc, "R_PARISC_PLTOFF16WF", FALSE, 0, 0, FALSE },
316   { R_PARISC_PLTOFF16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
317     bfd_elf_generic_reloc, "R_PARISC_PLTOFF16DF", FALSE, 0, 0, FALSE },
318   /* 120 */
319   { R_PARISC_LTOFF_FPTR64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
320     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
321   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
322     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
323   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
324     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
325   { R_PARISC_LTOFF_FPTR14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
326     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14WR", FALSE, 0, 0, FALSE },
327   { R_PARISC_LTOFF_FPTR14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
328     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14DR", FALSE, 0, 0, FALSE },
329   { R_PARISC_LTOFF_FPTR16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
330     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16F", FALSE, 0, 0, FALSE },
331   { R_PARISC_LTOFF_FPTR16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
332     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16WF", FALSE, 0, 0, FALSE },
333   { R_PARISC_LTOFF_FPTR16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
334     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
335   /* 128 */
336   { R_PARISC_COPY, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
337     bfd_elf_generic_reloc, "R_PARISC_COPY", FALSE, 0, 0, FALSE },
338   { R_PARISC_IPLT, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
339     bfd_elf_generic_reloc, "R_PARISC_IPLT", FALSE, 0, 0, FALSE },
340   { R_PARISC_EPLT, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
341     bfd_elf_generic_reloc, "R_PARISC_EPLT", FALSE, 0, 0, FALSE },
342   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
343     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
344   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
345     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
346   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
347     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
348   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
349     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
350   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
351     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
352   /* 136 */
353   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
354     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
355   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
356     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
357   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
358     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
359   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
360     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
361   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
362     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
363   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
364     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
365   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
366     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
367   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
368     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
369   /* 144 */
370   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
371     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
372   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
373     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
374   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
375     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
376   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
377     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
378   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
379     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
380   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
381     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
382   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
383     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
384   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
385     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
386   /* 152 */
387   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
388     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
389   { R_PARISC_TPREL32, 0, 0, 32, FALSE, 0, complain_overflow_dont,
390     bfd_elf_generic_reloc, "R_PARISC_TPREL32", FALSE, 0, 0, FALSE },
391   { R_PARISC_TPREL21L, 0, 0, 21, FALSE, 0, complain_overflow_dont,
392     bfd_elf_generic_reloc, "R_PARISC_TPREL21L", FALSE, 0, 0, FALSE },
393   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
394     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
395   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
396     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
397   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
398     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
399   { R_PARISC_TPREL14R, 0, 0, 14, FALSE, 0, complain_overflow_dont,
400     bfd_elf_generic_reloc, "R_PARISC_TPREL14R", FALSE, 0, 0, FALSE },
401   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
402     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
403   /* 160 */
404   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
405     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
406   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
407     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
408   { R_PARISC_LTOFF_TP21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
409     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP21L", FALSE, 0, 0, FALSE },
410   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
411     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
412   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
413     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
414   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
415     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
416   { R_PARISC_LTOFF_TP14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
417     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
418   { R_PARISC_LTOFF_TP14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
419     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14F", FALSE, 0, 0, FALSE },
420   /* 168 */
421   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
422     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
423   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
424     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
425   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
426     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
427   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
428     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
429   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
430     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
431   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
432     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
433   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
434     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
435   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
436     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
437   /* 176 */
438   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
439     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
440   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
441     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
442   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
443     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
444   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
445     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
446   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
447     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
448   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
449     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
450   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
451     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
452   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
453     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
454   /* 184 */
455   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
456     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
457   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
458     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
459   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
460     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
461   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
462     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
463   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
464     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
465   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
466     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
467   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
468     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
469   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
470     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
471   /* 192 */
472   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
473     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
474   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
475     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
476   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
477     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
478   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
479     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
480   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
481     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
482   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
483     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
484   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
485     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
486   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
487     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
488   /* 200 */
489   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
490     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
491   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
492     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
493   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
494     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
495   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
496     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
497   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
498     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
499   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
500     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
501   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
502     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
503   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
504     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
505   /* 208 */
506   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
507     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
508   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
509     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
510   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
511     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
512   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
513     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
514   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
515     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
516   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
517     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
518   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
519     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
520   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
521     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
522   /* 216 */
523   { R_PARISC_TPREL64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
524     bfd_elf_generic_reloc, "R_PARISC_TPREL64", FALSE, 0, 0, FALSE },
525   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
526     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
527   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
528     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
529   { R_PARISC_TPREL14WR, 0, 0, 14, FALSE, 0, complain_overflow_dont,
530     bfd_elf_generic_reloc, "R_PARISC_TPREL14WR", FALSE, 0, 0, FALSE },
531   { R_PARISC_TPREL14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
532     bfd_elf_generic_reloc, "R_PARISC_TPREL14DR", FALSE, 0, 0, FALSE },
533   { R_PARISC_TPREL16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
534     bfd_elf_generic_reloc, "R_PARISC_TPREL16F", FALSE, 0, 0, FALSE },
535   { R_PARISC_TPREL16WF, 0, 0, 16, FALSE, 0, complain_overflow_dont,
536     bfd_elf_generic_reloc, "R_PARISC_TPREL16WF", FALSE, 0, 0, FALSE },
537   { R_PARISC_TPREL16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
538     bfd_elf_generic_reloc, "R_PARISC_TPREL16DF", FALSE, 0, 0, FALSE },
539   /* 224 */
540   { R_PARISC_LTOFF_TP64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
541     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP64", FALSE, 0, 0, FALSE },
542   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
543     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
544   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
545     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
546   { R_PARISC_LTOFF_TP14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
547     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14WR", FALSE, 0, 0, FALSE },
548   { R_PARISC_LTOFF_TP14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
549     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14DR", FALSE, 0, 0, FALSE },
550   { R_PARISC_LTOFF_TP16F, 0, 0, 16, FALSE, 0, complain_overflow_dont,
551     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16F", FALSE, 0, 0, FALSE },
552   { R_PARISC_LTOFF_TP16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
553     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16WF", FALSE, 0, 0, FALSE },
554   { R_PARISC_LTOFF_TP16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
555     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16DF", FALSE, 0, 0, FALSE },
556   /* 232 */
557   { R_PARISC_GNU_VTENTRY, 0, 0, 0, FALSE, 0, complain_overflow_dont,
558     bfd_elf_generic_reloc, "R_PARISC_GNU_VTENTRY", FALSE, 0, 0, FALSE },
559   { R_PARISC_GNU_VTINHERIT, 0, 0, 0, FALSE, 0, complain_overflow_dont,
560     bfd_elf_generic_reloc, "R_PARISC_GNU_VTINHERIT", FALSE, 0, 0, FALSE },
561 };
562
563 #define OFFSET_14R_FROM_21L 4
564 #define OFFSET_14F_FROM_21L 5
565
566 /* Return the final relocation type for the given base type, instruction
567    format, and field selector.  */
568
569 elf_hppa_reloc_type
570 elf_hppa_reloc_final_type (bfd *abfd,
571                            elf_hppa_reloc_type base_type,
572                            int format,
573                            unsigned int field)
574 {
575   elf_hppa_reloc_type final_type = base_type;
576
577   /* Just a tangle of nested switch statements to deal with the braindamage
578      that a different field selector means a completely different relocation
579      for PA ELF.  */
580   switch (base_type)
581     {
582     /* We have been using generic relocation types.  However, that may not
583        really make sense.  Anyway, we need to support both R_PARISC_DIR64
584        and R_PARISC_DIR32 here.  */
585     case R_PARISC_DIR32:
586     case R_PARISC_DIR64:
587     case R_HPPA_ABS_CALL:
588       switch (format)
589         {
590         case 14:
591           switch (field)
592             {
593             case e_fsel:
594               final_type = R_PARISC_DIR14F;
595               break;
596             case e_rsel:
597             case e_rrsel:
598             case e_rdsel:
599               final_type = R_PARISC_DIR14R;
600               break;
601             case e_rtsel:
602               final_type = R_PARISC_DLTIND14R;
603               break;
604             case e_rtpsel:
605               final_type = R_PARISC_LTOFF_FPTR14DR;
606               break;
607             case e_tsel:
608               final_type = R_PARISC_DLTIND14F;
609               break;
610             case e_rpsel:
611               final_type = R_PARISC_PLABEL14R;
612               break;
613             default:
614               return R_PARISC_NONE;
615             }
616           break;
617
618         case 17:
619           switch (field)
620             {
621             case e_fsel:
622               final_type = R_PARISC_DIR17F;
623               break;
624             case e_rsel:
625             case e_rrsel:
626             case e_rdsel:
627               final_type = R_PARISC_DIR17R;
628               break;
629             default:
630               return R_PARISC_NONE;
631             }
632           break;
633
634         case 21:
635           switch (field)
636             {
637             case e_lsel:
638             case e_lrsel:
639             case e_ldsel:
640             case e_nlsel:
641             case e_nlrsel:
642               final_type = R_PARISC_DIR21L;
643               break;
644             case e_ltsel:
645               final_type = R_PARISC_DLTIND21L;
646               break;
647             case e_ltpsel:
648               final_type = R_PARISC_LTOFF_FPTR21L;
649               break;
650             case e_lpsel:
651               final_type = R_PARISC_PLABEL21L;
652               break;
653             default:
654               return R_PARISC_NONE;
655             }
656           break;
657
658         case 32:
659           switch (field)
660             {
661             case e_fsel:
662               final_type = R_PARISC_DIR32;
663               /* When in 64bit mode, a 32bit relocation is supposed to
664                  be a section relative relocation.  Dwarf2 (for example)
665                  uses 32bit section relative relocations.  */
666               if (bfd_get_arch_info (abfd)->bits_per_address != 32)
667                 final_type = R_PARISC_SECREL32;
668               break;
669             case e_psel:
670               final_type = R_PARISC_PLABEL32;
671               break;
672             default:
673               return R_PARISC_NONE;
674             }
675           break;
676
677         case 64:
678           switch (field)
679             {
680             case e_fsel:
681               final_type = R_PARISC_DIR64;
682               break;
683             case e_psel:
684               final_type = R_PARISC_FPTR64;
685               break;
686             default:
687               return R_PARISC_NONE;
688             }
689           break;
690
691         default:
692           return R_PARISC_NONE;
693         }
694       break;
695
696     case R_HPPA_GOTOFF:
697       switch (format)
698         {
699         case 14:
700           switch (field)
701             {
702             case e_rsel:
703             case e_rrsel:
704             case e_rdsel:
705               /* R_PARISC_DLTREL14R for elf64, R_PARISC_DPREL14R for elf32  */
706               final_type = base_type + OFFSET_14R_FROM_21L;
707               break;
708             case e_fsel:
709               /* R_PARISC_DLTREL14F for elf64, R_PARISC_DPREL14F for elf32  */
710               final_type = base_type + OFFSET_14F_FROM_21L;
711               break;
712             default:
713               return R_PARISC_NONE;
714             }
715           break;
716
717         case 21:
718           switch (field)
719             {
720             case e_lsel:
721             case e_lrsel:
722             case e_ldsel:
723             case e_nlsel:
724             case e_nlrsel:
725               /* R_PARISC_DLTREL21L for elf64, R_PARISC_DPREL21L for elf32  */
726               final_type = base_type;
727               break;
728             default:
729               return R_PARISC_NONE;
730             }
731           break;
732
733         default:
734           return R_PARISC_NONE;
735         }
736       break;
737
738     case R_HPPA_PCREL_CALL:
739       switch (format)
740         {
741         case 12:
742           switch (field)
743             {
744             case e_fsel:
745               final_type = R_PARISC_PCREL12F;
746               break;
747             default:
748               return R_PARISC_NONE;
749             }
750           break;
751
752         case 14:
753           /* Contrary to appearances, these are not calls of any sort.
754              Rather, they are loads/stores with a pcrel reloc.  */
755           switch (field)
756             {
757             case e_rsel:
758             case e_rrsel:
759             case e_rdsel:
760               final_type = R_PARISC_PCREL14R;
761               break;
762             case e_fsel:
763               if (bfd_get_mach (abfd) < 25)
764                 final_type = R_PARISC_PCREL14F;
765               else
766                 final_type = R_PARISC_PCREL16F;
767               break;
768             default:
769               return R_PARISC_NONE;
770             }
771           break;
772
773         case 17:
774           switch (field)
775             {
776             case e_rsel:
777             case e_rrsel:
778             case e_rdsel:
779               final_type = R_PARISC_PCREL17R;
780               break;
781             case e_fsel:
782               final_type = R_PARISC_PCREL17F;
783               break;
784             default:
785               return R_PARISC_NONE;
786             }
787           break;
788
789         case 21:
790           switch (field)
791             {
792             case e_lsel:
793             case e_lrsel:
794             case e_ldsel:
795             case e_nlsel:
796             case e_nlrsel:
797               final_type = R_PARISC_PCREL21L;
798               break;
799             default:
800               return R_PARISC_NONE;
801             }
802           break;
803
804         case 22:
805           switch (field)
806             {
807             case e_fsel:
808               final_type = R_PARISC_PCREL22F;
809               break;
810             default:
811               return R_PARISC_NONE;
812             }
813           break;
814
815         case 32:
816           switch (field)
817             {
818             case e_fsel:
819               final_type = R_PARISC_PCREL32;
820               break;
821             default:
822               return R_PARISC_NONE;
823             }
824           break;
825
826         case 64:
827           switch (field)
828             {
829             case e_fsel:
830               final_type = R_PARISC_PCREL64;
831               break;
832             default:
833               return R_PARISC_NONE;
834             }
835           break;
836
837         default:
838           return R_PARISC_NONE;
839         }
840       break;
841
842     case R_PARISC_GNU_VTENTRY:
843     case R_PARISC_GNU_VTINHERIT:
844     case R_PARISC_SEGREL32:
845     case R_PARISC_SEGBASE:
846       /* The defaults are fine for these cases.  */
847       break;
848
849     default:
850       return R_PARISC_NONE;
851     }
852
853   return final_type;
854 }
855
856 /* Return one (or more) BFD relocations which implement the base
857    relocation with modifications based on format and field.  */
858
859 elf_hppa_reloc_type **
860 _bfd_elf_hppa_gen_reloc_type (bfd *abfd,
861                               elf_hppa_reloc_type base_type,
862                               int format,
863                               unsigned int field,
864                               int ignore ATTRIBUTE_UNUSED,
865                               asymbol *sym ATTRIBUTE_UNUSED)
866 {
867   elf_hppa_reloc_type *finaltype;
868   elf_hppa_reloc_type **final_types;
869   bfd_size_type amt = sizeof (elf_hppa_reloc_type *) * 2;
870
871   /* Allocate slots for the BFD relocation.  */
872   final_types = bfd_alloc (abfd, amt);
873   if (final_types == NULL)
874     return NULL;
875
876   /* Allocate space for the relocation itself.  */
877   amt = sizeof (elf_hppa_reloc_type);
878   finaltype = bfd_alloc (abfd, amt);
879   if (finaltype == NULL)
880     return NULL;
881
882   /* Some reasonable defaults.  */
883   final_types[0] = finaltype;
884   final_types[1] = NULL;
885
886   *finaltype = elf_hppa_reloc_final_type (abfd, base_type, format, field);
887
888   return final_types;
889 }
890
891 /* Translate from an elf into field into a howto relocation pointer.  */
892
893 static void
894 elf_hppa_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
895                         arelent *bfd_reloc,
896                         Elf_Internal_Rela *elf_reloc)
897 {
898   BFD_ASSERT (ELF_R_TYPE (elf_reloc->r_info)
899               < (unsigned int) R_PARISC_UNIMPLEMENTED);
900   bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
901 }
902
903 /* Translate from an elf into field into a howto relocation pointer.  */
904
905 static void
906 elf_hppa_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
907                             arelent *bfd_reloc,
908                             Elf_Internal_Rela *elf_reloc)
909 {
910   BFD_ASSERT (ELF_R_TYPE(elf_reloc->r_info)
911               < (unsigned int) R_PARISC_UNIMPLEMENTED);
912   bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
913 }
914
915 /* Return the address of the howto table entry to perform the CODE
916    relocation for an ARCH machine.  */
917
918 static reloc_howto_type *
919 elf_hppa_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
920                             bfd_reloc_code_real_type code)
921 {
922   if ((int) code < (int) R_PARISC_UNIMPLEMENTED)
923     {
924       BFD_ASSERT ((int) elf_hppa_howto_table[(int) code].type == (int) code);
925       return &elf_hppa_howto_table[(int) code];
926     }
927   return NULL;
928 }
929
930 /* Return TRUE if SYM represents a local label symbol.  */
931
932 static bfd_boolean
933 elf_hppa_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name)
934 {
935   if (name[0] == 'L' && name[1] == '$')
936     return 1;
937   return _bfd_elf_is_local_label_name (abfd, name);
938 }
939
940 /* Set the correct type for an ELF section.  We do this by the
941    section name, which is a hack, but ought to work.  */
942
943 static bfd_boolean
944 elf_hppa_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
945 {
946   const char *name;
947
948   name = bfd_get_section_name (abfd, sec);
949
950   if (strcmp (name, ".PARISC.unwind") == 0)
951     {
952       int indx;
953       asection *asec;
954 #if ARCH_SIZE == 64
955       hdr->sh_type = SHT_LOPROC + 1;
956 #else
957       hdr->sh_type = 1;
958 #endif
959       /* ?!? How are unwinds supposed to work for symbols in arbitrary
960          sections?  Or what if we have multiple .text sections in a single
961          .o file?  HP really messed up on this one.
962
963          Ugh.  We can not use elf_section_data (sec)->this_idx at this
964          point because it is not initialized yet.
965
966          So we (gasp) recompute it here.  Hopefully nobody ever changes the
967          way sections are numbered in elf.c!  */
968       for (asec = abfd->sections, indx = 1; asec; asec = asec->next, indx++)
969         {
970           if (asec->name && strcmp (asec->name, ".text") == 0)
971             {
972               hdr->sh_info = indx;
973               break;
974             }
975         }
976
977       /* I have no idea if this is really necessary or what it means.  */
978       hdr->sh_entsize = 4;
979     }
980   return TRUE;
981 }
982
983 static void
984 elf_hppa_final_write_processing (bfd *abfd,
985                                  bfd_boolean linker ATTRIBUTE_UNUSED)
986 {
987   int mach = bfd_get_mach (abfd);
988
989   elf_elfheader (abfd)->e_flags &= ~(EF_PARISC_ARCH | EF_PARISC_TRAPNIL
990                                      | EF_PARISC_EXT | EF_PARISC_LSB
991                                      | EF_PARISC_WIDE | EF_PARISC_NO_KABP
992                                      | EF_PARISC_LAZYSWAP);
993
994   if (mach == 10)
995     elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_0;
996   else if (mach == 11)
997     elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_1;
998   else if (mach == 20)
999     elf_elfheader (abfd)->e_flags |= EFA_PARISC_2_0;
1000   else if (mach == 25)
1001     elf_elfheader (abfd)->e_flags |= (EF_PARISC_WIDE
1002                                       | EFA_PARISC_2_0
1003                                       /* The GNU tools have trapped without
1004                                          option since 1993, so need to take
1005                                          a step backwards with the ELF
1006                                          based toolchains.  */
1007                                       | EF_PARISC_TRAPNIL);
1008 }
1009
1010 /* Comparison function for qsort to sort unwind section during a
1011    final link.  */
1012
1013 static int
1014 hppa_unwind_entry_compare (const void *a, const void *b)
1015 {
1016   const bfd_byte *ap, *bp;
1017   unsigned long av, bv;
1018
1019   ap = a;
1020   av = (unsigned long) ap[0] << 24;
1021   av |= (unsigned long) ap[1] << 16;
1022   av |= (unsigned long) ap[2] << 8;
1023   av |= (unsigned long) ap[3];
1024
1025   bp = b;
1026   bv = (unsigned long) bp[0] << 24;
1027   bv |= (unsigned long) bp[1] << 16;
1028   bv |= (unsigned long) bp[2] << 8;
1029   bv |= (unsigned long) bp[3];
1030
1031   return av < bv ? -1 : av > bv ? 1 : 0;
1032 }
1033
1034 static bfd_boolean elf_hppa_sort_unwind (bfd *abfd)
1035 {
1036   asection *s;
1037
1038   /* Magic section names, but this is much safer than having
1039      relocate_section remember where SEGREL32 relocs occurred.
1040      Consider what happens if someone inept creates a linker script
1041      that puts unwind information in .text.  */
1042   s = bfd_get_section_by_name (abfd, ".PARISC.unwind");
1043   if (s != NULL)
1044     {
1045       bfd_size_type size;
1046       char *contents;
1047
1048       size = s->_raw_size;
1049       contents = bfd_malloc (size);
1050       if (contents == NULL)
1051         return FALSE;
1052
1053       if (! bfd_get_section_contents (abfd, s, contents, (file_ptr) 0, size))
1054         return FALSE;
1055
1056       qsort (contents, (size_t) (size / 16), 16, hppa_unwind_entry_compare);
1057
1058       if (! bfd_set_section_contents (abfd, s, contents, (file_ptr) 0, size))
1059         return FALSE;
1060     }
1061
1062   return TRUE;
1063 }
1064
1065 #if ARCH_SIZE == 64
1066 /* Hook called by the linker routine which adds symbols from an object
1067    file.  HP's libraries define symbols with HP specific section
1068    indices, which we have to handle.  */
1069
1070 static bfd_boolean
1071 elf_hppa_add_symbol_hook (bfd *abfd,
1072                           struct bfd_link_info *info ATTRIBUTE_UNUSED,
1073                           const Elf_Internal_Sym *sym,
1074                           const char **namep ATTRIBUTE_UNUSED,
1075                           flagword *flagsp ATTRIBUTE_UNUSED,
1076                           asection **secp,
1077                           bfd_vma *valp)
1078 {
1079   int index = sym->st_shndx;
1080
1081   switch (index)
1082     {
1083     case SHN_PARISC_ANSI_COMMON:
1084       *secp = bfd_make_section_old_way (abfd, ".PARISC.ansi.common");
1085       (*secp)->flags |= SEC_IS_COMMON;
1086       *valp = sym->st_size;
1087       break;
1088
1089     case SHN_PARISC_HUGE_COMMON:
1090       *secp = bfd_make_section_old_way (abfd, ".PARISC.huge.common");
1091       (*secp)->flags |= SEC_IS_COMMON;
1092       *valp = sym->st_size;
1093       break;
1094     }
1095
1096   return TRUE;
1097 }
1098
1099 static bfd_boolean
1100 elf_hppa_unmark_useless_dynamic_symbols (struct elf_link_hash_entry *h,
1101                                          void *data)
1102 {
1103   struct bfd_link_info *info = data;
1104
1105   if (h->root.type == bfd_link_hash_warning)
1106     h = (struct elf_link_hash_entry *) h->root.u.i.link;
1107
1108   /* If we are not creating a shared library, and this symbol is
1109      referenced by a shared library but is not defined anywhere, then
1110      the generic code will warn that it is undefined.
1111
1112      This behavior is undesirable on HPs since the standard shared
1113      libraries contain references to undefined symbols.
1114
1115      So we twiddle the flags associated with such symbols so that they
1116      will not trigger the warning.  ?!? FIXME.  This is horribly fragile.
1117
1118      Ultimately we should have better controls over the generic ELF BFD
1119      linker code.  */
1120   if (! info->relocatable
1121       && ! (info->shared
1122             && info->unresolved_syms_in_shared_libs == RM_IGNORE)
1123       && h->root.type == bfd_link_hash_undefined
1124       && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0
1125       && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
1126     {
1127       h->elf_link_hash_flags &= ~ELF_LINK_HASH_REF_DYNAMIC;
1128       h->elf_link_hash_flags |= 0x8000;
1129     }
1130
1131   return TRUE;
1132 }
1133
1134 static bfd_boolean
1135 elf_hppa_remark_useless_dynamic_symbols (struct elf_link_hash_entry *h,
1136                                          void *data)
1137 {
1138   struct bfd_link_info *info = data;
1139
1140   if (h->root.type == bfd_link_hash_warning)
1141     h = (struct elf_link_hash_entry *) h->root.u.i.link;
1142
1143   /* If we are not creating a shared library, and this symbol is
1144      referenced by a shared library but is not defined anywhere, then
1145      the generic code will warn that it is undefined.
1146
1147      This behavior is undesirable on HPs since the standard shared
1148      libraries contain references to undefined symbols.
1149
1150      So we twiddle the flags associated with such symbols so that they
1151      will not trigger the warning.  ?!? FIXME.  This is horribly fragile.
1152
1153      Ultimately we should have better controls over the generic ELF BFD
1154      linker code.  */
1155   if (! info->relocatable
1156       && ! (info->shared
1157             && info->unresolved_syms_in_shared_libs == RM_IGNORE)
1158       && h->root.type == bfd_link_hash_undefined
1159       && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
1160       && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0
1161       && (h->elf_link_hash_flags & 0x8000) != 0)
1162     {
1163       h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
1164       h->elf_link_hash_flags &= ~0x8000;
1165     }
1166
1167   return TRUE;
1168 }
1169
1170 static bfd_boolean
1171 elf_hppa_is_dynamic_loader_symbol (const char *name)
1172 {
1173   return (! strcmp (name, "__CPU_REVISION")
1174           || ! strcmp (name, "__CPU_KEYBITS_1")
1175           || ! strcmp (name, "__SYSTEM_ID_D")
1176           || ! strcmp (name, "__FPU_MODEL")
1177           || ! strcmp (name, "__FPU_REVISION")
1178           || ! strcmp (name, "__ARGC")
1179           || ! strcmp (name, "__ARGV")
1180           || ! strcmp (name, "__ENVP")
1181           || ! strcmp (name, "__TLS_SIZE_D")
1182           || ! strcmp (name, "__LOAD_INFO")
1183           || ! strcmp (name, "__systab"));
1184 }
1185
1186 /* Record the lowest address for the data and text segments.  */
1187 static void
1188 elf_hppa_record_segment_addrs (bfd *abfd ATTRIBUTE_UNUSED,
1189                                asection *section,
1190                                void *data)
1191 {
1192   struct elf64_hppa_link_hash_table *hppa_info;
1193   bfd_vma value;
1194
1195   hppa_info = data;
1196
1197   value = section->vma - section->filepos;
1198
1199   if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
1200        == (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
1201       && value < hppa_info->text_segment_base)
1202     hppa_info->text_segment_base = value;
1203   else if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
1204             == (SEC_ALLOC | SEC_LOAD))
1205            && value < hppa_info->data_segment_base)
1206     hppa_info->data_segment_base = value;
1207 }
1208
1209 /* Called after we have seen all the input files/sections, but before
1210    final symbol resolution and section placement has been determined.
1211
1212    We use this hook to (possibly) provide a value for __gp, then we
1213    fall back to the generic ELF final link routine.  */
1214
1215 static bfd_boolean
1216 elf_hppa_final_link (bfd *abfd, struct bfd_link_info *info)
1217 {
1218   bfd_boolean retval;
1219   struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
1220
1221   if (! info->relocatable)
1222     {
1223       struct elf_link_hash_entry *gp;
1224       bfd_vma gp_val;
1225
1226       /* The linker script defines a value for __gp iff it was referenced
1227          by one of the objects being linked.  First try to find the symbol
1228          in the hash table.  If that fails, just compute the value __gp
1229          should have had.  */
1230       gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", FALSE,
1231                                  FALSE, FALSE);
1232
1233       if (gp)
1234         {
1235
1236           /* Adjust the value of __gp as we may want to slide it into the
1237              .plt section so that the stubs can access PLT entries without
1238              using an addil sequence.  */
1239           gp->root.u.def.value += hppa_info->gp_offset;
1240
1241           gp_val = (gp->root.u.def.section->output_section->vma
1242                     + gp->root.u.def.section->output_offset
1243                     + gp->root.u.def.value);
1244         }
1245       else
1246         {
1247           asection *sec;
1248
1249           /* First look for a .plt section.  If found, then __gp is the
1250              address of the .plt + gp_offset.
1251
1252              If no .plt is found, then look for .dlt, .opd and .data (in
1253              that order) and set __gp to the base address of whichever
1254              section is found first.  */
1255
1256           sec = hppa_info->plt_sec;
1257           if (sec && ! (sec->flags & SEC_EXCLUDE))
1258             gp_val = (sec->output_offset
1259                       + sec->output_section->vma
1260                       + hppa_info->gp_offset);
1261           else
1262             {
1263               sec = hppa_info->dlt_sec;
1264               if (!sec || (sec->flags & SEC_EXCLUDE))
1265                 sec = hppa_info->opd_sec;
1266               if (!sec || (sec->flags & SEC_EXCLUDE))
1267                 sec = bfd_get_section_by_name (abfd, ".data");
1268               if (!sec || (sec->flags & SEC_EXCLUDE))
1269                 return FALSE;
1270
1271               gp_val = sec->output_offset + sec->output_section->vma;
1272             }
1273         }
1274
1275       /* Install whatever value we found/computed for __gp.  */
1276       _bfd_set_gp_value (abfd, gp_val);
1277     }
1278
1279   /* We need to know the base of the text and data segments so that we
1280      can perform SEGREL relocations.  We will record the base addresses
1281      when we encounter the first SEGREL relocation.  */
1282   hppa_info->text_segment_base = (bfd_vma)-1;
1283   hppa_info->data_segment_base = (bfd_vma)-1;
1284
1285   /* HP's shared libraries have references to symbols that are not
1286      defined anywhere.  The generic ELF BFD linker code will complain
1287      about such symbols.
1288
1289      So we detect the losing case and arrange for the flags on the symbol
1290      to indicate that it was never referenced.  This keeps the generic
1291      ELF BFD link code happy and appears to not create any secondary
1292      problems.  Ultimately we need a way to control the behavior of the
1293      generic ELF BFD link code better.  */
1294   elf_link_hash_traverse (elf_hash_table (info),
1295                           elf_hppa_unmark_useless_dynamic_symbols,
1296                           info);
1297
1298   /* Invoke the regular ELF backend linker to do all the work.  */
1299   retval = bfd_elf_bfd_final_link (abfd, info);
1300
1301   elf_link_hash_traverse (elf_hash_table (info),
1302                           elf_hppa_remark_useless_dynamic_symbols,
1303                           info);
1304
1305   /* If we're producing a final executable, sort the contents of the
1306      unwind section. */
1307   if (retval)
1308     retval = elf_hppa_sort_unwind (abfd);
1309
1310   return retval;
1311 }
1312
1313 /* Relocate an HPPA ELF section.  */
1314
1315 static bfd_boolean
1316 elf_hppa_relocate_section (bfd *output_bfd,
1317                            struct bfd_link_info *info,
1318                            bfd *input_bfd,
1319                            asection *input_section,
1320                            bfd_byte *contents,
1321                            Elf_Internal_Rela *relocs,
1322                            Elf_Internal_Sym *local_syms,
1323                            asection **local_sections)
1324 {
1325   Elf_Internal_Shdr *symtab_hdr;
1326   Elf_Internal_Rela *rel;
1327   Elf_Internal_Rela *relend;
1328   struct elf64_hppa_link_hash_table *hppa_info;
1329
1330   if (info->relocatable)
1331     return TRUE;
1332
1333   hppa_info = elf64_hppa_hash_table (info);
1334   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
1335
1336   rel = relocs;
1337   relend = relocs + input_section->reloc_count;
1338   for (; rel < relend; rel++)
1339     {
1340       int r_type;
1341       reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
1342       unsigned long r_symndx;
1343       struct elf_link_hash_entry *h;
1344       Elf_Internal_Sym *sym;
1345       asection *sym_sec;
1346       bfd_vma relocation;
1347       bfd_reloc_status_type r;
1348       const char *sym_name;
1349       const char *dyn_name;
1350       char *dynh_buf = NULL;
1351       size_t dynh_buflen = 0;
1352       struct elf64_hppa_dyn_hash_entry *dyn_h = NULL;
1353
1354       r_type = ELF_R_TYPE (rel->r_info);
1355       if (r_type < 0 || r_type >= (int) R_PARISC_UNIMPLEMENTED)
1356         {
1357           bfd_set_error (bfd_error_bad_value);
1358           return FALSE;
1359         }
1360
1361       /* This is a final link.  */
1362       r_symndx = ELF_R_SYM (rel->r_info);
1363       h = NULL;
1364       sym = NULL;
1365       sym_sec = NULL;
1366       if (r_symndx < symtab_hdr->sh_info)
1367         {
1368           /* This is a local symbol.  */
1369           sym = local_syms + r_symndx;
1370           sym_sec = local_sections[r_symndx];
1371           relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rel);
1372
1373           /* If this symbol has an entry in the PA64 dynamic hash
1374              table, then get it.  */
1375           dyn_name = get_dyn_name (input_bfd, h, rel,
1376                                    &dynh_buf, &dynh_buflen);
1377           dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1378                                               dyn_name, FALSE, FALSE);
1379
1380         }
1381       else
1382         {
1383           /* This is not a local symbol.  */
1384           long indx;
1385
1386           indx = r_symndx - symtab_hdr->sh_info;
1387           h = elf_sym_hashes (input_bfd)[indx];
1388           while (h->root.type == bfd_link_hash_indirect
1389                  || h->root.type == bfd_link_hash_warning)
1390             h = (struct elf_link_hash_entry *) h->root.u.i.link;
1391           if (h->root.type == bfd_link_hash_defined
1392               || h->root.type == bfd_link_hash_defweak)
1393             {
1394               sym_sec = h->root.u.def.section;
1395
1396               /* If this symbol has an entry in the PA64 dynamic hash
1397                  table, then get it.  */
1398               dyn_name = get_dyn_name (input_bfd, h, rel,
1399                                        &dynh_buf, &dynh_buflen);
1400               dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1401                                                   dyn_name, FALSE, FALSE);
1402
1403               /* If we have a relocation against a symbol defined in a
1404                  shared library and we have not created an entry in the
1405                  PA64 dynamic symbol hash table for it, then we lose.  */
1406               if (sym_sec->output_section == NULL && dyn_h == NULL)
1407                 {
1408                   (*_bfd_error_handler)
1409                     (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
1410                      bfd_archive_filename (input_bfd), h->root.root.string,
1411                      bfd_get_section_name (input_bfd, input_section));
1412                   relocation = 0;
1413                 }
1414               else if (sym_sec->output_section)
1415                 relocation = (h->root.u.def.value
1416                               + sym_sec->output_offset
1417                               + sym_sec->output_section->vma);
1418               /* Value will be provided via one of the offsets in the
1419                  dyn_h hash table entry.  */
1420               else
1421                 relocation = 0;
1422             }
1423           /* Allow undefined symbols in shared libraries.  */
1424           else if (info->shared
1425                    && info->unresolved_syms_in_shared_libs == RM_IGNORE
1426                    && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
1427             {
1428               if (info->symbolic)
1429                 (*info->callbacks->undefined_symbol)
1430                   (info, h->root.root.string, input_bfd,
1431                    input_section, rel->r_offset, FALSE);
1432
1433               /* If this symbol has an entry in the PA64 dynamic hash
1434                  table, then get it.  */
1435               dyn_name = get_dyn_name (input_bfd, h, rel,
1436                                        &dynh_buf, &dynh_buflen);
1437               dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1438                                                   dyn_name, FALSE, FALSE);
1439
1440               if (dyn_h == NULL)
1441                 {
1442                   (*_bfd_error_handler)
1443                     (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
1444                      bfd_archive_filename (input_bfd), h->root.root.string,
1445                      bfd_get_section_name (input_bfd, input_section));
1446                 }
1447               relocation = 0;
1448             }
1449           else if (h->root.type == bfd_link_hash_undefweak)
1450             {
1451               dyn_name = get_dyn_name (input_bfd, h, rel,
1452                                        &dynh_buf, &dynh_buflen);
1453               dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1454                                                   dyn_name, FALSE, FALSE);
1455
1456               if (dyn_h == NULL)
1457                 {
1458                   (*_bfd_error_handler)
1459                     (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
1460                      bfd_archive_filename (input_bfd), h->root.root.string,
1461                      bfd_get_section_name (input_bfd, input_section));
1462                 }
1463               relocation = 0;
1464             }
1465           else
1466             {
1467               /* Ignore dynamic loader defined symbols.  */
1468               if (elf_hppa_is_dynamic_loader_symbol (h->root.root.string))
1469                 relocation = 0;
1470               else
1471                 {
1472                   if (!((*info->callbacks->undefined_symbol)
1473                         (info, h->root.root.string, input_bfd,
1474                          input_section, rel->r_offset, TRUE)))
1475                     return FALSE;
1476                   break;
1477                 }
1478             }
1479         }
1480
1481       if (h != NULL)
1482         sym_name = h->root.root.string;
1483       else
1484         {
1485           sym_name = bfd_elf_string_from_elf_section (input_bfd,
1486                                                       symtab_hdr->sh_link,
1487                                                       sym->st_name);
1488           if (sym_name == NULL)
1489             return FALSE;
1490           if (*sym_name == '\0')
1491             sym_name = bfd_section_name (input_bfd, sym_sec);
1492         }
1493
1494       r = elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
1495                                         input_section, contents,
1496                                         relocation, info, sym_sec,
1497                                         h, dyn_h);
1498
1499       if (r != bfd_reloc_ok)
1500         {
1501           switch (r)
1502             {
1503             default:
1504               abort ();
1505             case bfd_reloc_overflow:
1506               {
1507                 if (!((*info->callbacks->reloc_overflow)
1508                       (info, sym_name, howto->name, (bfd_vma) 0,
1509                         input_bfd, input_section, rel->r_offset)))
1510                   return FALSE;
1511               }
1512               break;
1513             }
1514         }
1515     }
1516   return TRUE;
1517 }
1518
1519 /* Compute the value for a relocation (REL) during a final link stage,
1520    then insert the value into the proper location in CONTENTS.
1521
1522    VALUE is a tentative value for the relocation and may be overridden
1523    and modified here based on the specific relocation to be performed.
1524
1525    For example we do conversions for PC-relative branches in this routine
1526    or redirection of calls to external routines to stubs.
1527
1528    The work of actually applying the relocation is left to a helper
1529    routine in an attempt to reduce the complexity and size of this
1530    function.  */
1531
1532 static bfd_reloc_status_type
1533 elf_hppa_final_link_relocate (Elf_Internal_Rela *rel,
1534                               bfd *input_bfd,
1535                               bfd *output_bfd,
1536                               asection *input_section,
1537                               bfd_byte *contents,
1538                               bfd_vma value,
1539                               struct bfd_link_info *info,
1540                               asection *sym_sec,
1541                               struct elf_link_hash_entry *h ATTRIBUTE_UNUSED,
1542                               struct elf64_hppa_dyn_hash_entry *dyn_h)
1543 {
1544   int insn;
1545   bfd_vma offset = rel->r_offset;
1546   bfd_signed_vma addend = rel->r_addend;
1547   reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
1548   unsigned int r_type = howto->type;
1549   bfd_byte *hit_data = contents + offset;
1550   struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
1551
1552   insn = bfd_get_32 (input_bfd, hit_data);
1553
1554   switch (r_type)
1555     {
1556     case R_PARISC_NONE:
1557       break;
1558
1559     /* Basic function call support.
1560
1561        Note for a call to a function defined in another dynamic library
1562        we want to redirect the call to a stub.  */
1563
1564     /* Random PC relative relocs.  */
1565     case R_PARISC_PCREL21L:
1566     case R_PARISC_PCREL14R:
1567     case R_PARISC_PCREL14F:
1568     case R_PARISC_PCREL14WR:
1569     case R_PARISC_PCREL14DR:
1570     case R_PARISC_PCREL16F:
1571     case R_PARISC_PCREL16WF:
1572     case R_PARISC_PCREL16DF:
1573       {
1574         /* If this is a call to a function defined in another dynamic
1575            library, then redirect the call to the local stub for this
1576            function.  */
1577         if (sym_sec == NULL || sym_sec->output_section == NULL)
1578           value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1579                    + hppa_info->stub_sec->output_section->vma);
1580
1581         /* Turn VALUE into a proper PC relative address.  */
1582         value -= (offset + input_section->output_offset
1583                   + input_section->output_section->vma);
1584
1585         /* Adjust for any field selectors.  */
1586         if (r_type == R_PARISC_PCREL21L)
1587           value = hppa_field_adjust (value, -8 + addend, e_lsel);
1588         else if (r_type == R_PARISC_PCREL14F
1589                  || r_type == R_PARISC_PCREL16F
1590                  || r_type == R_PARISC_PCREL16WF
1591                  || r_type == R_PARISC_PCREL16DF)
1592           value = hppa_field_adjust (value, -8 + addend, e_fsel);
1593         else
1594           value = hppa_field_adjust (value, -8 + addend, e_rsel);
1595
1596         /* Apply the relocation to the given instruction.  */
1597         insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1598         break;
1599       }
1600
1601     case R_PARISC_PCREL12F:
1602     case R_PARISC_PCREL22F:
1603     case R_PARISC_PCREL17F:
1604     case R_PARISC_PCREL22C:
1605     case R_PARISC_PCREL17C:
1606     case R_PARISC_PCREL17R:
1607       {
1608         /* If this is a call to a function defined in another dynamic
1609            library, then redirect the call to the local stub for this
1610            function.  */
1611         if (sym_sec == NULL || sym_sec->output_section == NULL)
1612           value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1613                    + hppa_info->stub_sec->output_section->vma);
1614
1615         /* Turn VALUE into a proper PC relative address.  */
1616         value -= (offset + input_section->output_offset
1617                   + input_section->output_section->vma);
1618
1619         /* Adjust for any field selectors.  */
1620         if (r_type == R_PARISC_PCREL17R)
1621           value = hppa_field_adjust (value, -8 + addend, e_rsel);
1622         else
1623           value = hppa_field_adjust (value, -8 + addend, e_fsel);
1624
1625         /* All branches are implicitly shifted by 2 places.  */
1626         value >>= 2;
1627
1628         /* Apply the relocation to the given instruction.  */
1629         insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1630         break;
1631       }
1632
1633     /* Indirect references to data through the DLT.  */
1634     case R_PARISC_DLTIND14R:
1635     case R_PARISC_DLTIND14F:
1636     case R_PARISC_DLTIND14DR:
1637     case R_PARISC_DLTIND14WR:
1638     case R_PARISC_DLTIND21L:
1639     case R_PARISC_LTOFF_FPTR14R:
1640     case R_PARISC_LTOFF_FPTR14DR:
1641     case R_PARISC_LTOFF_FPTR14WR:
1642     case R_PARISC_LTOFF_FPTR21L:
1643     case R_PARISC_LTOFF_FPTR16F:
1644     case R_PARISC_LTOFF_FPTR16WF:
1645     case R_PARISC_LTOFF_FPTR16DF:
1646     case R_PARISC_LTOFF_TP21L:
1647     case R_PARISC_LTOFF_TP14R:
1648     case R_PARISC_LTOFF_TP14F:
1649     case R_PARISC_LTOFF_TP14WR:
1650     case R_PARISC_LTOFF_TP14DR:
1651     case R_PARISC_LTOFF_TP16F:
1652     case R_PARISC_LTOFF_TP16WF:
1653     case R_PARISC_LTOFF_TP16DF:
1654     case R_PARISC_LTOFF16F:
1655     case R_PARISC_LTOFF16WF:
1656     case R_PARISC_LTOFF16DF:
1657       {
1658         /* If this relocation was against a local symbol, then we still
1659            have not set up the DLT entry (it's not convenient to do so
1660            in the "finalize_dlt" routine because it is difficult to get
1661            to the local symbol's value).
1662
1663            So, if this is a local symbol (h == NULL), then we need to
1664            fill in its DLT entry.
1665
1666            Similarly we may still need to set up an entry in .opd for
1667            a local function which had its address taken.  */
1668         if (dyn_h->h == NULL)
1669           {
1670             /* Now do .opd creation if needed.  */
1671             if (r_type == R_PARISC_LTOFF_FPTR14R
1672                 || r_type == R_PARISC_LTOFF_FPTR14DR
1673                 || r_type == R_PARISC_LTOFF_FPTR14WR
1674                 || r_type == R_PARISC_LTOFF_FPTR21L
1675                 || r_type == R_PARISC_LTOFF_FPTR16F
1676                 || r_type == R_PARISC_LTOFF_FPTR16WF
1677                 || r_type == R_PARISC_LTOFF_FPTR16DF)
1678               {
1679                 /* The first two words of an .opd entry are zero.  */
1680                 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset,
1681                         0, 16);
1682
1683                 /* The next word is the address of the function.  */
1684                 bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
1685                             (hppa_info->opd_sec->contents
1686                              + dyn_h->opd_offset + 16));
1687
1688                 /* The last word is our local __gp value.  */
1689                 value = _bfd_get_gp_value
1690                           (hppa_info->opd_sec->output_section->owner);
1691                 bfd_put_64 (hppa_info->opd_sec->owner, value,
1692                             (hppa_info->opd_sec->contents
1693                              + dyn_h->opd_offset + 24));
1694
1695                 /* The DLT value is the address of the .opd entry.  */
1696                 value = (dyn_h->opd_offset
1697                          + hppa_info->opd_sec->output_offset
1698                          + hppa_info->opd_sec->output_section->vma);
1699                 addend = 0;
1700               }
1701
1702             bfd_put_64 (hppa_info->dlt_sec->owner,
1703                         value + addend,
1704                         hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
1705           }
1706
1707         /* We want the value of the DLT offset for this symbol, not
1708            the symbol's actual address.  Note that __gp may not point
1709            to the start of the DLT, so we have to compute the absolute
1710            address, then subtract out the value of __gp.  */
1711         value = (dyn_h->dlt_offset
1712                  + hppa_info->dlt_sec->output_offset
1713                  + hppa_info->dlt_sec->output_section->vma);
1714         value -= _bfd_get_gp_value (output_bfd);
1715
1716         /* All DLTIND relocations are basically the same at this point,
1717            except that we need different field selectors for the 21bit
1718            version vs the 14bit versions.  */
1719         if (r_type == R_PARISC_DLTIND21L
1720             || r_type == R_PARISC_LTOFF_FPTR21L
1721             || r_type == R_PARISC_LTOFF_TP21L)
1722           value = hppa_field_adjust (value, 0, e_lsel);
1723         else if (r_type == R_PARISC_DLTIND14F
1724                  || r_type == R_PARISC_LTOFF_FPTR16F
1725                  || r_type == R_PARISC_LTOFF_FPTR16WF
1726                  || r_type == R_PARISC_LTOFF_FPTR16DF
1727                  || r_type == R_PARISC_LTOFF16F
1728                  || r_type == R_PARISC_LTOFF16DF
1729                  || r_type == R_PARISC_LTOFF16WF
1730                  || r_type == R_PARISC_LTOFF_TP16F
1731                  || r_type == R_PARISC_LTOFF_TP16WF
1732                  || r_type == R_PARISC_LTOFF_TP16DF)
1733           value = hppa_field_adjust (value, 0, e_fsel);
1734         else
1735           value = hppa_field_adjust (value, 0, e_rsel);
1736
1737         insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1738         break;
1739       }
1740
1741     case R_PARISC_DLTREL14R:
1742     case R_PARISC_DLTREL14F:
1743     case R_PARISC_DLTREL14DR:
1744     case R_PARISC_DLTREL14WR:
1745     case R_PARISC_DLTREL21L:
1746     case R_PARISC_DPREL21L:
1747     case R_PARISC_DPREL14WR:
1748     case R_PARISC_DPREL14DR:
1749     case R_PARISC_DPREL14R:
1750     case R_PARISC_DPREL14F:
1751     case R_PARISC_GPREL16F:
1752     case R_PARISC_GPREL16WF:
1753     case R_PARISC_GPREL16DF:
1754       {
1755         /* Subtract out the global pointer value to make value a DLT
1756            relative address.  */
1757         value -= _bfd_get_gp_value (output_bfd);
1758
1759         /* All DLTREL relocations are basically the same at this point,
1760            except that we need different field selectors for the 21bit
1761            version vs the 14bit versions.  */
1762         if (r_type == R_PARISC_DLTREL21L
1763             || r_type == R_PARISC_DPREL21L)
1764           value = hppa_field_adjust (value, addend, e_lrsel);
1765         else if (r_type == R_PARISC_DLTREL14F
1766                  || r_type == R_PARISC_DPREL14F
1767                  || r_type == R_PARISC_GPREL16F
1768                  || r_type == R_PARISC_GPREL16WF
1769                  || r_type == R_PARISC_GPREL16DF)
1770           value = hppa_field_adjust (value, addend, e_fsel);
1771         else
1772           value = hppa_field_adjust (value, addend, e_rrsel);
1773
1774         insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1775         break;
1776       }
1777
1778     case R_PARISC_DIR21L:
1779     case R_PARISC_DIR17R:
1780     case R_PARISC_DIR17F:
1781     case R_PARISC_DIR14R:
1782     case R_PARISC_DIR14F:
1783     case R_PARISC_DIR14WR:
1784     case R_PARISC_DIR14DR:
1785     case R_PARISC_DIR16F:
1786     case R_PARISC_DIR16WF:
1787     case R_PARISC_DIR16DF:
1788       {
1789         /* All DIR relocations are basically the same at this point,
1790            except that branch offsets need to be divided by four, and
1791            we need different field selectors.  Note that we don't
1792            redirect absolute calls to local stubs.  */
1793
1794         if (r_type == R_PARISC_DIR21L)
1795           value = hppa_field_adjust (value, addend, e_lrsel);
1796         else if (r_type == R_PARISC_DIR17F
1797                  || r_type == R_PARISC_DIR16F
1798                  || r_type == R_PARISC_DIR16WF
1799                  || r_type == R_PARISC_DIR16DF
1800                  || r_type == R_PARISC_DIR14F)
1801           value = hppa_field_adjust (value, addend, e_fsel);
1802         else
1803           value = hppa_field_adjust (value, addend, e_rrsel);
1804
1805         if (r_type == R_PARISC_DIR17R || r_type == R_PARISC_DIR17F)
1806           {
1807             /* All branches are implicitly shifted by 2 places.  */
1808             value >>= 2;
1809           }
1810
1811         insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1812         break;
1813       }
1814
1815     case R_PARISC_PLTOFF21L:
1816     case R_PARISC_PLTOFF14R:
1817     case R_PARISC_PLTOFF14F:
1818     case R_PARISC_PLTOFF14WR:
1819     case R_PARISC_PLTOFF14DR:
1820     case R_PARISC_PLTOFF16F:
1821     case R_PARISC_PLTOFF16WF:
1822     case R_PARISC_PLTOFF16DF:
1823       {
1824         /* We want the value of the PLT offset for this symbol, not
1825            the symbol's actual address.  Note that __gp may not point
1826            to the start of the DLT, so we have to compute the absolute
1827            address, then subtract out the value of __gp.  */
1828         value = (dyn_h->plt_offset
1829                  + hppa_info->plt_sec->output_offset
1830                  + hppa_info->plt_sec->output_section->vma);
1831         value -= _bfd_get_gp_value (output_bfd);
1832
1833         /* All PLTOFF relocations are basically the same at this point,
1834            except that we need different field selectors for the 21bit
1835            version vs the 14bit versions.  */
1836         if (r_type == R_PARISC_PLTOFF21L)
1837           value = hppa_field_adjust (value, addend, e_lrsel);
1838         else if (r_type == R_PARISC_PLTOFF14F
1839                  || r_type == R_PARISC_PLTOFF16F
1840                  || r_type == R_PARISC_PLTOFF16WF
1841                  || r_type == R_PARISC_PLTOFF16DF)
1842           value = hppa_field_adjust (value, addend, e_fsel);
1843         else
1844           value = hppa_field_adjust (value, addend, e_rrsel);
1845
1846         insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1847         break;
1848       }
1849
1850     case R_PARISC_LTOFF_FPTR32:
1851       {
1852         /* We may still need to create the FPTR itself if it was for
1853            a local symbol.  */
1854         if (dyn_h->h == NULL)
1855           {
1856             /* The first two words of an .opd entry are zero.  */
1857             memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
1858
1859             /* The next word is the address of the function.  */
1860             bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
1861                         (hppa_info->opd_sec->contents
1862                          + dyn_h->opd_offset + 16));
1863
1864             /* The last word is our local __gp value.  */
1865             value = _bfd_get_gp_value
1866                       (hppa_info->opd_sec->output_section->owner);
1867             bfd_put_64 (hppa_info->opd_sec->owner, value,
1868                         hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
1869
1870             /* The DLT value is the address of the .opd entry.  */
1871             value = (dyn_h->opd_offset
1872                      + hppa_info->opd_sec->output_offset
1873                      + hppa_info->opd_sec->output_section->vma);
1874
1875             bfd_put_64 (hppa_info->dlt_sec->owner,
1876                         value,
1877                         hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
1878           }
1879
1880         /* We want the value of the DLT offset for this symbol, not
1881            the symbol's actual address.  Note that __gp may not point
1882            to the start of the DLT, so we have to compute the absolute
1883            address, then subtract out the value of __gp.  */
1884         value = (dyn_h->dlt_offset
1885                  + hppa_info->dlt_sec->output_offset
1886                  + hppa_info->dlt_sec->output_section->vma);
1887         value -= _bfd_get_gp_value (output_bfd);
1888         bfd_put_32 (input_bfd, value, hit_data);
1889         return bfd_reloc_ok;
1890       }
1891
1892     case R_PARISC_LTOFF_FPTR64:
1893     case R_PARISC_LTOFF_TP64:
1894       {
1895         /* We may still need to create the FPTR itself if it was for
1896            a local symbol.  */
1897         if (dyn_h->h == NULL && r_type == R_PARISC_LTOFF_FPTR64)
1898           {
1899             /* The first two words of an .opd entry are zero.  */
1900             memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
1901
1902             /* The next word is the address of the function.  */
1903             bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
1904                         (hppa_info->opd_sec->contents
1905                          + dyn_h->opd_offset + 16));
1906
1907             /* The last word is our local __gp value.  */
1908             value = _bfd_get_gp_value
1909                       (hppa_info->opd_sec->output_section->owner);
1910             bfd_put_64 (hppa_info->opd_sec->owner, value,
1911                         hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
1912
1913             /* The DLT value is the address of the .opd entry.  */
1914             value = (dyn_h->opd_offset
1915                      + hppa_info->opd_sec->output_offset
1916                      + hppa_info->opd_sec->output_section->vma);
1917
1918             bfd_put_64 (hppa_info->dlt_sec->owner,
1919                         value,
1920                         hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
1921           }
1922
1923         /* We want the value of the DLT offset for this symbol, not
1924            the symbol's actual address.  Note that __gp may not point
1925            to the start of the DLT, so we have to compute the absolute
1926            address, then subtract out the value of __gp.  */
1927         value = (dyn_h->dlt_offset
1928                  + hppa_info->dlt_sec->output_offset
1929                  + hppa_info->dlt_sec->output_section->vma);
1930         value -= _bfd_get_gp_value (output_bfd);
1931         bfd_put_64 (input_bfd, value, hit_data);
1932         return bfd_reloc_ok;
1933       }
1934
1935     case R_PARISC_DIR32:
1936       bfd_put_32 (input_bfd, value + addend, hit_data);
1937       return bfd_reloc_ok;
1938
1939     case R_PARISC_DIR64:
1940       bfd_put_64 (input_bfd, value + addend, hit_data);
1941       return bfd_reloc_ok;
1942
1943     case R_PARISC_GPREL64:
1944       /* Subtract out the global pointer value to make value a DLT
1945          relative address.  */
1946       value -= _bfd_get_gp_value (output_bfd);
1947
1948       bfd_put_64 (input_bfd, value + addend, hit_data);
1949       return bfd_reloc_ok;
1950
1951     case R_PARISC_LTOFF64:
1952         /* We want the value of the DLT offset for this symbol, not
1953            the symbol's actual address.  Note that __gp may not point
1954            to the start of the DLT, so we have to compute the absolute
1955            address, then subtract out the value of __gp.  */
1956       value = (dyn_h->dlt_offset
1957                + hppa_info->dlt_sec->output_offset
1958                + hppa_info->dlt_sec->output_section->vma);
1959       value -= _bfd_get_gp_value (output_bfd);
1960
1961       bfd_put_64 (input_bfd, value + addend, hit_data);
1962       return bfd_reloc_ok;
1963
1964     case R_PARISC_PCREL32:
1965       {
1966         /* If this is a call to a function defined in another dynamic
1967            library, then redirect the call to the local stub for this
1968            function.  */
1969         if (sym_sec == NULL || sym_sec->output_section == NULL)
1970           value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1971                    + hppa_info->stub_sec->output_section->vma);
1972
1973         /* Turn VALUE into a proper PC relative address.  */
1974         value -= (offset + input_section->output_offset
1975                   + input_section->output_section->vma);
1976
1977         value += addend;
1978         value -= 8;
1979         bfd_put_32 (input_bfd, value, hit_data);
1980         return bfd_reloc_ok;
1981       }
1982
1983     case R_PARISC_PCREL64:
1984       {
1985         /* If this is a call to a function defined in another dynamic
1986            library, then redirect the call to the local stub for this
1987            function.  */
1988         if (sym_sec == NULL || sym_sec->output_section == NULL)
1989           value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1990                    + hppa_info->stub_sec->output_section->vma);
1991
1992         /* Turn VALUE into a proper PC relative address.  */
1993         value -= (offset + input_section->output_offset
1994                   + input_section->output_section->vma);
1995
1996         value += addend;
1997         value -= 8;
1998         bfd_put_64 (input_bfd, value, hit_data);
1999         return bfd_reloc_ok;
2000       }
2001
2002     case R_PARISC_FPTR64:
2003       {
2004         /* We may still need to create the FPTR itself if it was for
2005            a local symbol.  */
2006         if (dyn_h->h == NULL)
2007           {
2008             /* The first two words of an .opd entry are zero.  */
2009             memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
2010
2011             /* The next word is the address of the function.  */
2012             bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
2013                         (hppa_info->opd_sec->contents
2014                          + dyn_h->opd_offset + 16));
2015
2016             /* The last word is our local __gp value.  */
2017             value = _bfd_get_gp_value
2018                       (hppa_info->opd_sec->output_section->owner);
2019             bfd_put_64 (hppa_info->opd_sec->owner, value,
2020                         hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
2021           }
2022
2023         if (dyn_h->want_opd)
2024           /* We want the value of the OPD offset for this symbol.  */
2025           value = (dyn_h->opd_offset
2026                    + hppa_info->opd_sec->output_offset
2027                    + hppa_info->opd_sec->output_section->vma);
2028         else
2029           /* We want the address of the symbol.  */
2030           value += addend;
2031
2032         bfd_put_64 (input_bfd, value, hit_data);
2033         return bfd_reloc_ok;
2034       }
2035
2036     case R_PARISC_SECREL32:
2037       bfd_put_32 (input_bfd,
2038                   value + addend - sym_sec->output_section->vma,
2039                   hit_data);
2040       return bfd_reloc_ok;
2041
2042     case R_PARISC_SEGREL32:
2043     case R_PARISC_SEGREL64:
2044       {
2045         /* If this is the first SEGREL relocation, then initialize
2046            the segment base values.  */
2047         if (hppa_info->text_segment_base == (bfd_vma) -1)
2048           bfd_map_over_sections (output_bfd, elf_hppa_record_segment_addrs,
2049                                  hppa_info);
2050
2051         /* VALUE holds the absolute address.  We want to include the
2052            addend, then turn it into a segment relative address.
2053
2054            The segment is derived from SYM_SEC.  We assume that there are
2055            only two segments of note in the resulting executable/shlib.
2056            A readonly segment (.text) and a readwrite segment (.data).  */
2057         value += addend;
2058
2059         if (sym_sec->flags & SEC_CODE)
2060           value -= hppa_info->text_segment_base;
2061         else
2062           value -= hppa_info->data_segment_base;
2063
2064         if (r_type == R_PARISC_SEGREL32)
2065           bfd_put_32 (input_bfd, value, hit_data);
2066         else
2067           bfd_put_64 (input_bfd, value, hit_data);
2068         return bfd_reloc_ok;
2069       }
2070
2071     /* Something we don't know how to handle.  */
2072     default:
2073       return bfd_reloc_notsupported;
2074     }
2075
2076   /* Update the instruction word.  */
2077   bfd_put_32 (input_bfd, (bfd_vma) insn, hit_data);
2078   return bfd_reloc_ok;
2079 }
2080
2081 /* Relocate the given INSN.  VALUE should be the actual value we want
2082    to insert into the instruction, ie by this point we should not be
2083    concerned with computing an offset relative to the DLT, PC, etc.
2084    Instead this routine is meant to handle the bit manipulations needed
2085    to insert the relocation into the given instruction.  */
2086
2087 static int
2088 elf_hppa_relocate_insn (int insn, int sym_value, unsigned int r_type)
2089 {
2090   switch (r_type)
2091     {
2092     /* This is any 22 bit branch.  In PA2.0 syntax it corresponds to
2093        the "B" instruction.  */
2094     case R_PARISC_PCREL22F:
2095     case R_PARISC_PCREL22C:
2096       return (insn & ~0x3ff1ffd) | re_assemble_22 (sym_value);
2097
2098       /* This is any 12 bit branch.  */
2099     case R_PARISC_PCREL12F:
2100       return (insn & ~0x1ffd) | re_assemble_12 (sym_value);
2101
2102     /* This is any 17 bit branch.  In PA2.0 syntax it also corresponds
2103        to the "B" instruction as well as BE.  */
2104     case R_PARISC_PCREL17F:
2105     case R_PARISC_DIR17F:
2106     case R_PARISC_DIR17R:
2107     case R_PARISC_PCREL17C:
2108     case R_PARISC_PCREL17R:
2109       return (insn & ~0x1f1ffd) | re_assemble_17 (sym_value);
2110
2111     /* ADDIL or LDIL instructions.  */
2112     case R_PARISC_DLTREL21L:
2113     case R_PARISC_DLTIND21L:
2114     case R_PARISC_LTOFF_FPTR21L:
2115     case R_PARISC_PCREL21L:
2116     case R_PARISC_LTOFF_TP21L:
2117     case R_PARISC_DPREL21L:
2118     case R_PARISC_PLTOFF21L:
2119     case R_PARISC_DIR21L:
2120       return (insn & ~0x1fffff) | re_assemble_21 (sym_value);
2121
2122     /* LDO and integer loads/stores with 14 bit displacements.  */
2123     case R_PARISC_DLTREL14R:
2124     case R_PARISC_DLTREL14F:
2125     case R_PARISC_DLTIND14R:
2126     case R_PARISC_DLTIND14F:
2127     case R_PARISC_LTOFF_FPTR14R:
2128     case R_PARISC_PCREL14R:
2129     case R_PARISC_PCREL14F:
2130     case R_PARISC_LTOFF_TP14R:
2131     case R_PARISC_LTOFF_TP14F:
2132     case R_PARISC_DPREL14R:
2133     case R_PARISC_DPREL14F:
2134     case R_PARISC_PLTOFF14R:
2135     case R_PARISC_PLTOFF14F:
2136     case R_PARISC_DIR14R:
2137     case R_PARISC_DIR14F:
2138       return (insn & ~0x3fff) | low_sign_unext (sym_value, 14);
2139
2140     /* PA2.0W LDO and integer loads/stores with 16 bit displacements.  */
2141     case R_PARISC_LTOFF_FPTR16F:
2142     case R_PARISC_PCREL16F:
2143     case R_PARISC_LTOFF_TP16F:
2144     case R_PARISC_GPREL16F:
2145     case R_PARISC_PLTOFF16F:
2146     case R_PARISC_DIR16F:
2147     case R_PARISC_LTOFF16F:
2148       return (insn & ~0xffff) | re_assemble_16 (sym_value);
2149
2150     /* Doubleword loads and stores with a 14 bit displacement.  */
2151     case R_PARISC_DLTREL14DR:
2152     case R_PARISC_DLTIND14DR:
2153     case R_PARISC_LTOFF_FPTR14DR:
2154     case R_PARISC_LTOFF_FPTR16DF:
2155     case R_PARISC_PCREL14DR:
2156     case R_PARISC_PCREL16DF:
2157     case R_PARISC_LTOFF_TP14DR:
2158     case R_PARISC_LTOFF_TP16DF:
2159     case R_PARISC_DPREL14DR:
2160     case R_PARISC_GPREL16DF:
2161     case R_PARISC_PLTOFF14DR:
2162     case R_PARISC_PLTOFF16DF:
2163     case R_PARISC_DIR14DR:
2164     case R_PARISC_DIR16DF:
2165     case R_PARISC_LTOFF16DF:
2166       return (insn & ~0x3ff1) | (((sym_value & 0x2000) >> 13)
2167                                  | ((sym_value & 0x1ff8) << 1));
2168
2169     /* Floating point single word load/store instructions.  */
2170     case R_PARISC_DLTREL14WR:
2171     case R_PARISC_DLTIND14WR:
2172     case R_PARISC_LTOFF_FPTR14WR:
2173     case R_PARISC_LTOFF_FPTR16WF:
2174     case R_PARISC_PCREL14WR:
2175     case R_PARISC_PCREL16WF:
2176     case R_PARISC_LTOFF_TP14WR:
2177     case R_PARISC_LTOFF_TP16WF:
2178     case R_PARISC_DPREL14WR:
2179     case R_PARISC_GPREL16WF:
2180     case R_PARISC_PLTOFF14WR:
2181     case R_PARISC_PLTOFF16WF:
2182     case R_PARISC_DIR16WF:
2183     case R_PARISC_DIR14WR:
2184     case R_PARISC_LTOFF16WF:
2185       return (insn & ~0x3ff9) | (((sym_value & 0x2000) >> 13)
2186                                  | ((sym_value & 0x1ffc) << 1));
2187
2188     default:
2189       return insn;
2190     }
2191 }
2192 #endif