file as.info-5 was initially added on branch binutils-2_10-branch.
[binutils.git] / bfd / elf-hppa.h
blobdab039b09abf90b0b319781358b5bad11ad92fc8
1 /* Common code for PA ELF implementations.
2 Copyright (C) 1999, 2000 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
23 sizes.
25 Most of the routines are written to be size independent, but sometimes
26 external constraints require 32 or 64 bit specific code. We remap
27 the definitions/functions as necessary here. */
28 #if ARCH_SIZE == 64
29 #define ELF_R_TYPE(X) ELF64_R_TYPE(X)
30 #define ELF_R_SYM(X) ELF64_R_SYM(X)
31 #define elf_hppa_internal_shdr Elf64_Internal_Shdr
32 #define _bfd_elf_hppa_gen_reloc_type _bfd_elf64_hppa_gen_reloc_type
33 #define elf_hppa_relocate_section elf64_hppa_relocate_section
34 #define bfd_elf_bfd_final_link bfd_elf64_bfd_final_link
35 #define elf_hppa_final_link elf64_hppa_final_link
36 #endif
37 #if ARCH_SIZE == 32
38 #define ELF_R_TYPE(X) ELF32_R_TYPE(X)
39 #define ELF_R_SYM(X) ELF32_R_SYM(X)
40 #define elf_hppa_internal_shdr Elf32_Internal_Shdr
41 #define _bfd_elf_hppa_gen_reloc_type _bfd_elf32_hppa_gen_reloc_type
42 #define elf_hppa_relocate_section elf32_hppa_relocate_section
43 #define bfd_elf_bfd_final_link bfd_elf32_bfd_final_link
44 #define elf_hppa_final_link elf32_hppa_final_link
45 #endif
47 elf_hppa_reloc_type ** _bfd_elf_hppa_gen_reloc_type
48 PARAMS ((bfd *, elf_hppa_reloc_type, int, int, int, asymbol *));
50 static void elf_hppa_info_to_howto
51 PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
53 static void elf_hppa_info_to_howto_rel
54 PARAMS ((bfd *, arelent *, Elf_Internal_Rel *));
56 static reloc_howto_type * elf_hppa_reloc_type_lookup
57 PARAMS ((bfd *, bfd_reloc_code_real_type));
59 static boolean elf_hppa_is_local_label_name
60 PARAMS ((bfd *, const char *));
62 static boolean elf_hppa_fake_sections
63 PARAMS ((bfd *abfd, elf_hppa_internal_shdr *, asection *));
65 #if ARCH_SIZE == 64
66 static void elf_hppa_final_write_processing
67 PARAMS ((bfd *, boolean));
69 static boolean elf_hppa_add_symbol_hook
70 PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
71 const char **, flagword *, asection **, bfd_vma *));
73 static boolean elf_hppa_unmark_useless_dynamic_symbols
74 PARAMS ((struct elf_link_hash_entry *, PTR));
76 static boolean elf_hppa_remark_useless_dynamic_symbols
77 PARAMS ((struct elf_link_hash_entry *, PTR));
79 static void elf_hppa_record_segment_addrs
80 PARAMS ((bfd *, asection *, PTR));
82 static boolean elf_hppa_final_link
83 PARAMS ((bfd *, struct bfd_link_info *));
85 static boolean elf_hppa_relocate_section
86 PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
87 bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
89 static bfd_reloc_status_type elf_hppa_final_link_relocate
90 PARAMS ((Elf_Internal_Rela *, bfd *, bfd *, asection *,
91 bfd_byte *, bfd_vma, struct bfd_link_info *,
92 asection *, struct elf_link_hash_entry *,
93 struct elf64_hppa_dyn_hash_entry *));
95 static unsigned int elf_hppa_relocate_insn
96 PARAMS ((unsigned int, unsigned int, unsigned int));
97 #endif
100 /* ELF/PA relocation howto entries. */
102 static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
104 { R_PARISC_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield,
105 bfd_elf_generic_reloc, "R_PARISC_NONE", false, 0, 0, false },
107 /* The values in DIR32 are to placate the check in
108 _bfd_stab_section_find_nearest_line. */
109 { R_PARISC_DIR32, 0, 2, 32, false, 0, complain_overflow_bitfield,
110 bfd_elf_generic_reloc, "R_PARISC_DIR32", false, 0, 0xffffffff, false },
111 { R_PARISC_DIR21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
112 bfd_elf_generic_reloc, "R_PARISC_DIR21L", false, 0, 0, false },
113 { R_PARISC_DIR17R, 0, 0, 17, false, 0, complain_overflow_bitfield,
114 bfd_elf_generic_reloc, "R_PARISC_DIR17R", false, 0, 0, false },
115 { R_PARISC_DIR17F, 0, 0, 17, false, 0, complain_overflow_bitfield,
116 bfd_elf_generic_reloc, "R_PARISC_DIR17F", false, 0, 0, false },
117 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
118 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
119 { R_PARISC_DIR14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
120 bfd_elf_generic_reloc, "R_PARISC_DIR14R", false, 0, 0, false },
121 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
122 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
123 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
124 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
125 { R_PARISC_PCREL32, 0, 0, 32, true, 0, complain_overflow_bitfield,
126 bfd_elf_generic_reloc, "R_PARISC_PCREL32", false, 0, 0, false },
128 { R_PARISC_PCREL21L, 0, 0, 21, true, 0, complain_overflow_bitfield,
129 bfd_elf_generic_reloc, "R_PARISC_PCREL21L", false, 0, 0, false },
130 { R_PARISC_PCREL17R, 0, 0, 17, true, 0, complain_overflow_bitfield,
131 bfd_elf_generic_reloc, "R_PARISC_PCREL17R", false, 0, 0, false },
132 { R_PARISC_PCREL17F, 0, 0, 17, true, 0, complain_overflow_bitfield,
133 bfd_elf_generic_reloc, "R_PARISC_PCREL17F", false, 0, 0, false },
134 { R_PARISC_PCREL17C, 0, 0, 17, true, 0, complain_overflow_bitfield,
135 bfd_elf_generic_reloc, "R_PARISC_PCREL17C", false, 0, 0, false },
136 { R_PARISC_PCREL14R, 0, 0, 14, true, 0, complain_overflow_bitfield,
137 bfd_elf_generic_reloc, "R_PARISC_PCREL14R", false, 0, 0, false },
138 { R_PARISC_PCREL14F, 0, 0, 14, true, 0, complain_overflow_bitfield,
139 bfd_elf_generic_reloc, "R_PARISC_PCREL14F", false, 0, 0, false },
140 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
141 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
142 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
143 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
144 { R_PARISC_DPREL21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
145 bfd_elf_generic_reloc, "R_PARISC_DPREL21L", false, 0, 0, false },
146 { R_PARISC_DPREL14WR, 0, 0, 0, false, 0, complain_overflow_bitfield,
147 bfd_elf_generic_reloc, "R_PARISC_DPREL14WR", false, 0, 0, false },
149 { R_PARISC_DPREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
150 bfd_elf_generic_reloc, "R_PARISC_DPREL14DR", false, 0, 0, false },
151 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
152 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
153 { R_PARISC_DPREL14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
154 bfd_elf_generic_reloc, "R_PARISC_DPREL14R", false, 0, 0, false },
155 { R_PARISC_DPREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
156 bfd_elf_generic_reloc, "R_PARISC_DPREL14F", false, 0, 0, false },
157 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
158 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
159 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
160 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
161 { R_PARISC_DLTREL21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
162 bfd_elf_generic_reloc, "R_PARISC_DLTREL21L", 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_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
168 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
170 { R_PARISC_DLTREL14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
171 bfd_elf_generic_reloc, "R_PARISC_DLTREL14R", false, 0, 0, false },
172 { R_PARISC_DLTREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
173 bfd_elf_generic_reloc, "R_PARISC_DLTREL14F", false, 0, 0, false },
174 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
175 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
176 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
177 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
178 { R_PARISC_DLTIND21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
179 bfd_elf_generic_reloc, "R_PARISC_DLTIND21L", 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_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
185 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
186 { R_PARISC_DLTIND14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
187 bfd_elf_generic_reloc, "R_PARISC_DLTIND14R", false, 0, 0, false },
188 { R_PARISC_DLTIND14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
189 bfd_elf_generic_reloc, "R_PARISC_DLTIND14F", false, 0, 0, false },
191 { R_PARISC_SETBASE, 0, 0, 0, false, 0, complain_overflow_bitfield,
192 bfd_elf_generic_reloc, "R_PARISC_SETBASE", false, 0, 0, false },
193 { R_PARISC_SECREL32, 0, 0, 0, false, 0, complain_overflow_bitfield,
194 bfd_elf_generic_reloc, "R_PARISC_SECREL32", false, 0, 0, false },
195 { R_PARISC_BASEREL21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
196 bfd_elf_generic_reloc, "R_PARISC_BASEREL21L", false, 0, 0, false },
197 { R_PARISC_BASEREL17R, 0, 0, 17, false, 0, complain_overflow_bitfield,
198 bfd_elf_generic_reloc, "R_PARISC_BASEREL17R", false, 0, 0, false },
199 { R_PARISC_BASEREL17F, 0, 0, 17, false, 0, complain_overflow_bitfield,
200 bfd_elf_generic_reloc, "R_PARISC_BASEREL17F", false, 0, 0, false },
201 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
202 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
203 { R_PARISC_BASEREL14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
204 bfd_elf_generic_reloc, "R_PARISC_BASEREL14R", false, 0, 0, false },
205 { R_PARISC_BASEREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
206 bfd_elf_generic_reloc, "R_PARISC_BASEREL14F", false, 0, 0, false },
207 { R_PARISC_SEGBASE, 0, 0, 0, false, 0, complain_overflow_bitfield,
208 bfd_elf_generic_reloc, "R_PARISC_SEGBASE", false, 0, 0, false },
209 { R_PARISC_SEGREL32, 0, 0, 0, false, 0, complain_overflow_bitfield,
210 bfd_elf_generic_reloc, "R_PARISC_SEGREL32", false, 0, 0, false },
212 { R_PARISC_PLTOFF21L, 0, 0, 0, false, 0, complain_overflow_bitfield,
213 bfd_elf_generic_reloc, "R_PARISC_PLTOFF21L", false, 0, 0, false },
214 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
215 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
216 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
217 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
218 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
219 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
220 { R_PARISC_PLTOFF14R, 0, 0, 0, false, 0, complain_overflow_bitfield,
221 bfd_elf_generic_reloc, "R_PARISC_PLTOFF14R", false, 0, 0, false },
222 { R_PARISC_PLTOFF14F, 0, 0, 0, false, 0, complain_overflow_bitfield,
223 bfd_elf_generic_reloc, "R_PARISC_PLTOFF14F", 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_LTOFF_FPTR32, 0, 0, 0, false, 0, complain_overflow_bitfield,
227 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR32", false, 0, 0, false },
228 { R_PARISC_LTOFF_FPTR21L, 0, 0, 0, false, 0, complain_overflow_bitfield,
229 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR21L", false, 0, 0, false },
230 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
231 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", 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_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
236 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
237 { R_PARISC_LTOFF_FPTR14R, 0, 0, 0, false, 0, complain_overflow_bitfield,
238 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14R", 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_FPTR64, 0, 0, 0, false, 0, complain_overflow_bitfield,
242 bfd_elf_generic_reloc, "R_PARISC_FPTR64", false, 0, 0, false },
243 { R_PARISC_PLABEL32, 0, 0, 32, false, 0, complain_overflow_bitfield,
244 bfd_elf_generic_reloc, "R_PARISC_PLABEL32", false, 0, 0, false },
245 { R_PARISC_PLABEL21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
246 bfd_elf_generic_reloc, "R_PARISC_PLABEL21L", 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 },
249 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
250 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
251 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
252 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
254 { R_PARISC_PLABEL14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
255 bfd_elf_generic_reloc, "R_PARISC_PLABEL14R", 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_PCREL64, 0, 0, 0, false, 0, complain_overflow_bitfield,
259 bfd_elf_generic_reloc, "R_PARISC_PCREL64", false, 0, 0, false },
260 { R_PARISC_PCREL22C, 0, 0, 0, false, 0, complain_overflow_bitfield,
261 bfd_elf_generic_reloc, "R_PARISC_PCREL22C", false, 0, 0, false },
262 { R_PARISC_PCREL22F, 0, 0, 0, false, 0, complain_overflow_bitfield,
263 bfd_elf_generic_reloc, "R_PARISC_PCREL22F", false, 0, 0, false },
264 { R_PARISC_PCREL14WR, 0, 0, 0, false, 0, complain_overflow_bitfield,
265 bfd_elf_generic_reloc, "R_PARISC_PCREL14WR", false, 0, 0, false },
266 { R_PARISC_PCREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
267 bfd_elf_generic_reloc, "R_PARISC_PCREL14DR", false, 0, 0, false },
268 { R_PARISC_PCREL16F, 0, 0, 0, false, 0, complain_overflow_bitfield,
269 bfd_elf_generic_reloc, "R_PARISC_PCREL16F", false, 0, 0, false },
270 { R_PARISC_PCREL16WF, 0, 0, 0, false, 0, complain_overflow_bitfield,
271 bfd_elf_generic_reloc, "R_PARISC_PCREL16WF", false, 0, 0, false },
272 { R_PARISC_PCREL16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
273 bfd_elf_generic_reloc, "R_PARISC_PCREL16DF", false, 0, 0, false },
275 { R_PARISC_DIR64, 0, 0, 0, false, 0, complain_overflow_bitfield,
276 bfd_elf_generic_reloc, "R_PARISC_DIR64", false, 0, 0, false },
277 { R_PARISC_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield,
278 bfd_elf_generic_reloc, "R_PARISC_NONE", false, 0, 0, false },
279 { R_PARISC_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield,
280 bfd_elf_generic_reloc, "R_PARISC_NONE", false, 0, 0, false },
281 { R_PARISC_DIR14WR, 0, 0, 0, false, 0, complain_overflow_bitfield,
282 bfd_elf_generic_reloc, "R_PARISC_DIR14WR", false, 0, 0, false },
283 { R_PARISC_DIR14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
284 bfd_elf_generic_reloc, "R_PARISC_DIR14DR", false, 0, 0, false },
285 { R_PARISC_DIR16F, 0, 0, 0, false, 0, complain_overflow_bitfield,
286 bfd_elf_generic_reloc, "R_PARISC_DIR16F", false, 0, 0, false },
287 { R_PARISC_DIR16WF, 0, 0, 0, false, 0, complain_overflow_bitfield,
288 bfd_elf_generic_reloc, "R_PARISC_DIR16WF", false, 0, 0, false },
289 { R_PARISC_DIR16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
290 bfd_elf_generic_reloc, "R_PARISC_DIR16DF", false, 0, 0, false },
291 { R_PARISC_GPREL64, 0, 0, 0, false, 0, complain_overflow_bitfield,
292 bfd_elf_generic_reloc, "R_PARISC_GPREL64", 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 },
296 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
297 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
298 { R_PARISC_DLTREL14WR, 0, 0, 0, false, 0, complain_overflow_bitfield,
299 bfd_elf_generic_reloc, "R_PARISC_DLTREL14WR", false, 0, 0, false },
300 { R_PARISC_DLTREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
301 bfd_elf_generic_reloc, "R_PARISC_DLTREL14DR", false, 0, 0, false },
302 { R_PARISC_GPREL16F, 0, 0, 0, false, 0, complain_overflow_bitfield,
303 bfd_elf_generic_reloc, "R_PARISC_GPREL16F", false, 0, 0, false },
304 { R_PARISC_GPREL16WF, 0, 0, 0, false, 0, complain_overflow_bitfield,
305 bfd_elf_generic_reloc, "R_PARISC_GPREL16WF", false, 0, 0, false },
306 { R_PARISC_GPREL16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
307 bfd_elf_generic_reloc, "R_PARISC_GPREL16DF", false, 0, 0, false },
308 { R_PARISC_LTOFF64, 0, 0, 0, false, 0, complain_overflow_bitfield,
309 bfd_elf_generic_reloc, "R_PARISC_LTOFF64", 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_DLTIND14WR, 0, 0, 0, false, 0, complain_overflow_bitfield,
315 bfd_elf_generic_reloc, "R_PARISC_DLTIND14WR", false, 0, 0, false },
317 { R_PARISC_DLTIND14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
318 bfd_elf_generic_reloc, "R_PARISC_DLTIND14DR", false, 0, 0, false },
319 { R_PARISC_LTOFF16F, 0, 0, 0, false, 0, complain_overflow_bitfield,
320 bfd_elf_generic_reloc, "R_PARISC_LTOFF16F", false, 0, 0, false },
321 { R_PARISC_LTOFF16WF, 0, 0, 0, false, 0, complain_overflow_bitfield,
322 bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", false, 0, 0, false },
323 { R_PARISC_LTOFF16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
324 bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", false, 0, 0, false },
325 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
326 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
327 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
328 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
329 { R_PARISC_BASEREL14WR, 0, 0, 0, false, 0, complain_overflow_bitfield,
330 bfd_elf_generic_reloc, "R_PARISC_BSEREL14WR", false, 0, 0, false },
331 { R_PARISC_BASEREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
332 bfd_elf_generic_reloc, "R_PARISC_BASEREL14DR", 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 },
338 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
339 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
340 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
341 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
342 { R_PARISC_SEGREL64, 0, 0, 0, false, 0, complain_overflow_bitfield,
343 bfd_elf_generic_reloc, "R_PARISC_SEGREL64", false, 0, 0, false },
344 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
345 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
346 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
347 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
348 { R_PARISC_PLTOFF14WR, 0, 0, 0, false, 0, complain_overflow_bitfield,
349 bfd_elf_generic_reloc, "R_PARISC_PLTOFF14WR", false, 0, 0, false },
350 { R_PARISC_PLTOFF14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
351 bfd_elf_generic_reloc, "R_PARISC_PLTOFF14DR", false, 0, 0, false },
352 { R_PARISC_PLTOFF16F, 0, 0, 0, false, 0, complain_overflow_bitfield,
353 bfd_elf_generic_reloc, "R_PARISC_PLTOFF16F", false, 0, 0, false },
354 { R_PARISC_PLTOFF16WF, 0, 0, 0, false, 0, complain_overflow_bitfield,
355 bfd_elf_generic_reloc, "R_PARISC_PLTOFF16WF", false, 0, 0, false },
356 { R_PARISC_PLTOFF16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
357 bfd_elf_generic_reloc, "R_PARISC_PLTOFF16DF", false, 0, 0, false },
359 { R_PARISC_LTOFF_FPTR64, 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_LTOFF_FPTR14WR, 0, 0, 0, false, 0, complain_overflow_bitfield,
366 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14WR", false, 0, 0, false },
367 { R_PARISC_LTOFF_FPTR14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
368 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14DR", false, 0, 0, false },
369 { R_PARISC_LTOFF_FPTR16F, 0, 0, 0, false, 0, complain_overflow_bitfield,
370 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16F", false, 0, 0, false },
371 { R_PARISC_LTOFF_FPTR16WF, 0, 0, 0, false, 0, complain_overflow_bitfield,
372 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16WF", false, 0, 0, false },
373 { R_PARISC_LTOFF_FPTR16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
374 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
375 { R_PARISC_COPY, 0, 0, 0, false, 0, complain_overflow_bitfield,
376 bfd_elf_generic_reloc, "R_PARISC_COPY", false, 0, 0, false },
377 { R_PARISC_IPLT, 0, 0, 0, false, 0, complain_overflow_bitfield,
378 bfd_elf_generic_reloc, "R_PARISC_IPLT", false, 0, 0, false },
380 { R_PARISC_EPLT, 0, 0, 0, false, 0, complain_overflow_bitfield,
381 bfd_elf_generic_reloc, "R_PARISC_EPLT", false, 0, 0, false },
382 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
383 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
384 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
385 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
386 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
387 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
388 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
389 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
390 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
391 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", 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_dont,
395 NULL, "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 },
401 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
402 NULL, "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_bitfield,
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_bitfield,
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_dont,
416 NULL, "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 },
419 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
420 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
422 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
423 NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
424 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
425 NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
426 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
427 NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
428 { R_PARISC_TPREL32, 0, 0, 0, false, 0, complain_overflow_dont,
429 NULL, "R_PARISC_TPREL32", false, 0, 0, false },
430 { R_PARISC_TPREL21L, 0, 0, 0, false, 0, complain_overflow_dont,
431 NULL, "R_PARISC_TPREL21L", false, 0, 0, false },
432 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
433 NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
434 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
435 NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
436 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
437 NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
438 { R_PARISC_TPREL14R, 0, 0, 0, false, 0, complain_overflow_dont,
439 NULL, "R_PARISC_TPREL14R", false, 0, 0, false },
440 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
441 NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
443 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
444 NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
445 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
446 NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
447 { R_PARISC_LTOFF_TP21L, 0, 0, 0, false, 0, complain_overflow_bitfield,
448 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP21L", false, 0, 0, false },
449 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
450 NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
451 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
452 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
453 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
454 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
455 { R_PARISC_LTOFF_TP14R, 0, 0, 0, false, 0, complain_overflow_bitfield,
456 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
457 { R_PARISC_LTOFF_TP14F, 0, 0, 0, false, 0, complain_overflow_bitfield,
458 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14F", false, 0, 0, false },
459 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
460 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
461 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
462 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
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_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
467 NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
468 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
469 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
470 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
471 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
472 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
473 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
474 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
475 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
476 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
477 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
478 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
479 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
480 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
481 NULL, "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 },
485 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
486 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
487 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
488 NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
489 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
490 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
491 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
492 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
493 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
494 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
495 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
496 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
497 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
498 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
499 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
500 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
501 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
502 NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
503 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
504 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
506 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
507 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
508 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
509 NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
510 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
511 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
512 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
513 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
514 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_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_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
519 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
520 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
521 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
522 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
523 NULL, "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 },
527 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
528 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
529 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
530 NULL, "R_PARISC_UNIMPLEMENTED", 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_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
536 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
537 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
538 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_bitfield,
542 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
543 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
544 NULL, "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 },
548 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
549 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
550 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
551 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
552 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
553 NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
554 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
555 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
556 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
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_TPREL64, 0, 0, 0, false, 0, complain_overflow_bitfield,
561 bfd_elf_generic_reloc, "R_PARISC_TPREL64", 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_bitfield,
565 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
566 { R_PARISC_TPREL14WR, 0, 0, 0, false, 0, complain_overflow_dont,
567 NULL, "R_PARISC_TPREL14WR", false, 0, 0, false },
569 { R_PARISC_TPREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
570 bfd_elf_generic_reloc, "R_PARISC_TPREL14DR", false, 0, 0, false },
571 { R_PARISC_TPREL16F, 0, 0, 0, false, 0, complain_overflow_bitfield,
572 bfd_elf_generic_reloc, "R_PARISC_TPREL16F", false, 0, 0, false },
573 { R_PARISC_TPREL16WF, 0, 0, 0, false, 0, complain_overflow_dont,
574 NULL, "R_PARISC_TPREL16WF", false, 0, 0, false },
575 { R_PARISC_TPREL16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
576 bfd_elf_generic_reloc, "R_PARISC_TPREL16DF", false, 0, 0, false },
577 { R_PARISC_LTOFF_TP64, 0, 0, 0, false, 0, complain_overflow_bitfield,
578 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP64", false, 0, 0, false },
579 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
580 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
581 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
582 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
583 { R_PARISC_LTOFF_TP14WR, 0, 0, 0, false, 0, complain_overflow_bitfield,
584 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14WR", false, 0, 0, false },
585 { R_PARISC_LTOFF_TP14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
586 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14DR", false, 0, 0, false },
587 { R_PARISC_LTOFF_TP16F, 0, 0, 0, false, 0, complain_overflow_dont,
588 NULL, "R_PARISC_LTOFF_TP16F", false, 0, 0, false },
590 { R_PARISC_LTOFF_TP16WF, 0, 0, 0, false, 0, complain_overflow_bitfield,
591 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16WF", false, 0, 0, false },
592 { R_PARISC_LTOFF_TP16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
593 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16DF", false, 0, 0, false },
596 #define OFFSET_14R_FROM_21L 4
597 #define OFFSET_14F_FROM_21L 5
599 /* Return one (or more) BFD relocations which implement the base
600 relocation with modifications based on format and field. */
602 elf_hppa_reloc_type **
603 _bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
604 bfd *abfd;
605 elf_hppa_reloc_type base_type;
606 int format;
607 int field;
608 int ignore ATTRIBUTE_UNUSED;
609 asymbol *sym ATTRIBUTE_UNUSED;
611 elf_hppa_reloc_type *finaltype;
612 elf_hppa_reloc_type **final_types;
614 /* Allocate slots for the BFD relocation. */
615 final_types = ((elf_hppa_reloc_type **)
616 bfd_alloc (abfd, sizeof (elf_hppa_reloc_type *) * 2));
617 if (final_types == NULL)
618 return NULL;
620 /* Allocate space for the relocation itself. */
621 finaltype = ((elf_hppa_reloc_type *)
622 bfd_alloc (abfd, sizeof (elf_hppa_reloc_type)));
623 if (finaltype == NULL)
624 return NULL;
626 /* Some reasonable defaults. */
627 final_types[0] = finaltype;
628 final_types[1] = NULL;
630 #define final_type finaltype[0]
632 final_type = base_type;
634 /* Just a tangle of nested switch statements to deal with the braindamage
635 that a different field selector means a completely different relocation
636 for PA ELF. */
637 switch (base_type)
639 /* We have been using generic relocation types. However, that may not
640 really make sense. Anyway, we need to support both R_PARISC_DIR64
641 and R_PARISC_DIR32 here. */
642 case R_PARISC_DIR32:
643 case R_PARISC_DIR64:
644 case R_HPPA_ABS_CALL:
645 switch (format)
647 case 14:
648 switch (field)
650 case e_rsel:
651 case e_rrsel:
652 final_type = R_PARISC_DIR14R;
653 break;
654 case e_rtsel:
655 final_type = R_PARISC_DLTIND14R;
656 break;
657 case e_rtpsel:
658 final_type = R_PARISC_LTOFF_FPTR14DR;
659 break;
660 case e_tsel:
661 final_type = R_PARISC_DLTIND14F;
662 break;
663 case e_rpsel:
664 final_type = R_PARISC_PLABEL14R;
665 break;
666 default:
667 return NULL;
669 break;
671 case 17:
672 switch (field)
674 case e_fsel:
675 final_type = R_PARISC_DIR17F;
676 break;
677 case e_rsel:
678 case e_rrsel:
679 final_type = R_PARISC_DIR17R;
680 break;
681 default:
682 return NULL;
684 break;
686 case 21:
687 switch (field)
689 case e_lsel:
690 case e_lrsel:
691 final_type = R_PARISC_DIR21L;
692 break;
693 case e_ltsel:
694 final_type = R_PARISC_DLTIND21L;
695 break;
696 case e_ltpsel:
697 final_type = R_PARISC_LTOFF_FPTR21L;
698 break;
699 case e_lpsel:
700 final_type = R_PARISC_PLABEL21L;
701 break;
702 default:
703 return NULL;
705 break;
707 case 32:
708 switch (field)
710 case e_fsel:
711 final_type = R_PARISC_DIR32;
712 /* When in 64bit mode, a 32bit relocation is supposed to
713 be a section relative relocation. Dwarf2 (for example)
714 uses 32bit section relative relocations. */
715 if (bfd_get_arch_info (abfd)->bits_per_address != 32)
716 final_type = R_PARISC_SECREL32;
717 break;
718 case e_psel:
719 final_type = R_PARISC_PLABEL32;
720 break;
721 default:
722 return NULL;
724 break;
726 case 64:
727 switch (field)
729 case e_fsel:
730 final_type = R_PARISC_DIR64;
731 break;
732 case e_psel:
733 final_type = R_PARISC_FPTR64;
734 break;
735 default:
736 return NULL;
738 break;
740 default:
741 return NULL;
743 break;
746 case R_HPPA_GOTOFF:
747 switch (format)
749 case 14:
750 switch (field)
752 case e_rsel:
753 case e_rrsel:
754 final_type = base_type + OFFSET_14R_FROM_21L;
755 break;
756 case e_fsel:
757 final_type = base_type + OFFSET_14F_FROM_21L;
758 break;
759 default:
760 return NULL;
762 break;
764 case 21:
765 switch (field)
767 case e_lrsel:
768 case e_lsel:
769 final_type = base_type;
770 break;
771 default:
772 return NULL;
774 break;
776 default:
777 return NULL;
779 break;
782 case R_HPPA_PCREL_CALL:
783 switch (format)
785 case 14:
786 switch (field)
788 case e_rsel:
789 case e_rrsel:
790 final_type = R_PARISC_PCREL14R;
791 break;
792 case e_fsel:
793 final_type = R_PARISC_PCREL14F;
794 break;
795 default:
796 return NULL;
798 break;
800 case 17:
801 switch (field)
803 case e_rsel:
804 case e_rrsel:
805 final_type = R_PARISC_PCREL17R;
806 break;
807 case e_fsel:
808 final_type = R_PARISC_PCREL17F;
809 break;
810 default:
811 return NULL;
813 break;
815 case 22:
816 switch (field)
818 case e_fsel:
819 final_type = R_PARISC_PCREL22F;
820 break;
821 default:
822 return NULL;
824 break;
826 case 21:
827 switch (field)
829 case e_lsel:
830 case e_lrsel:
831 final_type = R_PARISC_PCREL21L;
832 break;
833 default:
834 return NULL;
836 break;
838 default:
839 return NULL;
841 break;
843 case R_PARISC_SEGREL32:
844 case R_PARISC_SEGBASE:
845 /* The defaults are fine for these cases. */
846 break;
848 default:
849 return NULL;
852 return final_types;
855 /* Translate from an elf into field into a howto relocation pointer. */
857 static void
858 elf_hppa_info_to_howto (abfd, bfd_reloc, elf_reloc)
859 bfd *abfd ATTRIBUTE_UNUSED;
860 arelent *bfd_reloc;
861 Elf_Internal_Rela *elf_reloc;
863 BFD_ASSERT (ELF_R_TYPE(elf_reloc->r_info)
864 < (unsigned int) R_PARISC_UNIMPLEMENTED);
865 bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
868 /* Translate from an elf into field into a howto relocation pointer. */
870 static void
871 elf_hppa_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
872 bfd *abfd ATTRIBUTE_UNUSED;
873 arelent *bfd_reloc;
874 Elf_Internal_Rel *elf_reloc;
876 BFD_ASSERT (ELF_R_TYPE(elf_reloc->r_info)
877 < (unsigned int) R_PARISC_UNIMPLEMENTED);
878 bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
881 /* Return the address of the howto table entry to perform the CODE
882 relocation for an ARCH machine. */
884 static reloc_howto_type *
885 elf_hppa_reloc_type_lookup (abfd, code)
886 bfd *abfd ATTRIBUTE_UNUSED;
887 bfd_reloc_code_real_type code;
889 if ((int) code < (int) R_PARISC_UNIMPLEMENTED)
891 BFD_ASSERT ((int) elf_hppa_howto_table[(int) code].type == (int) code);
892 return &elf_hppa_howto_table[(int) code];
894 return NULL;
897 /* Return true if SYM represents a local label symbol. */
899 static boolean
900 elf_hppa_is_local_label_name (abfd, name)
901 bfd *abfd ATTRIBUTE_UNUSED;
902 const char *name;
904 return (name[0] == 'L' && name[1] == '$');
907 /* Set the correct type for an ELF section. We do this by the
908 section name, which is a hack, but ought to work. */
910 static boolean
911 elf_hppa_fake_sections (abfd, hdr, sec)
912 bfd *abfd;
913 elf_hppa_internal_shdr *hdr;
914 asection *sec;
916 register const char *name;
918 name = bfd_get_section_name (abfd, sec);
920 if (strcmp (name, ".PARISC.unwind") == 0)
922 int indx;
923 asection *sec;
924 #if ARCH_SIZE == 64
925 hdr->sh_type = SHT_LOPROC + 1;
926 #else
927 hdr->sh_type = 1;
928 #endif
929 /* ?!? How are unwinds supposed to work for symbols in arbitrary
930 sections? Or what if we have multiple .text sections in a single
931 .o file? HP really messed up on this one.
933 Ugh. We can not use elf_section_data (sec)->this_idx at this
934 point because it is not initialized yet.
936 So we (gasp) recompute it here. Hopefully nobody ever changes the
937 way sections are numbered in elf.c! */
938 for (sec = abfd->sections, indx = 1; sec; sec = sec->next, indx++)
940 if (sec->name && strcmp (sec->name, ".text") == 0)
942 hdr->sh_info = indx;
943 break;
947 /* I have no idea if this is really necessary or what it means. */
948 hdr->sh_entsize = 4;
950 return true;
953 #if ARCH_SIZE == 64
954 static void
955 elf_hppa_final_write_processing (abfd, linker)
956 bfd *abfd;
957 boolean linker;
959 int mach = bfd_get_mach (abfd);
961 elf_elfheader (abfd)->e_flags &= ~(EF_PARISC_ARCH | EF_PARISC_TRAPNIL
962 | EF_PARISC_EXT | EF_PARISC_LSB
963 | EF_PARISC_WIDE | EF_PARISC_NO_KABP
964 | EF_PARISC_LAZYSWAP);
966 if (mach == 10)
967 elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_0;
968 else if (mach == 11)
969 elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_1;
970 else if (mach == 20)
971 elf_elfheader (abfd)->e_flags |= EFA_PARISC_2_0;
972 else if (mach == 25)
973 elf_elfheader (abfd)->e_flags |= (EF_PARISC_WIDE
974 | EFA_PARISC_2_0
975 /* The GNU tools have trapped without
976 option since 1993, so need to take
977 a step backwards with the ELF
978 based toolchains. */
979 | EF_PARISC_TRAPNIL);
982 /* Hook called by the linker routine which adds symbols from an object
983 file. HP's libraries define symbols with HP specific section
984 indices, which we have to handle. */
986 static boolean
987 elf_hppa_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
988 bfd *abfd;
989 struct bfd_link_info *info ATTRIBUTE_UNUSED;
990 const Elf_Internal_Sym *sym;
991 const char **namep ATTRIBUTE_UNUSED;
992 flagword *flagsp ATTRIBUTE_UNUSED;
993 asection **secp;
994 bfd_vma *valp;
996 int index = sym->st_shndx;
998 switch (index)
1000 case SHN_PARISC_ANSI_COMMON:
1001 *secp = bfd_make_section_old_way (abfd, ".PARISC.ansi.common");
1002 (*secp)->flags |= SEC_IS_COMMON;
1003 *valp = sym->st_size;
1004 break;
1006 case SHN_PARISC_HUGE_COMMON:
1007 *secp = bfd_make_section_old_way (abfd, ".PARISC.huge.common");
1008 (*secp)->flags |= SEC_IS_COMMON;
1009 *valp = sym->st_size;
1010 break;
1013 return true;
1016 static boolean
1017 elf_hppa_unmark_useless_dynamic_symbols (h, data)
1018 struct elf_link_hash_entry *h;
1019 PTR data;
1021 struct bfd_link_info *info = (struct bfd_link_info *)data;
1023 /* If we are not creating a shared library, and this symbol is
1024 referenced by a shared library but is not defined anywhere, then
1025 the generic code will warn that it is undefined.
1027 This behavior is undesirable on HPs since the standard shared
1028 libraries contain references to undefined symbols.
1030 So we twiddle the flags associated with such symbols so that they
1031 will not trigger the warning. ?!? FIXME. This is horribly fragile.
1033 Ultimately we should have better controls over the generic ELF BFD
1034 linker code. */
1035 if (! info->relocateable
1036 && ! (info->shared
1037 && !info->no_undefined)
1038 && h->root.type == bfd_link_hash_undefined
1039 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0
1040 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
1042 h->elf_link_hash_flags &= ~ELF_LINK_HASH_REF_DYNAMIC;
1043 h->elf_link_hash_flags |= 0x8000;
1046 return true;
1050 static boolean
1051 elf_hppa_remark_useless_dynamic_symbols (h, data)
1052 struct elf_link_hash_entry *h;
1053 PTR data;
1055 struct bfd_link_info *info = (struct bfd_link_info *)data;
1057 /* If we are not creating a shared library, and this symbol is
1058 referenced by a shared library but is not defined anywhere, then
1059 the generic code will warn that it is undefined.
1061 This behavior is undesirable on HPs since the standard shared
1062 libraries contain reerences to undefined symbols.
1064 So we twiddle the flags associated with such symbols so that they
1065 will not trigger the warning. ?!? FIXME. This is horribly fragile.
1067 Ultimately we should have better controls over the generic ELF BFD
1068 linker code. */
1069 if (! info->relocateable
1070 && ! (info->shared
1071 && !info->no_undefined)
1072 && h->root.type == bfd_link_hash_undefined
1073 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
1074 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0
1075 && (h->elf_link_hash_flags & 0x8000) != 0)
1077 h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
1078 h->elf_link_hash_flags &= ~0x8000;
1081 return true;
1084 /* Record the lowest address for the data and text segments. */
1085 static void
1086 elf_hppa_record_segment_addrs (abfd, section, data)
1087 bfd *abfd ATTRIBUTE_UNUSED;
1088 asection *section;
1089 PTR data;
1091 struct elf64_hppa_link_hash_table *hppa_info;
1092 bfd_vma value;
1094 hppa_info = (struct elf64_hppa_link_hash_table *)data;
1096 value = section->vma - section->filepos;
1098 if ((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY)
1099 == (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
1100 && value < hppa_info->text_segment_base)
1101 hppa_info->text_segment_base = value;
1102 else if ((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY)
1103 == (SEC_ALLOC | SEC_LOAD))
1104 && value < hppa_info->data_segment_base)
1105 hppa_info->data_segment_base = value;
1108 /* Called after we have seen all the input files/sections, but before
1109 final symbol resolution and section placement has been determined.
1111 We use this hook to (possibly) provide a value for __gp, then we
1112 fall back to the generic ELF final link routine. */
1114 static boolean
1115 elf_hppa_final_link (abfd, info)
1116 bfd *abfd;
1117 struct bfd_link_info *info;
1119 boolean retval;
1121 if (! info->relocateable)
1123 struct elf_link_hash_entry *gp;
1124 bfd_vma gp_val;
1125 struct elf64_hppa_link_hash_table *hppa_info;
1127 hppa_info = elf64_hppa_hash_table (info);
1129 /* The linker script defines a value for __gp iff it was referenced
1130 by one of the objects being linked. First try to find the symbol
1131 in the hash table. If that fails, just compute the value __gp
1132 should have had. */
1133 gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", false,
1134 false, false);
1136 if (gp)
1139 /* Adjust the value of __gp as we may want to slide it into the
1140 .plt section so that the stubs can access PLT entries without
1141 using an addil sequence. */
1142 gp->root.u.def.value += elf64_hppa_hash_table (info)->gp_offset;
1144 gp_val = (gp->root.u.def.section->output_section->vma
1145 + gp->root.u.def.section->output_offset
1146 + gp->root.u.def.value);
1148 else
1150 asection *sec;
1153 /* First look for a .plt section. If found, then __gp is the
1154 address of the .plt + gp_offset.
1156 If no .plt is found, then look for .dlt, .opd and .data (in
1157 that order) and set __gp to the base address of whichever section
1158 is found first. */
1160 sec = hppa_info->plt_sec;
1161 if (sec)
1162 gp_val = (sec->output_offset
1163 + sec->output_section->vma
1164 + hppa_info->gp_offset);
1165 else
1167 sec = hppa_info->dlt_sec;
1168 if (!sec)
1169 sec = hppa_info->opd_sec;
1170 if (!sec)
1171 sec = bfd_get_section_by_name (abfd, ".data");
1172 if (!sec)
1173 return false;
1175 gp_val = sec->output_offset + sec->output_section->vma;
1179 /* Install whatever value we found/computed for __gp. */
1180 _bfd_set_gp_value (abfd, gp_val);
1183 /* We need to know the base of the text and data segments so that we
1184 can perform SEGREL relocations. We will recore the base addresses
1185 when we encounter the first SEGREL relocation. */
1186 elf64_hppa_hash_table (info)->text_segment_base = (bfd_vma)-1;
1187 elf64_hppa_hash_table (info)->data_segment_base = (bfd_vma)-1;
1189 /* HP's shared libraries have references to symbols that are not
1190 defined anywhere. The generic ELF BFD linker code will complaim
1191 about such symbols.
1193 So we detect the losing case and arrange for the flags on the symbol
1194 to indicate that it was never referenced. This keeps the generic
1195 ELF BFD link code happy and appears to not create any secondary
1196 problems. Ultimately we need a way to control the behavior of the
1197 generic ELF BFD link code better. */
1198 elf_link_hash_traverse (elf_hash_table (info),
1199 elf_hppa_unmark_useless_dynamic_symbols,
1200 info);
1202 /* Invoke the regular ELF backend linker to do all the work. */
1203 retval = bfd_elf_bfd_final_link (abfd, info);
1205 elf_link_hash_traverse (elf_hash_table (info),
1206 elf_hppa_remark_useless_dynamic_symbols,
1207 info);
1209 return retval;
1212 /* Relocate an HPPA ELF section. */
1214 static boolean
1215 elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
1216 contents, relocs, local_syms, local_sections)
1217 bfd *output_bfd;
1218 struct bfd_link_info *info;
1219 bfd *input_bfd;
1220 asection *input_section;
1221 bfd_byte *contents;
1222 Elf_Internal_Rela *relocs;
1223 Elf_Internal_Sym *local_syms;
1224 asection **local_sections;
1226 Elf_Internal_Shdr *symtab_hdr;
1227 Elf_Internal_Rela *rel;
1228 Elf_Internal_Rela *relend;
1229 struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
1231 symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
1233 rel = relocs;
1234 relend = relocs + input_section->reloc_count;
1235 for (; rel < relend; rel++)
1237 int r_type;
1238 reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
1239 unsigned long r_symndx;
1240 struct elf_link_hash_entry *h;
1241 Elf_Internal_Sym *sym;
1242 asection *sym_sec;
1243 bfd_vma relocation;
1244 bfd_reloc_status_type r;
1245 const char *sym_name;
1246 char *dyn_name;
1247 char *dynh_buf = NULL;
1248 size_t dynh_buflen = 0;
1249 struct elf64_hppa_dyn_hash_entry *dyn_h = NULL;
1251 r_type = ELF_R_TYPE (rel->r_info);
1252 if (r_type < 0 || r_type >= (int) R_PARISC_UNIMPLEMENTED)
1254 bfd_set_error (bfd_error_bad_value);
1255 return false;
1258 r_symndx = ELF_R_SYM (rel->r_info);
1260 if (info->relocateable)
1262 /* This is a relocateable link. We don't have to change
1263 anything, unless the reloc is against a section symbol,
1264 in which case we have to adjust according to where the
1265 section symbol winds up in the output section. */
1266 if (r_symndx < symtab_hdr->sh_info)
1268 sym = local_syms + r_symndx;
1269 if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
1271 sym_sec = local_sections[r_symndx];
1272 rel->r_addend += sym_sec->output_offset;
1276 continue;
1279 /* This is a final link. */
1280 h = NULL;
1281 sym = NULL;
1282 sym_sec = NULL;
1283 if (r_symndx < symtab_hdr->sh_info)
1285 /* This is a local symbol. */
1286 sym = local_syms + r_symndx;
1287 sym_sec = local_sections[r_symndx];
1288 relocation = ((ELF_ST_TYPE (sym->st_info) == STT_SECTION
1289 ? 0 : sym->st_value)
1290 + sym_sec->output_offset
1291 + sym_sec->output_section->vma);
1293 /* If this symbol has an entry in the PA64 dynamic hash
1294 table, then get it. */
1295 dyn_name = get_dyn_name (input_bfd, h, rel,
1296 &dynh_buf, &dynh_buflen);
1297 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1298 dyn_name, false, false);
1301 else
1303 /* This is not a local symbol. */
1304 long indx;
1306 indx = r_symndx - symtab_hdr->sh_info;
1307 h = elf_sym_hashes (input_bfd)[indx];
1308 while (h->root.type == bfd_link_hash_indirect
1309 || h->root.type == bfd_link_hash_warning)
1310 h = (struct elf_link_hash_entry *) h->root.u.i.link;
1311 if (h->root.type == bfd_link_hash_defined
1312 || h->root.type == bfd_link_hash_defweak)
1314 sym_sec = h->root.u.def.section;
1316 /* If this symbol has an entry in the PA64 dynamic hash
1317 table, then get it. */
1318 dyn_name = get_dyn_name (input_bfd, h, rel,
1319 &dynh_buf, &dynh_buflen);
1320 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1321 dyn_name, false, false);
1323 /* If we have a relocation against a symbol defined in a
1324 shared library and we have not created an entry in the
1325 PA64 dynamic symbol hash table for it, then we lose. */
1326 if (sym_sec->output_section == NULL && dyn_h == NULL)
1328 (*_bfd_error_handler)
1329 (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
1330 bfd_get_filename (input_bfd), h->root.root.string,
1331 bfd_get_section_name (input_bfd, input_section));
1332 relocation = 0;
1334 else if (sym_sec->output_section)
1335 relocation = (h->root.u.def.value
1336 + sym_sec->output_offset
1337 + sym_sec->output_section->vma);
1338 /* Value will be provided via one of the offsets in the
1339 dyn_h hash table entry. */
1340 else
1341 relocation = 0;
1343 /* Allow undefined symbols in shared libraries. */
1344 else if (info->shared && !info->no_undefined
1345 && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
1347 if (info->symbolic)
1348 (*info->callbacks->undefined_symbol)
1349 (info, h->root.root.string, input_bfd,
1350 input_section, rel->r_offset, false);
1352 /* If this symbol has an entry in the PA64 dynamic hash
1353 table, then get it. */
1354 dyn_name = get_dyn_name (input_bfd, h, rel,
1355 &dynh_buf, &dynh_buflen);
1356 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1357 dyn_name, false, false);
1359 if (dyn_h == NULL)
1361 (*_bfd_error_handler)
1362 (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
1363 bfd_get_filename (input_bfd), h->root.root.string,
1364 bfd_get_section_name (input_bfd, input_section));
1365 relocation = 0;
1367 relocation = 0;
1369 else if (h->root.type == bfd_link_hash_undefweak)
1370 relocation = 0;
1371 else
1373 if (!((*info->callbacks->undefined_symbol)
1374 (info, h->root.root.string, input_bfd,
1375 input_section, rel->r_offset, true)))
1376 return false;
1377 break;
1381 if (h != NULL)
1382 sym_name = h->root.root.string;
1383 else
1385 sym_name = bfd_elf_string_from_elf_section (input_bfd,
1386 symtab_hdr->sh_link,
1387 sym->st_name);
1388 if (sym_name == NULL)
1389 return false;
1390 if (*sym_name == '\0')
1391 sym_name = bfd_section_name (input_bfd, sym_sec);
1394 r = elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
1395 input_section, contents,
1396 relocation, info, sym_sec,
1397 h, dyn_h);
1399 if (r != bfd_reloc_ok)
1401 switch (r)
1403 default:
1404 abort ();
1405 case bfd_reloc_overflow:
1407 if (!((*info->callbacks->reloc_overflow)
1408 (info, sym_name, howto->name, (bfd_vma) 0,
1409 input_bfd, input_section, rel->r_offset)))
1410 return false;
1412 break;
1416 return true;
1420 /* Compute the value for a relocation (REL) during a final link stage,
1421 then insert the value into the proper location in CONTENTS.
1423 VALUE is a tentative value for the relocation and may be overridden
1424 and modified here based on the specific relocation to be performed.
1426 For example we do conversions for PC-relative branches in this routine
1427 or redirection of calls to external routines to stubs.
1429 The work of actually applying the relocation is left to a helper
1430 routine in an attempt to reduce the complexity and size of this
1431 function. */
1433 static bfd_reloc_status_type
1434 elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
1435 input_section, contents, value,
1436 info, sym_sec, h, dyn_h)
1437 Elf_Internal_Rela *rel;
1438 bfd *input_bfd;
1439 bfd *output_bfd;
1440 asection *input_section;
1441 bfd_byte *contents;
1442 bfd_vma value;
1443 struct bfd_link_info *info;
1444 asection *sym_sec;
1445 struct elf_link_hash_entry *h;
1446 struct elf64_hppa_dyn_hash_entry *dyn_h;
1448 unsigned int insn;
1449 bfd_vma offset = rel->r_offset;
1450 bfd_vma addend = rel->r_addend;
1451 reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
1452 unsigned int r_type = howto->type;
1453 bfd_byte *hit_data = contents + offset;
1454 struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
1456 insn = bfd_get_32 (input_bfd, hit_data);
1458 switch (r_type)
1460 case R_PARISC_NONE:
1461 break;
1463 /* Basic function call support. I'm not entirely sure if PCREL14F is
1464 actually needed or even handled correctly.
1466 Note for a call to a function defined in another dynamic library
1467 we want to redirect the call to a stub. */
1469 /* Random PC relative relocs. */
1470 case R_PARISC_PCREL21L:
1471 case R_PARISC_PCREL14R:
1472 case R_PARISC_PCREL14F:
1473 case R_PARISC_PCREL14WR:
1474 case R_PARISC_PCREL14DR:
1475 case R_PARISC_PCREL16F:
1476 case R_PARISC_PCREL16WF:
1477 case R_PARISC_PCREL16DF:
1479 /* If this is a call to a function defined in another dynamic
1480 library, then redirect the call to the local stub for this
1481 function. */
1482 if (sym_sec == NULL || sym_sec->output_section == NULL)
1483 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1484 + hppa_info->stub_sec->output_section->vma);
1486 /* Turn VALUE into a proper PC relative address. */
1487 value -= (offset + input_section->output_offset
1488 + input_section->output_section->vma);
1490 /* Adjust for any field selectors. */
1491 if (r_type == R_PARISC_PCREL21L)
1492 value = hppa_field_adjust (value, -8 + addend, e_lsel);
1493 else if (r_type == R_PARISC_PCREL14F
1494 || r_type == R_PARISC_PCREL16F
1495 || r_type == R_PARISC_PCREL16WF
1496 || r_type == R_PARISC_PCREL16DF)
1497 value = hppa_field_adjust (value, -8 + addend, e_fsel);
1498 else
1499 value = hppa_field_adjust (value, -8 + addend, e_rsel);
1501 /* Apply the relocation to the given instruction. */
1502 insn = elf_hppa_relocate_insn (insn, value, r_type);
1503 break;
1506 case R_PARISC_PCREL22F:
1507 case R_PARISC_PCREL17F:
1508 case R_PARISC_PCREL22C:
1509 case R_PARISC_PCREL17C:
1510 case R_PARISC_PCREL17R:
1512 /* If this is a call to a function defined in another dynamic
1513 library, then redirect the call to the local stub for this
1514 function. */
1515 if (sym_sec == NULL || sym_sec->output_section == NULL)
1516 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1517 + hppa_info->stub_sec->output_section->vma);
1519 /* Turn VALUE into a proper PC relative address. */
1520 value -= (offset + input_section->output_offset
1521 + input_section->output_section->vma);
1523 /* Adjust for any field selectors. */
1524 value = hppa_field_adjust (value, -8 + addend, e_fsel);
1526 /* All branches are implicitly shifted by 2 places. */
1527 value >>= 2;
1529 /* Apply the relocation to the given instruction. */
1530 insn = elf_hppa_relocate_insn (insn, value, r_type);
1531 break;
1534 /* Indirect references to data through the DLT. */
1535 case R_PARISC_DLTIND14R:
1536 case R_PARISC_DLTIND14F:
1537 case R_PARISC_DLTIND14DR:
1538 case R_PARISC_DLTIND14WR:
1539 case R_PARISC_DLTIND21L:
1540 case R_PARISC_LTOFF_FPTR14R:
1541 case R_PARISC_LTOFF_FPTR14DR:
1542 case R_PARISC_LTOFF_FPTR14WR:
1543 case R_PARISC_LTOFF_FPTR21L:
1544 case R_PARISC_LTOFF_FPTR16F:
1545 case R_PARISC_LTOFF_FPTR16WF:
1546 case R_PARISC_LTOFF_FPTR16DF:
1547 case R_PARISC_LTOFF_TP21L:
1548 case R_PARISC_LTOFF_TP14R:
1549 case R_PARISC_LTOFF_TP14F:
1550 case R_PARISC_LTOFF_TP14WR:
1551 case R_PARISC_LTOFF_TP14DR:
1552 case R_PARISC_LTOFF_TP16F:
1553 case R_PARISC_LTOFF_TP16WF:
1554 case R_PARISC_LTOFF_TP16DF:
1555 case R_PARISC_LTOFF16F:
1556 case R_PARISC_LTOFF16WF:
1557 case R_PARISC_LTOFF16DF:
1559 /* If this relocation was against a local symbol, then we still
1560 have not set up the DLT entry (it's not convienent to do so
1561 in the "finalize_dlt" routine because it is difficult to get
1562 to the local symbol's value).
1564 So, if this is a local symbol (h == NULL), then we need to
1565 fill in its DLT entry.
1567 Similarly we may still need to set up an entry in .opd for
1568 a local function which had its address taken. */
1569 if (dyn_h->h == NULL)
1571 bfd_put_64 (hppa_info->dlt_sec->owner,
1572 value,
1573 hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
1575 /* Now handle .opd creation if needed. */
1576 if (r_type == R_PARISC_LTOFF_FPTR14R
1577 || r_type == R_PARISC_LTOFF_FPTR14DR
1578 || r_type == R_PARISC_LTOFF_FPTR14WR
1579 || r_type == R_PARISC_LTOFF_FPTR21L
1580 || r_type == R_PARISC_LTOFF_FPTR16F
1581 || r_type == R_PARISC_LTOFF_FPTR16WF
1582 || r_type == R_PARISC_LTOFF_FPTR16DF)
1584 /* The first two words of an .opd entry are zero. */
1585 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset,
1586 0, 16);
1588 /* The next word is the address of the function. */
1589 bfd_put_64 (hppa_info->opd_sec->owner, value,
1590 (hppa_info->opd_sec->contents
1591 + dyn_h->opd_offset + 16));
1593 /* The last word is our local __gp value. */
1594 value = _bfd_get_gp_value
1595 (hppa_info->opd_sec->output_section->owner);
1596 bfd_put_64 (hppa_info->opd_sec->owner, value,
1597 (hppa_info->opd_sec->contents
1598 + dyn_h->opd_offset + 24));
1602 /* We want the value of the DLT offset for this symbol, not
1603 the symbol's actual address. Note that __gp may not point
1604 to the start of the DLT, so we have to compute the absolute
1605 address, then subtract out the value of __gp. */
1606 value = (dyn_h->dlt_offset
1607 + hppa_info->dlt_sec->output_offset
1608 + hppa_info->dlt_sec->output_section->vma);
1609 value -= _bfd_get_gp_value (output_bfd);
1611 /* All DLTIND relocations are basically the same at this point,
1612 except that we need different field selectors for the 21bit
1613 version vs the 14bit versions. */
1614 if (r_type == R_PARISC_DLTIND21L
1615 || r_type == R_PARISC_LTOFF_FPTR21L
1616 || r_type == R_PARISC_LTOFF_TP21L)
1617 value = hppa_field_adjust (value, addend, e_lrsel);
1618 else if (r_type == R_PARISC_DLTIND14F
1619 || r_type == R_PARISC_LTOFF_FPTR16F
1620 || r_type == R_PARISC_LTOFF_FPTR16WF
1621 || r_type == R_PARISC_LTOFF_FPTR16DF
1622 || r_type == R_PARISC_LTOFF16F
1623 || r_type == R_PARISC_LTOFF16DF
1624 || r_type == R_PARISC_LTOFF16WF
1625 || r_type == R_PARISC_LTOFF_TP16F
1626 || r_type == R_PARISC_LTOFF_TP16WF
1627 || r_type == R_PARISC_LTOFF_TP16DF)
1628 value = hppa_field_adjust (value, addend, e_fsel);
1629 else
1630 value = hppa_field_adjust (value, addend, e_rrsel);
1632 insn = elf_hppa_relocate_insn (insn, value, r_type);
1633 break;
1636 case R_PARISC_DLTREL14R:
1637 case R_PARISC_DLTREL14F:
1638 case R_PARISC_DLTREL14DR:
1639 case R_PARISC_DLTREL14WR:
1640 case R_PARISC_DLTREL21L:
1641 case R_PARISC_DPREL21L:
1642 case R_PARISC_DPREL14WR:
1643 case R_PARISC_DPREL14DR:
1644 case R_PARISC_DPREL14R:
1645 case R_PARISC_DPREL14F:
1646 case R_PARISC_GPREL16F:
1647 case R_PARISC_GPREL16WF:
1648 case R_PARISC_GPREL16DF:
1650 /* Subtract out the global pointer value to make value a DLT
1651 relative address. */
1652 value -= _bfd_get_gp_value (output_bfd);
1654 /* All DLTREL relocations are basically the same at this point,
1655 except that we need different field selectors for the 21bit
1656 version vs the 14bit versions. */
1657 if (r_type == R_PARISC_DLTREL21L
1658 || r_type == R_PARISC_DPREL21L)
1659 value = hppa_field_adjust (value, addend, e_lrsel);
1660 else if (r_type == R_PARISC_DLTREL14F
1661 || r_type == R_PARISC_DPREL14F
1662 || r_type == R_PARISC_GPREL16F
1663 || r_type == R_PARISC_GPREL16WF
1664 || r_type == R_PARISC_GPREL16DF)
1665 value = hppa_field_adjust (value, addend, e_fsel);
1666 else
1667 value = hppa_field_adjust (value, addend, e_rrsel);
1669 insn = elf_hppa_relocate_insn (insn, value, r_type);
1670 break;
1673 case R_PARISC_DIR21L:
1674 case R_PARISC_DIR17R:
1675 case R_PARISC_DIR17F:
1676 case R_PARISC_DIR14R:
1677 case R_PARISC_DIR14WR:
1678 case R_PARISC_DIR14DR:
1679 case R_PARISC_DIR16F:
1680 case R_PARISC_DIR16WF:
1681 case R_PARISC_DIR16DF:
1683 /* All DIR relocations are basically the same at this point,
1684 except that we need different field selectors for the 21bit
1685 version vs the 14bit versions. */
1687 if (r_type == R_PARISC_DIR21L)
1688 value = hppa_field_adjust (value, addend, e_lrsel);
1689 else if (r_type == R_PARISC_DIR17F
1690 || r_type == R_PARISC_DIR16F
1691 || r_type == R_PARISC_DIR16WF
1692 || r_type == R_PARISC_DIR16DF)
1693 value = hppa_field_adjust (value, addend, e_fsel);
1694 else
1695 value = hppa_field_adjust (value, addend, e_rrsel);
1697 insn = elf_hppa_relocate_insn (insn, value, r_type);
1698 break;
1701 case R_PARISC_PLTOFF21L:
1702 case R_PARISC_PLTOFF14R:
1703 case R_PARISC_PLTOFF14F:
1704 case R_PARISC_PLTOFF14WR:
1705 case R_PARISC_PLTOFF14DR:
1706 case R_PARISC_PLTOFF16F:
1707 case R_PARISC_PLTOFF16WF:
1708 case R_PARISC_PLTOFF16DF:
1710 /* We want the value of the PLT offset for this symbol, not
1711 the symbol's actual address. Note that __gp may not point
1712 to the start of the DLT, so we have to compute the absolute
1713 address, then subtract out the value of __gp. */
1714 value = (dyn_h->plt_offset
1715 + hppa_info->plt_sec->output_offset
1716 + hppa_info->plt_sec->output_section->vma);
1717 value -= _bfd_get_gp_value (output_bfd);
1719 /* All PLTOFF relocations are basically the same at this point,
1720 except that we need different field selectors for the 21bit
1721 version vs the 14bit versions. */
1722 if (r_type == R_PARISC_PLTOFF21L)
1723 value = hppa_field_adjust (value, addend, e_lrsel);
1724 else if (r_type == R_PARISC_PLTOFF14F
1725 || r_type == R_PARISC_PLTOFF16F
1726 || r_type == R_PARISC_PLTOFF16WF
1727 || r_type == R_PARISC_PLTOFF16DF)
1728 value = hppa_field_adjust (value, addend, e_fsel);
1729 else
1730 value = hppa_field_adjust (value, addend, e_rrsel);
1732 insn = elf_hppa_relocate_insn (insn, value, r_type);
1733 break;
1736 case R_PARISC_LTOFF_FPTR32:
1738 /* We may still need to create the FPTR itself if it was for
1739 a local symbol. */
1740 if (dyn_h->h == NULL)
1742 /* The first two words of an .opd entry are zero. */
1743 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
1745 /* The next word is the address of the function. */
1746 bfd_put_64 (hppa_info->opd_sec->owner, value,
1747 (hppa_info->opd_sec->contents
1748 + dyn_h->opd_offset + 16));
1750 /* The last word is our local __gp value. */
1751 value = _bfd_get_gp_value
1752 (hppa_info->opd_sec->output_section->owner);
1753 bfd_put_64 (hppa_info->opd_sec->owner, value,
1754 hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
1757 /* We want the value of the DLT offset for this symbol, not
1758 the symbol's actual address. Note that __gp may not point
1759 to the start of the DLT, so we have to compute the absolute
1760 address, then subtract out the value of __gp. */
1761 value = (dyn_h->dlt_offset
1762 + hppa_info->dlt_sec->output_offset
1763 + hppa_info->dlt_sec->output_section->vma);
1764 value -= _bfd_get_gp_value (output_bfd);
1765 bfd_put_32 (input_bfd, value, hit_data);
1766 return bfd_reloc_ok;
1769 case R_PARISC_LTOFF_FPTR64:
1770 case R_PARISC_LTOFF_TP64:
1772 /* We may still need to create the FPTR itself if it was for
1773 a local symbol. */
1774 if (dyn_h->h == NULL && r_type == R_PARISC_LTOFF_FPTR64)
1776 /* The first two words of an .opd entry are zero. */
1777 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
1779 /* The next word is the address of the function. */
1780 bfd_put_64 (hppa_info->opd_sec->owner, value,
1781 (hppa_info->opd_sec->contents
1782 + dyn_h->opd_offset + 16));
1784 /* The last word is our local __gp value. */
1785 value = _bfd_get_gp_value
1786 (hppa_info->opd_sec->output_section->owner);
1787 bfd_put_64 (hppa_info->opd_sec->owner, value,
1788 hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
1791 /* We want the value of the DLT offset for this symbol, not
1792 the symbol's actual address. Note that __gp may not point
1793 to the start of the DLT, so we have to compute the absolute
1794 address, then subtract out the value of __gp. */
1795 value = (dyn_h->dlt_offset
1796 + hppa_info->dlt_sec->output_offset
1797 + hppa_info->dlt_sec->output_section->vma);
1798 value -= _bfd_get_gp_value (output_bfd);
1799 bfd_put_64 (input_bfd, value, hit_data);
1800 return bfd_reloc_ok;
1803 case R_PARISC_DIR32:
1804 bfd_put_32 (input_bfd, value + addend, hit_data);
1805 return bfd_reloc_ok;
1807 case R_PARISC_DIR64:
1808 bfd_put_64 (input_bfd, value + addend, hit_data);
1809 return bfd_reloc_ok;
1811 case R_PARISC_GPREL64:
1812 /* Subtract out the global pointer value to make value a DLT
1813 relative address. */
1814 value -= _bfd_get_gp_value (output_bfd);
1815 value += addend;
1817 bfd_put_64 (input_bfd, value + addend, hit_data);
1818 return bfd_reloc_ok;
1820 case R_PARISC_LTOFF64:
1821 /* We want the value of the DLT offset for this symbol, not
1822 the symbol's actual address. Note that __gp may not point
1823 to the start of the DLT, so we have to compute the absolute
1824 address, then subtract out the value of __gp. */
1825 value = (dyn_h->dlt_offset
1826 + hppa_info->dlt_sec->output_offset
1827 + hppa_info->dlt_sec->output_section->vma);
1828 value -= _bfd_get_gp_value (output_bfd);
1830 bfd_put_64 (input_bfd, value + addend, hit_data);
1831 return bfd_reloc_ok;
1833 case R_PARISC_PCREL32:
1835 /* If this is a call to a function defined in another dynamic
1836 library, then redirect the call to the local stub for this
1837 function. */
1838 if (sym_sec == NULL || sym_sec->output_section == NULL)
1839 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1840 + hppa_info->stub_sec->output_section->vma);
1842 /* Turn VALUE into a proper PC relative address. */
1843 value -= (offset + input_section->output_offset
1844 + input_section->output_section->vma);
1846 value += addend;
1847 value -= 8;
1848 bfd_put_64 (input_bfd, value, hit_data);
1849 return bfd_reloc_ok;
1852 case R_PARISC_PCREL64:
1854 /* If this is a call to a function defined in another dynamic
1855 library, then redirect the call to the local stub for this
1856 function. */
1857 if (sym_sec == NULL || sym_sec->output_section == NULL)
1858 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1859 + hppa_info->stub_sec->output_section->vma);
1862 /* Turn VALUE into a proper PC relative address. */
1863 value -= (offset + input_section->output_offset
1864 + input_section->output_section->vma);
1866 value += addend;
1867 value -= 8;
1868 bfd_put_64 (input_bfd, value, hit_data);
1869 return bfd_reloc_ok;
1873 case R_PARISC_FPTR64:
1875 /* We may still need to create the FPTR itself if it was for
1876 a local symbol. */
1877 if (dyn_h->h == NULL)
1879 /* The first two words of an .opd entry are zero. */
1880 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
1882 /* The next word is the address of the function. */
1883 bfd_put_64 (hppa_info->opd_sec->owner, value,
1884 (hppa_info->opd_sec->contents
1885 + dyn_h->opd_offset + 16));
1887 /* The last word is our local __gp value. */
1888 value = _bfd_get_gp_value
1889 (hppa_info->opd_sec->output_section->owner);
1890 bfd_put_64 (hppa_info->opd_sec->owner, value,
1891 hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
1894 /* We want the value of the OPD offset for this symbol, not
1895 the symbol's actual address. */
1896 value = (dyn_h->opd_offset
1897 + hppa_info->opd_sec->output_offset
1898 + hppa_info->opd_sec->output_section->vma);
1900 bfd_put_64 (input_bfd, value + addend, hit_data);
1901 return bfd_reloc_ok;
1904 case R_PARISC_SECREL32:
1905 bfd_put_32 (input_bfd,
1906 (value + addend
1907 - sym_sec->output_section->vma),
1908 hit_data);
1909 return bfd_reloc_ok;
1911 case R_PARISC_SEGREL32:
1912 case R_PARISC_SEGREL64:
1914 /* If this is the first SEGREL relocation, then initialize
1915 the segment base values. */
1916 if (hppa_info->text_segment_base == (bfd_vma) -1)
1917 bfd_map_over_sections (output_bfd, elf_hppa_record_segment_addrs,
1918 elf64_hppa_hash_table (info));
1920 /* VALUE holds the absolute address. We want to include the
1921 addend, then turn it into a segment relative address.
1923 The segment is derived from SYM_SEC. We assume that there are
1924 only two segments of note in the resulting executable/shlib.
1925 A readonly segment (.text) and a readwrite segment (.data). */
1926 value += addend;
1928 if (sym_sec->flags & SEC_CODE)
1929 value -= hppa_info->text_segment_base;
1930 else
1931 value -= hppa_info->data_segment_base;
1933 if (r_type == R_PARISC_SEGREL32)
1934 bfd_put_32 (input_bfd, value, hit_data);
1935 else
1936 bfd_put_64 (input_bfd, value, hit_data);
1937 return bfd_reloc_ok;
1941 /* Something we don't know how to handle. */
1942 default:
1943 return bfd_reloc_notsupported;
1946 /* Update the instruction word. */
1947 bfd_put_32 (input_bfd, insn, hit_data);
1948 return (bfd_reloc_ok);
1951 /* Relocate the given INSN. VALUE should be the actual value we want
1952 to insert into the instruction, ie by this point we should not be
1953 concerned with computing an offset relative to the DLT, PC, etc.
1954 Instead this routine is meant to handle the bit manipulations needed
1955 to insert the relocation into the given instruction. */
1957 static unsigned int
1958 elf_hppa_relocate_insn (insn, sym_value, r_type)
1959 unsigned int insn;
1960 unsigned int sym_value;
1961 unsigned int r_type;
1963 switch (r_type)
1965 /* This is any 22bit branch. In PA2.0 syntax it corresponds to
1966 the "B" instruction. */
1967 case R_PARISC_PCREL22F:
1968 case R_PARISC_PCREL22C:
1969 return re_assemble_22 (insn & ~ 0x3ff1ffd, sym_value);
1971 /* This is any 17bit branch. In PA2.0 syntax it also corresponds to
1972 the "B" instruction as well as BE. */
1973 case R_PARISC_PCREL17F:
1974 case R_PARISC_DIR17F:
1975 case R_PARISC_DIR17R:
1976 case R_PARISC_PCREL17C:
1977 case R_PARISC_PCREL17R:
1978 return re_assemble_17 (insn & ~ 0x1f1ffd, sym_value);
1980 /* ADDIL or LDIL instructions. */
1981 case R_PARISC_DLTREL21L:
1982 case R_PARISC_DLTIND21L:
1983 case R_PARISC_LTOFF_FPTR21L:
1984 case R_PARISC_PCREL21L:
1985 case R_PARISC_LTOFF_TP21L:
1986 case R_PARISC_DPREL21L:
1987 case R_PARISC_PLTOFF21L:
1988 case R_PARISC_DIR21L:
1989 return re_assemble_21 (insn & ~ 0x1fffff, sym_value);
1991 /* LDO and integer loads/stores with 14bit displacements. */
1992 case R_PARISC_DLTREL14R:
1993 case R_PARISC_DLTREL14F:
1994 case R_PARISC_DLTIND14R:
1995 case R_PARISC_DLTIND14F:
1996 case R_PARISC_LTOFF_FPTR14R:
1997 case R_PARISC_LTOFF_FPTR16F:
1998 case R_PARISC_PCREL14R:
1999 case R_PARISC_PCREL14F:
2000 case R_PARISC_PCREL16F:
2001 case R_PARISC_LTOFF_TP14R:
2002 case R_PARISC_LTOFF_TP14F:
2003 case R_PARISC_LTOFF_TP16F:
2004 case R_PARISC_DPREL14R:
2005 case R_PARISC_DPREL14F:
2006 case R_PARISC_GPREL16F:
2007 case R_PARISC_PLTOFF14R:
2008 case R_PARISC_PLTOFF14F:
2009 case R_PARISC_PLTOFF16F:
2010 case R_PARISC_DIR14R:
2011 case R_PARISC_DIR16F:
2012 case R_PARISC_LTOFF16F:
2013 return (insn & ~ 0x3fff) | low_sign_unext (sym_value, 14);
2015 /* Doubleword loads and stores with a 14bit displacement. */
2016 case R_PARISC_DLTREL14DR:
2017 case R_PARISC_DLTIND14DR:
2018 case R_PARISC_LTOFF_FPTR14DR:
2019 case R_PARISC_LTOFF_FPTR16DF:
2020 case R_PARISC_PCREL14DR:
2021 case R_PARISC_PCREL16DF:
2022 case R_PARISC_LTOFF_TP14DR:
2023 case R_PARISC_LTOFF_TP16DF:
2024 case R_PARISC_DPREL14DR:
2025 case R_PARISC_GPREL16DF:
2026 case R_PARISC_PLTOFF14DR:
2027 case R_PARISC_PLTOFF16DF:
2028 case R_PARISC_DIR14DR:
2029 case R_PARISC_DIR16DF:
2030 case R_PARISC_LTOFF16DF:
2031 return (insn & ~ 0x3ff1) | (((sym_value & 0x2000) >> 13)
2032 | ((sym_value & 0x1ff8) << 1));
2034 /* Floating point single word load/store instructions. */
2035 case R_PARISC_DLTREL14WR:
2036 case R_PARISC_DLTIND14WR:
2037 case R_PARISC_LTOFF_FPTR14WR:
2038 case R_PARISC_LTOFF_FPTR16WF:
2039 case R_PARISC_PCREL14WR:
2040 case R_PARISC_PCREL16WF:
2041 case R_PARISC_LTOFF_TP14WR:
2042 case R_PARISC_LTOFF_TP16WF:
2043 case R_PARISC_DPREL14WR:
2044 case R_PARISC_GPREL16WF:
2045 case R_PARISC_PLTOFF14WR:
2046 case R_PARISC_PLTOFF16WF:
2047 case R_PARISC_DIR16WF:
2048 case R_PARISC_DIR14WR:
2049 case R_PARISC_LTOFF16WF:
2050 return (insn & ~ 0x3ff9) | (((sym_value & 0x2000) >> 13)
2051 | ((sym_value & 0x1ffc) << 1));
2053 default:
2054 return insn;
2057 #endif