* ldcref.c (cref_fill_array): Call bfd_demangle rather than demangle.
[deliverable/binutils-gdb.git] / bfd / elf-hppa.h
1 /* Common code for PA ELF implementations.
2 Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
3 Free Software Foundation, Inc.
4
5 This file is part of BFD, the Binary File Descriptor library.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 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, 0, 0, FALSE, 0, complain_overflow_bitfield,
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
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_get_arch_info (abfd)->bits_per_address != 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 default:
748 return R_PARISC_NONE;
749 }
750 break;
751
752 case R_HPPA_PCREL_CALL:
753 switch (format)
754 {
755 case 12:
756 switch (field)
757 {
758 case e_fsel:
759 final_type = R_PARISC_PCREL12F;
760 break;
761 default:
762 return R_PARISC_NONE;
763 }
764 break;
765
766 case 14:
767 /* Contrary to appearances, these are not calls of any sort.
768 Rather, they are loads/stores with a pcrel reloc. */
769 switch (field)
770 {
771 case e_rsel:
772 case e_rrsel:
773 case e_rdsel:
774 final_type = R_PARISC_PCREL14R;
775 break;
776 case e_fsel:
777 if (bfd_get_mach (abfd) < 25)
778 final_type = R_PARISC_PCREL14F;
779 else
780 final_type = R_PARISC_PCREL16F;
781 break;
782 default:
783 return R_PARISC_NONE;
784 }
785 break;
786
787 case 17:
788 switch (field)
789 {
790 case e_rsel:
791 case e_rrsel:
792 case e_rdsel:
793 final_type = R_PARISC_PCREL17R;
794 break;
795 case e_fsel:
796 final_type = R_PARISC_PCREL17F;
797 break;
798 default:
799 return R_PARISC_NONE;
800 }
801 break;
802
803 case 21:
804 switch (field)
805 {
806 case e_lsel:
807 case e_lrsel:
808 case e_ldsel:
809 case e_nlsel:
810 case e_nlrsel:
811 final_type = R_PARISC_PCREL21L;
812 break;
813 default:
814 return R_PARISC_NONE;
815 }
816 break;
817
818 case 22:
819 switch (field)
820 {
821 case e_fsel:
822 final_type = R_PARISC_PCREL22F;
823 break;
824 default:
825 return R_PARISC_NONE;
826 }
827 break;
828
829 case 32:
830 switch (field)
831 {
832 case e_fsel:
833 final_type = R_PARISC_PCREL32;
834 break;
835 default:
836 return R_PARISC_NONE;
837 }
838 break;
839
840 case 64:
841 switch (field)
842 {
843 case e_fsel:
844 final_type = R_PARISC_PCREL64;
845 break;
846 default:
847 return R_PARISC_NONE;
848 }
849 break;
850
851 default:
852 return R_PARISC_NONE;
853 }
854 break;
855
856 case R_PARISC_TLS_GD21L:
857 switch (field)
858 {
859 case e_ltsel:
860 case e_lrsel:
861 final_type = R_PARISC_TLS_GD21L;
862 break;
863 case e_rtsel:
864 case e_rrsel:
865 final_type = R_PARISC_TLS_GD14R;
866 break;
867 default:
868 return R_PARISC_NONE;
869 }
870 break;
871
872 case R_PARISC_TLS_LDM21L:
873 switch (field)
874 {
875 case e_ltsel:
876 case e_lrsel:
877 final_type = R_PARISC_TLS_LDM21L;
878 break;
879 case e_rtsel:
880 case e_rrsel:
881 final_type = R_PARISC_TLS_LDM14R;
882 break;
883 default:
884 return R_PARISC_NONE;
885 }
886 break;
887
888 case R_PARISC_TLS_LDO21L:
889 switch (field)
890 {
891 case e_lrsel:
892 final_type = R_PARISC_TLS_LDO21L;
893 break;
894 case e_rrsel:
895 final_type = R_PARISC_TLS_LDO14R;
896 break;
897 default:
898 return R_PARISC_NONE;
899 }
900 break;
901
902 case R_PARISC_TLS_IE21L:
903 switch (field)
904 {
905 case e_ltsel:
906 case e_lrsel:
907 final_type = R_PARISC_TLS_IE21L;
908 break;
909 case e_rtsel:
910 case e_rrsel:
911 final_type = R_PARISC_TLS_IE14R;
912 break;
913 default:
914 return R_PARISC_NONE;
915 }
916 break;
917
918 case R_PARISC_TLS_LE21L:
919 switch (field)
920 {
921 case e_lrsel:
922 final_type = R_PARISC_TLS_LE21L;
923 break;
924 case e_rrsel:
925 final_type = R_PARISC_TLS_LE14R;
926 break;
927 default:
928 return R_PARISC_NONE;
929 }
930 break;
931
932 case R_PARISC_GNU_VTENTRY:
933 case R_PARISC_GNU_VTINHERIT:
934 case R_PARISC_SEGREL32:
935 case R_PARISC_SEGBASE:
936 /* The defaults are fine for these cases. */
937 break;
938
939 default:
940 return R_PARISC_NONE;
941 }
942
943 return final_type;
944 }
945
946 /* Return one (or more) BFD relocations which implement the base
947 relocation with modifications based on format and field. */
948
949 elf_hppa_reloc_type **
950 _bfd_elf_hppa_gen_reloc_type (bfd *abfd,
951 elf_hppa_reloc_type base_type,
952 int format,
953 unsigned int field,
954 int ignore ATTRIBUTE_UNUSED,
955 asymbol *sym ATTRIBUTE_UNUSED)
956 {
957 elf_hppa_reloc_type *finaltype;
958 elf_hppa_reloc_type **final_types;
959 bfd_size_type amt = sizeof (elf_hppa_reloc_type *) * 2;
960
961 /* Allocate slots for the BFD relocation. */
962 final_types = bfd_alloc (abfd, amt);
963 if (final_types == NULL)
964 return NULL;
965
966 /* Allocate space for the relocation itself. */
967 amt = sizeof (elf_hppa_reloc_type);
968 finaltype = bfd_alloc (abfd, amt);
969 if (finaltype == NULL)
970 return NULL;
971
972 /* Some reasonable defaults. */
973 final_types[0] = finaltype;
974 final_types[1] = NULL;
975
976 *finaltype = elf_hppa_reloc_final_type (abfd, base_type, format, field);
977
978 return final_types;
979 }
980
981 /* Translate from an elf into field into a howto relocation pointer. */
982
983 static void
984 elf_hppa_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
985 arelent *bfd_reloc,
986 Elf_Internal_Rela *elf_reloc)
987 {
988 BFD_ASSERT (ELF_R_TYPE (elf_reloc->r_info)
989 < (unsigned int) R_PARISC_UNIMPLEMENTED);
990 bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
991 }
992
993 /* Translate from an elf into field into a howto relocation pointer. */
994
995 static void
996 elf_hppa_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
997 arelent *bfd_reloc,
998 Elf_Internal_Rela *elf_reloc)
999 {
1000 BFD_ASSERT (ELF_R_TYPE (elf_reloc->r_info)
1001 < (unsigned int) R_PARISC_UNIMPLEMENTED);
1002 bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
1003 }
1004
1005 /* Return the address of the howto table entry to perform the CODE
1006 relocation for an ARCH machine. */
1007
1008 static reloc_howto_type *
1009 elf_hppa_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
1010 bfd_reloc_code_real_type code)
1011 {
1012 if ((int) code < (int) R_PARISC_UNIMPLEMENTED)
1013 {
1014 BFD_ASSERT ((int) elf_hppa_howto_table[(int) code].type == (int) code);
1015 return &elf_hppa_howto_table[(int) code];
1016 }
1017 return NULL;
1018 }
1019
1020 static reloc_howto_type *
1021 elf_hppa_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
1022 const char *r_name)
1023 {
1024 unsigned int i;
1025
1026 for (i = 0;
1027 i < sizeof (elf_hppa_howto_table) / sizeof (elf_hppa_howto_table[0]);
1028 i++)
1029 if (elf_hppa_howto_table[i].name != NULL
1030 && strcasecmp (elf_hppa_howto_table[i].name, r_name) == 0)
1031 return &elf_hppa_howto_table[i];
1032
1033 return NULL;
1034 }
1035
1036 /* Return TRUE if SYM represents a local label symbol. */
1037
1038 static bfd_boolean
1039 elf_hppa_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name)
1040 {
1041 if (name[0] == 'L' && name[1] == '$')
1042 return TRUE;
1043 return _bfd_elf_is_local_label_name (abfd, name);
1044 }
1045
1046 /* Set the correct type for an ELF section. We do this by the
1047 section name, which is a hack, but ought to work. */
1048
1049 static bfd_boolean
1050 elf_hppa_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
1051 {
1052 const char *name;
1053
1054 name = bfd_get_section_name (abfd, sec);
1055
1056 if (strcmp (name, ".PARISC.unwind") == 0)
1057 {
1058 int indx;
1059 asection *asec;
1060
1061 #if ARCH_SIZE == 64
1062 hdr->sh_type = SHT_LOPROC + 1;
1063 #else
1064 hdr->sh_type = 1;
1065 #endif
1066 /* ?!? How are unwinds supposed to work for symbols in arbitrary
1067 sections? Or what if we have multiple .text sections in a single
1068 .o file? HP really messed up on this one.
1069
1070 Ugh. We can not use elf_section_data (sec)->this_idx at this
1071 point because it is not initialized yet.
1072
1073 So we (gasp) recompute it here. Hopefully nobody ever changes the
1074 way sections are numbered in elf.c! */
1075 for (asec = abfd->sections, indx = 1; asec; asec = asec->next, indx++)
1076 {
1077 if (asec->name && strcmp (asec->name, ".text") == 0)
1078 {
1079 hdr->sh_info = indx;
1080 break;
1081 }
1082 }
1083
1084 /* I have no idea if this is really necessary or what it means. */
1085 hdr->sh_entsize = 4;
1086 }
1087 return TRUE;
1088 }
1089
1090 static void
1091 elf_hppa_final_write_processing (bfd *abfd,
1092 bfd_boolean linker ATTRIBUTE_UNUSED)
1093 {
1094 int mach = bfd_get_mach (abfd);
1095
1096 elf_elfheader (abfd)->e_flags &= ~(EF_PARISC_ARCH | EF_PARISC_TRAPNIL
1097 | EF_PARISC_EXT | EF_PARISC_LSB
1098 | EF_PARISC_WIDE | EF_PARISC_NO_KABP
1099 | EF_PARISC_LAZYSWAP);
1100
1101 if (mach == 10)
1102 elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_0;
1103 else if (mach == 11)
1104 elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_1;
1105 else if (mach == 20)
1106 elf_elfheader (abfd)->e_flags |= EFA_PARISC_2_0;
1107 else if (mach == 25)
1108 elf_elfheader (abfd)->e_flags |= (EF_PARISC_WIDE
1109 | EFA_PARISC_2_0
1110 /* The GNU tools have trapped without
1111 option since 1993, so need to take
1112 a step backwards with the ELF
1113 based toolchains. */
1114 | EF_PARISC_TRAPNIL);
1115 }
1116
1117 /* Comparison function for qsort to sort unwind section during a
1118 final link. */
1119
1120 static int
1121 hppa_unwind_entry_compare (const void *a, const void *b)
1122 {
1123 const bfd_byte *ap, *bp;
1124 unsigned long av, bv;
1125
1126 ap = a;
1127 av = (unsigned long) ap[0] << 24;
1128 av |= (unsigned long) ap[1] << 16;
1129 av |= (unsigned long) ap[2] << 8;
1130 av |= (unsigned long) ap[3];
1131
1132 bp = b;
1133 bv = (unsigned long) bp[0] << 24;
1134 bv |= (unsigned long) bp[1] << 16;
1135 bv |= (unsigned long) bp[2] << 8;
1136 bv |= (unsigned long) bp[3];
1137
1138 return av < bv ? -1 : av > bv ? 1 : 0;
1139 }
1140
1141 static bfd_boolean
1142 elf_hppa_sort_unwind (bfd *abfd)
1143 {
1144 asection *s;
1145
1146 /* Magic section names, but this is much safer than having
1147 relocate_section remember where SEGREL32 relocs occurred.
1148 Consider what happens if someone inept creates a linker script
1149 that puts unwind information in .text. */
1150 s = bfd_get_section_by_name (abfd, ".PARISC.unwind");
1151 if (s != NULL)
1152 {
1153 bfd_size_type size;
1154 bfd_byte *contents;
1155
1156 if (!bfd_malloc_and_get_section (abfd, s, &contents))
1157 return FALSE;
1158
1159 size = s->size;
1160 qsort (contents, (size_t) (size / 16), 16, hppa_unwind_entry_compare);
1161
1162 if (! bfd_set_section_contents (abfd, s, contents, (file_ptr) 0, size))
1163 return FALSE;
1164 }
1165
1166 return TRUE;
1167 }
1168
1169 /* What to do when ld finds relocations against symbols defined in
1170 discarded sections. */
1171
1172 static unsigned int
1173 elf_hppa_action_discarded (asection *sec)
1174 {
1175 if (strcmp (".PARISC.unwind", sec->name) == 0)
1176 return 0;
1177
1178 return _bfd_elf_default_action_discarded (sec);
1179 }
1180
1181 #if ARCH_SIZE == 64
1182 /* Hook called by the linker routine which adds symbols from an object
1183 file. HP's libraries define symbols with HP specific section
1184 indices, which we have to handle. */
1185
1186 static bfd_boolean
1187 elf_hppa_add_symbol_hook (bfd *abfd,
1188 struct bfd_link_info *info ATTRIBUTE_UNUSED,
1189 Elf_Internal_Sym *sym,
1190 const char **namep ATTRIBUTE_UNUSED,
1191 flagword *flagsp ATTRIBUTE_UNUSED,
1192 asection **secp,
1193 bfd_vma *valp)
1194 {
1195 int index = sym->st_shndx;
1196
1197 switch (index)
1198 {
1199 case SHN_PARISC_ANSI_COMMON:
1200 *secp = bfd_make_section_old_way (abfd, ".PARISC.ansi.common");
1201 (*secp)->flags |= SEC_IS_COMMON;
1202 *valp = sym->st_size;
1203 break;
1204
1205 case SHN_PARISC_HUGE_COMMON:
1206 *secp = bfd_make_section_old_way (abfd, ".PARISC.huge.common");
1207 (*secp)->flags |= SEC_IS_COMMON;
1208 *valp = sym->st_size;
1209 break;
1210 }
1211
1212 return TRUE;
1213 }
1214
1215 static bfd_boolean
1216 elf_hppa_unmark_useless_dynamic_symbols (struct elf_link_hash_entry *h,
1217 void *data)
1218 {
1219 struct bfd_link_info *info = data;
1220
1221 if (h->root.type == bfd_link_hash_warning)
1222 h = (struct elf_link_hash_entry *) h->root.u.i.link;
1223
1224 /* If we are not creating a shared library, and this symbol is
1225 referenced by a shared library but is not defined anywhere, then
1226 the generic code will warn that it is undefined.
1227
1228 This behavior is undesirable on HPs since the standard shared
1229 libraries contain references to undefined symbols.
1230
1231 So we twiddle the flags associated with such symbols so that they
1232 will not trigger the warning. ?!? FIXME. This is horribly fragile.
1233
1234 Ultimately we should have better controls over the generic ELF BFD
1235 linker code. */
1236 if (! info->relocatable
1237 && info->unresolved_syms_in_shared_libs != RM_IGNORE
1238 && h->root.type == bfd_link_hash_undefined
1239 && h->ref_dynamic
1240 && !h->ref_regular)
1241 {
1242 h->ref_dynamic = 0;
1243 h->pointer_equality_needed = 1;
1244 }
1245
1246 return TRUE;
1247 }
1248
1249 static bfd_boolean
1250 elf_hppa_remark_useless_dynamic_symbols (struct elf_link_hash_entry *h,
1251 void *data)
1252 {
1253 struct bfd_link_info *info = data;
1254
1255 if (h->root.type == bfd_link_hash_warning)
1256 h = (struct elf_link_hash_entry *) h->root.u.i.link;
1257
1258 /* If we are not creating a shared library, and this symbol is
1259 referenced by a shared library but is not defined anywhere, then
1260 the generic code will warn that it is undefined.
1261
1262 This behavior is undesirable on HPs since the standard shared
1263 libraries contain references to undefined symbols.
1264
1265 So we twiddle the flags associated with such symbols so that they
1266 will not trigger the warning. ?!? FIXME. This is horribly fragile.
1267
1268 Ultimately we should have better controls over the generic ELF BFD
1269 linker code. */
1270 if (! info->relocatable
1271 && info->unresolved_syms_in_shared_libs != RM_IGNORE
1272 && h->root.type == bfd_link_hash_undefined
1273 && !h->ref_dynamic
1274 && !h->ref_regular
1275 && h->pointer_equality_needed)
1276 {
1277 h->ref_dynamic = 1;
1278 h->pointer_equality_needed = 0;
1279 }
1280
1281 return TRUE;
1282 }
1283
1284 static bfd_boolean
1285 elf_hppa_is_dynamic_loader_symbol (const char *name)
1286 {
1287 return (! strcmp (name, "__CPU_REVISION")
1288 || ! strcmp (name, "__CPU_KEYBITS_1")
1289 || ! strcmp (name, "__SYSTEM_ID_D")
1290 || ! strcmp (name, "__FPU_MODEL")
1291 || ! strcmp (name, "__FPU_REVISION")
1292 || ! strcmp (name, "__ARGC")
1293 || ! strcmp (name, "__ARGV")
1294 || ! strcmp (name, "__ENVP")
1295 || ! strcmp (name, "__TLS_SIZE_D")
1296 || ! strcmp (name, "__LOAD_INFO")
1297 || ! strcmp (name, "__systab"));
1298 }
1299
1300 /* Record the lowest address for the data and text segments. */
1301 static void
1302 elf_hppa_record_segment_addrs (bfd *abfd ATTRIBUTE_UNUSED,
1303 asection *section,
1304 void *data)
1305 {
1306 struct elf64_hppa_link_hash_table *hppa_info;
1307 bfd_vma value;
1308
1309 hppa_info = data;
1310
1311 value = section->vma - section->filepos;
1312
1313 if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
1314 == (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
1315 && value < hppa_info->text_segment_base)
1316 hppa_info->text_segment_base = value;
1317 else if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
1318 == (SEC_ALLOC | SEC_LOAD))
1319 && value < hppa_info->data_segment_base)
1320 hppa_info->data_segment_base = value;
1321 }
1322
1323 /* Called after we have seen all the input files/sections, but before
1324 final symbol resolution and section placement has been determined.
1325
1326 We use this hook to (possibly) provide a value for __gp, then we
1327 fall back to the generic ELF final link routine. */
1328
1329 static bfd_boolean
1330 elf_hppa_final_link (bfd *abfd, struct bfd_link_info *info)
1331 {
1332 bfd_boolean retval;
1333 struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
1334
1335 if (! info->relocatable)
1336 {
1337 struct elf_link_hash_entry *gp;
1338 bfd_vma gp_val;
1339
1340 /* The linker script defines a value for __gp iff it was referenced
1341 by one of the objects being linked. First try to find the symbol
1342 in the hash table. If that fails, just compute the value __gp
1343 should have had. */
1344 gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", FALSE,
1345 FALSE, FALSE);
1346
1347 if (gp)
1348 {
1349
1350 /* Adjust the value of __gp as we may want to slide it into the
1351 .plt section so that the stubs can access PLT entries without
1352 using an addil sequence. */
1353 gp->root.u.def.value += hppa_info->gp_offset;
1354
1355 gp_val = (gp->root.u.def.section->output_section->vma
1356 + gp->root.u.def.section->output_offset
1357 + gp->root.u.def.value);
1358 }
1359 else
1360 {
1361 asection *sec;
1362
1363 /* First look for a .plt section. If found, then __gp is the
1364 address of the .plt + gp_offset.
1365
1366 If no .plt is found, then look for .dlt, .opd and .data (in
1367 that order) and set __gp to the base address of whichever
1368 section is found first. */
1369
1370 sec = hppa_info->plt_sec;
1371 if (sec && ! (sec->flags & SEC_EXCLUDE))
1372 gp_val = (sec->output_offset
1373 + sec->output_section->vma
1374 + hppa_info->gp_offset);
1375 else
1376 {
1377 sec = hppa_info->dlt_sec;
1378 if (!sec || (sec->flags & SEC_EXCLUDE))
1379 sec = hppa_info->opd_sec;
1380 if (!sec || (sec->flags & SEC_EXCLUDE))
1381 sec = bfd_get_section_by_name (abfd, ".data");
1382 if (!sec || (sec->flags & SEC_EXCLUDE))
1383 gp_val = 0;
1384 else
1385 gp_val = sec->output_offset + sec->output_section->vma;
1386 }
1387 }
1388
1389 /* Install whatever value we found/computed for __gp. */
1390 _bfd_set_gp_value (abfd, gp_val);
1391 }
1392
1393 /* We need to know the base of the text and data segments so that we
1394 can perform SEGREL relocations. We will record the base addresses
1395 when we encounter the first SEGREL relocation. */
1396 hppa_info->text_segment_base = (bfd_vma)-1;
1397 hppa_info->data_segment_base = (bfd_vma)-1;
1398
1399 /* HP's shared libraries have references to symbols that are not
1400 defined anywhere. The generic ELF BFD linker code will complain
1401 about such symbols.
1402
1403 So we detect the losing case and arrange for the flags on the symbol
1404 to indicate that it was never referenced. This keeps the generic
1405 ELF BFD link code happy and appears to not create any secondary
1406 problems. Ultimately we need a way to control the behavior of the
1407 generic ELF BFD link code better. */
1408 elf_link_hash_traverse (elf_hash_table (info),
1409 elf_hppa_unmark_useless_dynamic_symbols,
1410 info);
1411
1412 /* Invoke the regular ELF backend linker to do all the work. */
1413 retval = bfd_elf_final_link (abfd, info);
1414
1415 elf_link_hash_traverse (elf_hash_table (info),
1416 elf_hppa_remark_useless_dynamic_symbols,
1417 info);
1418
1419 /* If we're producing a final executable, sort the contents of the
1420 unwind section. */
1421 if (retval)
1422 retval = elf_hppa_sort_unwind (abfd);
1423
1424 return retval;
1425 }
1426
1427 /* Relocate the given INSN. VALUE should be the actual value we want
1428 to insert into the instruction, ie by this point we should not be
1429 concerned with computing an offset relative to the DLT, PC, etc.
1430 Instead this routine is meant to handle the bit manipulations needed
1431 to insert the relocation into the given instruction. */
1432
1433 static int
1434 elf_hppa_relocate_insn (int insn, int sym_value, unsigned int r_type)
1435 {
1436 switch (r_type)
1437 {
1438 /* This is any 22 bit branch. In PA2.0 syntax it corresponds to
1439 the "B" instruction. */
1440 case R_PARISC_PCREL22F:
1441 case R_PARISC_PCREL22C:
1442 return (insn & ~0x3ff1ffd) | re_assemble_22 (sym_value);
1443
1444 /* This is any 12 bit branch. */
1445 case R_PARISC_PCREL12F:
1446 return (insn & ~0x1ffd) | re_assemble_12 (sym_value);
1447
1448 /* This is any 17 bit branch. In PA2.0 syntax it also corresponds
1449 to the "B" instruction as well as BE. */
1450 case R_PARISC_PCREL17F:
1451 case R_PARISC_DIR17F:
1452 case R_PARISC_DIR17R:
1453 case R_PARISC_PCREL17C:
1454 case R_PARISC_PCREL17R:
1455 return (insn & ~0x1f1ffd) | re_assemble_17 (sym_value);
1456
1457 /* ADDIL or LDIL instructions. */
1458 case R_PARISC_DLTREL21L:
1459 case R_PARISC_DLTIND21L:
1460 case R_PARISC_LTOFF_FPTR21L:
1461 case R_PARISC_PCREL21L:
1462 case R_PARISC_LTOFF_TP21L:
1463 case R_PARISC_DPREL21L:
1464 case R_PARISC_PLTOFF21L:
1465 case R_PARISC_DIR21L:
1466 return (insn & ~0x1fffff) | re_assemble_21 (sym_value);
1467
1468 /* LDO and integer loads/stores with 14 bit displacements. */
1469 case R_PARISC_DLTREL14R:
1470 case R_PARISC_DLTREL14F:
1471 case R_PARISC_DLTIND14R:
1472 case R_PARISC_DLTIND14F:
1473 case R_PARISC_LTOFF_FPTR14R:
1474 case R_PARISC_PCREL14R:
1475 case R_PARISC_PCREL14F:
1476 case R_PARISC_LTOFF_TP14R:
1477 case R_PARISC_LTOFF_TP14F:
1478 case R_PARISC_DPREL14R:
1479 case R_PARISC_DPREL14F:
1480 case R_PARISC_PLTOFF14R:
1481 case R_PARISC_PLTOFF14F:
1482 case R_PARISC_DIR14R:
1483 case R_PARISC_DIR14F:
1484 return (insn & ~0x3fff) | low_sign_unext (sym_value, 14);
1485
1486 /* PA2.0W LDO and integer loads/stores with 16 bit displacements. */
1487 case R_PARISC_LTOFF_FPTR16F:
1488 case R_PARISC_PCREL16F:
1489 case R_PARISC_LTOFF_TP16F:
1490 case R_PARISC_GPREL16F:
1491 case R_PARISC_PLTOFF16F:
1492 case R_PARISC_DIR16F:
1493 case R_PARISC_LTOFF16F:
1494 return (insn & ~0xffff) | re_assemble_16 (sym_value);
1495
1496 /* Doubleword loads and stores with a 14 bit displacement. */
1497 case R_PARISC_DLTREL14DR:
1498 case R_PARISC_DLTIND14DR:
1499 case R_PARISC_LTOFF_FPTR14DR:
1500 case R_PARISC_LTOFF_FPTR16DF:
1501 case R_PARISC_PCREL14DR:
1502 case R_PARISC_PCREL16DF:
1503 case R_PARISC_LTOFF_TP14DR:
1504 case R_PARISC_LTOFF_TP16DF:
1505 case R_PARISC_DPREL14DR:
1506 case R_PARISC_GPREL16DF:
1507 case R_PARISC_PLTOFF14DR:
1508 case R_PARISC_PLTOFF16DF:
1509 case R_PARISC_DIR14DR:
1510 case R_PARISC_DIR16DF:
1511 case R_PARISC_LTOFF16DF:
1512 return (insn & ~0x3ff1) | (((sym_value & 0x2000) >> 13)
1513 | ((sym_value & 0x1ff8) << 1));
1514
1515 /* Floating point single word load/store instructions. */
1516 case R_PARISC_DLTREL14WR:
1517 case R_PARISC_DLTIND14WR:
1518 case R_PARISC_LTOFF_FPTR14WR:
1519 case R_PARISC_LTOFF_FPTR16WF:
1520 case R_PARISC_PCREL14WR:
1521 case R_PARISC_PCREL16WF:
1522 case R_PARISC_LTOFF_TP14WR:
1523 case R_PARISC_LTOFF_TP16WF:
1524 case R_PARISC_DPREL14WR:
1525 case R_PARISC_GPREL16WF:
1526 case R_PARISC_PLTOFF14WR:
1527 case R_PARISC_PLTOFF16WF:
1528 case R_PARISC_DIR16WF:
1529 case R_PARISC_DIR14WR:
1530 case R_PARISC_LTOFF16WF:
1531 return (insn & ~0x3ff9) | (((sym_value & 0x2000) >> 13)
1532 | ((sym_value & 0x1ffc) << 1));
1533
1534 default:
1535 return insn;
1536 }
1537 }
1538
1539 /* Compute the value for a relocation (REL) during a final link stage,
1540 then insert the value into the proper location in CONTENTS.
1541
1542 VALUE is a tentative value for the relocation and may be overridden
1543 and modified here based on the specific relocation to be performed.
1544
1545 For example we do conversions for PC-relative branches in this routine
1546 or redirection of calls to external routines to stubs.
1547
1548 The work of actually applying the relocation is left to a helper
1549 routine in an attempt to reduce the complexity and size of this
1550 function. */
1551
1552 static bfd_reloc_status_type
1553 elf_hppa_final_link_relocate (Elf_Internal_Rela *rel,
1554 bfd *input_bfd,
1555 bfd *output_bfd,
1556 asection *input_section,
1557 bfd_byte *contents,
1558 bfd_vma value,
1559 struct bfd_link_info *info,
1560 asection *sym_sec,
1561 struct elf_link_hash_entry *h ATTRIBUTE_UNUSED,
1562 struct elf64_hppa_dyn_hash_entry *dyn_h)
1563 {
1564 int insn;
1565 bfd_vma offset = rel->r_offset;
1566 bfd_signed_vma addend = rel->r_addend;
1567 reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
1568 unsigned int r_type = howto->type;
1569 bfd_byte *hit_data = contents + offset;
1570 struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
1571
1572 insn = bfd_get_32 (input_bfd, hit_data);
1573
1574 switch (r_type)
1575 {
1576 case R_PARISC_NONE:
1577 break;
1578
1579 /* Basic function call support.
1580
1581 Note for a call to a function defined in another dynamic library
1582 we want to redirect the call to a stub. */
1583
1584 /* Random PC relative relocs. */
1585 case R_PARISC_PCREL21L:
1586 case R_PARISC_PCREL14R:
1587 case R_PARISC_PCREL14F:
1588 case R_PARISC_PCREL14WR:
1589 case R_PARISC_PCREL14DR:
1590 case R_PARISC_PCREL16F:
1591 case R_PARISC_PCREL16WF:
1592 case R_PARISC_PCREL16DF:
1593 {
1594 /* If this is a call to a function defined in another dynamic
1595 library, then redirect the call to the local stub for this
1596 function. */
1597 if (sym_sec == NULL || sym_sec->output_section == NULL)
1598 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1599 + hppa_info->stub_sec->output_section->vma);
1600
1601 /* Turn VALUE into a proper PC relative address. */
1602 value -= (offset + input_section->output_offset
1603 + input_section->output_section->vma);
1604
1605 /* Adjust for any field selectors. */
1606 if (r_type == R_PARISC_PCREL21L)
1607 value = hppa_field_adjust (value, -8 + addend, e_lsel);
1608 else if (r_type == R_PARISC_PCREL14F
1609 || r_type == R_PARISC_PCREL16F
1610 || r_type == R_PARISC_PCREL16WF
1611 || r_type == R_PARISC_PCREL16DF)
1612 value = hppa_field_adjust (value, -8 + addend, e_fsel);
1613 else
1614 value = hppa_field_adjust (value, -8 + addend, e_rsel);
1615
1616 /* Apply the relocation to the given instruction. */
1617 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1618 break;
1619 }
1620
1621 case R_PARISC_PCREL12F:
1622 case R_PARISC_PCREL22F:
1623 case R_PARISC_PCREL17F:
1624 case R_PARISC_PCREL22C:
1625 case R_PARISC_PCREL17C:
1626 case R_PARISC_PCREL17R:
1627 {
1628 /* If this is a call to a function defined in another dynamic
1629 library, then redirect the call to the local stub for this
1630 function. */
1631 if (sym_sec == NULL || sym_sec->output_section == NULL)
1632 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1633 + hppa_info->stub_sec->output_section->vma);
1634
1635 /* Turn VALUE into a proper PC relative address. */
1636 value -= (offset + input_section->output_offset
1637 + input_section->output_section->vma);
1638
1639 /* Adjust for any field selectors. */
1640 if (r_type == R_PARISC_PCREL17R)
1641 value = hppa_field_adjust (value, -8 + addend, e_rsel);
1642 else
1643 value = hppa_field_adjust (value, -8 + addend, e_fsel);
1644
1645 /* All branches are implicitly shifted by 2 places. */
1646 value >>= 2;
1647
1648 /* Apply the relocation to the given instruction. */
1649 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1650 break;
1651 }
1652
1653 /* Indirect references to data through the DLT. */
1654 case R_PARISC_DLTIND14R:
1655 case R_PARISC_DLTIND14F:
1656 case R_PARISC_DLTIND14DR:
1657 case R_PARISC_DLTIND14WR:
1658 case R_PARISC_DLTIND21L:
1659 case R_PARISC_LTOFF_FPTR14R:
1660 case R_PARISC_LTOFF_FPTR14DR:
1661 case R_PARISC_LTOFF_FPTR14WR:
1662 case R_PARISC_LTOFF_FPTR21L:
1663 case R_PARISC_LTOFF_FPTR16F:
1664 case R_PARISC_LTOFF_FPTR16WF:
1665 case R_PARISC_LTOFF_FPTR16DF:
1666 case R_PARISC_LTOFF_TP21L:
1667 case R_PARISC_LTOFF_TP14R:
1668 case R_PARISC_LTOFF_TP14F:
1669 case R_PARISC_LTOFF_TP14WR:
1670 case R_PARISC_LTOFF_TP14DR:
1671 case R_PARISC_LTOFF_TP16F:
1672 case R_PARISC_LTOFF_TP16WF:
1673 case R_PARISC_LTOFF_TP16DF:
1674 case R_PARISC_LTOFF16F:
1675 case R_PARISC_LTOFF16WF:
1676 case R_PARISC_LTOFF16DF:
1677 {
1678 /* If this relocation was against a local symbol, then we still
1679 have not set up the DLT entry (it's not convenient to do so
1680 in the "finalize_dlt" routine because it is difficult to get
1681 to the local symbol's value).
1682
1683 So, if this is a local symbol (h == NULL), then we need to
1684 fill in its DLT entry.
1685
1686 Similarly we may still need to set up an entry in .opd for
1687 a local function which had its address taken. */
1688 if (dyn_h->h == NULL)
1689 {
1690 /* Now do .opd creation if needed. */
1691 if (r_type == R_PARISC_LTOFF_FPTR14R
1692 || r_type == R_PARISC_LTOFF_FPTR14DR
1693 || r_type == R_PARISC_LTOFF_FPTR14WR
1694 || r_type == R_PARISC_LTOFF_FPTR21L
1695 || r_type == R_PARISC_LTOFF_FPTR16F
1696 || r_type == R_PARISC_LTOFF_FPTR16WF
1697 || r_type == R_PARISC_LTOFF_FPTR16DF)
1698 {
1699 /* The first two words of an .opd entry are zero. */
1700 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset,
1701 0, 16);
1702
1703 /* The next word is the address of the function. */
1704 bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
1705 (hppa_info->opd_sec->contents
1706 + dyn_h->opd_offset + 16));
1707
1708 /* The last word is our local __gp value. */
1709 value = _bfd_get_gp_value
1710 (hppa_info->opd_sec->output_section->owner);
1711 bfd_put_64 (hppa_info->opd_sec->owner, value,
1712 (hppa_info->opd_sec->contents
1713 + dyn_h->opd_offset + 24));
1714
1715 /* The DLT value is the address of the .opd entry. */
1716 value = (dyn_h->opd_offset
1717 + hppa_info->opd_sec->output_offset
1718 + hppa_info->opd_sec->output_section->vma);
1719 addend = 0;
1720 }
1721
1722 bfd_put_64 (hppa_info->dlt_sec->owner,
1723 value + addend,
1724 hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
1725 }
1726
1727 /* We want the value of the DLT offset for this symbol, not
1728 the symbol's actual address. Note that __gp may not point
1729 to the start of the DLT, so we have to compute the absolute
1730 address, then subtract out the value of __gp. */
1731 value = (dyn_h->dlt_offset
1732 + hppa_info->dlt_sec->output_offset
1733 + hppa_info->dlt_sec->output_section->vma);
1734 value -= _bfd_get_gp_value (output_bfd);
1735
1736 /* All DLTIND relocations are basically the same at this point,
1737 except that we need different field selectors for the 21bit
1738 version vs the 14bit versions. */
1739 if (r_type == R_PARISC_DLTIND21L
1740 || r_type == R_PARISC_LTOFF_FPTR21L
1741 || r_type == R_PARISC_LTOFF_TP21L)
1742 value = hppa_field_adjust (value, 0, e_lsel);
1743 else if (r_type == R_PARISC_DLTIND14F
1744 || r_type == R_PARISC_LTOFF_FPTR16F
1745 || r_type == R_PARISC_LTOFF_FPTR16WF
1746 || r_type == R_PARISC_LTOFF_FPTR16DF
1747 || r_type == R_PARISC_LTOFF16F
1748 || r_type == R_PARISC_LTOFF16DF
1749 || r_type == R_PARISC_LTOFF16WF
1750 || r_type == R_PARISC_LTOFF_TP16F
1751 || r_type == R_PARISC_LTOFF_TP16WF
1752 || r_type == R_PARISC_LTOFF_TP16DF)
1753 value = hppa_field_adjust (value, 0, e_fsel);
1754 else
1755 value = hppa_field_adjust (value, 0, e_rsel);
1756
1757 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1758 break;
1759 }
1760
1761 case R_PARISC_DLTREL14R:
1762 case R_PARISC_DLTREL14F:
1763 case R_PARISC_DLTREL14DR:
1764 case R_PARISC_DLTREL14WR:
1765 case R_PARISC_DLTREL21L:
1766 case R_PARISC_DPREL21L:
1767 case R_PARISC_DPREL14WR:
1768 case R_PARISC_DPREL14DR:
1769 case R_PARISC_DPREL14R:
1770 case R_PARISC_DPREL14F:
1771 case R_PARISC_GPREL16F:
1772 case R_PARISC_GPREL16WF:
1773 case R_PARISC_GPREL16DF:
1774 {
1775 /* Subtract out the global pointer value to make value a DLT
1776 relative address. */
1777 value -= _bfd_get_gp_value (output_bfd);
1778
1779 /* All DLTREL relocations are basically the same at this point,
1780 except that we need different field selectors for the 21bit
1781 version vs the 14bit versions. */
1782 if (r_type == R_PARISC_DLTREL21L
1783 || r_type == R_PARISC_DPREL21L)
1784 value = hppa_field_adjust (value, addend, e_lrsel);
1785 else if (r_type == R_PARISC_DLTREL14F
1786 || r_type == R_PARISC_DPREL14F
1787 || r_type == R_PARISC_GPREL16F
1788 || r_type == R_PARISC_GPREL16WF
1789 || r_type == R_PARISC_GPREL16DF)
1790 value = hppa_field_adjust (value, addend, e_fsel);
1791 else
1792 value = hppa_field_adjust (value, addend, e_rrsel);
1793
1794 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1795 break;
1796 }
1797
1798 case R_PARISC_DIR21L:
1799 case R_PARISC_DIR17R:
1800 case R_PARISC_DIR17F:
1801 case R_PARISC_DIR14R:
1802 case R_PARISC_DIR14F:
1803 case R_PARISC_DIR14WR:
1804 case R_PARISC_DIR14DR:
1805 case R_PARISC_DIR16F:
1806 case R_PARISC_DIR16WF:
1807 case R_PARISC_DIR16DF:
1808 {
1809 /* All DIR relocations are basically the same at this point,
1810 except that branch offsets need to be divided by four, and
1811 we need different field selectors. Note that we don't
1812 redirect absolute calls to local stubs. */
1813
1814 if (r_type == R_PARISC_DIR21L)
1815 value = hppa_field_adjust (value, addend, e_lrsel);
1816 else if (r_type == R_PARISC_DIR17F
1817 || r_type == R_PARISC_DIR16F
1818 || r_type == R_PARISC_DIR16WF
1819 || r_type == R_PARISC_DIR16DF
1820 || r_type == R_PARISC_DIR14F)
1821 value = hppa_field_adjust (value, addend, e_fsel);
1822 else
1823 value = hppa_field_adjust (value, addend, e_rrsel);
1824
1825 if (r_type == R_PARISC_DIR17R || r_type == R_PARISC_DIR17F)
1826 /* All branches are implicitly shifted by 2 places. */
1827 value >>= 2;
1828
1829 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1830 break;
1831 }
1832
1833 case R_PARISC_PLTOFF21L:
1834 case R_PARISC_PLTOFF14R:
1835 case R_PARISC_PLTOFF14F:
1836 case R_PARISC_PLTOFF14WR:
1837 case R_PARISC_PLTOFF14DR:
1838 case R_PARISC_PLTOFF16F:
1839 case R_PARISC_PLTOFF16WF:
1840 case R_PARISC_PLTOFF16DF:
1841 {
1842 /* We want the value of the PLT offset for this symbol, not
1843 the symbol's actual address. Note that __gp may not point
1844 to the start of the DLT, so we have to compute the absolute
1845 address, then subtract out the value of __gp. */
1846 value = (dyn_h->plt_offset
1847 + hppa_info->plt_sec->output_offset
1848 + hppa_info->plt_sec->output_section->vma);
1849 value -= _bfd_get_gp_value (output_bfd);
1850
1851 /* All PLTOFF relocations are basically the same at this point,
1852 except that we need different field selectors for the 21bit
1853 version vs the 14bit versions. */
1854 if (r_type == R_PARISC_PLTOFF21L)
1855 value = hppa_field_adjust (value, addend, e_lrsel);
1856 else if (r_type == R_PARISC_PLTOFF14F
1857 || r_type == R_PARISC_PLTOFF16F
1858 || r_type == R_PARISC_PLTOFF16WF
1859 || r_type == R_PARISC_PLTOFF16DF)
1860 value = hppa_field_adjust (value, addend, e_fsel);
1861 else
1862 value = hppa_field_adjust (value, addend, e_rrsel);
1863
1864 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1865 break;
1866 }
1867
1868 case R_PARISC_LTOFF_FPTR32:
1869 {
1870 /* We may still need to create the FPTR itself if it was for
1871 a local symbol. */
1872 if (dyn_h->h == NULL)
1873 {
1874 /* The first two words of an .opd entry are zero. */
1875 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
1876
1877 /* The next word is the address of the function. */
1878 bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
1879 (hppa_info->opd_sec->contents
1880 + dyn_h->opd_offset + 16));
1881
1882 /* The last word is our local __gp value. */
1883 value = _bfd_get_gp_value
1884 (hppa_info->opd_sec->output_section->owner);
1885 bfd_put_64 (hppa_info->opd_sec->owner, value,
1886 hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
1887
1888 /* The DLT value is the address of the .opd entry. */
1889 value = (dyn_h->opd_offset
1890 + hppa_info->opd_sec->output_offset
1891 + hppa_info->opd_sec->output_section->vma);
1892
1893 bfd_put_64 (hppa_info->dlt_sec->owner,
1894 value,
1895 hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
1896 }
1897
1898 /* We want the value of the DLT offset for this symbol, not
1899 the symbol's actual address. Note that __gp may not point
1900 to the start of the DLT, so we have to compute the absolute
1901 address, then subtract out the value of __gp. */
1902 value = (dyn_h->dlt_offset
1903 + hppa_info->dlt_sec->output_offset
1904 + hppa_info->dlt_sec->output_section->vma);
1905 value -= _bfd_get_gp_value (output_bfd);
1906 bfd_put_32 (input_bfd, value, hit_data);
1907 return bfd_reloc_ok;
1908 }
1909
1910 case R_PARISC_LTOFF_FPTR64:
1911 case R_PARISC_LTOFF_TP64:
1912 {
1913 /* We may still need to create the FPTR itself if it was for
1914 a local symbol. */
1915 if (dyn_h->h == NULL && r_type == R_PARISC_LTOFF_FPTR64)
1916 {
1917 /* The first two words of an .opd entry are zero. */
1918 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
1919
1920 /* The next word is the address of the function. */
1921 bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
1922 (hppa_info->opd_sec->contents
1923 + dyn_h->opd_offset + 16));
1924
1925 /* The last word is our local __gp value. */
1926 value = _bfd_get_gp_value
1927 (hppa_info->opd_sec->output_section->owner);
1928 bfd_put_64 (hppa_info->opd_sec->owner, value,
1929 hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
1930
1931 /* The DLT value is the address of the .opd entry. */
1932 value = (dyn_h->opd_offset
1933 + hppa_info->opd_sec->output_offset
1934 + hppa_info->opd_sec->output_section->vma);
1935
1936 bfd_put_64 (hppa_info->dlt_sec->owner,
1937 value,
1938 hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
1939 }
1940
1941 /* We want the value of the DLT offset for this symbol, not
1942 the symbol's actual address. Note that __gp may not point
1943 to the start of the DLT, so we have to compute the absolute
1944 address, then subtract out the value of __gp. */
1945 value = (dyn_h->dlt_offset
1946 + hppa_info->dlt_sec->output_offset
1947 + hppa_info->dlt_sec->output_section->vma);
1948 value -= _bfd_get_gp_value (output_bfd);
1949 bfd_put_64 (input_bfd, value, hit_data);
1950 return bfd_reloc_ok;
1951 }
1952
1953 case R_PARISC_DIR32:
1954 bfd_put_32 (input_bfd, value + addend, hit_data);
1955 return bfd_reloc_ok;
1956
1957 case R_PARISC_DIR64:
1958 bfd_put_64 (input_bfd, value + addend, hit_data);
1959 return bfd_reloc_ok;
1960
1961 case R_PARISC_GPREL64:
1962 /* Subtract out the global pointer value to make value a DLT
1963 relative address. */
1964 value -= _bfd_get_gp_value (output_bfd);
1965
1966 bfd_put_64 (input_bfd, value + addend, hit_data);
1967 return bfd_reloc_ok;
1968
1969 case R_PARISC_LTOFF64:
1970 /* We want the value of the DLT offset for this symbol, not
1971 the symbol's actual address. Note that __gp may not point
1972 to the start of the DLT, so we have to compute the absolute
1973 address, then subtract out the value of __gp. */
1974 value = (dyn_h->dlt_offset
1975 + hppa_info->dlt_sec->output_offset
1976 + hppa_info->dlt_sec->output_section->vma);
1977 value -= _bfd_get_gp_value (output_bfd);
1978
1979 bfd_put_64 (input_bfd, value + addend, hit_data);
1980 return bfd_reloc_ok;
1981
1982 case R_PARISC_PCREL32:
1983 {
1984 /* If this is a call to a function defined in another dynamic
1985 library, then redirect the call to the local stub for this
1986 function. */
1987 if (sym_sec == NULL || sym_sec->output_section == NULL)
1988 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1989 + hppa_info->stub_sec->output_section->vma);
1990
1991 /* Turn VALUE into a proper PC relative address. */
1992 value -= (offset + input_section->output_offset
1993 + input_section->output_section->vma);
1994
1995 value += addend;
1996 value -= 8;
1997 bfd_put_32 (input_bfd, value, hit_data);
1998 return bfd_reloc_ok;
1999 }
2000
2001 case R_PARISC_PCREL64:
2002 {
2003 /* If this is a call to a function defined in another dynamic
2004 library, then redirect the call to the local stub for this
2005 function. */
2006 if (sym_sec == NULL || sym_sec->output_section == NULL)
2007 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
2008 + hppa_info->stub_sec->output_section->vma);
2009
2010 /* Turn VALUE into a proper PC relative address. */
2011 value -= (offset + input_section->output_offset
2012 + input_section->output_section->vma);
2013
2014 value += addend;
2015 value -= 8;
2016 bfd_put_64 (input_bfd, value, hit_data);
2017 return bfd_reloc_ok;
2018 }
2019
2020 case R_PARISC_FPTR64:
2021 {
2022 /* We may still need to create the FPTR itself if it was for
2023 a local symbol. */
2024 if (dyn_h->h == NULL)
2025 {
2026 /* The first two words of an .opd entry are zero. */
2027 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
2028
2029 /* The next word is the address of the function. */
2030 bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
2031 (hppa_info->opd_sec->contents
2032 + dyn_h->opd_offset + 16));
2033
2034 /* The last word is our local __gp value. */
2035 value = _bfd_get_gp_value
2036 (hppa_info->opd_sec->output_section->owner);
2037 bfd_put_64 (hppa_info->opd_sec->owner, value,
2038 hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
2039 }
2040
2041 if (dyn_h->want_opd)
2042 /* We want the value of the OPD offset for this symbol. */
2043 value = (dyn_h->opd_offset
2044 + hppa_info->opd_sec->output_offset
2045 + hppa_info->opd_sec->output_section->vma);
2046 else
2047 /* We want the address of the symbol. */
2048 value += addend;
2049
2050 bfd_put_64 (input_bfd, value, hit_data);
2051 return bfd_reloc_ok;
2052 }
2053
2054 case R_PARISC_SECREL32:
2055 bfd_put_32 (input_bfd,
2056 value + addend - sym_sec->output_section->vma,
2057 hit_data);
2058 return bfd_reloc_ok;
2059
2060 case R_PARISC_SEGREL32:
2061 case R_PARISC_SEGREL64:
2062 {
2063 /* If this is the first SEGREL relocation, then initialize
2064 the segment base values. */
2065 if (hppa_info->text_segment_base == (bfd_vma) -1)
2066 bfd_map_over_sections (output_bfd, elf_hppa_record_segment_addrs,
2067 hppa_info);
2068
2069 /* VALUE holds the absolute address. We want to include the
2070 addend, then turn it into a segment relative address.
2071
2072 The segment is derived from SYM_SEC. We assume that there are
2073 only two segments of note in the resulting executable/shlib.
2074 A readonly segment (.text) and a readwrite segment (.data). */
2075 value += addend;
2076
2077 if (sym_sec->flags & SEC_CODE)
2078 value -= hppa_info->text_segment_base;
2079 else
2080 value -= hppa_info->data_segment_base;
2081
2082 if (r_type == R_PARISC_SEGREL32)
2083 bfd_put_32 (input_bfd, value, hit_data);
2084 else
2085 bfd_put_64 (input_bfd, value, hit_data);
2086 return bfd_reloc_ok;
2087 }
2088
2089 /* Something we don't know how to handle. */
2090 default:
2091 return bfd_reloc_notsupported;
2092 }
2093
2094 /* Update the instruction word. */
2095 bfd_put_32 (input_bfd, (bfd_vma) insn, hit_data);
2096 return bfd_reloc_ok;
2097 }
2098
2099 /* Relocate an HPPA ELF section. */
2100
2101 static bfd_boolean
2102 elf_hppa_relocate_section (bfd *output_bfd,
2103 struct bfd_link_info *info,
2104 bfd *input_bfd,
2105 asection *input_section,
2106 bfd_byte *contents,
2107 Elf_Internal_Rela *relocs,
2108 Elf_Internal_Sym *local_syms,
2109 asection **local_sections)
2110 {
2111 Elf_Internal_Shdr *symtab_hdr;
2112 Elf_Internal_Rela *rel;
2113 Elf_Internal_Rela *relend;
2114 struct elf64_hppa_link_hash_table *hppa_info;
2115
2116 hppa_info = elf64_hppa_hash_table (info);
2117 symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
2118
2119 rel = relocs;
2120 relend = relocs + input_section->reloc_count;
2121 for (; rel < relend; rel++)
2122 {
2123 int r_type;
2124 reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
2125 unsigned long r_symndx;
2126 struct elf_link_hash_entry *h;
2127 Elf_Internal_Sym *sym;
2128 asection *sym_sec;
2129 bfd_vma relocation;
2130 bfd_reloc_status_type r;
2131 const char *dyn_name;
2132 char *dynh_buf = NULL;
2133 size_t dynh_buflen = 0;
2134 struct elf64_hppa_dyn_hash_entry *dyn_h = NULL;
2135
2136 r_type = ELF_R_TYPE (rel->r_info);
2137 if (r_type < 0 || r_type >= (int) R_PARISC_UNIMPLEMENTED)
2138 {
2139 bfd_set_error (bfd_error_bad_value);
2140 return FALSE;
2141 }
2142
2143 /* This is a final link. */
2144 r_symndx = ELF_R_SYM (rel->r_info);
2145 h = NULL;
2146 sym = NULL;
2147 sym_sec = NULL;
2148 if (r_symndx < symtab_hdr->sh_info)
2149 {
2150 /* This is a local symbol. */
2151 sym = local_syms + r_symndx;
2152 sym_sec = local_sections[r_symndx];
2153 relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rel);
2154
2155 /* If this symbol has an entry in the PA64 dynamic hash
2156 table, then get it. */
2157 dyn_name = get_dyn_name (input_bfd, h, rel,
2158 &dynh_buf, &dynh_buflen);
2159 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
2160 dyn_name, FALSE, FALSE);
2161
2162 }
2163 else
2164 {
2165 /* This is not a local symbol. */
2166 long indx;
2167
2168 relocation = 0;
2169 indx = r_symndx - symtab_hdr->sh_info;
2170 h = elf_sym_hashes (input_bfd)[indx];
2171 while (h->root.type == bfd_link_hash_indirect
2172 || h->root.type == bfd_link_hash_warning)
2173 h = (struct elf_link_hash_entry *) h->root.u.i.link;
2174 if (h->root.type == bfd_link_hash_defined
2175 || h->root.type == bfd_link_hash_defweak)
2176 {
2177 sym_sec = h->root.u.def.section;
2178
2179 /* If this symbol has an entry in the PA64 dynamic hash
2180 table, then get it. */
2181 dyn_name = get_dyn_name (input_bfd, h, rel,
2182 &dynh_buf, &dynh_buflen);
2183 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
2184 dyn_name, FALSE, FALSE);
2185
2186 /* If we have a relocation against a symbol defined in a
2187 shared library and we have not created an entry in the
2188 PA64 dynamic symbol hash table for it, then we lose. */
2189 if (!info->relocatable
2190 && sym_sec->output_section == NULL && dyn_h == NULL)
2191 {
2192 (*_bfd_error_handler)
2193 (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
2194 input_bfd,
2195 input_section,
2196 (long) rel->r_offset,
2197 howto->name,
2198 h->root.root.string);
2199 }
2200 else if (sym_sec->output_section)
2201 relocation = (h->root.u.def.value
2202 + sym_sec->output_offset
2203 + sym_sec->output_section->vma);
2204 }
2205 else if (info->unresolved_syms_in_objects == RM_IGNORE
2206 && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
2207 {
2208 /* If this symbol has an entry in the PA64 dynamic hash
2209 table, then get it. */
2210 dyn_name = get_dyn_name (input_bfd, h, rel,
2211 &dynh_buf, &dynh_buflen);
2212 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
2213 dyn_name, FALSE, FALSE);
2214
2215 if (!info->relocatable && dyn_h == NULL)
2216 {
2217 (*_bfd_error_handler)
2218 (_("%B(%A): warning: unresolvable relocation against symbol `%s'"),
2219 input_bfd, input_section, h->root.root.string);
2220 }
2221 }
2222 else if (h->root.type == bfd_link_hash_undefweak)
2223 {
2224 dyn_name = get_dyn_name (input_bfd, h, rel,
2225 &dynh_buf, &dynh_buflen);
2226 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
2227 dyn_name, FALSE, FALSE);
2228
2229 if (!info->relocatable && dyn_h == NULL)
2230 {
2231 (*_bfd_error_handler)
2232 (_("%B(%A): warning: unresolvable relocation against symbol `%s'"),
2233 input_bfd, input_section, h->root.root.string);
2234 }
2235 }
2236 else if (!info->relocatable)
2237 {
2238 /* Ignore dynamic loader defined symbols. */
2239 if (!elf_hppa_is_dynamic_loader_symbol (h->root.root.string))
2240 {
2241 if (!((*info->callbacks->undefined_symbol)
2242 (info, h->root.root.string, input_bfd,
2243 input_section, rel->r_offset,
2244 (info->unresolved_syms_in_objects == RM_GENERATE_ERROR
2245 || ELF_ST_VISIBILITY (h->other)))))
2246 return FALSE;
2247 break;
2248 }
2249 }
2250 }
2251
2252 if (sym_sec != NULL && elf_discarded_section (sym_sec))
2253 {
2254 /* For relocs against symbols from removed linkonce sections,
2255 or sections discarded by a linker script, we just want the
2256 section contents zeroed. Avoid any special processing. */
2257 _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
2258 rel->r_info = 0;
2259 rel->r_addend = 0;
2260 continue;
2261 }
2262
2263 if (info->relocatable)
2264 continue;
2265
2266 r = elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
2267 input_section, contents,
2268 relocation, info, sym_sec,
2269 h, dyn_h);
2270
2271 if (r != bfd_reloc_ok)
2272 {
2273 switch (r)
2274 {
2275 default:
2276 abort ();
2277 case bfd_reloc_overflow:
2278 {
2279 const char *sym_name;
2280
2281 if (h != NULL)
2282 sym_name = NULL;
2283 else
2284 {
2285 sym_name = bfd_elf_string_from_elf_section (input_bfd,
2286 symtab_hdr->sh_link,
2287 sym->st_name);
2288 if (sym_name == NULL)
2289 return FALSE;
2290 if (*sym_name == '\0')
2291 sym_name = bfd_section_name (input_bfd, sym_sec);
2292 }
2293
2294 if (!((*info->callbacks->reloc_overflow)
2295 (info, (h ? &h->root : NULL), sym_name,
2296 howto->name, (bfd_vma) 0, input_bfd,
2297 input_section, rel->r_offset)))
2298 return FALSE;
2299 }
2300 break;
2301 }
2302 }
2303 }
2304 return TRUE;
2305 }
2306
2307 #endif /* ARCH_SIZE == 64 */
This page took 0.137107 seconds and 4 git commands to generate.