1 /* Common code for PA ELF implementations.
2 Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
4 This file is part of BFD, the Binary File Descriptor library.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
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.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20 #define ELF_HOWTO_TABLE_SIZE R_PARISC_UNIMPLEMENTED + 1
22 /* This file is included by multiple PA ELF BFD backends with different
25 Most of the routines are written to be size independent, but sometimes
26 external constraints require 32 or 64 bit specific code. We remap
27 the definitions/functions as necessary here. */
29 #define ELF_R_TYPE(X) ELF64_R_TYPE(X)
30 #define ELF_R_SYM(X) ELF64_R_SYM(X)
31 #define elf_hppa_internal_shdr Elf64_Internal_Shdr
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 bfd_elf_bfd_final_link bfd_elf64_bfd_final_link
36 #define elf_hppa_final_link elf64_hppa_final_link
39 #define ELF_R_TYPE(X) ELF32_R_TYPE(X)
40 #define ELF_R_SYM(X) ELF32_R_SYM(X)
41 #define elf_hppa_internal_shdr Elf32_Internal_Shdr
42 #define elf_hppa_reloc_final_type elf32_hppa_reloc_final_type
43 #define _bfd_elf_hppa_gen_reloc_type _bfd_elf32_hppa_gen_reloc_type
44 #define elf_hppa_relocate_section elf32_hppa_relocate_section
45 #define bfd_elf_bfd_final_link bfd_elf32_bfd_final_link
46 #define elf_hppa_final_link elf32_hppa_final_link
49 static void elf_hppa_info_to_howto
50 PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
52 static void elf_hppa_info_to_howto_rel
53 PARAMS ((bfd *, arelent *, Elf_Internal_Rel *));
55 static reloc_howto_type * elf_hppa_reloc_type_lookup
56 PARAMS ((bfd *, bfd_reloc_code_real_type));
58 static boolean elf_hppa_is_local_label_name
59 PARAMS ((bfd *, const char *));
61 static boolean elf_hppa_fake_sections
62 PARAMS ((bfd *abfd, elf_hppa_internal_shdr *, asection *));
64 static void elf_hppa_final_write_processing
65 PARAMS ((bfd *, boolean));
67 static int hppa_unwind_entry_compare
68 PARAMS ((const PTR, const PTR));
70 static boolean elf_hppa_sort_unwind
74 static boolean elf_hppa_add_symbol_hook
75 PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
76 const char **, flagword *, asection **, bfd_vma *));
78 static boolean elf_hppa_unmark_useless_dynamic_symbols
79 PARAMS ((struct elf_link_hash_entry *, PTR));
81 static boolean elf_hppa_remark_useless_dynamic_symbols
82 PARAMS ((struct elf_link_hash_entry *, PTR));
84 static boolean elf_hppa_is_dynamic_loader_symbol
85 PARAMS ((const char *));
87 static void elf_hppa_record_segment_addrs
88 PARAMS ((bfd *, asection *, PTR));
90 static boolean elf_hppa_final_link
91 PARAMS ((bfd *, struct bfd_link_info *));
93 static boolean elf_hppa_relocate_section
94 PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
95 bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
97 static bfd_reloc_status_type elf_hppa_final_link_relocate
98 PARAMS ((Elf_Internal_Rela *, bfd *, bfd *, asection *,
99 bfd_byte *, bfd_vma, struct bfd_link_info *,
100 asection *, struct elf_link_hash_entry *,
101 struct elf64_hppa_dyn_hash_entry *));
103 static int elf_hppa_relocate_insn
104 PARAMS ((int, int, unsigned int));
107 /* ELF/PA relocation howto entries. */
109 static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
111 { R_PARISC_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield,
112 bfd_elf_generic_reloc, "R_PARISC_NONE", false, 0, 0, false },
114 /* The values in DIR32 are to placate the check in
115 _bfd_stab_section_find_nearest_line. */
116 { R_PARISC_DIR32, 0, 2, 32, false, 0, complain_overflow_bitfield,
117 bfd_elf_generic_reloc, "R_PARISC_DIR32", false, 0, 0xffffffff, false },
118 { R_PARISC_DIR21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
119 bfd_elf_generic_reloc, "R_PARISC_DIR21L", false, 0, 0, false },
120 { R_PARISC_DIR17R, 0, 0, 17, false, 0, complain_overflow_bitfield,
121 bfd_elf_generic_reloc, "R_PARISC_DIR17R", false, 0, 0, false },
122 { R_PARISC_DIR17F, 0, 0, 17, false, 0, complain_overflow_bitfield,
123 bfd_elf_generic_reloc, "R_PARISC_DIR17F", false, 0, 0, false },
124 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
125 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
126 { R_PARISC_DIR14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
127 bfd_elf_generic_reloc, "R_PARISC_DIR14R", false, 0, 0, false },
128 { R_PARISC_DIR14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
129 bfd_elf_generic_reloc, "R_PARISC_DIR14F", false, 0, 0, false },
131 { R_PARISC_PCREL12F, 0, 0, 12, true, 0, complain_overflow_bitfield,
132 bfd_elf_generic_reloc, "R_PARISC_PCREL12F", false, 0, 0, false },
133 { R_PARISC_PCREL32, 0, 0, 32, true, 0, complain_overflow_bitfield,
134 bfd_elf_generic_reloc, "R_PARISC_PCREL32", false, 0, 0, false },
135 { R_PARISC_PCREL21L, 0, 0, 21, true, 0, complain_overflow_bitfield,
136 bfd_elf_generic_reloc, "R_PARISC_PCREL21L", false, 0, 0, false },
137 { R_PARISC_PCREL17R, 0, 0, 17, true, 0, complain_overflow_bitfield,
138 bfd_elf_generic_reloc, "R_PARISC_PCREL17R", false, 0, 0, false },
139 { R_PARISC_PCREL17F, 0, 0, 17, true, 0, complain_overflow_bitfield,
140 bfd_elf_generic_reloc, "R_PARISC_PCREL17F", false, 0, 0, false },
141 { R_PARISC_PCREL17C, 0, 0, 17, true, 0, complain_overflow_bitfield,
142 bfd_elf_generic_reloc, "R_PARISC_PCREL17C", false, 0, 0, false },
143 { R_PARISC_PCREL14R, 0, 0, 14, true, 0, complain_overflow_bitfield,
144 bfd_elf_generic_reloc, "R_PARISC_PCREL14R", false, 0, 0, false },
145 { R_PARISC_PCREL14F, 0, 0, 14, true, 0, complain_overflow_bitfield,
146 bfd_elf_generic_reloc, "R_PARISC_PCREL14F", 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_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
151 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
152 { R_PARISC_DPREL21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
153 bfd_elf_generic_reloc, "R_PARISC_DPREL21L", false, 0, 0, false },
154 { R_PARISC_DPREL14WR, 0, 0, 14, false, 0, complain_overflow_bitfield,
155 bfd_elf_generic_reloc, "R_PARISC_DPREL14WR", false, 0, 0, false },
156 { R_PARISC_DPREL14DR, 0, 0, 14, false, 0, complain_overflow_bitfield,
157 bfd_elf_generic_reloc, "R_PARISC_DPREL14DR", false, 0, 0, false },
158 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
159 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
160 { R_PARISC_DPREL14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
161 bfd_elf_generic_reloc, "R_PARISC_DPREL14R", false, 0, 0, false },
162 { R_PARISC_DPREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
163 bfd_elf_generic_reloc, "R_PARISC_DPREL14F", 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_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
168 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
169 { R_PARISC_DLTREL21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
170 bfd_elf_generic_reloc, "R_PARISC_DLTREL21L", false, 0, 0, false },
171 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
172 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
173 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
174 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
175 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
176 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
177 { R_PARISC_DLTREL14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
178 bfd_elf_generic_reloc, "R_PARISC_DLTREL14R", false, 0, 0, false },
179 { R_PARISC_DLTREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
180 bfd_elf_generic_reloc, "R_PARISC_DLTREL14F", 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_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
185 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
186 { R_PARISC_DLTIND21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
187 bfd_elf_generic_reloc, "R_PARISC_DLTIND21L", false, 0, 0, false },
188 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
189 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
190 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
191 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
192 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
193 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
194 { R_PARISC_DLTIND14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
195 bfd_elf_generic_reloc, "R_PARISC_DLTIND14R", false, 0, 0, false },
196 { R_PARISC_DLTIND14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
197 bfd_elf_generic_reloc, "R_PARISC_DLTIND14F", false, 0, 0, false },
199 { R_PARISC_SETBASE, 0, 0, 0, false, 0, complain_overflow_bitfield,
200 bfd_elf_generic_reloc, "R_PARISC_SETBASE", false, 0, 0, false },
201 { R_PARISC_SECREL32, 0, 0, 32, false, 0, complain_overflow_bitfield,
202 bfd_elf_generic_reloc, "R_PARISC_SECREL32", false, 0, 0, false },
203 { R_PARISC_BASEREL21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
204 bfd_elf_generic_reloc, "R_PARISC_BASEREL21L", false, 0, 0, false },
205 { R_PARISC_BASEREL17R, 0, 0, 17, false, 0, complain_overflow_bitfield,
206 bfd_elf_generic_reloc, "R_PARISC_BASEREL17R", false, 0, 0, false },
207 { R_PARISC_BASEREL17F, 0, 0, 17, false, 0, complain_overflow_bitfield,
208 bfd_elf_generic_reloc, "R_PARISC_BASEREL17F", false, 0, 0, false },
209 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
210 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
211 { R_PARISC_BASEREL14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
212 bfd_elf_generic_reloc, "R_PARISC_BASEREL14R", false, 0, 0, false },
213 { R_PARISC_BASEREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
214 bfd_elf_generic_reloc, "R_PARISC_BASEREL14F", false, 0, 0, false },
216 { R_PARISC_SEGBASE, 0, 0, 0, false, 0, complain_overflow_bitfield,
217 bfd_elf_generic_reloc, "R_PARISC_SEGBASE", false, 0, 0, false },
218 { R_PARISC_SEGREL32, 0, 0, 32, false, 0, complain_overflow_bitfield,
219 bfd_elf_generic_reloc, "R_PARISC_SEGREL32", false, 0, 0, false },
220 { R_PARISC_PLTOFF21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
221 bfd_elf_generic_reloc, "R_PARISC_PLTOFF21L", false, 0, 0, false },
222 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
223 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
224 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
225 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
226 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
227 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
228 { R_PARISC_PLTOFF14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
229 bfd_elf_generic_reloc, "R_PARISC_PLTOFF14R", false, 0, 0, false },
230 { R_PARISC_PLTOFF14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
231 bfd_elf_generic_reloc, "R_PARISC_PLTOFF14F", false, 0, 0, false },
233 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
234 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
235 { R_PARISC_LTOFF_FPTR32, 0, 0, 32, false, 0, complain_overflow_bitfield,
236 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR32", false, 0, 0, false },
237 { R_PARISC_LTOFF_FPTR21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
238 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR21L", false, 0, 0, false },
239 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
240 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
241 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
242 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
243 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
244 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
245 { R_PARISC_LTOFF_FPTR14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
246 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14R", false, 0, 0, false },
247 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
248 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
250 { R_PARISC_FPTR64, 0, 0, 64, false, 0, complain_overflow_bitfield,
251 bfd_elf_generic_reloc, "R_PARISC_FPTR64", false, 0, 0, false },
252 { R_PARISC_PLABEL32, 0, 0, 32, false, 0, complain_overflow_bitfield,
253 bfd_elf_generic_reloc, "R_PARISC_PLABEL32", false, 0, 0, false },
254 { R_PARISC_PLABEL21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
255 bfd_elf_generic_reloc, "R_PARISC_PLABEL21L", false, 0, 0, false },
256 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
257 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
258 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
259 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
260 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
261 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
262 { R_PARISC_PLABEL14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
263 bfd_elf_generic_reloc, "R_PARISC_PLABEL14R", false, 0, 0, false },
264 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
265 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
267 { R_PARISC_PCREL64, 0, 0, 64, false, 0, complain_overflow_bitfield,
268 bfd_elf_generic_reloc, "R_PARISC_PCREL64", false, 0, 0, false },
269 { R_PARISC_PCREL22C, 0, 0, 22, false, 0, complain_overflow_bitfield,
270 bfd_elf_generic_reloc, "R_PARISC_PCREL22C", false, 0, 0, false },
271 { R_PARISC_PCREL22F, 0, 0, 22, false, 0, complain_overflow_bitfield,
272 bfd_elf_generic_reloc, "R_PARISC_PCREL22F", false, 0, 0, false },
273 { R_PARISC_PCREL14WR, 0, 0, 14, false, 0, complain_overflow_bitfield,
274 bfd_elf_generic_reloc, "R_PARISC_PCREL14WR", false, 0, 0, false },
275 { R_PARISC_PCREL14DR, 0, 0, 14, false, 0, complain_overflow_bitfield,
276 bfd_elf_generic_reloc, "R_PARISC_PCREL14DR", false, 0, 0, false },
277 { R_PARISC_PCREL16F, 0, 0, 16, false, 0, complain_overflow_bitfield,
278 bfd_elf_generic_reloc, "R_PARISC_PCREL16F", false, 0, 0, false },
279 { R_PARISC_PCREL16WF, 0, 0, 16, false, 0, complain_overflow_bitfield,
280 bfd_elf_generic_reloc, "R_PARISC_PCREL16WF", false, 0, 0, false },
281 { R_PARISC_PCREL16DF, 0, 0, 16, false, 0, complain_overflow_bitfield,
282 bfd_elf_generic_reloc, "R_PARISC_PCREL16DF", false, 0, 0, false },
284 { R_PARISC_DIR64, 0, 0, 64, false, 0, complain_overflow_bitfield,
285 bfd_elf_generic_reloc, "R_PARISC_DIR64", 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 { R_PARISC_DIR14WR, 0, 0, 14, false, 0, complain_overflow_bitfield,
291 bfd_elf_generic_reloc, "R_PARISC_DIR14WR", false, 0, 0, false },
292 { R_PARISC_DIR14DR, 0, 0, 14, false, 0, complain_overflow_bitfield,
293 bfd_elf_generic_reloc, "R_PARISC_DIR14DR", false, 0, 0, false },
294 { R_PARISC_DIR16F, 0, 0, 16, false, 0, complain_overflow_bitfield,
295 bfd_elf_generic_reloc, "R_PARISC_DIR16F", false, 0, 0, false },
296 { R_PARISC_DIR16WF, 0, 0, 16, false, 0, complain_overflow_bitfield,
297 bfd_elf_generic_reloc, "R_PARISC_DIR16WF", false, 0, 0, false },
298 { R_PARISC_DIR16DF, 0, 0, 16, false, 0, complain_overflow_bitfield,
299 bfd_elf_generic_reloc, "R_PARISC_DIR16DF", false, 0, 0, false },
301 { R_PARISC_GPREL64, 0, 0, 64, false, 0, complain_overflow_bitfield,
302 bfd_elf_generic_reloc, "R_PARISC_GPREL64", false, 0, 0, false },
303 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
304 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
305 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
306 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
307 { R_PARISC_DLTREL14WR, 0, 0, 14, false, 0, complain_overflow_bitfield,
308 bfd_elf_generic_reloc, "R_PARISC_DLTREL14WR", false, 0, 0, false },
309 { R_PARISC_DLTREL14DR, 0, 0, 14, false, 0, complain_overflow_bitfield,
310 bfd_elf_generic_reloc, "R_PARISC_DLTREL14DR", false, 0, 0, false },
311 { R_PARISC_GPREL16F, 0, 0, 16, false, 0, complain_overflow_bitfield,
312 bfd_elf_generic_reloc, "R_PARISC_GPREL16F", false, 0, 0, false },
313 { R_PARISC_GPREL16WF, 0, 0, 16, false, 0, complain_overflow_bitfield,
314 bfd_elf_generic_reloc, "R_PARISC_GPREL16WF", false, 0, 0, false },
315 { R_PARISC_GPREL16DF, 0, 0, 16, false, 0, complain_overflow_bitfield,
316 bfd_elf_generic_reloc, "R_PARISC_GPREL16DF", false, 0, 0, false },
318 { R_PARISC_LTOFF64, 0, 0, 64, false, 0, complain_overflow_bitfield,
319 bfd_elf_generic_reloc, "R_PARISC_LTOFF64", false, 0, 0, false },
320 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
321 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
322 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
323 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
324 { R_PARISC_DLTIND14WR, 0, 0, 14, false, 0, complain_overflow_bitfield,
325 bfd_elf_generic_reloc, "R_PARISC_DLTIND14WR", false, 0, 0, false },
326 { R_PARISC_DLTIND14DR, 0, 0, 14, false, 0, complain_overflow_bitfield,
327 bfd_elf_generic_reloc, "R_PARISC_DLTIND14DR", false, 0, 0, false },
328 { R_PARISC_LTOFF16F, 0, 0, 16, false, 0, complain_overflow_bitfield,
329 bfd_elf_generic_reloc, "R_PARISC_LTOFF16F", false, 0, 0, false },
330 { R_PARISC_LTOFF16WF, 0, 0, 16, false, 0, complain_overflow_bitfield,
331 bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", false, 0, 0, false },
332 { R_PARISC_LTOFF16DF, 0, 0, 16, false, 0, complain_overflow_bitfield,
333 bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", 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_BASEREL14WR, 0, 0, 14, false, 0, complain_overflow_bitfield,
340 bfd_elf_generic_reloc, "R_PARISC_BASEREL14WR", false, 0, 0, false },
341 { R_PARISC_BASEREL14DR, 0, 0, 14, false, 0, complain_overflow_bitfield,
342 bfd_elf_generic_reloc, "R_PARISC_BASEREL14DR", false, 0, 0, false },
343 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
344 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
345 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
346 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
347 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
348 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
349 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
350 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
352 { R_PARISC_SEGREL64, 0, 0, 64, false, 0, complain_overflow_bitfield,
353 bfd_elf_generic_reloc, "R_PARISC_SEGREL64", 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 { R_PARISC_PLTOFF14WR, 0, 0, 14, false, 0, complain_overflow_bitfield,
359 bfd_elf_generic_reloc, "R_PARISC_PLTOFF14WR", false, 0, 0, false },
360 { R_PARISC_PLTOFF14DR, 0, 0, 14, false, 0, complain_overflow_bitfield,
361 bfd_elf_generic_reloc, "R_PARISC_PLTOFF14DR", false, 0, 0, false },
362 { R_PARISC_PLTOFF16F, 0, 0, 16, false, 0, complain_overflow_bitfield,
363 bfd_elf_generic_reloc, "R_PARISC_PLTOFF16F", false, 0, 0, false },
364 { R_PARISC_PLTOFF16WF, 0, 0, 16, false, 0, complain_overflow_bitfield,
365 bfd_elf_generic_reloc, "R_PARISC_PLTOFF16WF", false, 0, 0, false },
366 { R_PARISC_PLTOFF16DF, 0, 0, 16, false, 0, complain_overflow_bitfield,
367 bfd_elf_generic_reloc, "R_PARISC_PLTOFF16DF", false, 0, 0, false },
369 { R_PARISC_LTOFF_FPTR64, 0, 0, 64, 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_bitfield,
372 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
373 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
374 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
375 { R_PARISC_LTOFF_FPTR14WR, 0, 0, 14, false, 0, complain_overflow_bitfield,
376 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14WR", false, 0, 0, false },
377 { R_PARISC_LTOFF_FPTR14DR, 0, 0, 14, false, 0, complain_overflow_bitfield,
378 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14DR", false, 0, 0, false },
379 { R_PARISC_LTOFF_FPTR16F, 0, 0, 16, false, 0, complain_overflow_bitfield,
380 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16F", false, 0, 0, false },
381 { R_PARISC_LTOFF_FPTR16WF, 0, 0, 16, false, 0, complain_overflow_bitfield,
382 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16WF", false, 0, 0, false },
383 { R_PARISC_LTOFF_FPTR16DF, 0, 0, 16, false, 0, complain_overflow_bitfield,
384 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
386 { R_PARISC_COPY, 0, 0, 0, false, 0, complain_overflow_bitfield,
387 bfd_elf_generic_reloc, "R_PARISC_COPY", false, 0, 0, false },
388 { R_PARISC_IPLT, 0, 0, 0, false, 0, complain_overflow_bitfield,
389 bfd_elf_generic_reloc, "R_PARISC_IPLT", false, 0, 0, false },
390 { R_PARISC_EPLT, 0, 0, 0, false, 0, complain_overflow_bitfield,
391 bfd_elf_generic_reloc, "R_PARISC_EPLT", false, 0, 0, false },
392 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
393 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
394 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
395 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
396 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
397 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
398 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
399 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
400 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
401 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_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
406 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
407 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
408 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
409 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
410 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
411 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
412 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
413 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
414 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
415 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
416 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
417 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
418 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 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
427 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
428 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
429 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
430 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
431 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
432 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
433 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
434 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
435 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_TPREL32, 0, 0, 32, false, 0, complain_overflow_dont,
440 bfd_elf_generic_reloc, "R_PARISC_TPREL32", false, 0, 0, false },
441 { R_PARISC_TPREL21L, 0, 0, 21, false, 0, complain_overflow_dont,
442 bfd_elf_generic_reloc, "R_PARISC_TPREL21L", false, 0, 0, false },
443 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
444 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
445 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
446 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
447 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
448 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
449 { R_PARISC_TPREL14R, 0, 0, 14, false, 0, complain_overflow_dont,
450 bfd_elf_generic_reloc, "R_PARISC_TPREL14R", false, 0, 0, false },
451 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
452 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
454 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
455 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
456 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
457 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
458 { R_PARISC_LTOFF_TP21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
459 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP21L", false, 0, 0, false },
460 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
461 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
462 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
463 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
464 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
465 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
466 { R_PARISC_LTOFF_TP14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
467 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
468 { R_PARISC_LTOFF_TP14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
469 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14F", 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_bitfield,
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 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
478 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
479 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
480 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
481 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
482 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
483 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
484 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
485 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
486 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_dont,
493 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
494 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
495 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
496 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
497 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
498 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
499 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
500 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
501 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
502 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
503 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 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
512 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
513 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
514 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
515 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
516 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
517 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
518 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
519 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
520 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
522 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
523 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
524 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
525 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
526 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
527 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
528 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
529 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
530 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
531 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
532 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
533 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
534 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
535 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
536 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
537 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
539 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
540 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
541 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
542 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
543 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
544 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
545 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
546 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
547 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
548 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
549 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
550 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
551 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
552 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
553 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
554 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
556 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
557 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
558 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
559 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
560 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
561 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
562 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
563 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
564 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
565 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
566 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
567 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
568 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
569 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
570 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
571 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
573 { R_PARISC_TPREL64, 0, 0, 64, false, 0, complain_overflow_bitfield,
574 bfd_elf_generic_reloc, "R_PARISC_TPREL64", false, 0, 0, false },
575 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
576 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
577 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
578 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
579 { R_PARISC_TPREL14WR, 0, 0, 14, false, 0, complain_overflow_dont,
580 bfd_elf_generic_reloc, "R_PARISC_TPREL14WR", false, 0, 0, false },
581 { R_PARISC_TPREL14DR, 0, 0, 14, false, 0, complain_overflow_bitfield,
582 bfd_elf_generic_reloc, "R_PARISC_TPREL14DR", false, 0, 0, false },
583 { R_PARISC_TPREL16F, 0, 0, 16, false, 0, complain_overflow_bitfield,
584 bfd_elf_generic_reloc, "R_PARISC_TPREL16F", false, 0, 0, false },
585 { R_PARISC_TPREL16WF, 0, 0, 16, false, 0, complain_overflow_dont,
586 bfd_elf_generic_reloc, "R_PARISC_TPREL16WF", false, 0, 0, false },
587 { R_PARISC_TPREL16DF, 0, 0, 16, false, 0, complain_overflow_bitfield,
588 bfd_elf_generic_reloc, "R_PARISC_TPREL16DF", false, 0, 0, false },
590 { R_PARISC_LTOFF_TP64, 0, 0, 64, false, 0, complain_overflow_bitfield,
591 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP64", false, 0, 0, false },
592 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
593 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
594 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
595 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
596 { R_PARISC_LTOFF_TP14WR, 0, 0, 14, false, 0, complain_overflow_bitfield,
597 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14WR", false, 0, 0, false },
598 { R_PARISC_LTOFF_TP14DR, 0, 0, 14, false, 0, complain_overflow_bitfield,
599 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14DR", false, 0, 0, false },
600 { R_PARISC_LTOFF_TP16F, 0, 0, 16, false, 0, complain_overflow_dont,
601 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16F", false, 0, 0, false },
602 { R_PARISC_LTOFF_TP16WF, 0, 0, 16, false, 0, complain_overflow_bitfield,
603 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16WF", false, 0, 0, false },
604 { R_PARISC_LTOFF_TP16DF, 0, 0, 16, false, 0, complain_overflow_bitfield,
605 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16DF", false, 0, 0, false },
607 { R_PARISC_GNU_VTENTRY, 0, 0, 0, false, 0, complain_overflow_dont,
608 bfd_elf_generic_reloc, "R_PARISC_GNU_VTENTRY", false, 0, 0, false },
609 { R_PARISC_GNU_VTINHERIT, 0, 0, 0, false, 0, complain_overflow_dont,
610 bfd_elf_generic_reloc, "R_PARISC_GNU_VTINHERIT", false, 0, 0, false },
613 #define OFFSET_14R_FROM_21L 4
614 #define OFFSET_14F_FROM_21L 5
616 /* Return the final relocation type for the given base type, instruction
617 format, and field selector. */
620 elf_hppa_reloc_final_type (abfd, base_type, format, field)
622 elf_hppa_reloc_type base_type;
626 elf_hppa_reloc_type final_type = base_type;
628 /* Just a tangle of nested switch statements to deal with the braindamage
629 that a different field selector means a completely different relocation
633 /* We have been using generic relocation types. However, that may not
634 really make sense. Anyway, we need to support both R_PARISC_DIR64
635 and R_PARISC_DIR32 here. */
638 case R_HPPA_ABS_CALL:
645 final_type = R_PARISC_DIR14F;
650 final_type = R_PARISC_DIR14R;
653 final_type = R_PARISC_DLTIND14R;
656 final_type = R_PARISC_LTOFF_FPTR14DR;
659 final_type = R_PARISC_DLTIND14F;
662 final_type = R_PARISC_PLABEL14R;
665 return R_PARISC_NONE;
673 final_type = R_PARISC_DIR17F;
678 final_type = R_PARISC_DIR17R;
681 return R_PARISC_NONE;
693 final_type = R_PARISC_DIR21L;
696 final_type = R_PARISC_DLTIND21L;
699 final_type = R_PARISC_LTOFF_FPTR21L;
702 final_type = R_PARISC_PLABEL21L;
705 return R_PARISC_NONE;
713 final_type = R_PARISC_DIR32;
714 /* When in 64bit mode, a 32bit relocation is supposed to
715 be a section relative relocation. Dwarf2 (for example)
716 uses 32bit section relative relocations. */
717 if (bfd_get_arch_info (abfd)->bits_per_address != 32)
718 final_type = R_PARISC_SECREL32;
721 final_type = R_PARISC_PLABEL32;
724 return R_PARISC_NONE;
732 final_type = R_PARISC_DIR64;
735 final_type = R_PARISC_FPTR64;
738 return R_PARISC_NONE;
743 return R_PARISC_NONE;
756 /* R_PARISC_DLTREL14R for elf64, R_PARISC_DPREL14R for elf32 */
757 final_type = base_type + OFFSET_14R_FROM_21L;
760 /* R_PARISC_DLTREL14F for elf64, R_PARISC_DPREL14F for elf32 */
761 final_type = base_type + OFFSET_14F_FROM_21L;
764 return R_PARISC_NONE;
776 /* R_PARISC_DLTREL21L for elf64, R_PARISC_DPREL21L for elf32 */
777 final_type = base_type;
780 return R_PARISC_NONE;
785 return R_PARISC_NONE;
789 case R_HPPA_PCREL_CALL:
796 final_type = R_PARISC_PCREL12F;
799 return R_PARISC_NONE;
804 /* Contrary to appearances, these are not calls of any sort.
805 Rather, they are loads/stores with a pcrel reloc. */
811 final_type = R_PARISC_PCREL14R;
814 final_type = R_PARISC_PCREL14F;
817 return R_PARISC_NONE;
827 final_type = R_PARISC_PCREL17R;
830 final_type = R_PARISC_PCREL17F;
833 return R_PARISC_NONE;
845 final_type = R_PARISC_PCREL21L;
848 return R_PARISC_NONE;
856 final_type = R_PARISC_PCREL22F;
859 return R_PARISC_NONE;
864 return R_PARISC_NONE;
868 case R_PARISC_GNU_VTENTRY:
869 case R_PARISC_GNU_VTINHERIT:
870 case R_PARISC_SEGREL32:
871 case R_PARISC_SEGBASE:
872 /* The defaults are fine for these cases. */
876 return R_PARISC_NONE;
882 /* Return one (or more) BFD relocations which implement the base
883 relocation with modifications based on format and field. */
885 elf_hppa_reloc_type **
886 _bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
888 elf_hppa_reloc_type base_type;
891 int ignore ATTRIBUTE_UNUSED;
892 asymbol *sym ATTRIBUTE_UNUSED;
894 elf_hppa_reloc_type *finaltype;
895 elf_hppa_reloc_type **final_types;
896 bfd_size_type amt = sizeof (elf_hppa_reloc_type *) * 2;
898 /* Allocate slots for the BFD relocation. */
899 final_types = (elf_hppa_reloc_type **) bfd_alloc (abfd, amt);
900 if (final_types == NULL)
903 /* Allocate space for the relocation itself. */
904 amt = sizeof (elf_hppa_reloc_type);
905 finaltype = (elf_hppa_reloc_type *) bfd_alloc (abfd, amt);
906 if (finaltype == NULL)
909 /* Some reasonable defaults. */
910 final_types[0] = finaltype;
911 final_types[1] = NULL;
913 *finaltype = elf_hppa_reloc_final_type (abfd, base_type, format, field);
918 /* Translate from an elf into field into a howto relocation pointer. */
921 elf_hppa_info_to_howto (abfd, bfd_reloc, elf_reloc)
922 bfd *abfd ATTRIBUTE_UNUSED;
924 Elf_Internal_Rela *elf_reloc;
926 BFD_ASSERT (ELF_R_TYPE(elf_reloc->r_info)
927 < (unsigned int) R_PARISC_UNIMPLEMENTED);
928 bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
931 /* Translate from an elf into field into a howto relocation pointer. */
934 elf_hppa_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
935 bfd *abfd ATTRIBUTE_UNUSED;
937 Elf_Internal_Rel *elf_reloc;
939 BFD_ASSERT (ELF_R_TYPE(elf_reloc->r_info)
940 < (unsigned int) R_PARISC_UNIMPLEMENTED);
941 bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
944 /* Return the address of the howto table entry to perform the CODE
945 relocation for an ARCH machine. */
947 static reloc_howto_type *
948 elf_hppa_reloc_type_lookup (abfd, code)
949 bfd *abfd ATTRIBUTE_UNUSED;
950 bfd_reloc_code_real_type code;
952 if ((int) code < (int) R_PARISC_UNIMPLEMENTED)
954 BFD_ASSERT ((int) elf_hppa_howto_table[(int) code].type == (int) code);
955 return &elf_hppa_howto_table[(int) code];
960 /* Return true if SYM represents a local label symbol. */
963 elf_hppa_is_local_label_name (abfd, name)
964 bfd *abfd ATTRIBUTE_UNUSED;
967 if (name[0] == 'L' && name[1] == '$')
969 return _bfd_elf_is_local_label_name (abfd, name);
972 /* Set the correct type for an ELF section. We do this by the
973 section name, which is a hack, but ought to work. */
976 elf_hppa_fake_sections (abfd, hdr, sec)
978 elf_hppa_internal_shdr *hdr;
981 register const char *name;
983 name = bfd_get_section_name (abfd, sec);
985 if (strcmp (name, ".PARISC.unwind") == 0)
990 hdr->sh_type = SHT_LOPROC + 1;
994 /* ?!? How are unwinds supposed to work for symbols in arbitrary
995 sections? Or what if we have multiple .text sections in a single
996 .o file? HP really messed up on this one.
998 Ugh. We can not use elf_section_data (sec)->this_idx at this
999 point because it is not initialized yet.
1001 So we (gasp) recompute it here. Hopefully nobody ever changes the
1002 way sections are numbered in elf.c! */
1003 for (asec = abfd->sections, indx = 1; asec; asec = asec->next, indx++)
1005 if (asec->name && strcmp (asec->name, ".text") == 0)
1007 hdr->sh_info = indx;
1012 /* I have no idea if this is really necessary or what it means. */
1013 hdr->sh_entsize = 4;
1019 elf_hppa_final_write_processing (abfd, linker)
1021 boolean linker ATTRIBUTE_UNUSED;
1023 int mach = bfd_get_mach (abfd);
1025 elf_elfheader (abfd)->e_flags &= ~(EF_PARISC_ARCH | EF_PARISC_TRAPNIL
1026 | EF_PARISC_EXT | EF_PARISC_LSB
1027 | EF_PARISC_WIDE | EF_PARISC_NO_KABP
1028 | EF_PARISC_LAZYSWAP);
1031 elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_0;
1032 else if (mach == 11)
1033 elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_1;
1034 else if (mach == 20)
1035 elf_elfheader (abfd)->e_flags |= EFA_PARISC_2_0;
1036 else if (mach == 25)
1037 elf_elfheader (abfd)->e_flags |= (EF_PARISC_WIDE
1039 /* The GNU tools have trapped without
1040 option since 1993, so need to take
1041 a step backwards with the ELF
1042 based toolchains. */
1043 | EF_PARISC_TRAPNIL);
1046 /* Comparison function for qsort to sort unwind section during a
1050 hppa_unwind_entry_compare (a, b)
1054 const bfd_byte *ap, *bp;
1055 unsigned long av, bv;
1057 ap = (const bfd_byte *) a;
1058 av = (unsigned long) ap[0] << 24;
1059 av |= (unsigned long) ap[1] << 16;
1060 av |= (unsigned long) ap[2] << 8;
1061 av |= (unsigned long) ap[3];
1063 bp = (const bfd_byte *) b;
1064 bv = (unsigned long) bp[0] << 24;
1065 bv |= (unsigned long) bp[1] << 16;
1066 bv |= (unsigned long) bp[2] << 8;
1067 bv |= (unsigned long) bp[3];
1069 return av < bv ? -1 : av > bv ? 1 : 0;
1072 static boolean elf_hppa_sort_unwind (abfd)
1077 /* Magic section names, but this is much safer than having
1078 relocate_section remember where SEGREL32 relocs occurred.
1079 Consider what happens if someone inept creates a linker script
1080 that puts unwind information in .text. */
1081 s = bfd_get_section_by_name (abfd, ".PARISC.unwind");
1087 size = s->_raw_size;
1088 contents = bfd_malloc (size);
1089 if (contents == NULL)
1092 if (! bfd_get_section_contents (abfd, s, contents, (file_ptr) 0, size))
1095 qsort (contents, (size_t) (size / 16), 16, hppa_unwind_entry_compare);
1097 if (! bfd_set_section_contents (abfd, s, contents, (file_ptr) 0, size))
1105 /* Hook called by the linker routine which adds symbols from an object
1106 file. HP's libraries define symbols with HP specific section
1107 indices, which we have to handle. */
1110 elf_hppa_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
1112 struct bfd_link_info *info ATTRIBUTE_UNUSED;
1113 const Elf_Internal_Sym *sym;
1114 const char **namep ATTRIBUTE_UNUSED;
1115 flagword *flagsp ATTRIBUTE_UNUSED;
1119 int index = sym->st_shndx;
1123 case SHN_PARISC_ANSI_COMMON:
1124 *secp = bfd_make_section_old_way (abfd, ".PARISC.ansi.common");
1125 (*secp)->flags |= SEC_IS_COMMON;
1126 *valp = sym->st_size;
1129 case SHN_PARISC_HUGE_COMMON:
1130 *secp = bfd_make_section_old_way (abfd, ".PARISC.huge.common");
1131 (*secp)->flags |= SEC_IS_COMMON;
1132 *valp = sym->st_size;
1140 elf_hppa_unmark_useless_dynamic_symbols (h, data)
1141 struct elf_link_hash_entry *h;
1144 struct bfd_link_info *info = (struct bfd_link_info *)data;
1146 if (h->root.type == bfd_link_hash_warning)
1147 h = (struct elf_link_hash_entry *) h->root.u.i.link;
1149 /* If we are not creating a shared library, and this symbol is
1150 referenced by a shared library but is not defined anywhere, then
1151 the generic code will warn that it is undefined.
1153 This behavior is undesirable on HPs since the standard shared
1154 libraries contain references to undefined symbols.
1156 So we twiddle the flags associated with such symbols so that they
1157 will not trigger the warning. ?!? FIXME. This is horribly fragile.
1159 Ultimately we should have better controls over the generic ELF BFD
1161 if (! info->relocateable
1163 && !info->no_undefined)
1164 && h->root.type == bfd_link_hash_undefined
1165 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0
1166 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
1168 h->elf_link_hash_flags &= ~ELF_LINK_HASH_REF_DYNAMIC;
1169 h->elf_link_hash_flags |= 0x8000;
1176 elf_hppa_remark_useless_dynamic_symbols (h, data)
1177 struct elf_link_hash_entry *h;
1180 struct bfd_link_info *info = (struct bfd_link_info *)data;
1182 if (h->root.type == bfd_link_hash_warning)
1183 h = (struct elf_link_hash_entry *) h->root.u.i.link;
1185 /* If we are not creating a shared library, and this symbol is
1186 referenced by a shared library but is not defined anywhere, then
1187 the generic code will warn that it is undefined.
1189 This behavior is undesirable on HPs since the standard shared
1190 libraries contain reerences to undefined symbols.
1192 So we twiddle the flags associated with such symbols so that they
1193 will not trigger the warning. ?!? FIXME. This is horribly fragile.
1195 Ultimately we should have better controls over the generic ELF BFD
1197 if (! info->relocateable
1199 && !info->no_undefined)
1200 && h->root.type == bfd_link_hash_undefined
1201 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
1202 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0
1203 && (h->elf_link_hash_flags & 0x8000) != 0)
1205 h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
1206 h->elf_link_hash_flags &= ~0x8000;
1213 elf_hppa_is_dynamic_loader_symbol (name)
1216 return (! strcmp (name, "__CPU_REVISION")
1217 || ! strcmp (name, "__CPU_KEYBITS_1")
1218 || ! strcmp (name, "__SYSTEM_ID_D")
1219 || ! strcmp (name, "__FPU_MODEL")
1220 || ! strcmp (name, "__FPU_REVISION")
1221 || ! strcmp (name, "__ARGC")
1222 || ! strcmp (name, "__ARGV")
1223 || ! strcmp (name, "__ENVP")
1224 || ! strcmp (name, "__TLS_SIZE_D")
1225 || ! strcmp (name, "__LOAD_INFO")
1226 || ! strcmp (name, "__systab"));
1229 /* Record the lowest address for the data and text segments. */
1231 elf_hppa_record_segment_addrs (abfd, section, data)
1232 bfd *abfd ATTRIBUTE_UNUSED;
1236 struct elf64_hppa_link_hash_table *hppa_info;
1239 hppa_info = (struct elf64_hppa_link_hash_table *)data;
1241 value = section->vma - section->filepos;
1243 if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
1244 == (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
1245 && value < hppa_info->text_segment_base)
1246 hppa_info->text_segment_base = value;
1247 else if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
1248 == (SEC_ALLOC | SEC_LOAD))
1249 && value < hppa_info->data_segment_base)
1250 hppa_info->data_segment_base = value;
1253 /* Called after we have seen all the input files/sections, but before
1254 final symbol resolution and section placement has been determined.
1256 We use this hook to (possibly) provide a value for __gp, then we
1257 fall back to the generic ELF final link routine. */
1260 elf_hppa_final_link (abfd, info)
1262 struct bfd_link_info *info;
1265 struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
1267 if (! info->relocateable)
1269 struct elf_link_hash_entry *gp;
1272 /* The linker script defines a value for __gp iff it was referenced
1273 by one of the objects being linked. First try to find the symbol
1274 in the hash table. If that fails, just compute the value __gp
1276 gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", false,
1282 /* Adjust the value of __gp as we may want to slide it into the
1283 .plt section so that the stubs can access PLT entries without
1284 using an addil sequence. */
1285 gp->root.u.def.value += hppa_info->gp_offset;
1287 gp_val = (gp->root.u.def.section->output_section->vma
1288 + gp->root.u.def.section->output_offset
1289 + gp->root.u.def.value);
1295 /* First look for a .plt section. If found, then __gp is the
1296 address of the .plt + gp_offset.
1298 If no .plt is found, then look for .dlt, .opd and .data (in
1299 that order) and set __gp to the base address of whichever
1300 section is found first. */
1302 sec = hppa_info->plt_sec;
1303 if (sec && ! (sec->flags & SEC_EXCLUDE))
1304 gp_val = (sec->output_offset
1305 + sec->output_section->vma
1306 + hppa_info->gp_offset);
1309 sec = hppa_info->dlt_sec;
1310 if (!sec || (sec->flags & SEC_EXCLUDE))
1311 sec = hppa_info->opd_sec;
1312 if (!sec || (sec->flags & SEC_EXCLUDE))
1313 sec = bfd_get_section_by_name (abfd, ".data");
1314 if (!sec || (sec->flags & SEC_EXCLUDE))
1317 gp_val = sec->output_offset + sec->output_section->vma;
1321 /* Install whatever value we found/computed for __gp. */
1322 _bfd_set_gp_value (abfd, gp_val);
1325 /* We need to know the base of the text and data segments so that we
1326 can perform SEGREL relocations. We will record the base addresses
1327 when we encounter the first SEGREL relocation. */
1328 hppa_info->text_segment_base = (bfd_vma)-1;
1329 hppa_info->data_segment_base = (bfd_vma)-1;
1331 /* HP's shared libraries have references to symbols that are not
1332 defined anywhere. The generic ELF BFD linker code will complaim
1335 So we detect the losing case and arrange for the flags on the symbol
1336 to indicate that it was never referenced. This keeps the generic
1337 ELF BFD link code happy and appears to not create any secondary
1338 problems. Ultimately we need a way to control the behavior of the
1339 generic ELF BFD link code better. */
1340 elf_link_hash_traverse (elf_hash_table (info),
1341 elf_hppa_unmark_useless_dynamic_symbols,
1344 /* Invoke the regular ELF backend linker to do all the work. */
1345 retval = bfd_elf_bfd_final_link (abfd, info);
1347 elf_link_hash_traverse (elf_hash_table (info),
1348 elf_hppa_remark_useless_dynamic_symbols,
1351 /* If we're producing a final executable, sort the contents of the
1354 retval = elf_hppa_sort_unwind (abfd);
1359 /* Relocate an HPPA ELF section. */
1362 elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
1363 contents, relocs, local_syms, local_sections)
1365 struct bfd_link_info *info;
1367 asection *input_section;
1369 Elf_Internal_Rela *relocs;
1370 Elf_Internal_Sym *local_syms;
1371 asection **local_sections;
1373 Elf_Internal_Shdr *symtab_hdr;
1374 Elf_Internal_Rela *rel;
1375 Elf_Internal_Rela *relend;
1376 struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
1378 symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
1381 relend = relocs + input_section->reloc_count;
1382 for (; rel < relend; rel++)
1385 reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
1386 unsigned long r_symndx;
1387 struct elf_link_hash_entry *h;
1388 Elf_Internal_Sym *sym;
1391 bfd_reloc_status_type r;
1392 const char *sym_name;
1393 const char *dyn_name;
1394 char *dynh_buf = NULL;
1395 size_t dynh_buflen = 0;
1396 struct elf64_hppa_dyn_hash_entry *dyn_h = NULL;
1398 r_type = ELF_R_TYPE (rel->r_info);
1399 if (r_type < 0 || r_type >= (int) R_PARISC_UNIMPLEMENTED)
1401 bfd_set_error (bfd_error_bad_value);
1405 r_symndx = ELF_R_SYM (rel->r_info);
1407 if (info->relocateable)
1409 /* This is a relocateable link. We don't have to change
1410 anything, unless the reloc is against a section symbol,
1411 in which case we have to adjust according to where the
1412 section symbol winds up in the output section. */
1413 if (r_symndx < symtab_hdr->sh_info)
1415 sym = local_syms + r_symndx;
1416 if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
1418 sym_sec = local_sections[r_symndx];
1419 rel->r_addend += sym_sec->output_offset;
1426 /* This is a final link. */
1430 if (r_symndx < symtab_hdr->sh_info)
1432 /* This is a local symbol. */
1433 sym = local_syms + r_symndx;
1434 sym_sec = local_sections[r_symndx];
1435 relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel);
1437 /* If this symbol has an entry in the PA64 dynamic hash
1438 table, then get it. */
1439 dyn_name = get_dyn_name (input_section, h, rel,
1440 &dynh_buf, &dynh_buflen);
1441 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1442 dyn_name, false, false);
1447 /* This is not a local symbol. */
1450 indx = r_symndx - symtab_hdr->sh_info;
1451 h = elf_sym_hashes (input_bfd)[indx];
1452 while (h->root.type == bfd_link_hash_indirect
1453 || h->root.type == bfd_link_hash_warning)
1454 h = (struct elf_link_hash_entry *) h->root.u.i.link;
1455 if (h->root.type == bfd_link_hash_defined
1456 || h->root.type == bfd_link_hash_defweak)
1458 sym_sec = h->root.u.def.section;
1460 /* If this symbol has an entry in the PA64 dynamic hash
1461 table, then get it. */
1462 dyn_name = get_dyn_name (input_section, h, rel,
1463 &dynh_buf, &dynh_buflen);
1464 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1465 dyn_name, false, false);
1467 /* If we have a relocation against a symbol defined in a
1468 shared library and we have not created an entry in the
1469 PA64 dynamic symbol hash table for it, then we lose. */
1470 if (sym_sec->output_section == NULL && dyn_h == NULL)
1472 (*_bfd_error_handler)
1473 (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
1474 bfd_archive_filename (input_bfd), h->root.root.string,
1475 bfd_get_section_name (input_bfd, input_section));
1478 else if (sym_sec->output_section)
1479 relocation = (h->root.u.def.value
1480 + sym_sec->output_offset
1481 + sym_sec->output_section->vma);
1482 /* Value will be provided via one of the offsets in the
1483 dyn_h hash table entry. */
1487 /* Allow undefined symbols in shared libraries. */
1488 else if (info->shared && !info->no_undefined
1489 && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
1492 (*info->callbacks->undefined_symbol)
1493 (info, h->root.root.string, input_bfd,
1494 input_section, rel->r_offset, false);
1496 /* If this symbol has an entry in the PA64 dynamic hash
1497 table, then get it. */
1498 dyn_name = get_dyn_name (input_section, h, rel,
1499 &dynh_buf, &dynh_buflen);
1500 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1501 dyn_name, false, false);
1505 (*_bfd_error_handler)
1506 (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
1507 bfd_archive_filename (input_bfd), h->root.root.string,
1508 bfd_get_section_name (input_bfd, input_section));
1513 else if (h->root.type == bfd_link_hash_undefweak)
1517 /* Ignore dynamic loader defined symbols. */
1518 if (elf_hppa_is_dynamic_loader_symbol (h->root.root.string))
1522 if (!((*info->callbacks->undefined_symbol)
1523 (info, h->root.root.string, input_bfd,
1524 input_section, rel->r_offset, true)))
1532 sym_name = h->root.root.string;
1535 sym_name = bfd_elf_string_from_elf_section (input_bfd,
1536 symtab_hdr->sh_link,
1538 if (sym_name == NULL)
1540 if (*sym_name == '\0')
1541 sym_name = bfd_section_name (input_bfd, sym_sec);
1544 r = elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
1545 input_section, contents,
1546 relocation, info, sym_sec,
1549 if (r != bfd_reloc_ok)
1555 case bfd_reloc_overflow:
1557 if (!((*info->callbacks->reloc_overflow)
1558 (info, sym_name, howto->name, (bfd_vma) 0,
1559 input_bfd, input_section, rel->r_offset)))
1569 /* Compute the value for a relocation (REL) during a final link stage,
1570 then insert the value into the proper location in CONTENTS.
1572 VALUE is a tentative value for the relocation and may be overridden
1573 and modified here based on the specific relocation to be performed.
1575 For example we do conversions for PC-relative branches in this routine
1576 or redirection of calls to external routines to stubs.
1578 The work of actually applying the relocation is left to a helper
1579 routine in an attempt to reduce the complexity and size of this
1582 static bfd_reloc_status_type
1583 elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
1584 input_section, contents, value,
1585 info, sym_sec, h, dyn_h)
1586 Elf_Internal_Rela *rel;
1589 asection *input_section;
1592 struct bfd_link_info *info;
1594 struct elf_link_hash_entry *h ATTRIBUTE_UNUSED;
1595 struct elf64_hppa_dyn_hash_entry *dyn_h;
1598 bfd_vma offset = rel->r_offset;
1599 bfd_signed_vma addend = rel->r_addend;
1600 reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
1601 unsigned int r_type = howto->type;
1602 bfd_byte *hit_data = contents + offset;
1603 struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
1605 insn = bfd_get_32 (input_bfd, hit_data);
1612 /* Basic function call support. I'm not entirely sure if PCREL14F is
1613 actually needed or even handled correctly.
1615 Note for a call to a function defined in another dynamic library
1616 we want to redirect the call to a stub. */
1618 /* Random PC relative relocs. */
1619 case R_PARISC_PCREL21L:
1620 case R_PARISC_PCREL14R:
1621 case R_PARISC_PCREL14F:
1622 case R_PARISC_PCREL14WR:
1623 case R_PARISC_PCREL14DR:
1624 case R_PARISC_PCREL16F:
1625 case R_PARISC_PCREL16WF:
1626 case R_PARISC_PCREL16DF:
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
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);
1635 /* Turn VALUE into a proper PC relative address. */
1636 value -= (offset + input_section->output_offset
1637 + input_section->output_section->vma);
1639 /* Adjust for any field selectors. */
1640 if (r_type == R_PARISC_PCREL21L)
1641 value = hppa_field_adjust (value, -8 + addend, e_lsel);
1642 else if (r_type == R_PARISC_PCREL14F
1643 || r_type == R_PARISC_PCREL16F
1644 || r_type == R_PARISC_PCREL16WF
1645 || r_type == R_PARISC_PCREL16DF)
1646 value = hppa_field_adjust (value, -8 + addend, e_fsel);
1648 value = hppa_field_adjust (value, -8 + addend, e_rsel);
1650 /* Apply the relocation to the given instruction. */
1651 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1655 case R_PARISC_PCREL12F:
1656 case R_PARISC_PCREL22F:
1657 case R_PARISC_PCREL17F:
1658 case R_PARISC_PCREL22C:
1659 case R_PARISC_PCREL17C:
1660 case R_PARISC_PCREL17R:
1662 /* If this is a call to a function defined in another dynamic
1663 library, then redirect the call to the local stub for this
1665 if (sym_sec == NULL || sym_sec->output_section == NULL)
1666 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1667 + hppa_info->stub_sec->output_section->vma);
1669 /* Turn VALUE into a proper PC relative address. */
1670 value -= (offset + input_section->output_offset
1671 + input_section->output_section->vma);
1673 /* Adjust for any field selectors. */
1674 if (r_type == R_PARISC_PCREL17R)
1675 value = hppa_field_adjust (value, -8 + addend, e_rsel);
1677 value = hppa_field_adjust (value, -8 + addend, e_fsel);
1679 /* All branches are implicitly shifted by 2 places. */
1682 /* Apply the relocation to the given instruction. */
1683 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1687 /* Indirect references to data through the DLT. */
1688 case R_PARISC_DLTIND14R:
1689 case R_PARISC_DLTIND14F:
1690 case R_PARISC_DLTIND14DR:
1691 case R_PARISC_DLTIND14WR:
1692 case R_PARISC_DLTIND21L:
1693 case R_PARISC_LTOFF_FPTR14R:
1694 case R_PARISC_LTOFF_FPTR14DR:
1695 case R_PARISC_LTOFF_FPTR14WR:
1696 case R_PARISC_LTOFF_FPTR21L:
1697 case R_PARISC_LTOFF_FPTR16F:
1698 case R_PARISC_LTOFF_FPTR16WF:
1699 case R_PARISC_LTOFF_FPTR16DF:
1700 case R_PARISC_LTOFF_TP21L:
1701 case R_PARISC_LTOFF_TP14R:
1702 case R_PARISC_LTOFF_TP14F:
1703 case R_PARISC_LTOFF_TP14WR:
1704 case R_PARISC_LTOFF_TP14DR:
1705 case R_PARISC_LTOFF_TP16F:
1706 case R_PARISC_LTOFF_TP16WF:
1707 case R_PARISC_LTOFF_TP16DF:
1708 case R_PARISC_LTOFF16F:
1709 case R_PARISC_LTOFF16WF:
1710 case R_PARISC_LTOFF16DF:
1712 /* If this relocation was against a local symbol, then we still
1713 have not set up the DLT entry (it's not convenient to do so
1714 in the "finalize_dlt" routine because it is difficult to get
1715 to the local symbol's value).
1717 So, if this is a local symbol (h == NULL), then we need to
1718 fill in its DLT entry.
1720 Similarly we may still need to set up an entry in .opd for
1721 a local function which had its address taken. */
1722 if (dyn_h->h == NULL)
1724 /* Now do .opd creation if needed. */
1725 if (r_type == R_PARISC_LTOFF_FPTR14R
1726 || r_type == R_PARISC_LTOFF_FPTR14DR
1727 || r_type == R_PARISC_LTOFF_FPTR14WR
1728 || r_type == R_PARISC_LTOFF_FPTR21L
1729 || r_type == R_PARISC_LTOFF_FPTR16F
1730 || r_type == R_PARISC_LTOFF_FPTR16WF
1731 || r_type == R_PARISC_LTOFF_FPTR16DF)
1733 /* The first two words of an .opd entry are zero. */
1734 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset,
1737 /* The next word is the address of the function. */
1738 bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
1739 (hppa_info->opd_sec->contents
1740 + dyn_h->opd_offset + 16));
1742 /* The last word is our local __gp value. */
1743 value = _bfd_get_gp_value
1744 (hppa_info->opd_sec->output_section->owner);
1745 bfd_put_64 (hppa_info->opd_sec->owner, value,
1746 (hppa_info->opd_sec->contents
1747 + dyn_h->opd_offset + 24));
1749 /* The DLT value is the address of the .opd entry. */
1750 value = (dyn_h->opd_offset
1751 + hppa_info->opd_sec->output_offset
1752 + hppa_info->opd_sec->output_section->vma);
1756 bfd_put_64 (hppa_info->dlt_sec->owner,
1758 hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
1761 /* We want the value of the DLT offset for this symbol, not
1762 the symbol's actual address. Note that __gp may not point
1763 to the start of the DLT, so we have to compute the absolute
1764 address, then subtract out the value of __gp. */
1765 value = (dyn_h->dlt_offset
1766 + hppa_info->dlt_sec->output_offset
1767 + hppa_info->dlt_sec->output_section->vma);
1768 value -= _bfd_get_gp_value (output_bfd);
1770 /* All DLTIND relocations are basically the same at this point,
1771 except that we need different field selectors for the 21bit
1772 version vs the 14bit versions. */
1773 if (r_type == R_PARISC_DLTIND21L
1774 || r_type == R_PARISC_LTOFF_FPTR21L
1775 || r_type == R_PARISC_LTOFF_TP21L)
1776 value = hppa_field_adjust (value, 0, e_lsel);
1777 else if (r_type == R_PARISC_DLTIND14F
1778 || r_type == R_PARISC_LTOFF_FPTR16F
1779 || r_type == R_PARISC_LTOFF_FPTR16WF
1780 || r_type == R_PARISC_LTOFF_FPTR16DF
1781 || r_type == R_PARISC_LTOFF16F
1782 || r_type == R_PARISC_LTOFF16DF
1783 || r_type == R_PARISC_LTOFF16WF
1784 || r_type == R_PARISC_LTOFF_TP16F
1785 || r_type == R_PARISC_LTOFF_TP16WF
1786 || r_type == R_PARISC_LTOFF_TP16DF)
1787 value = hppa_field_adjust (value, 0, e_fsel);
1789 value = hppa_field_adjust (value, 0, e_rsel);
1791 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1795 case R_PARISC_DLTREL14R:
1796 case R_PARISC_DLTREL14F:
1797 case R_PARISC_DLTREL14DR:
1798 case R_PARISC_DLTREL14WR:
1799 case R_PARISC_DLTREL21L:
1800 case R_PARISC_DPREL21L:
1801 case R_PARISC_DPREL14WR:
1802 case R_PARISC_DPREL14DR:
1803 case R_PARISC_DPREL14R:
1804 case R_PARISC_DPREL14F:
1805 case R_PARISC_GPREL16F:
1806 case R_PARISC_GPREL16WF:
1807 case R_PARISC_GPREL16DF:
1809 /* Subtract out the global pointer value to make value a DLT
1810 relative address. */
1811 value -= _bfd_get_gp_value (output_bfd);
1813 /* All DLTREL relocations are basically the same at this point,
1814 except that we need different field selectors for the 21bit
1815 version vs the 14bit versions. */
1816 if (r_type == R_PARISC_DLTREL21L
1817 || r_type == R_PARISC_DPREL21L)
1818 value = hppa_field_adjust (value, addend, e_lrsel);
1819 else if (r_type == R_PARISC_DLTREL14F
1820 || r_type == R_PARISC_DPREL14F
1821 || r_type == R_PARISC_GPREL16F
1822 || r_type == R_PARISC_GPREL16WF
1823 || r_type == R_PARISC_GPREL16DF)
1824 value = hppa_field_adjust (value, addend, e_fsel);
1826 value = hppa_field_adjust (value, addend, e_rrsel);
1828 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1832 case R_PARISC_DIR21L:
1833 case R_PARISC_DIR17R:
1834 case R_PARISC_DIR17F:
1835 case R_PARISC_DIR14R:
1836 case R_PARISC_DIR14F:
1837 case R_PARISC_DIR14WR:
1838 case R_PARISC_DIR14DR:
1839 case R_PARISC_DIR16F:
1840 case R_PARISC_DIR16WF:
1841 case R_PARISC_DIR16DF:
1843 /* All DIR relocations are basically the same at this point,
1844 except that branch offsets need to be divided by four, and
1845 we need different field selectors. Note that we don't
1846 redirect absolute calls to local stubs. */
1848 if (r_type == R_PARISC_DIR21L)
1849 value = hppa_field_adjust (value, addend, e_lrsel);
1850 else if (r_type == R_PARISC_DIR17F
1851 || r_type == R_PARISC_DIR16F
1852 || r_type == R_PARISC_DIR16WF
1853 || r_type == R_PARISC_DIR16DF
1854 || r_type == R_PARISC_DIR14F)
1855 value = hppa_field_adjust (value, addend, e_fsel);
1857 value = hppa_field_adjust (value, addend, e_rrsel);
1859 if (r_type == R_PARISC_DIR17R || r_type == R_PARISC_DIR17F)
1861 /* All branches are implicitly shifted by 2 places. */
1865 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1869 case R_PARISC_PLTOFF21L:
1870 case R_PARISC_PLTOFF14R:
1871 case R_PARISC_PLTOFF14F:
1872 case R_PARISC_PLTOFF14WR:
1873 case R_PARISC_PLTOFF14DR:
1874 case R_PARISC_PLTOFF16F:
1875 case R_PARISC_PLTOFF16WF:
1876 case R_PARISC_PLTOFF16DF:
1878 /* We want the value of the PLT offset for this symbol, not
1879 the symbol's actual address. Note that __gp may not point
1880 to the start of the DLT, so we have to compute the absolute
1881 address, then subtract out the value of __gp. */
1882 value = (dyn_h->plt_offset
1883 + hppa_info->plt_sec->output_offset
1884 + hppa_info->plt_sec->output_section->vma);
1885 value -= _bfd_get_gp_value (output_bfd);
1887 /* All PLTOFF relocations are basically the same at this point,
1888 except that we need different field selectors for the 21bit
1889 version vs the 14bit versions. */
1890 if (r_type == R_PARISC_PLTOFF21L)
1891 value = hppa_field_adjust (value, addend, e_lrsel);
1892 else if (r_type == R_PARISC_PLTOFF14F
1893 || r_type == R_PARISC_PLTOFF16F
1894 || r_type == R_PARISC_PLTOFF16WF
1895 || r_type == R_PARISC_PLTOFF16DF)
1896 value = hppa_field_adjust (value, addend, e_fsel);
1898 value = hppa_field_adjust (value, addend, e_rrsel);
1900 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1904 case R_PARISC_LTOFF_FPTR32:
1906 /* We may still need to create the FPTR itself if it was for
1908 if (dyn_h->h == NULL)
1910 /* The first two words of an .opd entry are zero. */
1911 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
1913 /* The next word is the address of the function. */
1914 bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
1915 (hppa_info->opd_sec->contents
1916 + dyn_h->opd_offset + 16));
1918 /* The last word is our local __gp value. */
1919 value = _bfd_get_gp_value
1920 (hppa_info->opd_sec->output_section->owner);
1921 bfd_put_64 (hppa_info->opd_sec->owner, value,
1922 hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
1924 /* The DLT value is the address of the .opd entry. */
1925 value = (dyn_h->opd_offset
1926 + hppa_info->opd_sec->output_offset
1927 + hppa_info->opd_sec->output_section->vma);
1929 bfd_put_64 (hppa_info->dlt_sec->owner,
1931 hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
1934 /* We want the value of the DLT offset for this symbol, not
1935 the symbol's actual address. Note that __gp may not point
1936 to the start of the DLT, so we have to compute the absolute
1937 address, then subtract out the value of __gp. */
1938 value = (dyn_h->dlt_offset
1939 + hppa_info->dlt_sec->output_offset
1940 + hppa_info->dlt_sec->output_section->vma);
1941 value -= _bfd_get_gp_value (output_bfd);
1942 bfd_put_32 (input_bfd, value, hit_data);
1943 return bfd_reloc_ok;
1946 case R_PARISC_LTOFF_FPTR64:
1947 case R_PARISC_LTOFF_TP64:
1949 /* We may still need to create the FPTR itself if it was for
1951 if (dyn_h->h == NULL && r_type == R_PARISC_LTOFF_FPTR64)
1953 /* The first two words of an .opd entry are zero. */
1954 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
1956 /* The next word is the address of the function. */
1957 bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
1958 (hppa_info->opd_sec->contents
1959 + dyn_h->opd_offset + 16));
1961 /* The last word is our local __gp value. */
1962 value = _bfd_get_gp_value
1963 (hppa_info->opd_sec->output_section->owner);
1964 bfd_put_64 (hppa_info->opd_sec->owner, value,
1965 hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
1967 /* The DLT value is the address of the .opd entry. */
1968 value = (dyn_h->opd_offset
1969 + hppa_info->opd_sec->output_offset
1970 + hppa_info->opd_sec->output_section->vma);
1972 bfd_put_64 (hppa_info->dlt_sec->owner,
1974 hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
1977 /* We want the value of the DLT offset for this symbol, not
1978 the symbol's actual address. Note that __gp may not point
1979 to the start of the DLT, so we have to compute the absolute
1980 address, then subtract out the value of __gp. */
1981 value = (dyn_h->dlt_offset
1982 + hppa_info->dlt_sec->output_offset
1983 + hppa_info->dlt_sec->output_section->vma);
1984 value -= _bfd_get_gp_value (output_bfd);
1985 bfd_put_64 (input_bfd, value, hit_data);
1986 return bfd_reloc_ok;
1989 case R_PARISC_DIR32:
1990 bfd_put_32 (input_bfd, value + addend, hit_data);
1991 return bfd_reloc_ok;
1993 case R_PARISC_DIR64:
1994 bfd_put_64 (input_bfd, value + addend, hit_data);
1995 return bfd_reloc_ok;
1997 case R_PARISC_GPREL64:
1998 /* Subtract out the global pointer value to make value a DLT
1999 relative address. */
2000 value -= _bfd_get_gp_value (output_bfd);
2002 bfd_put_64 (input_bfd, value + addend, hit_data);
2003 return bfd_reloc_ok;
2005 case R_PARISC_LTOFF64:
2006 /* We want the value of the DLT offset for this symbol, not
2007 the symbol's actual address. Note that __gp may not point
2008 to the start of the DLT, so we have to compute the absolute
2009 address, then subtract out the value of __gp. */
2010 value = (dyn_h->dlt_offset
2011 + hppa_info->dlt_sec->output_offset
2012 + hppa_info->dlt_sec->output_section->vma);
2013 value -= _bfd_get_gp_value (output_bfd);
2015 bfd_put_64 (input_bfd, value + addend, hit_data);
2016 return bfd_reloc_ok;
2018 case R_PARISC_PCREL32:
2020 /* If this is a call to a function defined in another dynamic
2021 library, then redirect the call to the local stub for this
2023 if (sym_sec == NULL || sym_sec->output_section == NULL)
2024 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
2025 + hppa_info->stub_sec->output_section->vma);
2027 /* Turn VALUE into a proper PC relative address. */
2028 value -= (offset + input_section->output_offset
2029 + input_section->output_section->vma);
2033 bfd_put_32 (input_bfd, value, hit_data);
2034 return bfd_reloc_ok;
2037 case R_PARISC_PCREL64:
2039 /* If this is a call to a function defined in another dynamic
2040 library, then redirect the call to the local stub for this
2042 if (sym_sec == NULL || sym_sec->output_section == NULL)
2043 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
2044 + hppa_info->stub_sec->output_section->vma);
2046 /* Turn VALUE into a proper PC relative address. */
2047 value -= (offset + input_section->output_offset
2048 + input_section->output_section->vma);
2052 bfd_put_64 (input_bfd, value, hit_data);
2053 return bfd_reloc_ok;
2056 case R_PARISC_FPTR64:
2058 /* We may still need to create the FPTR itself if it was for
2060 if (dyn_h->h == NULL)
2062 /* The first two words of an .opd entry are zero. */
2063 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
2065 /* The next word is the address of the function. */
2066 bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
2067 (hppa_info->opd_sec->contents
2068 + dyn_h->opd_offset + 16));
2070 /* The last word is our local __gp value. */
2071 value = _bfd_get_gp_value
2072 (hppa_info->opd_sec->output_section->owner);
2073 bfd_put_64 (hppa_info->opd_sec->owner, value,
2074 hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
2077 if (dyn_h->want_opd)
2078 /* We want the value of the OPD offset for this symbol. */
2079 value = (dyn_h->opd_offset
2080 + hppa_info->opd_sec->output_offset
2081 + hppa_info->opd_sec->output_section->vma);
2083 /* We want the address of the symbol. */
2086 bfd_put_64 (input_bfd, value, hit_data);
2087 return bfd_reloc_ok;
2090 case R_PARISC_SECREL32:
2091 bfd_put_32 (input_bfd,
2092 value + addend - sym_sec->output_section->vma,
2094 return bfd_reloc_ok;
2096 case R_PARISC_SEGREL32:
2097 case R_PARISC_SEGREL64:
2099 /* If this is the first SEGREL relocation, then initialize
2100 the segment base values. */
2101 if (hppa_info->text_segment_base == (bfd_vma) -1)
2102 bfd_map_over_sections (output_bfd, elf_hppa_record_segment_addrs,
2105 /* VALUE holds the absolute address. We want to include the
2106 addend, then turn it into a segment relative address.
2108 The segment is derived from SYM_SEC. We assume that there are
2109 only two segments of note in the resulting executable/shlib.
2110 A readonly segment (.text) and a readwrite segment (.data). */
2113 if (sym_sec->flags & SEC_CODE)
2114 value -= hppa_info->text_segment_base;
2116 value -= hppa_info->data_segment_base;
2118 if (r_type == R_PARISC_SEGREL32)
2119 bfd_put_32 (input_bfd, value, hit_data);
2121 bfd_put_64 (input_bfd, value, hit_data);
2122 return bfd_reloc_ok;
2125 /* Something we don't know how to handle. */
2127 return bfd_reloc_notsupported;
2130 /* Update the instruction word. */
2131 bfd_put_32 (input_bfd, (bfd_vma) insn, hit_data);
2132 return bfd_reloc_ok;
2135 /* Relocate the given INSN. VALUE should be the actual value we want
2136 to insert into the instruction, ie by this point we should not be
2137 concerned with computing an offset relative to the DLT, PC, etc.
2138 Instead this routine is meant to handle the bit manipulations needed
2139 to insert the relocation into the given instruction. */
2142 elf_hppa_relocate_insn (insn, sym_value, r_type)
2145 unsigned int r_type;
2149 /* This is any 22 bit branch. In PA2.0 syntax it corresponds to
2150 the "B" instruction. */
2151 case R_PARISC_PCREL22F:
2152 case R_PARISC_PCREL22C:
2153 return (insn & ~0x3ff1ffd) | re_assemble_22 (sym_value);
2155 /* This is any 12 bit branch. */
2156 case R_PARISC_PCREL12F:
2157 return (insn & ~0x1ffd) | re_assemble_12 (sym_value);
2159 /* This is any 17 bit branch. In PA2.0 syntax it also corresponds
2160 to the "B" instruction as well as BE. */
2161 case R_PARISC_PCREL17F:
2162 case R_PARISC_DIR17F:
2163 case R_PARISC_DIR17R:
2164 case R_PARISC_PCREL17C:
2165 case R_PARISC_PCREL17R:
2166 return (insn & ~0x1f1ffd) | re_assemble_17 (sym_value);
2168 /* ADDIL or LDIL instructions. */
2169 case R_PARISC_DLTREL21L:
2170 case R_PARISC_DLTIND21L:
2171 case R_PARISC_LTOFF_FPTR21L:
2172 case R_PARISC_PCREL21L:
2173 case R_PARISC_LTOFF_TP21L:
2174 case R_PARISC_DPREL21L:
2175 case R_PARISC_PLTOFF21L:
2176 case R_PARISC_DIR21L:
2177 return (insn & ~0x1fffff) | re_assemble_21 (sym_value);
2179 /* LDO and integer loads/stores with 14 bit displacements. */
2180 case R_PARISC_DLTREL14R:
2181 case R_PARISC_DLTREL14F:
2182 case R_PARISC_DLTIND14R:
2183 case R_PARISC_DLTIND14F:
2184 case R_PARISC_LTOFF_FPTR14R:
2185 case R_PARISC_LTOFF_FPTR16F:
2186 case R_PARISC_PCREL14R:
2187 case R_PARISC_PCREL14F:
2188 case R_PARISC_PCREL16F:
2189 case R_PARISC_LTOFF_TP14R:
2190 case R_PARISC_LTOFF_TP14F:
2191 case R_PARISC_LTOFF_TP16F:
2192 case R_PARISC_DPREL14R:
2193 case R_PARISC_DPREL14F:
2194 case R_PARISC_GPREL16F:
2195 case R_PARISC_PLTOFF14R:
2196 case R_PARISC_PLTOFF14F:
2197 case R_PARISC_PLTOFF16F:
2198 case R_PARISC_DIR14R:
2199 case R_PARISC_DIR14F:
2200 case R_PARISC_DIR16F:
2201 case R_PARISC_LTOFF16F:
2202 return (insn & ~0x3fff) | low_sign_unext (sym_value, 14);
2204 /* Doubleword loads and stores with a 14 bit displacement. */
2205 case R_PARISC_DLTREL14DR:
2206 case R_PARISC_DLTIND14DR:
2207 case R_PARISC_LTOFF_FPTR14DR:
2208 case R_PARISC_LTOFF_FPTR16DF:
2209 case R_PARISC_PCREL14DR:
2210 case R_PARISC_PCREL16DF:
2211 case R_PARISC_LTOFF_TP14DR:
2212 case R_PARISC_LTOFF_TP16DF:
2213 case R_PARISC_DPREL14DR:
2214 case R_PARISC_GPREL16DF:
2215 case R_PARISC_PLTOFF14DR:
2216 case R_PARISC_PLTOFF16DF:
2217 case R_PARISC_DIR14DR:
2218 case R_PARISC_DIR16DF:
2219 case R_PARISC_LTOFF16DF:
2220 return (insn & ~0x3ff1) | (((sym_value & 0x2000) >> 13)
2221 | ((sym_value & 0x1ff8) << 1));
2223 /* Floating point single word load/store instructions. */
2224 case R_PARISC_DLTREL14WR:
2225 case R_PARISC_DLTIND14WR:
2226 case R_PARISC_LTOFF_FPTR14WR:
2227 case R_PARISC_LTOFF_FPTR16WF:
2228 case R_PARISC_PCREL14WR:
2229 case R_PARISC_PCREL16WF:
2230 case R_PARISC_LTOFF_TP14WR:
2231 case R_PARISC_LTOFF_TP16WF:
2232 case R_PARISC_DPREL14WR:
2233 case R_PARISC_GPREL16WF:
2234 case R_PARISC_PLTOFF14WR:
2235 case R_PARISC_PLTOFF16WF:
2236 case R_PARISC_DIR16WF:
2237 case R_PARISC_DIR14WR:
2238 case R_PARISC_LTOFF16WF:
2239 return (insn & ~0x3ff9) | (((sym_value & 0x2000) >> 13)
2240 | ((sym_value & 0x1ffc) << 1));