1 /* Common code for PA ELF implementations.
2    Copyright (C) 1999-2016 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 3 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., 51 Franklin Street - Fifth Floor, Boston,
19    MA 02110-1301, USA.  */
20 
21 #define ELF_HOWTO_TABLE_SIZE       R_PARISC_UNIMPLEMENTED + 1
22 
23 /* This file is included by multiple PA ELF BFD backends with different
24    sizes.
25 
26    Most of the routines are written to be size independent, but sometimes
27    external constraints require 32 or 64 bit specific code.  We remap
28    the definitions/functions as necessary here.  */
29 #if ARCH_SIZE == 64
30 #define ELF_R_TYPE(X)                 ELF64_R_TYPE(X)
31 #define ELF_R_SYM(X)                  ELF64_R_SYM(X)
32 #define elf_hppa_reloc_final_type     elf64_hppa_reloc_final_type
33 #define _bfd_elf_hppa_gen_reloc_type  _bfd_elf64_hppa_gen_reloc_type
34 #define elf_hppa_relocate_section     elf64_hppa_relocate_section
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 elf_hppa_final_link           elf32_hppa_final_link
44 #endif
45 
46 /* ELF/PA relocation howto entries.  */
47 
48 static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
49 {
50   { R_PARISC_NONE, 0, 3, 0, FALSE, 0, complain_overflow_dont,
51     bfd_elf_generic_reloc, "R_PARISC_NONE", FALSE, 0, 0, FALSE },
52 
53   /* The values in DIR32 are to placate the check in
54      _bfd_stab_section_find_nearest_line.  */
55   { R_PARISC_DIR32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
56     bfd_elf_generic_reloc, "R_PARISC_DIR32", FALSE, 0, 0xffffffff, FALSE },
57   { R_PARISC_DIR21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
58     bfd_elf_generic_reloc, "R_PARISC_DIR21L", FALSE, 0, 0, FALSE },
59   { R_PARISC_DIR17R, 0, 2, 17, FALSE, 0, complain_overflow_bitfield,
60     bfd_elf_generic_reloc, "R_PARISC_DIR17R", FALSE, 0, 0, FALSE },
61   { R_PARISC_DIR17F, 0, 2, 17, FALSE, 0, complain_overflow_bitfield,
62     bfd_elf_generic_reloc, "R_PARISC_DIR17F", FALSE, 0, 0, FALSE },
63   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
64     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
65   { R_PARISC_DIR14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
66     bfd_elf_generic_reloc, "R_PARISC_DIR14R", FALSE, 0, 0, FALSE },
67   { R_PARISC_DIR14F, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
68     bfd_elf_generic_reloc, "R_PARISC_DIR14F", FALSE, 0, 0, FALSE },
69   /* 8 */
70   { R_PARISC_PCREL12F, 0, 2, 12, TRUE, 0, complain_overflow_bitfield,
71     bfd_elf_generic_reloc, "R_PARISC_PCREL12F", FALSE, 0, 0, FALSE },
72   { R_PARISC_PCREL32, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
73     bfd_elf_generic_reloc, "R_PARISC_PCREL32", FALSE, 0, 0, FALSE },
74   { R_PARISC_PCREL21L, 0, 2, 21, TRUE, 0, complain_overflow_bitfield,
75     bfd_elf_generic_reloc, "R_PARISC_PCREL21L", FALSE, 0, 0, FALSE },
76   { R_PARISC_PCREL17R, 0, 2, 17, TRUE, 0, complain_overflow_bitfield,
77     bfd_elf_generic_reloc, "R_PARISC_PCREL17R", FALSE, 0, 0, FALSE },
78   { R_PARISC_PCREL17F, 0, 2, 17, TRUE, 0, complain_overflow_bitfield,
79     bfd_elf_generic_reloc, "R_PARISC_PCREL17F", FALSE, 0, 0, FALSE },
80   { R_PARISC_PCREL17C, 0, 2, 17, TRUE, 0, complain_overflow_bitfield,
81     bfd_elf_generic_reloc, "R_PARISC_PCREL17C", FALSE, 0, 0, FALSE },
82   { R_PARISC_PCREL14R, 0, 2, 14, TRUE, 0, complain_overflow_bitfield,
83     bfd_elf_generic_reloc, "R_PARISC_PCREL14R", FALSE, 0, 0, FALSE },
84   { R_PARISC_PCREL14F, 0, 2, 14, TRUE, 0, complain_overflow_bitfield,
85     bfd_elf_generic_reloc, "R_PARISC_PCREL14F", FALSE, 0, 0, FALSE },
86   /* 16 */
87   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
88     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
89   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
90     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
91   { R_PARISC_DPREL21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
92     bfd_elf_generic_reloc, "R_PARISC_DPREL21L", FALSE, 0, 0, FALSE },
93   { R_PARISC_DPREL14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
94     bfd_elf_generic_reloc, "R_PARISC_DPREL14WR", FALSE, 0, 0, FALSE },
95   { R_PARISC_DPREL14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
96     bfd_elf_generic_reloc, "R_PARISC_DPREL14DR", FALSE, 0, 0, FALSE },
97   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
98     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
99   { R_PARISC_DPREL14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
100     bfd_elf_generic_reloc, "R_PARISC_DPREL14R", FALSE, 0, 0, FALSE },
101   { R_PARISC_DPREL14F, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
102     bfd_elf_generic_reloc, "R_PARISC_DPREL14F", FALSE, 0, 0, FALSE },
103   /* 24 */
104   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
105     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
106   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
107     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
108   { R_PARISC_DLTREL21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
109     bfd_elf_generic_reloc, "R_PARISC_DLTREL21L", FALSE, 0, 0, FALSE },
110   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
111     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
112   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
113     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
114   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
115     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
116   { R_PARISC_DLTREL14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
117     bfd_elf_generic_reloc, "R_PARISC_DLTREL14R", FALSE, 0, 0, FALSE },
118   { R_PARISC_DLTREL14F, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
119     bfd_elf_generic_reloc, "R_PARISC_DLTREL14F", FALSE, 0, 0, FALSE },
120   /* 32 */
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_DLTIND21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
126     bfd_elf_generic_reloc, "R_PARISC_DLTIND21L", FALSE, 0, 0, FALSE },
127   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
128     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
129   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
130     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
131   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
132     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
133   { R_PARISC_DLTIND14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
134     bfd_elf_generic_reloc, "R_PARISC_DLTIND14R", FALSE, 0, 0, FALSE },
135   { R_PARISC_DLTIND14F, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
136     bfd_elf_generic_reloc, "R_PARISC_DLTIND14F", FALSE, 0, 0, FALSE },
137   /* 40 */
138   { R_PARISC_SETBASE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
139     bfd_elf_generic_reloc, "R_PARISC_SETBASE", FALSE, 0, 0, FALSE },
140   { R_PARISC_SECREL32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
141     bfd_elf_generic_reloc, "R_PARISC_SECREL32", FALSE, 0, 0xffffffff, FALSE },
142   { R_PARISC_BASEREL21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
143     bfd_elf_generic_reloc, "R_PARISC_BASEREL21L", FALSE, 0, 0, FALSE },
144   { R_PARISC_BASEREL17R, 0, 2, 17, FALSE, 0, complain_overflow_bitfield,
145     bfd_elf_generic_reloc, "R_PARISC_BASEREL17R", FALSE, 0, 0, FALSE },
146   { R_PARISC_BASEREL17F, 0, 2, 17, FALSE, 0, complain_overflow_bitfield,
147     bfd_elf_generic_reloc, "R_PARISC_BASEREL17F", FALSE, 0, 0, FALSE },
148   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
149     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
150   { R_PARISC_BASEREL14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
151     bfd_elf_generic_reloc, "R_PARISC_BASEREL14R", FALSE, 0, 0, FALSE },
152   { R_PARISC_BASEREL14F, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
153     bfd_elf_generic_reloc, "R_PARISC_BASEREL14F", FALSE, 0, 0, FALSE },
154   /* 48 */
155   { R_PARISC_SEGBASE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
156     bfd_elf_generic_reloc, "R_PARISC_SEGBASE", FALSE, 0, 0, FALSE },
157   { R_PARISC_SEGREL32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
158     bfd_elf_generic_reloc, "R_PARISC_SEGREL32", FALSE, 0, 0, FALSE },
159   { R_PARISC_PLTOFF21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
160     bfd_elf_generic_reloc, "R_PARISC_PLTOFF21L", FALSE, 0, 0, FALSE },
161   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
162     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
163   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
164     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
165   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
166     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
167   { R_PARISC_PLTOFF14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
168     bfd_elf_generic_reloc, "R_PARISC_PLTOFF14R", FALSE, 0, 0, FALSE },
169   { R_PARISC_PLTOFF14F, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
170     bfd_elf_generic_reloc, "R_PARISC_PLTOFF14F", FALSE, 0, 0, FALSE },
171   /* 56 */
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_LTOFF_FPTR32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
175     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR32", FALSE, 0, 0, FALSE },
176   { R_PARISC_LTOFF_FPTR21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
177     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR21L", FALSE, 0, 0, FALSE },
178   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
179     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
180   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
181     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
182   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
183     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
184   { R_PARISC_LTOFF_FPTR14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
185     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14R", FALSE, 0, 0, FALSE },
186   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
187     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
188   /* 64 */
189   { R_PARISC_FPTR64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
190     bfd_elf_generic_reloc, "R_PARISC_FPTR64", FALSE, 0, 0, FALSE },
191   { R_PARISC_PLABEL32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
192     bfd_elf_generic_reloc, "R_PARISC_PLABEL32", FALSE, 0, 0, FALSE },
193   { R_PARISC_PLABEL21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
194     bfd_elf_generic_reloc, "R_PARISC_PLABEL21L", FALSE, 0, 0, FALSE },
195   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
196     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", 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   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
200     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
201   { R_PARISC_PLABEL14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
202     bfd_elf_generic_reloc, "R_PARISC_PLABEL14R", FALSE, 0, 0, FALSE },
203   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
204     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
205   /* 72 */
206   { R_PARISC_PCREL64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
207     bfd_elf_generic_reloc, "R_PARISC_PCREL64", FALSE, 0, 0, FALSE },
208   { R_PARISC_PCREL22C, 0, 2, 22, FALSE, 0, complain_overflow_bitfield,
209     bfd_elf_generic_reloc, "R_PARISC_PCREL22C", FALSE, 0, 0, FALSE },
210   { R_PARISC_PCREL22F, 0, 2, 22, FALSE, 0, complain_overflow_bitfield,
211     bfd_elf_generic_reloc, "R_PARISC_PCREL22F", FALSE, 0, 0, FALSE },
212   { R_PARISC_PCREL14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
213     bfd_elf_generic_reloc, "R_PARISC_PCREL14WR", FALSE, 0, 0, FALSE },
214   { R_PARISC_PCREL14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
215     bfd_elf_generic_reloc, "R_PARISC_PCREL14DR", FALSE, 0, 0, FALSE },
216   { R_PARISC_PCREL16F, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
217     bfd_elf_generic_reloc, "R_PARISC_PCREL16F", FALSE, 0, 0, FALSE },
218   { R_PARISC_PCREL16WF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
219     bfd_elf_generic_reloc, "R_PARISC_PCREL16WF", FALSE, 0, 0, FALSE },
220   { R_PARISC_PCREL16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
221     bfd_elf_generic_reloc, "R_PARISC_PCREL16DF", FALSE, 0, 0, FALSE },
222   /* 80 */
223   { R_PARISC_DIR64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
224     bfd_elf_generic_reloc, "R_PARISC_DIR64", FALSE, 0, 0, FALSE },
225   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
226     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
227   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
228     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
229   { R_PARISC_DIR14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
230     bfd_elf_generic_reloc, "R_PARISC_DIR14WR", FALSE, 0, 0, FALSE },
231   { R_PARISC_DIR14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
232     bfd_elf_generic_reloc, "R_PARISC_DIR14DR", FALSE, 0, 0, FALSE },
233   { R_PARISC_DIR16F, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
234     bfd_elf_generic_reloc, "R_PARISC_DIR16F", FALSE, 0, 0, FALSE },
235   { R_PARISC_DIR16WF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
236     bfd_elf_generic_reloc, "R_PARISC_DIR16WF", FALSE, 0, 0, FALSE },
237   { R_PARISC_DIR16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
238     bfd_elf_generic_reloc, "R_PARISC_DIR16DF", FALSE, 0, 0, FALSE },
239   /* 88 */
240   { R_PARISC_GPREL64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
241     bfd_elf_generic_reloc, "R_PARISC_GPREL64", FALSE, 0, 0, FALSE },
242   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
243     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
244   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
245     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
246   { R_PARISC_DLTREL14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
247     bfd_elf_generic_reloc, "R_PARISC_DLTREL14WR", FALSE, 0, 0, FALSE },
248   { R_PARISC_DLTREL14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
249     bfd_elf_generic_reloc, "R_PARISC_DLTREL14DR", FALSE, 0, 0, FALSE },
250   { R_PARISC_GPREL16F, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
251     bfd_elf_generic_reloc, "R_PARISC_GPREL16F", FALSE, 0, 0, FALSE },
252   { R_PARISC_GPREL16WF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
253     bfd_elf_generic_reloc, "R_PARISC_GPREL16WF", FALSE, 0, 0, FALSE },
254   { R_PARISC_GPREL16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
255     bfd_elf_generic_reloc, "R_PARISC_GPREL16DF", FALSE, 0, 0, FALSE },
256   /* 96 */
257   { R_PARISC_LTOFF64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
258     bfd_elf_generic_reloc, "R_PARISC_LTOFF64", FALSE, 0, 0, FALSE },
259   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
260     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
261   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
262     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
263   { R_PARISC_DLTIND14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
264     bfd_elf_generic_reloc, "R_PARISC_DLTIND14WR", FALSE, 0, 0, FALSE },
265   { R_PARISC_DLTIND14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
266     bfd_elf_generic_reloc, "R_PARISC_DLTIND14DR", FALSE, 0, 0, FALSE },
267   { R_PARISC_LTOFF16F, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
268     bfd_elf_generic_reloc, "R_PARISC_LTOFF16F", FALSE, 0, 0, FALSE },
269   { R_PARISC_LTOFF16WF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
270     bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", FALSE, 0, 0, FALSE },
271   { R_PARISC_LTOFF16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
272     bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", FALSE, 0, 0, FALSE },
273   /* 104 */
274   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
275     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
276   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
277     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
278   { R_PARISC_BASEREL14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
279     bfd_elf_generic_reloc, "R_PARISC_BASEREL14WR", FALSE, 0, 0, FALSE },
280   { R_PARISC_BASEREL14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
281     bfd_elf_generic_reloc, "R_PARISC_BASEREL14DR", FALSE, 0, 0, FALSE },
282   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
283     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
284   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
285     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
286   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
287     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
288   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
289     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
290   /* 112 */
291   { R_PARISC_SEGREL64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
292     bfd_elf_generic_reloc, "R_PARISC_SEGREL64", 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_PLTOFF14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
298     bfd_elf_generic_reloc, "R_PARISC_PLTOFF14WR", FALSE, 0, 0, FALSE },
299   { R_PARISC_PLTOFF14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
300     bfd_elf_generic_reloc, "R_PARISC_PLTOFF14DR", FALSE, 0, 0, FALSE },
301   { R_PARISC_PLTOFF16F, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
302     bfd_elf_generic_reloc, "R_PARISC_PLTOFF16F", FALSE, 0, 0, FALSE },
303   { R_PARISC_PLTOFF16WF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
304     bfd_elf_generic_reloc, "R_PARISC_PLTOFF16WF", FALSE, 0, 0, FALSE },
305   { R_PARISC_PLTOFF16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
306     bfd_elf_generic_reloc, "R_PARISC_PLTOFF16DF", FALSE, 0, 0, FALSE },
307   /* 120 */
308   { R_PARISC_LTOFF_FPTR64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
309     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
310   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
311     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
312   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
313     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
314   { R_PARISC_LTOFF_FPTR14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
315     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14WR", FALSE, 0, 0, FALSE },
316   { R_PARISC_LTOFF_FPTR14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
317     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14DR", FALSE, 0, 0, FALSE },
318   { R_PARISC_LTOFF_FPTR16F, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
319     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16F", FALSE, 0, 0, FALSE },
320   { R_PARISC_LTOFF_FPTR16WF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
321     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16WF", FALSE, 0, 0, FALSE },
322   { R_PARISC_LTOFF_FPTR16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
323     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
324   /* 128 */
325   { R_PARISC_COPY, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
326     bfd_elf_generic_reloc, "R_PARISC_COPY", FALSE, 0, 0, FALSE },
327   { R_PARISC_IPLT, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
328     bfd_elf_generic_reloc, "R_PARISC_IPLT", FALSE, 0, 0, FALSE },
329   { R_PARISC_EPLT, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
330     bfd_elf_generic_reloc, "R_PARISC_EPLT", FALSE, 0, 0, FALSE },
331   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
332     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
333   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
334     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
335   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
336     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
337   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
338     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
339   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
340     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
341   /* 136 */
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_dont,
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_dont,
351     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
352   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
353     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
354   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
355     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
356   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
357     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
358   /* 144 */
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_bitfield,
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_dont,
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   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
370     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
371   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
372     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
373   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
374     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
375   /* 152 */
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_TPREL32, 0, 2, 32, FALSE, 0, complain_overflow_dont,
379     bfd_elf_generic_reloc, "R_PARISC_TPREL32", FALSE, 0, 0, FALSE },
380   { R_PARISC_TPREL21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
381     bfd_elf_generic_reloc, "R_PARISC_TPREL21L", 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   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
387     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
388   { R_PARISC_TPREL14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
389     bfd_elf_generic_reloc, "R_PARISC_TPREL14R", FALSE, 0, 0, FALSE },
390   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
391     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
392   /* 160 */
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_LTOFF_TP21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
398     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP21L", FALSE, 0, 0, FALSE },
399   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
400     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
401   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
402     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
403   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
404     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
405   { R_PARISC_LTOFF_TP14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
406     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14R", FALSE, 0, 0, FALSE },
407   { R_PARISC_LTOFF_TP14F, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
408     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14F", FALSE, 0, 0, FALSE },
409   /* 168 */
410   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
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_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
417     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
418   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
419     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
420   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
421     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
422   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
423     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
424   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
425     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
426   /* 176 */
427   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
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_dont,
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   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
438     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
439   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
440     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
441   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
442     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
443   /* 184 */
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_bitfield,
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_dont,
453     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
454   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
455     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
456   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
457     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
458   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
459     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
460   /* 192 */
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_bitfield,
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_bitfield,
470     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
471   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
472     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
473   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
474     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
475   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
476     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
477   /* 200 */
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_dont,
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_bitfield,
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   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
489     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
490   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
491     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
492   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
493     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
494   /* 208 */
495   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
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_dont,
504     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
505   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
506     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
507   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
508     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
509   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
510     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
511   /* 216 */
512   { R_PARISC_TPREL64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
513     bfd_elf_generic_reloc, "R_PARISC_TPREL64", FALSE, 0, 0, FALSE },
514   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
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_TPREL14WR, 0, 2, 14, FALSE, 0, complain_overflow_dont,
519     bfd_elf_generic_reloc, "R_PARISC_TPREL14WR", FALSE, 0, 0, FALSE },
520   { R_PARISC_TPREL14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
521     bfd_elf_generic_reloc, "R_PARISC_TPREL14DR", FALSE, 0, 0, FALSE },
522   { R_PARISC_TPREL16F, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
523     bfd_elf_generic_reloc, "R_PARISC_TPREL16F", FALSE, 0, 0, FALSE },
524   { R_PARISC_TPREL16WF, 0, 2, 16, FALSE, 0, complain_overflow_dont,
525     bfd_elf_generic_reloc, "R_PARISC_TPREL16WF", FALSE, 0, 0, FALSE },
526   { R_PARISC_TPREL16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
527     bfd_elf_generic_reloc, "R_PARISC_TPREL16DF", FALSE, 0, 0, FALSE },
528   /* 224 */
529   { R_PARISC_LTOFF_TP64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
530     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP64", FALSE, 0, 0, FALSE },
531   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
532     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
533   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
534     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
535   { R_PARISC_LTOFF_TP14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
536     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14WR", FALSE, 0, 0, FALSE },
537   { R_PARISC_LTOFF_TP14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
538     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14DR", FALSE, 0, 0, FALSE },
539   { R_PARISC_LTOFF_TP16F, 0, 2, 16, FALSE, 0, complain_overflow_dont,
540     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16F", FALSE, 0, 0, FALSE },
541   { R_PARISC_LTOFF_TP16WF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
542     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16WF", FALSE, 0, 0, FALSE },
543   { R_PARISC_LTOFF_TP16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
544     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16DF", FALSE, 0, 0, FALSE },
545   /* 232 */
546   { R_PARISC_GNU_VTENTRY, 0, 0, 0, FALSE, 0, complain_overflow_dont,
547     bfd_elf_generic_reloc, "R_PARISC_GNU_VTENTRY", FALSE, 0, 0, FALSE },
548   { R_PARISC_GNU_VTINHERIT, 0, 0, 0, FALSE, 0, complain_overflow_dont,
549     bfd_elf_generic_reloc, "R_PARISC_GNU_VTINHERIT", FALSE, 0, 0, FALSE },
550   { R_PARISC_TLS_GD21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
551     bfd_elf_generic_reloc, "R_PARISC_TLS_GD21L", FALSE, 0, 0, FALSE },
552   { R_PARISC_TLS_GD14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
553     bfd_elf_generic_reloc, "R_PARISC_TLS_GD14R", FALSE, 0, 0, FALSE },
554   { R_PARISC_TLS_GDCALL, 0, 0, 0, FALSE, 0, complain_overflow_dont,
555     bfd_elf_generic_reloc, "R_PARISC_TLS_GDCALL", FALSE, 0, 0, FALSE },
556   { R_PARISC_TLS_LDM21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
557     bfd_elf_generic_reloc, "R_PARISC_TLS_LDM21L", FALSE, 0, 0, FALSE },
558   { R_PARISC_TLS_LDM14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
559     bfd_elf_generic_reloc, "R_PARISC_TLS_LDM14R", FALSE, 0, 0, FALSE },
560   { R_PARISC_TLS_LDMCALL, 0, 0, 0, FALSE, 0, complain_overflow_dont,
561     bfd_elf_generic_reloc, "R_PARISC_TLS_LDMCALL", FALSE, 0, 0, FALSE },
562   /* 240 */
563   { R_PARISC_TLS_LDO21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
564     bfd_elf_generic_reloc, "R_PARISC_TLS_LDO21L", FALSE, 0, 0, FALSE },
565   { R_PARISC_TLS_LDO14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
566     bfd_elf_generic_reloc, "R_PARISC_TLS_LDO14R", FALSE, 0, 0, FALSE },
567   { R_PARISC_TLS_DTPMOD32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
568     bfd_elf_generic_reloc, "R_PARISC_TLS_DTPMOD32", FALSE, 0, 0, FALSE },
569   { R_PARISC_TLS_DTPMOD64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
570     bfd_elf_generic_reloc, "R_PARISC_TLS_DTPMOD64", FALSE, 0, 0, FALSE },
571   { R_PARISC_TLS_DTPOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
572     bfd_elf_generic_reloc, "R_PARISC_TLS_DTPOFF32", FALSE, 0, 0, FALSE },
573   { R_PARISC_TLS_DTPOFF64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
574     bfd_elf_generic_reloc, "R_PARISC_TLS_DTPOFF64", FALSE, 0, 0, FALSE },
575 };
576 
577 #define OFFSET_14R_FROM_21L 4
578 #define OFFSET_14F_FROM_21L 5
579 
580 /* Return the final relocation type for the given base type, instruction
581    format, and field selector.  */
582 
583 elf_hppa_reloc_type
elf_hppa_reloc_final_type(bfd * abfd,elf_hppa_reloc_type base_type,int format,unsigned int field)584 elf_hppa_reloc_final_type (bfd *abfd,
585 			   elf_hppa_reloc_type base_type,
586 			   int format,
587 			   unsigned int field)
588 {
589   elf_hppa_reloc_type final_type = base_type;
590 
591   /* Just a tangle of nested switch statements to deal with the braindamage
592      that a different field selector means a completely different relocation
593      for PA ELF.  */
594   switch (base_type)
595     {
596       /* We have been using generic relocation types.  However, that may not
597 	 really make sense.  Anyway, we need to support both R_PARISC_DIR64
598 	 and R_PARISC_DIR32 here.  */
599     case R_PARISC_DIR32:
600     case R_PARISC_DIR64:
601     case R_HPPA_ABS_CALL:
602       switch (format)
603 	{
604 	case 14:
605 	  switch (field)
606 	    {
607 	    case e_fsel:
608 	      final_type = R_PARISC_DIR14F;
609 	      break;
610 	    case e_rsel:
611 	    case e_rrsel:
612 	    case e_rdsel:
613 	      final_type = R_PARISC_DIR14R;
614 	      break;
615 	    case e_rtsel:
616 	      final_type = R_PARISC_DLTIND14R;
617 	      break;
618 	    case e_rtpsel:
619 	      final_type = R_PARISC_LTOFF_FPTR14DR;
620 	      break;
621 	    case e_tsel:
622 	      final_type = R_PARISC_DLTIND14F;
623 	      break;
624 	    case e_rpsel:
625 	      final_type = R_PARISC_PLABEL14R;
626 	      break;
627 	    default:
628 	      return R_PARISC_NONE;
629 	    }
630 	  break;
631 
632 	case 17:
633 	  switch (field)
634 	    {
635 	    case e_fsel:
636 	      final_type = R_PARISC_DIR17F;
637 	      break;
638 	    case e_rsel:
639 	    case e_rrsel:
640 	    case e_rdsel:
641 	      final_type = R_PARISC_DIR17R;
642 	      break;
643 	    default:
644 	      return R_PARISC_NONE;
645 	    }
646 	  break;
647 
648 	case 21:
649 	  switch (field)
650 	    {
651 	    case e_lsel:
652 	    case e_lrsel:
653 	    case e_ldsel:
654 	    case e_nlsel:
655 	    case e_nlrsel:
656 	      final_type = R_PARISC_DIR21L;
657 	      break;
658 	    case e_ltsel:
659 	      final_type = R_PARISC_DLTIND21L;
660 	      break;
661 	    case e_ltpsel:
662 	      final_type = R_PARISC_LTOFF_FPTR21L;
663 	      break;
664 	    case e_lpsel:
665 	      final_type = R_PARISC_PLABEL21L;
666 	      break;
667 	    default:
668 	      return R_PARISC_NONE;
669 	    }
670 	  break;
671 
672 	case 32:
673 	  switch (field)
674 	    {
675 	    case e_fsel:
676 	      final_type = R_PARISC_DIR32;
677 	      /* When in 64bit mode, a 32bit relocation is supposed to
678 		 be a section relative relocation.  Dwarf2 (for example)
679 		 uses 32bit section relative relocations.  */
680 	      if (bfd_arch_bits_per_address (abfd) != 32)
681 		final_type = R_PARISC_SECREL32;
682 	      break;
683 	    case e_psel:
684 	      final_type = R_PARISC_PLABEL32;
685 	      break;
686 	    default:
687 	      return R_PARISC_NONE;
688 	    }
689 	  break;
690 
691 	case 64:
692 	  switch (field)
693 	    {
694 	    case e_fsel:
695 	      final_type = R_PARISC_DIR64;
696 	      break;
697 	    case e_psel:
698 	      final_type = R_PARISC_FPTR64;
699 	      break;
700 	    default:
701 	      return R_PARISC_NONE;
702 	    }
703 	  break;
704 
705 	default:
706 	  return R_PARISC_NONE;
707 	}
708       break;
709 
710     case R_HPPA_GOTOFF:
711       switch (format)
712 	{
713 	case 14:
714 	  switch (field)
715 	    {
716 	    case e_rsel:
717 	    case e_rrsel:
718 	    case e_rdsel:
719 	      /* R_PARISC_DLTREL14R for elf64, R_PARISC_DPREL14R for elf32.  */
720 	      final_type = base_type + OFFSET_14R_FROM_21L;
721 	      break;
722 	    case e_fsel:
723 	      /* R_PARISC_DLTREL14F for elf64, R_PARISC_DPREL14F for elf32.  */
724 	      final_type = base_type + OFFSET_14F_FROM_21L;
725 	      break;
726 	    default:
727 	      return R_PARISC_NONE;
728 	    }
729 	  break;
730 
731 	case 21:
732 	  switch (field)
733 	    {
734 	    case e_lsel:
735 	    case e_lrsel:
736 	    case e_ldsel:
737 	    case e_nlsel:
738 	    case e_nlrsel:
739 	      /* R_PARISC_DLTREL21L for elf64, R_PARISC_DPREL21L for elf32.  */
740 	      final_type = base_type;
741 	      break;
742 	    default:
743 	      return R_PARISC_NONE;
744 	    }
745 	  break;
746 
747 	case 64:
748 	  switch (field)
749 	    {
750 	    case e_fsel:
751 	      final_type = R_PARISC_GPREL64;
752 	      break;
753 	    default:
754 	      return R_PARISC_NONE;
755 	    }
756 	  break;
757 
758 	default:
759 	  return R_PARISC_NONE;
760 	}
761       break;
762 
763     case R_HPPA_PCREL_CALL:
764       switch (format)
765 	{
766 	case 12:
767 	  switch (field)
768 	    {
769 	    case e_fsel:
770 	      final_type = R_PARISC_PCREL12F;
771 	      break;
772 	    default:
773 	      return R_PARISC_NONE;
774 	    }
775 	  break;
776 
777 	case 14:
778 	  /* Contrary to appearances, these are not calls of any sort.
779 	     Rather, they are loads/stores with a pcrel reloc.  */
780 	  switch (field)
781 	    {
782 	    case e_rsel:
783 	    case e_rrsel:
784 	    case e_rdsel:
785 	      final_type = R_PARISC_PCREL14R;
786 	      break;
787 	    case e_fsel:
788 	      if (bfd_get_mach (abfd) < 25)
789 		final_type = R_PARISC_PCREL14F;
790 	      else
791 		final_type = R_PARISC_PCREL16F;
792 	      break;
793 	    default:
794 	      return R_PARISC_NONE;
795 	    }
796 	  break;
797 
798 	case 17:
799 	  switch (field)
800 	    {
801 	    case e_rsel:
802 	    case e_rrsel:
803 	    case e_rdsel:
804 	      final_type = R_PARISC_PCREL17R;
805 	      break;
806 	    case e_fsel:
807 	      final_type = R_PARISC_PCREL17F;
808 	      break;
809 	    default:
810 	      return R_PARISC_NONE;
811 	    }
812 	  break;
813 
814 	case 21:
815 	  switch (field)
816 	    {
817 	    case e_lsel:
818 	    case e_lrsel:
819 	    case e_ldsel:
820 	    case e_nlsel:
821 	    case e_nlrsel:
822 	      final_type = R_PARISC_PCREL21L;
823 	      break;
824 	    default:
825 	      return R_PARISC_NONE;
826 	    }
827 	  break;
828 
829 	case 22:
830 	  switch (field)
831 	    {
832 	    case e_fsel:
833 	      final_type = R_PARISC_PCREL22F;
834 	      break;
835 	    default:
836 	      return R_PARISC_NONE;
837 	    }
838 	  break;
839 
840 	case 32:
841 	  switch (field)
842 	    {
843 	    case e_fsel:
844 	      final_type = R_PARISC_PCREL32;
845 	      break;
846 	    default:
847 	      return R_PARISC_NONE;
848 	    }
849 	  break;
850 
851 	case 64:
852 	  switch (field)
853 	    {
854 	    case e_fsel:
855 	      final_type = R_PARISC_PCREL64;
856 	      break;
857 	    default:
858 	      return R_PARISC_NONE;
859 	    }
860 	  break;
861 
862 	default:
863 	  return R_PARISC_NONE;
864 	}
865       break;
866 
867     case R_PARISC_TLS_GD21L:
868       switch (field)
869 	{
870 	  case e_ltsel:
871 	  case e_lrsel:
872 	    final_type = R_PARISC_TLS_GD21L;
873 	    break;
874 	  case e_rtsel:
875 	  case e_rrsel:
876 	    final_type = R_PARISC_TLS_GD14R;
877 	    break;
878 	  default:
879 	    return R_PARISC_NONE;
880 	}
881       break;
882 
883     case R_PARISC_TLS_LDM21L:
884       switch (field)
885 	{
886 	  case e_ltsel:
887 	  case e_lrsel:
888 	    final_type = R_PARISC_TLS_LDM21L;
889 	    break;
890 	  case e_rtsel:
891 	  case e_rrsel:
892 	    final_type = R_PARISC_TLS_LDM14R;
893 	    break;
894 	  default:
895 	    return R_PARISC_NONE;
896 	}
897       break;
898 
899     case R_PARISC_TLS_LDO21L:
900       switch (field)
901 	{
902 	  case e_lrsel:
903 	    final_type = R_PARISC_TLS_LDO21L;
904 	    break;
905 	  case e_rrsel:
906 	    final_type = R_PARISC_TLS_LDO14R;
907 	    break;
908 	  default:
909 	    return R_PARISC_NONE;
910 	}
911       break;
912 
913     case R_PARISC_TLS_IE21L:
914       switch (field)
915 	{
916 	  case e_ltsel:
917 	  case e_lrsel:
918 	    final_type = R_PARISC_TLS_IE21L;
919 	    break;
920 	  case e_rtsel:
921 	  case e_rrsel:
922 	    final_type = R_PARISC_TLS_IE14R;
923 	    break;
924 	  default:
925 	    return R_PARISC_NONE;
926 	}
927       break;
928 
929     case R_PARISC_TLS_LE21L:
930       switch (field)
931 	{
932 	  case e_lrsel:
933 	    final_type = R_PARISC_TLS_LE21L;
934 	    break;
935 	  case e_rrsel:
936 	    final_type = R_PARISC_TLS_LE14R;
937 	    break;
938 	  default:
939 	    return R_PARISC_NONE;
940 	}
941       break;
942 
943     case R_PARISC_SEGREL32:
944       switch (format)
945 	{
946 	case 32:
947 	  switch (field)
948 	    {
949 	    case e_fsel:
950 	      final_type = R_PARISC_SEGREL32;
951 	      break;
952 	    default:
953 	      return R_PARISC_NONE;
954 	    }
955 	  break;
956 
957 	case 64:
958 	  switch (field)
959 	    {
960 	    case e_fsel:
961 	      final_type = R_PARISC_SEGREL64;
962 	      break;
963 	    default:
964 	      return R_PARISC_NONE;
965 	    }
966 	  break;
967 
968 	default:
969 	  return R_PARISC_NONE;
970 	}
971       break;
972 
973     case R_PARISC_GNU_VTENTRY:
974     case R_PARISC_GNU_VTINHERIT:
975     case R_PARISC_SEGBASE:
976       /* The defaults are fine for these cases.  */
977       break;
978 
979     default:
980       return R_PARISC_NONE;
981     }
982 
983   return final_type;
984 }
985 
986 /* Return one (or more) BFD relocations which implement the base
987    relocation with modifications based on format and field.  */
988 
989 elf_hppa_reloc_type **
_bfd_elf_hppa_gen_reloc_type(bfd * abfd,elf_hppa_reloc_type base_type,int format,unsigned int field,int ignore ATTRIBUTE_UNUSED,asymbol * sym ATTRIBUTE_UNUSED)990 _bfd_elf_hppa_gen_reloc_type (bfd *abfd,
991 			      elf_hppa_reloc_type base_type,
992 			      int format,
993 			      unsigned int field,
994 			      int ignore ATTRIBUTE_UNUSED,
995 			      asymbol *sym ATTRIBUTE_UNUSED)
996 {
997   elf_hppa_reloc_type *finaltype;
998   elf_hppa_reloc_type **final_types;
999   bfd_size_type amt = sizeof (elf_hppa_reloc_type *) * 2;
1000 
1001   /* Allocate slots for the BFD relocation.  */
1002   final_types = bfd_alloc (abfd, amt);
1003   if (final_types == NULL)
1004     return NULL;
1005 
1006   /* Allocate space for the relocation itself.  */
1007   amt = sizeof (elf_hppa_reloc_type);
1008   finaltype = bfd_alloc (abfd, amt);
1009   if (finaltype == NULL)
1010     return NULL;
1011 
1012   /* Some reasonable defaults.  */
1013   final_types[0] = finaltype;
1014   final_types[1] = NULL;
1015 
1016   *finaltype = elf_hppa_reloc_final_type (abfd, base_type, format, field);
1017 
1018   return final_types;
1019 }
1020 
1021 /* Translate from an elf into field into a howto relocation pointer.  */
1022 
1023 static void
elf_hppa_info_to_howto(bfd * abfd ATTRIBUTE_UNUSED,arelent * bfd_reloc,Elf_Internal_Rela * elf_reloc)1024 elf_hppa_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
1025 			arelent *bfd_reloc,
1026 			Elf_Internal_Rela *elf_reloc)
1027 {
1028   BFD_ASSERT (ELF_R_TYPE (elf_reloc->r_info)
1029 	      < (unsigned int) R_PARISC_UNIMPLEMENTED);
1030   bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
1031 }
1032 
1033 /* Translate from an elf into field into a howto relocation pointer.  */
1034 
1035 static void
elf_hppa_info_to_howto_rel(bfd * abfd ATTRIBUTE_UNUSED,arelent * bfd_reloc,Elf_Internal_Rela * elf_reloc)1036 elf_hppa_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
1037 			    arelent *bfd_reloc,
1038 			    Elf_Internal_Rela *elf_reloc)
1039 {
1040   BFD_ASSERT (ELF_R_TYPE (elf_reloc->r_info)
1041 	      < (unsigned int) R_PARISC_UNIMPLEMENTED);
1042   bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
1043 }
1044 
1045 /* Return the address of the howto table entry to perform the CODE
1046    relocation for an ARCH machine.  */
1047 
1048 static reloc_howto_type *
elf_hppa_reloc_type_lookup(bfd * abfd ATTRIBUTE_UNUSED,bfd_reloc_code_real_type code)1049 elf_hppa_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
1050 			    bfd_reloc_code_real_type code)
1051 {
1052   if ((int) code < (int) R_PARISC_UNIMPLEMENTED)
1053     {
1054       BFD_ASSERT ((int) elf_hppa_howto_table[(int) code].type == (int) code);
1055       return &elf_hppa_howto_table[(int) code];
1056     }
1057   return NULL;
1058 }
1059 
1060 static reloc_howto_type *
elf_hppa_reloc_name_lookup(bfd * abfd ATTRIBUTE_UNUSED,const char * r_name)1061 elf_hppa_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
1062 			    const char *r_name)
1063 {
1064   unsigned int i;
1065 
1066   for (i = 0;
1067        i < sizeof (elf_hppa_howto_table) / sizeof (elf_hppa_howto_table[0]);
1068        i++)
1069     if (elf_hppa_howto_table[i].name != NULL
1070 	&& strcasecmp (elf_hppa_howto_table[i].name, r_name) == 0)
1071       return &elf_hppa_howto_table[i];
1072 
1073   return NULL;
1074 }
1075 
1076 /* Return TRUE if SYM represents a local label symbol.  */
1077 
1078 static bfd_boolean
elf_hppa_is_local_label_name(bfd * abfd ATTRIBUTE_UNUSED,const char * name)1079 elf_hppa_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name)
1080 {
1081   if (name[0] == 'L' && name[1] == '$')
1082     return TRUE;
1083   return _bfd_elf_is_local_label_name (abfd, name);
1084 }
1085 
1086 /* Set the correct type for an ELF section.  We do this by the
1087    section name, which is a hack, but ought to work.  */
1088 
1089 static bfd_boolean
elf_hppa_fake_sections(bfd * abfd,Elf_Internal_Shdr * hdr,asection * sec)1090 elf_hppa_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
1091 {
1092   const char *name;
1093 
1094   name = bfd_get_section_name (abfd, sec);
1095 
1096   if (strcmp (name, ".PARISC.unwind") == 0)
1097     {
1098       int indx;
1099       asection *asec;
1100 
1101 #if ARCH_SIZE == 64
1102       hdr->sh_type = SHT_LOPROC + 1;
1103 #else
1104       hdr->sh_type = 1;
1105 #endif
1106       /* ?!? How are unwinds supposed to work for symbols in arbitrary
1107 	 sections?  Or what if we have multiple .text sections in a single
1108 	 .o file?  HP really messed up on this one.
1109 
1110 	 Ugh.  We can not use elf_section_data (sec)->this_idx at this
1111 	 point because it is not initialized yet.
1112 
1113 	 So we (gasp) recompute it here.  Hopefully nobody ever changes the
1114 	 way sections are numbered in elf.c!  */
1115       for (asec = abfd->sections, indx = 1; asec; asec = asec->next, indx++)
1116 	{
1117 	  if (asec->name && strcmp (asec->name, ".text") == 0)
1118 	    {
1119 	      hdr->sh_info = indx;
1120 	      break;
1121 	    }
1122 	}
1123 
1124       /* I have no idea if this is really necessary or what it means.  */
1125       hdr->sh_entsize = 4;
1126     }
1127   return TRUE;
1128 }
1129 
1130 static void
elf_hppa_final_write_processing(bfd * abfd,bfd_boolean linker ATTRIBUTE_UNUSED)1131 elf_hppa_final_write_processing (bfd *abfd,
1132 				 bfd_boolean linker ATTRIBUTE_UNUSED)
1133 {
1134   int mach = bfd_get_mach (abfd);
1135 
1136   elf_elfheader (abfd)->e_flags &= ~(EF_PARISC_ARCH | EF_PARISC_TRAPNIL
1137 				     | EF_PARISC_EXT | EF_PARISC_LSB
1138 				     | EF_PARISC_WIDE | EF_PARISC_NO_KABP
1139 				     | EF_PARISC_LAZYSWAP);
1140 
1141   if (mach == 10)
1142     elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_0;
1143   else if (mach == 11)
1144     elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_1;
1145   else if (mach == 20)
1146     elf_elfheader (abfd)->e_flags |= EFA_PARISC_2_0;
1147   else if (mach == 25)
1148     elf_elfheader (abfd)->e_flags |= (EF_PARISC_WIDE
1149 				      | EFA_PARISC_2_0
1150 				      /* The GNU tools have trapped without
1151 					 option since 1993, so need to take
1152 					 a step backwards with the ELF
1153 					 based toolchains.  */
1154 				      | EF_PARISC_TRAPNIL);
1155 }
1156 
1157 /* Comparison function for qsort to sort unwind section during a
1158    final link.  */
1159 
1160 static int
hppa_unwind_entry_compare(const void * a,const void * b)1161 hppa_unwind_entry_compare (const void *a, const void *b)
1162 {
1163   const bfd_byte *ap, *bp;
1164   unsigned long av, bv;
1165 
1166   ap = a;
1167   av = (unsigned long) ap[0] << 24;
1168   av |= (unsigned long) ap[1] << 16;
1169   av |= (unsigned long) ap[2] << 8;
1170   av |= (unsigned long) ap[3];
1171 
1172   bp = b;
1173   bv = (unsigned long) bp[0] << 24;
1174   bv |= (unsigned long) bp[1] << 16;
1175   bv |= (unsigned long) bp[2] << 8;
1176   bv |= (unsigned long) bp[3];
1177 
1178   return av < bv ? -1 : av > bv ? 1 : 0;
1179 }
1180 
1181 static bfd_boolean
elf_hppa_sort_unwind(bfd * abfd)1182 elf_hppa_sort_unwind (bfd *abfd)
1183 {
1184   asection *s;
1185 
1186   /* Magic section names, but this is much safer than having
1187      relocate_section remember where SEGREL32 relocs occurred.
1188      Consider what happens if someone inept creates a linker script
1189      that puts unwind information in .text.  */
1190   s = bfd_get_section_by_name (abfd, ".PARISC.unwind");
1191   if (s != NULL)
1192     {
1193       bfd_size_type size;
1194       bfd_byte *contents;
1195 
1196       if (!bfd_malloc_and_get_section (abfd, s, &contents))
1197 	return FALSE;
1198 
1199       size = s->size;
1200       qsort (contents, (size_t) (size / 16), 16, hppa_unwind_entry_compare);
1201 
1202       if (! bfd_set_section_contents (abfd, s, contents, (file_ptr) 0, size))
1203 	return FALSE;
1204     }
1205 
1206   return TRUE;
1207 }
1208 
1209 /* What to do when ld finds relocations against symbols defined in
1210    discarded sections.  */
1211 
1212 static unsigned int
elf_hppa_action_discarded(asection * sec)1213 elf_hppa_action_discarded (asection *sec)
1214 {
1215   /* Ignore relocations in .data.rel.ro.local.  This section can contain
1216      PLABEL32 relocations to functions in discarded COMDAT groups.  */
1217   if (strcmp (".data.rel.ro.local", sec->name) == 0)
1218     return 0;
1219 
1220   if (strcmp (".PARISC.unwind", sec->name) == 0)
1221     return 0;
1222 
1223   return _bfd_elf_default_action_discarded (sec);
1224 }
1225