2001-01-03 Philip Blundell <pb@futuretv.com>
[binutils.git] / bfd / elf-hppa.h
blobad049ddcc21b7a50997dbe58507649ac46e6c472
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, unsigned 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 static void elf_hppa_final_write_processing
66 PARAMS ((bfd *, boolean));
68 #if ARCH_SIZE == 64
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
99 /* ELF/PA relocation howto entries. */
101 static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
103 { R_PARISC_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield,
104 bfd_elf_generic_reloc, "R_PARISC_NONE", false, 0, 0, false },
106 /* The values in DIR32 are to placate the check in
107 _bfd_stab_section_find_nearest_line. */
108 { R_PARISC_DIR32, 0, 2, 32, false, 0, complain_overflow_bitfield,
109 bfd_elf_generic_reloc, "R_PARISC_DIR32", false, 0, 0xffffffff, false },
110 { R_PARISC_DIR21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
111 bfd_elf_generic_reloc, "R_PARISC_DIR21L", false, 0, 0, false },
112 { R_PARISC_DIR17R, 0, 0, 17, false, 0, complain_overflow_bitfield,
113 bfd_elf_generic_reloc, "R_PARISC_DIR17R", false, 0, 0, false },
114 { R_PARISC_DIR17F, 0, 0, 17, false, 0, complain_overflow_bitfield,
115 bfd_elf_generic_reloc, "R_PARISC_DIR17F", false, 0, 0, false },
116 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
117 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
118 { R_PARISC_DIR14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
119 bfd_elf_generic_reloc, "R_PARISC_DIR14R", false, 0, 0, false },
120 { R_PARISC_DIR14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
121 bfd_elf_generic_reloc, "R_PARISC_DIR14F", false, 0, 0, false },
122 /* 8 */
123 { R_PARISC_PCREL12F, 0, 0, 12, true, 0, complain_overflow_bitfield,
124 bfd_elf_generic_reloc, "R_PARISC_PCREL12F", 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 },
127 { R_PARISC_PCREL21L, 0, 0, 21, true, 0, complain_overflow_bitfield,
128 bfd_elf_generic_reloc, "R_PARISC_PCREL21L", false, 0, 0, false },
129 { R_PARISC_PCREL17R, 0, 0, 17, true, 0, complain_overflow_bitfield,
130 bfd_elf_generic_reloc, "R_PARISC_PCREL17R", false, 0, 0, false },
131 { R_PARISC_PCREL17F, 0, 0, 17, true, 0, complain_overflow_bitfield,
132 bfd_elf_generic_reloc, "R_PARISC_PCREL17F", false, 0, 0, false },
133 { R_PARISC_PCREL17C, 0, 0, 17, true, 0, complain_overflow_bitfield,
134 bfd_elf_generic_reloc, "R_PARISC_PCREL17C", false, 0, 0, false },
135 { R_PARISC_PCREL14R, 0, 0, 14, true, 0, complain_overflow_bitfield,
136 bfd_elf_generic_reloc, "R_PARISC_PCREL14R", false, 0, 0, false },
137 { R_PARISC_PCREL14F, 0, 0, 14, true, 0, complain_overflow_bitfield,
138 bfd_elf_generic_reloc, "R_PARISC_PCREL14F", false, 0, 0, false },
139 /* 16 */
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 },
148 { R_PARISC_DPREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
149 bfd_elf_generic_reloc, "R_PARISC_DPREL14DR", 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_DPREL14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
153 bfd_elf_generic_reloc, "R_PARISC_DPREL14R", false, 0, 0, false },
154 { R_PARISC_DPREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
155 bfd_elf_generic_reloc, "R_PARISC_DPREL14F", false, 0, 0, false },
156 /* 24 */
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 },
169 { R_PARISC_DLTREL14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
170 bfd_elf_generic_reloc, "R_PARISC_DLTREL14R", false, 0, 0, false },
171 { R_PARISC_DLTREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
172 bfd_elf_generic_reloc, "R_PARISC_DLTREL14F", false, 0, 0, false },
173 /* 32 */
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 },
190 /* 40 */
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 /* 48 */
208 { R_PARISC_SEGBASE, 0, 0, 0, false, 0, complain_overflow_bitfield,
209 bfd_elf_generic_reloc, "R_PARISC_SEGBASE", false, 0, 0, false },
210 { R_PARISC_SEGREL32, 0, 0, 0, false, 0, complain_overflow_bitfield,
211 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 /* 56 */
225 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
226 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
227 { R_PARISC_LTOFF_FPTR32, 0, 0, 0, false, 0, complain_overflow_bitfield,
228 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR32", false, 0, 0, false },
229 { R_PARISC_LTOFF_FPTR21L, 0, 0, 0, false, 0, complain_overflow_bitfield,
230 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR21L", false, 0, 0, false },
231 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
232 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 /* 64 */
242 { R_PARISC_FPTR64, 0, 0, 0, false, 0, complain_overflow_bitfield,
243 bfd_elf_generic_reloc, "R_PARISC_FPTR64", false, 0, 0, false },
244 { R_PARISC_PLABEL32, 0, 0, 32, false, 0, complain_overflow_bitfield,
245 bfd_elf_generic_reloc, "R_PARISC_PLABEL32", false, 0, 0, false },
246 { R_PARISC_PLABEL21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
247 bfd_elf_generic_reloc, "R_PARISC_PLABEL21L", false, 0, 0, false },
248 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
249 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
250 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
251 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
252 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
253 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 /* 72 */
259 { R_PARISC_PCREL64, 0, 0, 0, false, 0, complain_overflow_bitfield,
260 bfd_elf_generic_reloc, "R_PARISC_PCREL64", false, 0, 0, false },
261 { R_PARISC_PCREL22C, 0, 0, 0, false, 0, complain_overflow_bitfield,
262 bfd_elf_generic_reloc, "R_PARISC_PCREL22C", false, 0, 0, false },
263 { R_PARISC_PCREL22F, 0, 0, 0, false, 0, complain_overflow_bitfield,
264 bfd_elf_generic_reloc, "R_PARISC_PCREL22F", false, 0, 0, false },
265 { R_PARISC_PCREL14WR, 0, 0, 0, false, 0, complain_overflow_bitfield,
266 bfd_elf_generic_reloc, "R_PARISC_PCREL14WR", false, 0, 0, false },
267 { R_PARISC_PCREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
268 bfd_elf_generic_reloc, "R_PARISC_PCREL14DR", false, 0, 0, false },
269 { R_PARISC_PCREL16F, 0, 0, 0, false, 0, complain_overflow_bitfield,
270 bfd_elf_generic_reloc, "R_PARISC_PCREL16F", false, 0, 0, false },
271 { R_PARISC_PCREL16WF, 0, 0, 0, false, 0, complain_overflow_bitfield,
272 bfd_elf_generic_reloc, "R_PARISC_PCREL16WF", false, 0, 0, false },
273 { R_PARISC_PCREL16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
274 bfd_elf_generic_reloc, "R_PARISC_PCREL16DF", false, 0, 0, false },
275 /* 80 */
276 { R_PARISC_DIR64, 0, 0, 0, false, 0, complain_overflow_bitfield,
277 bfd_elf_generic_reloc, "R_PARISC_DIR64", false, 0, 0, false },
278 { R_PARISC_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield,
279 bfd_elf_generic_reloc, "R_PARISC_NONE", false, 0, 0, false },
280 { R_PARISC_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield,
281 bfd_elf_generic_reloc, "R_PARISC_NONE", false, 0, 0, false },
282 { R_PARISC_DIR14WR, 0, 0, 0, false, 0, complain_overflow_bitfield,
283 bfd_elf_generic_reloc, "R_PARISC_DIR14WR", false, 0, 0, false },
284 { R_PARISC_DIR14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
285 bfd_elf_generic_reloc, "R_PARISC_DIR14DR", false, 0, 0, false },
286 { R_PARISC_DIR16F, 0, 0, 0, false, 0, complain_overflow_bitfield,
287 bfd_elf_generic_reloc, "R_PARISC_DIR16F", false, 0, 0, false },
288 { R_PARISC_DIR16WF, 0, 0, 0, false, 0, complain_overflow_bitfield,
289 bfd_elf_generic_reloc, "R_PARISC_DIR16WF", false, 0, 0, false },
290 { R_PARISC_DIR16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
291 bfd_elf_generic_reloc, "R_PARISC_DIR16DF", false, 0, 0, false },
292 /* 88 */
293 { R_PARISC_GPREL64, 0, 0, 0, false, 0, complain_overflow_bitfield,
294 bfd_elf_generic_reloc, "R_PARISC_GPREL64", false, 0, 0, false },
295 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
296 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
297 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
298 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
299 { R_PARISC_DLTREL14WR, 0, 0, 0, false, 0, complain_overflow_bitfield,
300 bfd_elf_generic_reloc, "R_PARISC_DLTREL14WR", false, 0, 0, false },
301 { R_PARISC_DLTREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
302 bfd_elf_generic_reloc, "R_PARISC_DLTREL14DR", false, 0, 0, false },
303 { R_PARISC_GPREL16F, 0, 0, 0, false, 0, complain_overflow_bitfield,
304 bfd_elf_generic_reloc, "R_PARISC_GPREL16F", false, 0, 0, false },
305 { R_PARISC_GPREL16WF, 0, 0, 0, false, 0, complain_overflow_bitfield,
306 bfd_elf_generic_reloc, "R_PARISC_GPREL16WF", false, 0, 0, false },
307 { R_PARISC_GPREL16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
308 bfd_elf_generic_reloc, "R_PARISC_GPREL16DF", false, 0, 0, false },
309 /* 96 */
310 { R_PARISC_LTOFF64, 0, 0, 0, false, 0, complain_overflow_bitfield,
311 bfd_elf_generic_reloc, "R_PARISC_LTOFF64", 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_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
315 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
316 { R_PARISC_DLTIND14WR, 0, 0, 0, false, 0, complain_overflow_bitfield,
317 bfd_elf_generic_reloc, "R_PARISC_DLTIND14WR", false, 0, 0, false },
318 { R_PARISC_DLTIND14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
319 bfd_elf_generic_reloc, "R_PARISC_DLTIND14DR", false, 0, 0, false },
320 { R_PARISC_LTOFF16F, 0, 0, 0, false, 0, complain_overflow_bitfield,
321 bfd_elf_generic_reloc, "R_PARISC_LTOFF16F", false, 0, 0, false },
322 { R_PARISC_LTOFF16WF, 0, 0, 0, false, 0, complain_overflow_bitfield,
323 bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", false, 0, 0, false },
324 { R_PARISC_LTOFF16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
325 bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", false, 0, 0, false },
326 /* 104 */
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_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
330 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
331 { R_PARISC_BASEREL14WR, 0, 0, 0, false, 0, complain_overflow_bitfield,
332 bfd_elf_generic_reloc, "R_PARISC_BASEREL14WR", false, 0, 0, false },
333 { R_PARISC_BASEREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
334 bfd_elf_generic_reloc, "R_PARISC_BASEREL14DR", false, 0, 0, false },
335 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
336 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
337 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
338 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
339 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
340 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
341 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
342 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
343 /* 112 */
344 { R_PARISC_SEGREL64, 0, 0, 0, false, 0, complain_overflow_bitfield,
345 bfd_elf_generic_reloc, "R_PARISC_SEGREL64", false, 0, 0, false },
346 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
347 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
348 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
349 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
350 { R_PARISC_PLTOFF14WR, 0, 0, 0, false, 0, complain_overflow_bitfield,
351 bfd_elf_generic_reloc, "R_PARISC_PLTOFF14WR", false, 0, 0, false },
352 { R_PARISC_PLTOFF14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
353 bfd_elf_generic_reloc, "R_PARISC_PLTOFF14DR", false, 0, 0, false },
354 { R_PARISC_PLTOFF16F, 0, 0, 0, false, 0, complain_overflow_bitfield,
355 bfd_elf_generic_reloc, "R_PARISC_PLTOFF16F", false, 0, 0, false },
356 { R_PARISC_PLTOFF16WF, 0, 0, 0, false, 0, complain_overflow_bitfield,
357 bfd_elf_generic_reloc, "R_PARISC_PLTOFF16WF", false, 0, 0, false },
358 { R_PARISC_PLTOFF16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
359 bfd_elf_generic_reloc, "R_PARISC_PLTOFF16DF", false, 0, 0, false },
360 /* 120 */
361 { R_PARISC_LTOFF_FPTR64, 0, 0, 0, false, 0, complain_overflow_bitfield,
362 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
363 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
364 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
365 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
366 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
367 { R_PARISC_LTOFF_FPTR14WR, 0, 0, 0, false, 0, complain_overflow_bitfield,
368 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14WR", false, 0, 0, false },
369 { R_PARISC_LTOFF_FPTR14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
370 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14DR", false, 0, 0, false },
371 { R_PARISC_LTOFF_FPTR16F, 0, 0, 0, false, 0, complain_overflow_bitfield,
372 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16F", false, 0, 0, false },
373 { R_PARISC_LTOFF_FPTR16WF, 0, 0, 0, false, 0, complain_overflow_bitfield,
374 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16WF", false, 0, 0, false },
375 { R_PARISC_LTOFF_FPTR16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
376 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
377 /* 128 */
378 { R_PARISC_COPY, 0, 0, 0, false, 0, complain_overflow_bitfield,
379 bfd_elf_generic_reloc, "R_PARISC_COPY", false, 0, 0, false },
380 { R_PARISC_IPLT, 0, 0, 0, false, 0, complain_overflow_bitfield,
381 bfd_elf_generic_reloc, "R_PARISC_IPLT", false, 0, 0, false },
382 { R_PARISC_EPLT, 0, 0, 0, false, 0, complain_overflow_bitfield,
383 bfd_elf_generic_reloc, "R_PARISC_EPLT", 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 /* 136 */
395 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
396 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
397 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
398 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
399 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
400 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
401 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
402 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
403 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
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 /* 144 */
412 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
413 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
414 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
415 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
416 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
417 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
418 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
419 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
420 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
421 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
422 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
423 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
424 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
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 /* 152 */
429 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
430 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
431 { R_PARISC_TPREL32, 0, 0, 0, false, 0, complain_overflow_dont,
432 bfd_elf_generic_reloc, "R_PARISC_TPREL32", false, 0, 0, false },
433 { R_PARISC_TPREL21L, 0, 0, 0, false, 0, complain_overflow_dont,
434 bfd_elf_generic_reloc, "R_PARISC_TPREL21L", false, 0, 0, false },
435 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
436 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
437 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
438 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
439 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
440 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
441 { R_PARISC_TPREL14R, 0, 0, 0, false, 0, complain_overflow_dont,
442 bfd_elf_generic_reloc, "R_PARISC_TPREL14R", 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 /* 160 */
446 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
447 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
448 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
449 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
450 { R_PARISC_LTOFF_TP21L, 0, 0, 0, false, 0, complain_overflow_bitfield,
451 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP21L", false, 0, 0, false },
452 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
453 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
454 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
455 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
456 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
457 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
458 { R_PARISC_LTOFF_TP14R, 0, 0, 0, false, 0, complain_overflow_bitfield,
459 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
460 { R_PARISC_LTOFF_TP14F, 0, 0, 0, false, 0, complain_overflow_bitfield,
461 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14F", false, 0, 0, false },
462 /* 168 */
463 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
464 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
465 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
466 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
467 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
468 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
469 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
470 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
471 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
472 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
473 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_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_bitfield,
478 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
479 /* 176 */
480 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
481 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
482 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
483 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
484 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
485 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
486 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
487 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
488 { 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_dont,
491 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
492 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
493 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
494 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
495 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
496 /* 184 */
497 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
498 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
499 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
500 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
501 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
502 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
503 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
504 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
505 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
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_dont,
512 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
513 /* 192 */
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_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_dont,
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 /* 200 */
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_dont,
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_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 /* 208 */
548 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
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_bitfield,
553 bfd_elf_generic_reloc, "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_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 /* 216 */
565 { R_PARISC_TPREL64, 0, 0, 0, false, 0, complain_overflow_bitfield,
566 bfd_elf_generic_reloc, "R_PARISC_TPREL64", false, 0, 0, false },
567 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
568 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
569 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
570 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
571 { R_PARISC_TPREL14WR, 0, 0, 0, false, 0, complain_overflow_dont,
572 bfd_elf_generic_reloc, "R_PARISC_TPREL14WR", false, 0, 0, false },
573 { R_PARISC_TPREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
574 bfd_elf_generic_reloc, "R_PARISC_TPREL14DR", false, 0, 0, false },
575 { R_PARISC_TPREL16F, 0, 0, 0, false, 0, complain_overflow_bitfield,
576 bfd_elf_generic_reloc, "R_PARISC_TPREL16F", false, 0, 0, false },
577 { R_PARISC_TPREL16WF, 0, 0, 0, false, 0, complain_overflow_dont,
578 bfd_elf_generic_reloc, "R_PARISC_TPREL16WF", false, 0, 0, false },
579 { R_PARISC_TPREL16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
580 bfd_elf_generic_reloc, "R_PARISC_TPREL16DF", false, 0, 0, false },
581 /* 224 */
582 { R_PARISC_LTOFF_TP64, 0, 0, 0, false, 0, complain_overflow_bitfield,
583 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP64", false, 0, 0, false },
584 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
585 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
586 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
587 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
588 { R_PARISC_LTOFF_TP14WR, 0, 0, 0, false, 0, complain_overflow_bitfield,
589 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14WR", false, 0, 0, false },
590 { R_PARISC_LTOFF_TP14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
591 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14DR", false, 0, 0, false },
592 { R_PARISC_LTOFF_TP16F, 0, 0, 0, false, 0, complain_overflow_dont,
593 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16F", false, 0, 0, false },
594 { R_PARISC_LTOFF_TP16WF, 0, 0, 0, false, 0, complain_overflow_bitfield,
595 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16WF", false, 0, 0, false },
596 { R_PARISC_LTOFF_TP16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
597 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16DF", false, 0, 0, false },
598 /* 232 */
599 { R_PARISC_GNU_VTENTRY, 0, 0, 0, false, 0, complain_overflow_dont,
600 bfd_elf_generic_reloc, "R_PARISC_GNU_VTENTRY", false, 0, 0, false },
601 { R_PARISC_GNU_VTINHERIT, 0, 0, 0, false, 0, complain_overflow_dont,
602 bfd_elf_generic_reloc, "R_PARISC_GNU_VTINHERIT", false, 0, 0, false },
605 #define OFFSET_14R_FROM_21L 4
606 #define OFFSET_14F_FROM_21L 5
608 /* Return one (or more) BFD relocations which implement the base
609 relocation with modifications based on format and field. */
611 elf_hppa_reloc_type **
612 _bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
613 bfd *abfd;
614 elf_hppa_reloc_type base_type;
615 int format;
616 unsigned int field;
617 int ignore ATTRIBUTE_UNUSED;
618 asymbol *sym ATTRIBUTE_UNUSED;
620 elf_hppa_reloc_type *finaltype;
621 elf_hppa_reloc_type **final_types;
623 /* Allocate slots for the BFD relocation. */
624 final_types = ((elf_hppa_reloc_type **)
625 bfd_alloc (abfd, sizeof (elf_hppa_reloc_type *) * 2));
626 if (final_types == NULL)
627 return NULL;
629 /* Allocate space for the relocation itself. */
630 finaltype = ((elf_hppa_reloc_type *)
631 bfd_alloc (abfd, sizeof (elf_hppa_reloc_type)));
632 if (finaltype == NULL)
633 return NULL;
635 /* Some reasonable defaults. */
636 final_types[0] = finaltype;
637 final_types[1] = NULL;
639 #define final_type finaltype[0]
641 final_type = base_type;
643 /* Just a tangle of nested switch statements to deal with the braindamage
644 that a different field selector means a completely different relocation
645 for PA ELF. */
646 switch (base_type)
648 /* We have been using generic relocation types. However, that may not
649 really make sense. Anyway, we need to support both R_PARISC_DIR64
650 and R_PARISC_DIR32 here. */
651 case R_PARISC_DIR32:
652 case R_PARISC_DIR64:
653 case R_HPPA_ABS_CALL:
654 switch (format)
656 case 14:
657 switch (field)
659 case e_fsel:
660 final_type = R_PARISC_DIR14F;
661 break;
662 case e_rsel:
663 case e_rrsel:
664 case e_rdsel:
665 final_type = R_PARISC_DIR14R;
666 break;
667 case e_rtsel:
668 final_type = R_PARISC_DLTIND14R;
669 break;
670 case e_rtpsel:
671 final_type = R_PARISC_LTOFF_FPTR14DR;
672 break;
673 case e_tsel:
674 final_type = R_PARISC_DLTIND14F;
675 break;
676 case e_rpsel:
677 final_type = R_PARISC_PLABEL14R;
678 break;
679 default:
680 return NULL;
682 break;
684 case 17:
685 switch (field)
687 case e_fsel:
688 final_type = R_PARISC_DIR17F;
689 break;
690 case e_rsel:
691 case e_rrsel:
692 case e_rdsel:
693 final_type = R_PARISC_DIR17R;
694 break;
695 default:
696 return NULL;
698 break;
700 case 21:
701 switch (field)
703 case e_lsel:
704 case e_lrsel:
705 case e_ldsel:
706 case e_nlsel:
707 case e_nlrsel:
708 final_type = R_PARISC_DIR21L;
709 break;
710 case e_ltsel:
711 final_type = R_PARISC_DLTIND21L;
712 break;
713 case e_ltpsel:
714 final_type = R_PARISC_LTOFF_FPTR21L;
715 break;
716 case e_lpsel:
717 final_type = R_PARISC_PLABEL21L;
718 break;
719 default:
720 return NULL;
722 break;
724 case 32:
725 switch (field)
727 case e_fsel:
728 final_type = R_PARISC_DIR32;
729 /* When in 64bit mode, a 32bit relocation is supposed to
730 be a section relative relocation. Dwarf2 (for example)
731 uses 32bit section relative relocations. */
732 if (bfd_get_arch_info (abfd)->bits_per_address != 32)
733 final_type = R_PARISC_SECREL32;
734 break;
735 case e_psel:
736 final_type = R_PARISC_PLABEL32;
737 break;
738 default:
739 return NULL;
741 break;
743 case 64:
744 switch (field)
746 case e_fsel:
747 final_type = R_PARISC_DIR64;
748 break;
749 case e_psel:
750 final_type = R_PARISC_FPTR64;
751 break;
752 default:
753 return NULL;
755 break;
757 default:
758 return NULL;
760 break;
762 case R_HPPA_GOTOFF:
763 switch (format)
765 case 14:
766 switch (field)
768 case e_rsel:
769 case e_rrsel:
770 case e_rdsel:
771 /* R_PARISC_DLTREL14R for elf64, R_PARISC_DPREL14R for elf32 */
772 final_type = base_type + OFFSET_14R_FROM_21L;
773 break;
774 case e_fsel:
775 /* R_PARISC_DLTREL14F for elf64, R_PARISC_DPREL14F for elf32 */
776 final_type = base_type + OFFSET_14F_FROM_21L;
777 break;
778 default:
779 return NULL;
781 break;
783 case 21:
784 switch (field)
786 case e_lsel:
787 case e_lrsel:
788 case e_ldsel:
789 case e_nlsel:
790 case e_nlrsel:
791 /* R_PARISC_DLTREL21L for elf64, R_PARISC_DPREL21L for elf32 */
792 final_type = base_type;
793 break;
794 default:
795 return NULL;
797 break;
799 default:
800 return NULL;
802 break;
804 case R_HPPA_PCREL_CALL:
805 switch (format)
807 case 12:
808 switch (field)
810 case e_fsel:
811 final_type = R_PARISC_PCREL12F;
812 break;
813 default:
814 return NULL;
816 break;
818 case 14:
819 /* Contrary to appearances, these are not calls of any sort.
820 Rather, they are loads/stores with a pcrel reloc. */
821 switch (field)
823 case e_rsel:
824 case e_rrsel:
825 case e_rdsel:
826 final_type = R_PARISC_PCREL14R;
827 break;
828 case e_fsel:
829 final_type = R_PARISC_PCREL14F;
830 break;
831 default:
832 return NULL;
834 break;
836 case 17:
837 switch (field)
839 case e_rsel:
840 case e_rrsel:
841 case e_rdsel:
842 final_type = R_PARISC_PCREL17R;
843 break;
844 case e_fsel:
845 final_type = R_PARISC_PCREL17F;
846 break;
847 default:
848 return NULL;
850 break;
852 case 21:
853 switch (field)
855 case e_lsel:
856 case e_lrsel:
857 case e_ldsel:
858 case e_nlsel:
859 case e_nlrsel:
860 final_type = R_PARISC_PCREL21L;
861 break;
862 default:
863 return NULL;
865 break;
867 case 22:
868 switch (field)
870 case e_fsel:
871 final_type = R_PARISC_PCREL22F;
872 break;
873 default:
874 return NULL;
876 break;
878 default:
879 return NULL;
881 break;
883 case R_PARISC_GNU_VTENTRY:
884 case R_PARISC_GNU_VTINHERIT:
885 case R_PARISC_SEGREL32:
886 case R_PARISC_SEGBASE:
887 /* The defaults are fine for these cases. */
888 break;
890 default:
891 return NULL;
894 return final_types;
897 /* Translate from an elf into field into a howto relocation pointer. */
899 static void
900 elf_hppa_info_to_howto (abfd, bfd_reloc, elf_reloc)
901 bfd *abfd ATTRIBUTE_UNUSED;
902 arelent *bfd_reloc;
903 Elf_Internal_Rela *elf_reloc;
905 BFD_ASSERT (ELF_R_TYPE(elf_reloc->r_info)
906 < (unsigned int) R_PARISC_UNIMPLEMENTED);
907 bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
910 /* Translate from an elf into field into a howto relocation pointer. */
912 static void
913 elf_hppa_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
914 bfd *abfd ATTRIBUTE_UNUSED;
915 arelent *bfd_reloc;
916 Elf_Internal_Rel *elf_reloc;
918 BFD_ASSERT (ELF_R_TYPE(elf_reloc->r_info)
919 < (unsigned int) R_PARISC_UNIMPLEMENTED);
920 bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
923 /* Return the address of the howto table entry to perform the CODE
924 relocation for an ARCH machine. */
926 static reloc_howto_type *
927 elf_hppa_reloc_type_lookup (abfd, code)
928 bfd *abfd ATTRIBUTE_UNUSED;
929 bfd_reloc_code_real_type code;
931 if ((int) code < (int) R_PARISC_UNIMPLEMENTED)
933 BFD_ASSERT ((int) elf_hppa_howto_table[(int) code].type == (int) code);
934 return &elf_hppa_howto_table[(int) code];
936 return NULL;
939 /* Return true if SYM represents a local label symbol. */
941 static boolean
942 elf_hppa_is_local_label_name (abfd, name)
943 bfd *abfd ATTRIBUTE_UNUSED;
944 const char *name;
946 if (name[0] == 'L' && name[1] == '$')
947 return 1;
948 return _bfd_elf_is_local_label_name (abfd, name);
951 /* Set the correct type for an ELF section. We do this by the
952 section name, which is a hack, but ought to work. */
954 static boolean
955 elf_hppa_fake_sections (abfd, hdr, sec)
956 bfd *abfd;
957 elf_hppa_internal_shdr *hdr;
958 asection *sec;
960 register const char *name;
962 name = bfd_get_section_name (abfd, sec);
964 if (strcmp (name, ".PARISC.unwind") == 0)
966 int indx;
967 asection *asec;
968 #if ARCH_SIZE == 64
969 hdr->sh_type = SHT_LOPROC + 1;
970 #else
971 hdr->sh_type = 1;
972 #endif
973 /* ?!? How are unwinds supposed to work for symbols in arbitrary
974 sections? Or what if we have multiple .text sections in a single
975 .o file? HP really messed up on this one.
977 Ugh. We can not use elf_section_data (sec)->this_idx at this
978 point because it is not initialized yet.
980 So we (gasp) recompute it here. Hopefully nobody ever changes the
981 way sections are numbered in elf.c! */
982 for (asec = abfd->sections, indx = 1; asec; asec = asec->next, indx++)
984 if (asec->name && strcmp (asec->name, ".text") == 0)
986 hdr->sh_info = indx;
987 break;
991 /* I have no idea if this is really necessary or what it means. */
992 hdr->sh_entsize = 4;
994 return true;
997 static void
998 elf_hppa_final_write_processing (abfd, linker)
999 bfd *abfd;
1000 boolean linker ATTRIBUTE_UNUSED;
1002 int mach = bfd_get_mach (abfd);
1004 elf_elfheader (abfd)->e_flags &= ~(EF_PARISC_ARCH | EF_PARISC_TRAPNIL
1005 | EF_PARISC_EXT | EF_PARISC_LSB
1006 | EF_PARISC_WIDE | EF_PARISC_NO_KABP
1007 | EF_PARISC_LAZYSWAP);
1009 if (mach == 10)
1010 elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_0;
1011 else if (mach == 11)
1012 elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_1;
1013 else if (mach == 20)
1014 elf_elfheader (abfd)->e_flags |= EFA_PARISC_2_0;
1015 else if (mach == 25)
1016 elf_elfheader (abfd)->e_flags |= (EF_PARISC_WIDE
1017 | EFA_PARISC_2_0
1018 /* The GNU tools have trapped without
1019 option since 1993, so need to take
1020 a step backwards with the ELF
1021 based toolchains. */
1022 | EF_PARISC_TRAPNIL);
1025 #if ARCH_SIZE == 64
1026 /* Hook called by the linker routine which adds symbols from an object
1027 file. HP's libraries define symbols with HP specific section
1028 indices, which we have to handle. */
1030 static boolean
1031 elf_hppa_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
1032 bfd *abfd;
1033 struct bfd_link_info *info ATTRIBUTE_UNUSED;
1034 const Elf_Internal_Sym *sym;
1035 const char **namep ATTRIBUTE_UNUSED;
1036 flagword *flagsp ATTRIBUTE_UNUSED;
1037 asection **secp;
1038 bfd_vma *valp;
1040 int index = sym->st_shndx;
1042 switch (index)
1044 case SHN_PARISC_ANSI_COMMON:
1045 *secp = bfd_make_section_old_way (abfd, ".PARISC.ansi.common");
1046 (*secp)->flags |= SEC_IS_COMMON;
1047 *valp = sym->st_size;
1048 break;
1050 case SHN_PARISC_HUGE_COMMON:
1051 *secp = bfd_make_section_old_way (abfd, ".PARISC.huge.common");
1052 (*secp)->flags |= SEC_IS_COMMON;
1053 *valp = sym->st_size;
1054 break;
1057 return true;
1060 static boolean
1061 elf_hppa_unmark_useless_dynamic_symbols (h, data)
1062 struct elf_link_hash_entry *h;
1063 PTR data;
1065 struct bfd_link_info *info = (struct bfd_link_info *)data;
1067 /* If we are not creating a shared library, and this symbol is
1068 referenced by a shared library but is not defined anywhere, then
1069 the generic code will warn that it is undefined.
1071 This behavior is undesirable on HPs since the standard shared
1072 libraries contain references to undefined symbols.
1074 So we twiddle the flags associated with such symbols so that they
1075 will not trigger the warning. ?!? FIXME. This is horribly fragile.
1077 Ultimately we should have better controls over the generic ELF BFD
1078 linker code. */
1079 if (! info->relocateable
1080 && ! (info->shared
1081 && !info->no_undefined)
1082 && h->root.type == bfd_link_hash_undefined
1083 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0
1084 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
1086 h->elf_link_hash_flags &= ~ELF_LINK_HASH_REF_DYNAMIC;
1087 h->elf_link_hash_flags |= 0x8000;
1090 return true;
1093 static boolean
1094 elf_hppa_remark_useless_dynamic_symbols (h, data)
1095 struct elf_link_hash_entry *h;
1096 PTR data;
1098 struct bfd_link_info *info = (struct bfd_link_info *)data;
1100 /* If we are not creating a shared library, and this symbol is
1101 referenced by a shared library but is not defined anywhere, then
1102 the generic code will warn that it is undefined.
1104 This behavior is undesirable on HPs since the standard shared
1105 libraries contain reerences to undefined symbols.
1107 So we twiddle the flags associated with such symbols so that they
1108 will not trigger the warning. ?!? FIXME. This is horribly fragile.
1110 Ultimately we should have better controls over the generic ELF BFD
1111 linker code. */
1112 if (! info->relocateable
1113 && ! (info->shared
1114 && !info->no_undefined)
1115 && h->root.type == bfd_link_hash_undefined
1116 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
1117 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0
1118 && (h->elf_link_hash_flags & 0x8000) != 0)
1120 h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
1121 h->elf_link_hash_flags &= ~0x8000;
1124 return true;
1127 /* Record the lowest address for the data and text segments. */
1128 static void
1129 elf_hppa_record_segment_addrs (abfd, section, data)
1130 bfd *abfd ATTRIBUTE_UNUSED;
1131 asection *section;
1132 PTR data;
1134 struct elf64_hppa_link_hash_table *hppa_info;
1135 bfd_vma value;
1137 hppa_info = (struct elf64_hppa_link_hash_table *)data;
1139 value = section->vma - section->filepos;
1141 if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
1142 == (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
1143 && value < hppa_info->text_segment_base)
1144 hppa_info->text_segment_base = value;
1145 else if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
1146 == (SEC_ALLOC | SEC_LOAD))
1147 && value < hppa_info->data_segment_base)
1148 hppa_info->data_segment_base = value;
1151 /* Called after we have seen all the input files/sections, but before
1152 final symbol resolution and section placement has been determined.
1154 We use this hook to (possibly) provide a value for __gp, then we
1155 fall back to the generic ELF final link routine. */
1157 static boolean
1158 elf_hppa_final_link (abfd, info)
1159 bfd *abfd;
1160 struct bfd_link_info *info;
1162 boolean retval;
1163 struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
1165 if (! info->relocateable)
1167 struct elf_link_hash_entry *gp;
1168 bfd_vma gp_val;
1170 /* The linker script defines a value for __gp iff it was referenced
1171 by one of the objects being linked. First try to find the symbol
1172 in the hash table. If that fails, just compute the value __gp
1173 should have had. */
1174 gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", false,
1175 false, false);
1177 if (gp)
1180 /* Adjust the value of __gp as we may want to slide it into the
1181 .plt section so that the stubs can access PLT entries without
1182 using an addil sequence. */
1183 gp->root.u.def.value += hppa_info->gp_offset;
1185 gp_val = (gp->root.u.def.section->output_section->vma
1186 + gp->root.u.def.section->output_offset
1187 + gp->root.u.def.value);
1189 else
1191 asection *sec;
1193 /* First look for a .plt section. If found, then __gp is the
1194 address of the .plt + gp_offset.
1196 If no .plt is found, then look for .dlt, .opd and .data (in
1197 that order) and set __gp to the base address of whichever section
1198 is found first. */
1200 sec = hppa_info->plt_sec;
1201 if (sec)
1202 gp_val = (sec->output_offset
1203 + sec->output_section->vma
1204 + hppa_info->gp_offset);
1205 else
1207 sec = hppa_info->dlt_sec;
1208 if (!sec)
1209 sec = hppa_info->opd_sec;
1210 if (!sec)
1211 sec = bfd_get_section_by_name (abfd, ".data");
1212 if (!sec)
1213 return false;
1215 gp_val = sec->output_offset + sec->output_section->vma;
1219 /* Install whatever value we found/computed for __gp. */
1220 _bfd_set_gp_value (abfd, gp_val);
1223 /* We need to know the base of the text and data segments so that we
1224 can perform SEGREL relocations. We will record the base addresses
1225 when we encounter the first SEGREL relocation. */
1226 hppa_info->text_segment_base = (bfd_vma)-1;
1227 hppa_info->data_segment_base = (bfd_vma)-1;
1229 /* HP's shared libraries have references to symbols that are not
1230 defined anywhere. The generic ELF BFD linker code will complaim
1231 about such symbols.
1233 So we detect the losing case and arrange for the flags on the symbol
1234 to indicate that it was never referenced. This keeps the generic
1235 ELF BFD link code happy and appears to not create any secondary
1236 problems. Ultimately we need a way to control the behavior of the
1237 generic ELF BFD link code better. */
1238 elf_link_hash_traverse (elf_hash_table (info),
1239 elf_hppa_unmark_useless_dynamic_symbols,
1240 info);
1242 /* Invoke the regular ELF backend linker to do all the work. */
1243 retval = bfd_elf_bfd_final_link (abfd, info);
1245 elf_link_hash_traverse (elf_hash_table (info),
1246 elf_hppa_remark_useless_dynamic_symbols,
1247 info);
1249 return retval;
1252 /* Relocate an HPPA ELF section. */
1254 static boolean
1255 elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
1256 contents, relocs, local_syms, local_sections)
1257 bfd *output_bfd;
1258 struct bfd_link_info *info;
1259 bfd *input_bfd;
1260 asection *input_section;
1261 bfd_byte *contents;
1262 Elf_Internal_Rela *relocs;
1263 Elf_Internal_Sym *local_syms;
1264 asection **local_sections;
1266 Elf_Internal_Shdr *symtab_hdr;
1267 Elf_Internal_Rela *rel;
1268 Elf_Internal_Rela *relend;
1269 struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
1271 symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
1273 rel = relocs;
1274 relend = relocs + input_section->reloc_count;
1275 for (; rel < relend; rel++)
1277 int r_type;
1278 reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
1279 unsigned long r_symndx;
1280 struct elf_link_hash_entry *h;
1281 Elf_Internal_Sym *sym;
1282 asection *sym_sec;
1283 bfd_vma relocation;
1284 bfd_reloc_status_type r;
1285 const char *sym_name;
1286 const char *dyn_name;
1287 char *dynh_buf = NULL;
1288 size_t dynh_buflen = 0;
1289 struct elf64_hppa_dyn_hash_entry *dyn_h = NULL;
1291 r_type = ELF_R_TYPE (rel->r_info);
1292 if (r_type < 0 || r_type >= (int) R_PARISC_UNIMPLEMENTED)
1294 bfd_set_error (bfd_error_bad_value);
1295 return false;
1298 r_symndx = ELF_R_SYM (rel->r_info);
1300 if (info->relocateable)
1302 /* This is a relocateable link. We don't have to change
1303 anything, unless the reloc is against a section symbol,
1304 in which case we have to adjust according to where the
1305 section symbol winds up in the output section. */
1306 if (r_symndx < symtab_hdr->sh_info)
1308 sym = local_syms + r_symndx;
1309 if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
1311 sym_sec = local_sections[r_symndx];
1312 rel->r_addend += sym_sec->output_offset;
1316 continue;
1319 /* This is a final link. */
1320 h = NULL;
1321 sym = NULL;
1322 sym_sec = NULL;
1323 if (r_symndx < symtab_hdr->sh_info)
1325 /* This is a local symbol. */
1326 sym = local_syms + r_symndx;
1327 sym_sec = local_sections[r_symndx];
1328 relocation = ((ELF_ST_TYPE (sym->st_info) == STT_SECTION
1329 ? 0 : sym->st_value)
1330 + sym_sec->output_offset
1331 + sym_sec->output_section->vma);
1333 /* If this symbol has an entry in the PA64 dynamic hash
1334 table, then get it. */
1335 dyn_name = get_dyn_name (input_section, h, rel,
1336 &dynh_buf, &dynh_buflen);
1337 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1338 dyn_name, false, false);
1341 else
1343 /* This is not a local symbol. */
1344 long indx;
1346 indx = r_symndx - symtab_hdr->sh_info;
1347 h = elf_sym_hashes (input_bfd)[indx];
1348 while (h->root.type == bfd_link_hash_indirect
1349 || h->root.type == bfd_link_hash_warning)
1350 h = (struct elf_link_hash_entry *) h->root.u.i.link;
1351 if (h->root.type == bfd_link_hash_defined
1352 || h->root.type == bfd_link_hash_defweak)
1354 sym_sec = h->root.u.def.section;
1356 /* If this symbol has an entry in the PA64 dynamic hash
1357 table, then get it. */
1358 dyn_name = get_dyn_name (input_section, h, rel,
1359 &dynh_buf, &dynh_buflen);
1360 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1361 dyn_name, false, false);
1363 /* If we have a relocation against a symbol defined in a
1364 shared library and we have not created an entry in the
1365 PA64 dynamic symbol hash table for it, then we lose. */
1366 if (sym_sec->output_section == NULL && dyn_h == NULL)
1368 (*_bfd_error_handler)
1369 (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
1370 bfd_get_filename (input_bfd), h->root.root.string,
1371 bfd_get_section_name (input_bfd, input_section));
1372 relocation = 0;
1374 else if (sym_sec->output_section)
1375 relocation = (h->root.u.def.value
1376 + sym_sec->output_offset
1377 + sym_sec->output_section->vma);
1378 /* Value will be provided via one of the offsets in the
1379 dyn_h hash table entry. */
1380 else
1381 relocation = 0;
1383 /* Allow undefined symbols in shared libraries. */
1384 else if (info->shared && !info->no_undefined
1385 && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
1387 if (info->symbolic)
1388 (*info->callbacks->undefined_symbol)
1389 (info, h->root.root.string, input_bfd,
1390 input_section, rel->r_offset, false);
1392 /* If this symbol has an entry in the PA64 dynamic hash
1393 table, then get it. */
1394 dyn_name = get_dyn_name (input_section, h, rel,
1395 &dynh_buf, &dynh_buflen);
1396 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1397 dyn_name, false, false);
1399 if (dyn_h == NULL)
1401 (*_bfd_error_handler)
1402 (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
1403 bfd_get_filename (input_bfd), h->root.root.string,
1404 bfd_get_section_name (input_bfd, input_section));
1405 relocation = 0;
1407 relocation = 0;
1409 else if (h->root.type == bfd_link_hash_undefweak)
1410 relocation = 0;
1411 else
1413 if (!((*info->callbacks->undefined_symbol)
1414 (info, h->root.root.string, input_bfd,
1415 input_section, rel->r_offset, true)))
1416 return false;
1417 break;
1421 if (h != NULL)
1422 sym_name = h->root.root.string;
1423 else
1425 sym_name = bfd_elf_string_from_elf_section (input_bfd,
1426 symtab_hdr->sh_link,
1427 sym->st_name);
1428 if (sym_name == NULL)
1429 return false;
1430 if (*sym_name == '\0')
1431 sym_name = bfd_section_name (input_bfd, sym_sec);
1434 r = elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
1435 input_section, contents,
1436 relocation, info, sym_sec,
1437 h, dyn_h);
1439 if (r != bfd_reloc_ok)
1441 switch (r)
1443 default:
1444 abort ();
1445 case bfd_reloc_overflow:
1447 if (!((*info->callbacks->reloc_overflow)
1448 (info, sym_name, howto->name, (bfd_vma) 0,
1449 input_bfd, input_section, rel->r_offset)))
1450 return false;
1452 break;
1456 return true;
1459 /* Compute the value for a relocation (REL) during a final link stage,
1460 then insert the value into the proper location in CONTENTS.
1462 VALUE is a tentative value for the relocation and may be overridden
1463 and modified here based on the specific relocation to be performed.
1465 For example we do conversions for PC-relative branches in this routine
1466 or redirection of calls to external routines to stubs.
1468 The work of actually applying the relocation is left to a helper
1469 routine in an attempt to reduce the complexity and size of this
1470 function. */
1472 static bfd_reloc_status_type
1473 elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
1474 input_section, contents, value,
1475 info, sym_sec, h, dyn_h)
1476 Elf_Internal_Rela *rel;
1477 bfd *input_bfd;
1478 bfd *output_bfd;
1479 asection *input_section;
1480 bfd_byte *contents;
1481 bfd_vma value;
1482 struct bfd_link_info *info;
1483 asection *sym_sec;
1484 struct elf_link_hash_entry *h ATTRIBUTE_UNUSED;
1485 struct elf64_hppa_dyn_hash_entry *dyn_h;
1487 unsigned int insn;
1488 bfd_vma offset = rel->r_offset;
1489 bfd_vma addend = rel->r_addend;
1490 reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
1491 unsigned int r_type = howto->type;
1492 bfd_byte *hit_data = contents + offset;
1493 struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
1495 insn = bfd_get_32 (input_bfd, hit_data);
1497 switch (r_type)
1499 case R_PARISC_NONE:
1500 break;
1502 /* Basic function call support. I'm not entirely sure if PCREL14F is
1503 actually needed or even handled correctly.
1505 Note for a call to a function defined in another dynamic library
1506 we want to redirect the call to a stub. */
1508 /* Random PC relative relocs. */
1509 case R_PARISC_PCREL21L:
1510 case R_PARISC_PCREL14R:
1511 case R_PARISC_PCREL14F:
1512 case R_PARISC_PCREL14WR:
1513 case R_PARISC_PCREL14DR:
1514 case R_PARISC_PCREL16F:
1515 case R_PARISC_PCREL16WF:
1516 case R_PARISC_PCREL16DF:
1518 /* If this is a call to a function defined in another dynamic
1519 library, then redirect the call to the local stub for this
1520 function. */
1521 if (sym_sec == NULL || sym_sec->output_section == NULL)
1522 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1523 + hppa_info->stub_sec->output_section->vma);
1525 /* Turn VALUE into a proper PC relative address. */
1526 value -= (offset + input_section->output_offset
1527 + input_section->output_section->vma);
1529 /* Adjust for any field selectors. */
1530 if (r_type == R_PARISC_PCREL21L)
1531 value = hppa_field_adjust (value, -8 + addend, e_lsel);
1532 else if (r_type == R_PARISC_PCREL14F
1533 || r_type == R_PARISC_PCREL16F
1534 || r_type == R_PARISC_PCREL16WF
1535 || r_type == R_PARISC_PCREL16DF)
1536 value = hppa_field_adjust (value, -8 + addend, e_fsel);
1537 else
1538 value = hppa_field_adjust (value, -8 + addend, e_rsel);
1540 /* Apply the relocation to the given instruction. */
1541 insn = elf_hppa_relocate_insn (insn, value, r_type);
1542 break;
1545 case R_PARISC_PCREL12F:
1546 case R_PARISC_PCREL22F:
1547 case R_PARISC_PCREL17F:
1548 case R_PARISC_PCREL22C:
1549 case R_PARISC_PCREL17C:
1550 case R_PARISC_PCREL17R:
1552 /* If this is a call to a function defined in another dynamic
1553 library, then redirect the call to the local stub for this
1554 function. */
1555 if (sym_sec == NULL || sym_sec->output_section == NULL)
1556 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1557 + hppa_info->stub_sec->output_section->vma);
1559 /* Turn VALUE into a proper PC relative address. */
1560 value -= (offset + input_section->output_offset
1561 + input_section->output_section->vma);
1563 /* Adjust for any field selectors. */
1564 if (r_type == R_PARISC_PCREL17R)
1565 value = hppa_field_adjust (value, -8 + addend, e_rsel);
1566 else
1567 value = hppa_field_adjust (value, -8 + addend, e_fsel);
1569 /* All branches are implicitly shifted by 2 places. */
1570 value >>= 2;
1572 /* Apply the relocation to the given instruction. */
1573 insn = elf_hppa_relocate_insn (insn, value, r_type);
1574 break;
1577 /* Indirect references to data through the DLT. */
1578 case R_PARISC_DLTIND14R:
1579 case R_PARISC_DLTIND14F:
1580 case R_PARISC_DLTIND14DR:
1581 case R_PARISC_DLTIND14WR:
1582 case R_PARISC_DLTIND21L:
1583 case R_PARISC_LTOFF_FPTR14R:
1584 case R_PARISC_LTOFF_FPTR14DR:
1585 case R_PARISC_LTOFF_FPTR14WR:
1586 case R_PARISC_LTOFF_FPTR21L:
1587 case R_PARISC_LTOFF_FPTR16F:
1588 case R_PARISC_LTOFF_FPTR16WF:
1589 case R_PARISC_LTOFF_FPTR16DF:
1590 case R_PARISC_LTOFF_TP21L:
1591 case R_PARISC_LTOFF_TP14R:
1592 case R_PARISC_LTOFF_TP14F:
1593 case R_PARISC_LTOFF_TP14WR:
1594 case R_PARISC_LTOFF_TP14DR:
1595 case R_PARISC_LTOFF_TP16F:
1596 case R_PARISC_LTOFF_TP16WF:
1597 case R_PARISC_LTOFF_TP16DF:
1598 case R_PARISC_LTOFF16F:
1599 case R_PARISC_LTOFF16WF:
1600 case R_PARISC_LTOFF16DF:
1602 /* If this relocation was against a local symbol, then we still
1603 have not set up the DLT entry (it's not convenient to do so
1604 in the "finalize_dlt" routine because it is difficult to get
1605 to the local symbol's value).
1607 So, if this is a local symbol (h == NULL), then we need to
1608 fill in its DLT entry.
1610 Similarly we may still need to set up an entry in .opd for
1611 a local function which had its address taken. */
1612 if (dyn_h->h == NULL)
1614 bfd_put_64 (hppa_info->dlt_sec->owner,
1615 value,
1616 hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
1618 /* Now handle .opd creation if needed. */
1619 if (r_type == R_PARISC_LTOFF_FPTR14R
1620 || r_type == R_PARISC_LTOFF_FPTR14DR
1621 || r_type == R_PARISC_LTOFF_FPTR14WR
1622 || r_type == R_PARISC_LTOFF_FPTR21L
1623 || r_type == R_PARISC_LTOFF_FPTR16F
1624 || r_type == R_PARISC_LTOFF_FPTR16WF
1625 || r_type == R_PARISC_LTOFF_FPTR16DF)
1627 /* The first two words of an .opd entry are zero. */
1628 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset,
1629 0, 16);
1631 /* The next word is the address of the function. */
1632 bfd_put_64 (hppa_info->opd_sec->owner, value,
1633 (hppa_info->opd_sec->contents
1634 + dyn_h->opd_offset + 16));
1636 /* The last word is our local __gp value. */
1637 value = _bfd_get_gp_value
1638 (hppa_info->opd_sec->output_section->owner);
1639 bfd_put_64 (hppa_info->opd_sec->owner, value,
1640 (hppa_info->opd_sec->contents
1641 + dyn_h->opd_offset + 24));
1645 /* We want the value of the DLT offset for this symbol, not
1646 the symbol's actual address. Note that __gp may not point
1647 to the start of the DLT, so we have to compute the absolute
1648 address, then subtract out the value of __gp. */
1649 value = (dyn_h->dlt_offset
1650 + hppa_info->dlt_sec->output_offset
1651 + hppa_info->dlt_sec->output_section->vma);
1652 value -= _bfd_get_gp_value (output_bfd);
1654 /* All DLTIND 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_DLTIND21L
1658 || r_type == R_PARISC_LTOFF_FPTR21L
1659 || r_type == R_PARISC_LTOFF_TP21L)
1660 value = hppa_field_adjust (value, addend, e_lrsel);
1661 else if (r_type == R_PARISC_DLTIND14F
1662 || r_type == R_PARISC_LTOFF_FPTR16F
1663 || r_type == R_PARISC_LTOFF_FPTR16WF
1664 || r_type == R_PARISC_LTOFF_FPTR16DF
1665 || r_type == R_PARISC_LTOFF16F
1666 || r_type == R_PARISC_LTOFF16DF
1667 || r_type == R_PARISC_LTOFF16WF
1668 || r_type == R_PARISC_LTOFF_TP16F
1669 || r_type == R_PARISC_LTOFF_TP16WF
1670 || r_type == R_PARISC_LTOFF_TP16DF)
1671 value = hppa_field_adjust (value, addend, e_fsel);
1672 else
1673 value = hppa_field_adjust (value, addend, e_rrsel);
1675 insn = elf_hppa_relocate_insn (insn, value, r_type);
1676 break;
1679 case R_PARISC_DLTREL14R:
1680 case R_PARISC_DLTREL14F:
1681 case R_PARISC_DLTREL14DR:
1682 case R_PARISC_DLTREL14WR:
1683 case R_PARISC_DLTREL21L:
1684 case R_PARISC_DPREL21L:
1685 case R_PARISC_DPREL14WR:
1686 case R_PARISC_DPREL14DR:
1687 case R_PARISC_DPREL14R:
1688 case R_PARISC_DPREL14F:
1689 case R_PARISC_GPREL16F:
1690 case R_PARISC_GPREL16WF:
1691 case R_PARISC_GPREL16DF:
1693 /* Subtract out the global pointer value to make value a DLT
1694 relative address. */
1695 value -= _bfd_get_gp_value (output_bfd);
1697 /* All DLTREL relocations are basically the same at this point,
1698 except that we need different field selectors for the 21bit
1699 version vs the 14bit versions. */
1700 if (r_type == R_PARISC_DLTREL21L
1701 || r_type == R_PARISC_DPREL21L)
1702 value = hppa_field_adjust (value, addend, e_lrsel);
1703 else if (r_type == R_PARISC_DLTREL14F
1704 || r_type == R_PARISC_DPREL14F
1705 || r_type == R_PARISC_GPREL16F
1706 || r_type == R_PARISC_GPREL16WF
1707 || r_type == R_PARISC_GPREL16DF)
1708 value = hppa_field_adjust (value, addend, e_fsel);
1709 else
1710 value = hppa_field_adjust (value, addend, e_rrsel);
1712 insn = elf_hppa_relocate_insn (insn, value, r_type);
1713 break;
1716 case R_PARISC_DIR21L:
1717 case R_PARISC_DIR17R:
1718 case R_PARISC_DIR17F:
1719 case R_PARISC_DIR14R:
1720 case R_PARISC_DIR14F:
1721 case R_PARISC_DIR14WR:
1722 case R_PARISC_DIR14DR:
1723 case R_PARISC_DIR16F:
1724 case R_PARISC_DIR16WF:
1725 case R_PARISC_DIR16DF:
1727 /* All DIR relocations are basically the same at this point,
1728 except that branch offsets need to be divided by four, and
1729 we need different field selectors. Note that we don't
1730 redirect absolute calls to local stubs. */
1732 if (r_type == R_PARISC_DIR21L)
1733 value = hppa_field_adjust (value, addend, e_lrsel);
1734 else if (r_type == R_PARISC_DIR17F
1735 || r_type == R_PARISC_DIR16F
1736 || r_type == R_PARISC_DIR16WF
1737 || r_type == R_PARISC_DIR16DF
1738 || r_type == R_PARISC_DIR14F)
1739 value = hppa_field_adjust (value, addend, e_fsel);
1740 else
1741 value = hppa_field_adjust (value, addend, e_rrsel);
1743 if (r_type == R_PARISC_DIR17R || r_type == R_PARISC_DIR17F)
1745 /* All branches are implicitly shifted by 2 places. */
1746 value >>= 2;
1749 insn = elf_hppa_relocate_insn (insn, value, r_type);
1750 break;
1753 case R_PARISC_PLTOFF21L:
1754 case R_PARISC_PLTOFF14R:
1755 case R_PARISC_PLTOFF14F:
1756 case R_PARISC_PLTOFF14WR:
1757 case R_PARISC_PLTOFF14DR:
1758 case R_PARISC_PLTOFF16F:
1759 case R_PARISC_PLTOFF16WF:
1760 case R_PARISC_PLTOFF16DF:
1762 /* We want the value of the PLT offset for this symbol, not
1763 the symbol's actual address. Note that __gp may not point
1764 to the start of the DLT, so we have to compute the absolute
1765 address, then subtract out the value of __gp. */
1766 value = (dyn_h->plt_offset
1767 + hppa_info->plt_sec->output_offset
1768 + hppa_info->plt_sec->output_section->vma);
1769 value -= _bfd_get_gp_value (output_bfd);
1771 /* All PLTOFF relocations are basically the same at this point,
1772 except that we need different field selectors for the 21bit
1773 version vs the 14bit versions. */
1774 if (r_type == R_PARISC_PLTOFF21L)
1775 value = hppa_field_adjust (value, addend, e_lrsel);
1776 else if (r_type == R_PARISC_PLTOFF14F
1777 || r_type == R_PARISC_PLTOFF16F
1778 || r_type == R_PARISC_PLTOFF16WF
1779 || r_type == R_PARISC_PLTOFF16DF)
1780 value = hppa_field_adjust (value, addend, e_fsel);
1781 else
1782 value = hppa_field_adjust (value, addend, e_rrsel);
1784 insn = elf_hppa_relocate_insn (insn, value, r_type);
1785 break;
1788 case R_PARISC_LTOFF_FPTR32:
1790 /* We may still need to create the FPTR itself if it was for
1791 a local symbol. */
1792 if (dyn_h->h == NULL)
1794 /* The first two words of an .opd entry are zero. */
1795 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
1797 /* The next word is the address of the function. */
1798 bfd_put_64 (hppa_info->opd_sec->owner, value,
1799 (hppa_info->opd_sec->contents
1800 + dyn_h->opd_offset + 16));
1802 /* The last word is our local __gp value. */
1803 value = _bfd_get_gp_value
1804 (hppa_info->opd_sec->output_section->owner);
1805 bfd_put_64 (hppa_info->opd_sec->owner, value,
1806 hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
1809 /* We want the value of the DLT offset for this symbol, not
1810 the symbol's actual address. Note that __gp may not point
1811 to the start of the DLT, so we have to compute the absolute
1812 address, then subtract out the value of __gp. */
1813 value = (dyn_h->dlt_offset
1814 + hppa_info->dlt_sec->output_offset
1815 + hppa_info->dlt_sec->output_section->vma);
1816 value -= _bfd_get_gp_value (output_bfd);
1817 bfd_put_32 (input_bfd, value, hit_data);
1818 return bfd_reloc_ok;
1821 case R_PARISC_LTOFF_FPTR64:
1822 case R_PARISC_LTOFF_TP64:
1824 /* We may still need to create the FPTR itself if it was for
1825 a local symbol. */
1826 if (dyn_h->h == NULL && r_type == R_PARISC_LTOFF_FPTR64)
1828 /* The first two words of an .opd entry are zero. */
1829 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
1831 /* The next word is the address of the function. */
1832 bfd_put_64 (hppa_info->opd_sec->owner, value,
1833 (hppa_info->opd_sec->contents
1834 + dyn_h->opd_offset + 16));
1836 /* The last word is our local __gp value. */
1837 value = _bfd_get_gp_value
1838 (hppa_info->opd_sec->output_section->owner);
1839 bfd_put_64 (hppa_info->opd_sec->owner, value,
1840 hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
1843 /* We want the value of the DLT offset for this symbol, not
1844 the symbol's actual address. Note that __gp may not point
1845 to the start of the DLT, so we have to compute the absolute
1846 address, then subtract out the value of __gp. */
1847 value = (dyn_h->dlt_offset
1848 + hppa_info->dlt_sec->output_offset
1849 + hppa_info->dlt_sec->output_section->vma);
1850 value -= _bfd_get_gp_value (output_bfd);
1851 bfd_put_64 (input_bfd, value, hit_data);
1852 return bfd_reloc_ok;
1855 case R_PARISC_DIR32:
1856 bfd_put_32 (input_bfd, value + addend, hit_data);
1857 return bfd_reloc_ok;
1859 case R_PARISC_DIR64:
1860 bfd_put_64 (input_bfd, value + addend, hit_data);
1861 return bfd_reloc_ok;
1863 case R_PARISC_GPREL64:
1864 /* Subtract out the global pointer value to make value a DLT
1865 relative address. */
1866 value -= _bfd_get_gp_value (output_bfd);
1868 bfd_put_64 (input_bfd, value + addend, hit_data);
1869 return bfd_reloc_ok;
1871 case R_PARISC_LTOFF64:
1872 /* We want the value of the DLT offset for this symbol, not
1873 the symbol's actual address. Note that __gp may not point
1874 to the start of the DLT, so we have to compute the absolute
1875 address, then subtract out the value of __gp. */
1876 value = (dyn_h->dlt_offset
1877 + hppa_info->dlt_sec->output_offset
1878 + hppa_info->dlt_sec->output_section->vma);
1879 value -= _bfd_get_gp_value (output_bfd);
1881 bfd_put_64 (input_bfd, value + addend, hit_data);
1882 return bfd_reloc_ok;
1884 case R_PARISC_PCREL32:
1886 /* If this is a call to a function defined in another dynamic
1887 library, then redirect the call to the local stub for this
1888 function. */
1889 if (sym_sec == NULL || sym_sec->output_section == NULL)
1890 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1891 + hppa_info->stub_sec->output_section->vma);
1893 /* Turn VALUE into a proper PC relative address. */
1894 value -= (offset + input_section->output_offset
1895 + input_section->output_section->vma);
1897 value += addend;
1898 value -= 8;
1899 bfd_put_32 (input_bfd, value, hit_data);
1900 return bfd_reloc_ok;
1903 case R_PARISC_PCREL64:
1905 /* If this is a call to a function defined in another dynamic
1906 library, then redirect the call to the local stub for this
1907 function. */
1908 if (sym_sec == NULL || sym_sec->output_section == NULL)
1909 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1910 + hppa_info->stub_sec->output_section->vma);
1912 /* Turn VALUE into a proper PC relative address. */
1913 value -= (offset + input_section->output_offset
1914 + input_section->output_section->vma);
1916 value += addend;
1917 value -= 8;
1918 bfd_put_64 (input_bfd, value, hit_data);
1919 return bfd_reloc_ok;
1922 case R_PARISC_FPTR64:
1924 /* We may still need to create the FPTR itself if it was for
1925 a local symbol. */
1926 if (dyn_h->h == NULL)
1928 /* The first two words of an .opd entry are zero. */
1929 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
1931 /* The next word is the address of the function. */
1932 bfd_put_64 (hppa_info->opd_sec->owner, value,
1933 (hppa_info->opd_sec->contents
1934 + dyn_h->opd_offset + 16));
1936 /* The last word is our local __gp value. */
1937 value = _bfd_get_gp_value
1938 (hppa_info->opd_sec->output_section->owner);
1939 bfd_put_64 (hppa_info->opd_sec->owner, value,
1940 hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
1943 /* We want the value of the OPD offset for this symbol, not
1944 the symbol's actual address. */
1945 value = (dyn_h->opd_offset
1946 + hppa_info->opd_sec->output_offset
1947 + hppa_info->opd_sec->output_section->vma);
1949 bfd_put_64 (input_bfd, value + addend, hit_data);
1950 return bfd_reloc_ok;
1953 case R_PARISC_SECREL32:
1954 bfd_put_32 (input_bfd,
1955 value + addend - sym_sec->output_section->vma,
1956 hit_data);
1957 return bfd_reloc_ok;
1959 case R_PARISC_SEGREL32:
1960 case R_PARISC_SEGREL64:
1962 /* If this is the first SEGREL relocation, then initialize
1963 the segment base values. */
1964 if (hppa_info->text_segment_base == (bfd_vma) -1)
1965 bfd_map_over_sections (output_bfd, elf_hppa_record_segment_addrs,
1966 hppa_info);
1968 /* VALUE holds the absolute address. We want to include the
1969 addend, then turn it into a segment relative address.
1971 The segment is derived from SYM_SEC. We assume that there are
1972 only two segments of note in the resulting executable/shlib.
1973 A readonly segment (.text) and a readwrite segment (.data). */
1974 value += addend;
1976 if (sym_sec->flags & SEC_CODE)
1977 value -= hppa_info->text_segment_base;
1978 else
1979 value -= hppa_info->data_segment_base;
1981 if (r_type == R_PARISC_SEGREL32)
1982 bfd_put_32 (input_bfd, value, hit_data);
1983 else
1984 bfd_put_64 (input_bfd, value, hit_data);
1985 return bfd_reloc_ok;
1988 /* Something we don't know how to handle. */
1989 default:
1990 return bfd_reloc_notsupported;
1993 /* Update the instruction word. */
1994 bfd_put_32 (input_bfd, insn, hit_data);
1995 return bfd_reloc_ok;
1998 /* Relocate the given INSN. VALUE should be the actual value we want
1999 to insert into the instruction, ie by this point we should not be
2000 concerned with computing an offset relative to the DLT, PC, etc.
2001 Instead this routine is meant to handle the bit manipulations needed
2002 to insert the relocation into the given instruction. */
2004 static unsigned int
2005 elf_hppa_relocate_insn (insn, sym_value, r_type)
2006 unsigned int insn;
2007 unsigned int sym_value;
2008 unsigned int r_type;
2010 switch (r_type)
2012 /* This is any 22 bit branch. In PA2.0 syntax it corresponds to
2013 the "B" instruction. */
2014 case R_PARISC_PCREL22F:
2015 case R_PARISC_PCREL22C:
2016 return (insn & ~ 0x3ff1ffd) | re_assemble_22 (sym_value);
2018 /* This is any 12 bit branch. */
2019 case R_PARISC_PCREL12F:
2020 return (insn & ~ 0x1ffd) | re_assemble_12 (sym_value);
2022 /* This is any 17 bit branch. In PA2.0 syntax it also corresponds
2023 to the "B" instruction as well as BE. */
2024 case R_PARISC_PCREL17F:
2025 case R_PARISC_DIR17F:
2026 case R_PARISC_DIR17R:
2027 case R_PARISC_PCREL17C:
2028 case R_PARISC_PCREL17R:
2029 return (insn & ~ 0x1f1ffd) | re_assemble_17 (sym_value);
2031 /* ADDIL or LDIL instructions. */
2032 case R_PARISC_DLTREL21L:
2033 case R_PARISC_DLTIND21L:
2034 case R_PARISC_LTOFF_FPTR21L:
2035 case R_PARISC_PCREL21L:
2036 case R_PARISC_LTOFF_TP21L:
2037 case R_PARISC_DPREL21L:
2038 case R_PARISC_PLTOFF21L:
2039 case R_PARISC_DIR21L:
2040 return (insn & ~ 0x1fffff) | re_assemble_21 (sym_value);
2042 /* LDO and integer loads/stores with 14 bit displacements. */
2043 case R_PARISC_DLTREL14R:
2044 case R_PARISC_DLTREL14F:
2045 case R_PARISC_DLTIND14R:
2046 case R_PARISC_DLTIND14F:
2047 case R_PARISC_LTOFF_FPTR14R:
2048 case R_PARISC_LTOFF_FPTR16F:
2049 case R_PARISC_PCREL14R:
2050 case R_PARISC_PCREL14F:
2051 case R_PARISC_PCREL16F:
2052 case R_PARISC_LTOFF_TP14R:
2053 case R_PARISC_LTOFF_TP14F:
2054 case R_PARISC_LTOFF_TP16F:
2055 case R_PARISC_DPREL14R:
2056 case R_PARISC_DPREL14F:
2057 case R_PARISC_GPREL16F:
2058 case R_PARISC_PLTOFF14R:
2059 case R_PARISC_PLTOFF14F:
2060 case R_PARISC_PLTOFF16F:
2061 case R_PARISC_DIR14R:
2062 case R_PARISC_DIR14F:
2063 case R_PARISC_DIR16F:
2064 case R_PARISC_LTOFF16F:
2065 return (insn & ~ 0x3fff) | low_sign_unext (sym_value, 14);
2067 /* Doubleword loads and stores with a 14 bit displacement. */
2068 case R_PARISC_DLTREL14DR:
2069 case R_PARISC_DLTIND14DR:
2070 case R_PARISC_LTOFF_FPTR14DR:
2071 case R_PARISC_LTOFF_FPTR16DF:
2072 case R_PARISC_PCREL14DR:
2073 case R_PARISC_PCREL16DF:
2074 case R_PARISC_LTOFF_TP14DR:
2075 case R_PARISC_LTOFF_TP16DF:
2076 case R_PARISC_DPREL14DR:
2077 case R_PARISC_GPREL16DF:
2078 case R_PARISC_PLTOFF14DR:
2079 case R_PARISC_PLTOFF16DF:
2080 case R_PARISC_DIR14DR:
2081 case R_PARISC_DIR16DF:
2082 case R_PARISC_LTOFF16DF:
2083 return (insn & ~ 0x3ff1) | (((sym_value & 0x2000) >> 13)
2084 | ((sym_value & 0x1ff8) << 1));
2086 /* Floating point single word load/store instructions. */
2087 case R_PARISC_DLTREL14WR:
2088 case R_PARISC_DLTIND14WR:
2089 case R_PARISC_LTOFF_FPTR14WR:
2090 case R_PARISC_LTOFF_FPTR16WF:
2091 case R_PARISC_PCREL14WR:
2092 case R_PARISC_PCREL16WF:
2093 case R_PARISC_LTOFF_TP14WR:
2094 case R_PARISC_LTOFF_TP16WF:
2095 case R_PARISC_DPREL14WR:
2096 case R_PARISC_GPREL16WF:
2097 case R_PARISC_PLTOFF14WR:
2098 case R_PARISC_PLTOFF16WF:
2099 case R_PARISC_DIR16WF:
2100 case R_PARISC_DIR14WR:
2101 case R_PARISC_LTOFF16WF:
2102 return (insn & ~ 0x3ff9) | (((sym_value & 0x2000) >> 13)
2103 | ((sym_value & 0x1ffc) << 1));
2105 default:
2106 return insn;
2109 #endif