oops - update date on newly created entry
[binutils.git] / bfd / elf-hppa.h
bloba98c2b0a9737dbf9093004815737f1ea4f5b620d
1 /* Common code for PA ELF implementations.
2 Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
4 This file is part of BFD, the Binary File Descriptor library.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20 #define ELF_HOWTO_TABLE_SIZE R_PARISC_UNIMPLEMENTED + 1
22 /* This file is included by multiple PA ELF BFD backends with different
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 elf_hppa_reloc_final_type elf64_hppa_reloc_final_type
33 #define _bfd_elf_hppa_gen_reloc_type _bfd_elf64_hppa_gen_reloc_type
34 #define elf_hppa_relocate_section elf64_hppa_relocate_section
35 #define bfd_elf_bfd_final_link bfd_elf64_bfd_final_link
36 #define elf_hppa_final_link elf64_hppa_final_link
37 #endif
38 #if ARCH_SIZE == 32
39 #define ELF_R_TYPE(X) ELF32_R_TYPE(X)
40 #define ELF_R_SYM(X) ELF32_R_SYM(X)
41 #define elf_hppa_internal_shdr Elf32_Internal_Shdr
42 #define elf_hppa_reloc_final_type elf32_hppa_reloc_final_type
43 #define _bfd_elf_hppa_gen_reloc_type _bfd_elf32_hppa_gen_reloc_type
44 #define elf_hppa_relocate_section elf32_hppa_relocate_section
45 #define bfd_elf_bfd_final_link bfd_elf32_bfd_final_link
46 #define elf_hppa_final_link elf32_hppa_final_link
47 #endif
49 static void elf_hppa_info_to_howto
50 PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
52 static void elf_hppa_info_to_howto_rel
53 PARAMS ((bfd *, arelent *, Elf_Internal_Rel *));
55 static reloc_howto_type * elf_hppa_reloc_type_lookup
56 PARAMS ((bfd *, bfd_reloc_code_real_type));
58 static boolean elf_hppa_is_local_label_name
59 PARAMS ((bfd *, const char *));
61 static boolean elf_hppa_fake_sections
62 PARAMS ((bfd *abfd, elf_hppa_internal_shdr *, asection *));
64 static void elf_hppa_final_write_processing
65 PARAMS ((bfd *, boolean));
67 #if ARCH_SIZE == 64
68 static boolean elf_hppa_add_symbol_hook
69 PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
70 const char **, flagword *, asection **, bfd_vma *));
72 static boolean elf_hppa_unmark_useless_dynamic_symbols
73 PARAMS ((struct elf_link_hash_entry *, PTR));
75 static boolean elf_hppa_remark_useless_dynamic_symbols
76 PARAMS ((struct elf_link_hash_entry *, PTR));
78 static void elf_hppa_record_segment_addrs
79 PARAMS ((bfd *, asection *, PTR));
81 static boolean elf_hppa_final_link
82 PARAMS ((bfd *, struct bfd_link_info *));
84 static boolean elf_hppa_relocate_section
85 PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
86 bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
88 static bfd_reloc_status_type elf_hppa_final_link_relocate
89 PARAMS ((Elf_Internal_Rela *, bfd *, bfd *, asection *,
90 bfd_byte *, bfd_vma, struct bfd_link_info *,
91 asection *, struct elf_link_hash_entry *,
92 struct elf64_hppa_dyn_hash_entry *));
94 static int elf_hppa_relocate_insn
95 PARAMS ((int, int, unsigned int));
96 #endif
98 /* ELF/PA relocation howto entries. */
100 static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
102 { R_PARISC_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield,
103 bfd_elf_generic_reloc, "R_PARISC_NONE", false, 0, 0, false },
105 /* The values in DIR32 are to placate the check in
106 _bfd_stab_section_find_nearest_line. */
107 { R_PARISC_DIR32, 0, 2, 32, false, 0, complain_overflow_bitfield,
108 bfd_elf_generic_reloc, "R_PARISC_DIR32", false, 0, 0xffffffff, false },
109 { R_PARISC_DIR21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
110 bfd_elf_generic_reloc, "R_PARISC_DIR21L", false, 0, 0, false },
111 { R_PARISC_DIR17R, 0, 0, 17, false, 0, complain_overflow_bitfield,
112 bfd_elf_generic_reloc, "R_PARISC_DIR17R", false, 0, 0, false },
113 { R_PARISC_DIR17F, 0, 0, 17, false, 0, complain_overflow_bitfield,
114 bfd_elf_generic_reloc, "R_PARISC_DIR17F", false, 0, 0, false },
115 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
116 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
117 { R_PARISC_DIR14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
118 bfd_elf_generic_reloc, "R_PARISC_DIR14R", false, 0, 0, false },
119 { R_PARISC_DIR14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
120 bfd_elf_generic_reloc, "R_PARISC_DIR14F", false, 0, 0, false },
121 /* 8 */
122 { R_PARISC_PCREL12F, 0, 0, 12, true, 0, complain_overflow_bitfield,
123 bfd_elf_generic_reloc, "R_PARISC_PCREL12F", false, 0, 0, false },
124 { R_PARISC_PCREL32, 0, 0, 32, true, 0, complain_overflow_bitfield,
125 bfd_elf_generic_reloc, "R_PARISC_PCREL32", false, 0, 0, false },
126 { R_PARISC_PCREL21L, 0, 0, 21, true, 0, complain_overflow_bitfield,
127 bfd_elf_generic_reloc, "R_PARISC_PCREL21L", false, 0, 0, false },
128 { R_PARISC_PCREL17R, 0, 0, 17, true, 0, complain_overflow_bitfield,
129 bfd_elf_generic_reloc, "R_PARISC_PCREL17R", false, 0, 0, false },
130 { R_PARISC_PCREL17F, 0, 0, 17, true, 0, complain_overflow_bitfield,
131 bfd_elf_generic_reloc, "R_PARISC_PCREL17F", false, 0, 0, false },
132 { R_PARISC_PCREL17C, 0, 0, 17, true, 0, complain_overflow_bitfield,
133 bfd_elf_generic_reloc, "R_PARISC_PCREL17C", false, 0, 0, false },
134 { R_PARISC_PCREL14R, 0, 0, 14, true, 0, complain_overflow_bitfield,
135 bfd_elf_generic_reloc, "R_PARISC_PCREL14R", false, 0, 0, false },
136 { R_PARISC_PCREL14F, 0, 0, 14, true, 0, complain_overflow_bitfield,
137 bfd_elf_generic_reloc, "R_PARISC_PCREL14F", false, 0, 0, false },
138 /* 16 */
139 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
140 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
141 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
142 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
143 { R_PARISC_DPREL21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
144 bfd_elf_generic_reloc, "R_PARISC_DPREL21L", false, 0, 0, false },
145 { R_PARISC_DPREL14WR, 0, 0, 14, false, 0, complain_overflow_bitfield,
146 bfd_elf_generic_reloc, "R_PARISC_DPREL14WR", false, 0, 0, false },
147 { R_PARISC_DPREL14DR, 0, 0, 14, false, 0, complain_overflow_bitfield,
148 bfd_elf_generic_reloc, "R_PARISC_DPREL14DR", false, 0, 0, false },
149 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
150 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
151 { R_PARISC_DPREL14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
152 bfd_elf_generic_reloc, "R_PARISC_DPREL14R", false, 0, 0, false },
153 { R_PARISC_DPREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
154 bfd_elf_generic_reloc, "R_PARISC_DPREL14F", false, 0, 0, false },
155 /* 24 */
156 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
157 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
158 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
159 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
160 { R_PARISC_DLTREL21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
161 bfd_elf_generic_reloc, "R_PARISC_DLTREL21L", false, 0, 0, false },
162 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
163 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
164 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
165 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
166 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
167 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
168 { R_PARISC_DLTREL14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
169 bfd_elf_generic_reloc, "R_PARISC_DLTREL14R", false, 0, 0, false },
170 { R_PARISC_DLTREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
171 bfd_elf_generic_reloc, "R_PARISC_DLTREL14F", false, 0, 0, false },
172 /* 32 */
173 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
174 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
175 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
176 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
177 { R_PARISC_DLTIND21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
178 bfd_elf_generic_reloc, "R_PARISC_DLTIND21L", false, 0, 0, false },
179 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
180 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
181 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
182 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
183 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
184 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
185 { R_PARISC_DLTIND14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
186 bfd_elf_generic_reloc, "R_PARISC_DLTIND14R", false, 0, 0, false },
187 { R_PARISC_DLTIND14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
188 bfd_elf_generic_reloc, "R_PARISC_DLTIND14F", false, 0, 0, false },
189 /* 40 */
190 { R_PARISC_SETBASE, 0, 0, 0, false, 0, complain_overflow_bitfield,
191 bfd_elf_generic_reloc, "R_PARISC_SETBASE", false, 0, 0, false },
192 { R_PARISC_SECREL32, 0, 0, 32, false, 0, complain_overflow_bitfield,
193 bfd_elf_generic_reloc, "R_PARISC_SECREL32", false, 0, 0, false },
194 { R_PARISC_BASEREL21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
195 bfd_elf_generic_reloc, "R_PARISC_BASEREL21L", false, 0, 0, false },
196 { R_PARISC_BASEREL17R, 0, 0, 17, false, 0, complain_overflow_bitfield,
197 bfd_elf_generic_reloc, "R_PARISC_BASEREL17R", false, 0, 0, false },
198 { R_PARISC_BASEREL17F, 0, 0, 17, false, 0, complain_overflow_bitfield,
199 bfd_elf_generic_reloc, "R_PARISC_BASEREL17F", false, 0, 0, false },
200 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
201 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
202 { R_PARISC_BASEREL14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
203 bfd_elf_generic_reloc, "R_PARISC_BASEREL14R", false, 0, 0, false },
204 { R_PARISC_BASEREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
205 bfd_elf_generic_reloc, "R_PARISC_BASEREL14F", false, 0, 0, false },
206 /* 48 */
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, 32, false, 0, complain_overflow_bitfield,
210 bfd_elf_generic_reloc, "R_PARISC_SEGREL32", false, 0, 0, false },
211 { R_PARISC_PLTOFF21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
212 bfd_elf_generic_reloc, "R_PARISC_PLTOFF21L", false, 0, 0, false },
213 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
214 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
215 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
216 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
217 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
218 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
219 { R_PARISC_PLTOFF14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
220 bfd_elf_generic_reloc, "R_PARISC_PLTOFF14R", false, 0, 0, false },
221 { R_PARISC_PLTOFF14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
222 bfd_elf_generic_reloc, "R_PARISC_PLTOFF14F", false, 0, 0, false },
223 /* 56 */
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, 32, 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, 21, 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 },
232 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
233 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
234 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
235 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
236 { R_PARISC_LTOFF_FPTR14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
237 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14R", false, 0, 0, false },
238 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
239 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
240 /* 64 */
241 { R_PARISC_FPTR64, 0, 0, 64, 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 },
253 { R_PARISC_PLABEL14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
254 bfd_elf_generic_reloc, "R_PARISC_PLABEL14R", false, 0, 0, false },
255 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
256 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
257 /* 72 */
258 { R_PARISC_PCREL64, 0, 0, 64, false, 0, complain_overflow_bitfield,
259 bfd_elf_generic_reloc, "R_PARISC_PCREL64", false, 0, 0, false },
260 { R_PARISC_PCREL22C, 0, 0, 22, false, 0, complain_overflow_bitfield,
261 bfd_elf_generic_reloc, "R_PARISC_PCREL22C", false, 0, 0, false },
262 { R_PARISC_PCREL22F, 0, 0, 22, false, 0, complain_overflow_bitfield,
263 bfd_elf_generic_reloc, "R_PARISC_PCREL22F", false, 0, 0, false },
264 { R_PARISC_PCREL14WR, 0, 0, 14, false, 0, complain_overflow_bitfield,
265 bfd_elf_generic_reloc, "R_PARISC_PCREL14WR", false, 0, 0, false },
266 { R_PARISC_PCREL14DR, 0, 0, 14, false, 0, complain_overflow_bitfield,
267 bfd_elf_generic_reloc, "R_PARISC_PCREL14DR", false, 0, 0, false },
268 { R_PARISC_PCREL16F, 0, 0, 16, false, 0, complain_overflow_bitfield,
269 bfd_elf_generic_reloc, "R_PARISC_PCREL16F", false, 0, 0, false },
270 { R_PARISC_PCREL16WF, 0, 0, 16, false, 0, complain_overflow_bitfield,
271 bfd_elf_generic_reloc, "R_PARISC_PCREL16WF", false, 0, 0, false },
272 { R_PARISC_PCREL16DF, 0, 0, 16, false, 0, complain_overflow_bitfield,
273 bfd_elf_generic_reloc, "R_PARISC_PCREL16DF", false, 0, 0, false },
274 /* 80 */
275 { R_PARISC_DIR64, 0, 0, 64, false, 0, complain_overflow_bitfield,
276 bfd_elf_generic_reloc, "R_PARISC_DIR64", false, 0, 0, false },
277 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
278 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
279 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
280 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
281 { R_PARISC_DIR14WR, 0, 0, 14, false, 0, complain_overflow_bitfield,
282 bfd_elf_generic_reloc, "R_PARISC_DIR14WR", false, 0, 0, false },
283 { R_PARISC_DIR14DR, 0, 0, 14, false, 0, complain_overflow_bitfield,
284 bfd_elf_generic_reloc, "R_PARISC_DIR14DR", false, 0, 0, false },
285 { R_PARISC_DIR16F, 0, 0, 16, false, 0, complain_overflow_bitfield,
286 bfd_elf_generic_reloc, "R_PARISC_DIR16F", false, 0, 0, false },
287 { R_PARISC_DIR16WF, 0, 0, 16, false, 0, complain_overflow_bitfield,
288 bfd_elf_generic_reloc, "R_PARISC_DIR16WF", false, 0, 0, false },
289 { R_PARISC_DIR16DF, 0, 0, 16, false, 0, complain_overflow_bitfield,
290 bfd_elf_generic_reloc, "R_PARISC_DIR16DF", false, 0, 0, false },
291 /* 88 */
292 { R_PARISC_GPREL64, 0, 0, 64, false, 0, complain_overflow_bitfield,
293 bfd_elf_generic_reloc, "R_PARISC_GPREL64", false, 0, 0, false },
294 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
295 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, 14, false, 0, complain_overflow_bitfield,
299 bfd_elf_generic_reloc, "R_PARISC_DLTREL14WR", false, 0, 0, false },
300 { R_PARISC_DLTREL14DR, 0, 0, 14, false, 0, complain_overflow_bitfield,
301 bfd_elf_generic_reloc, "R_PARISC_DLTREL14DR", false, 0, 0, false },
302 { R_PARISC_GPREL16F, 0, 0, 16, false, 0, complain_overflow_bitfield,
303 bfd_elf_generic_reloc, "R_PARISC_GPREL16F", false, 0, 0, false },
304 { R_PARISC_GPREL16WF, 0, 0, 16, false, 0, complain_overflow_bitfield,
305 bfd_elf_generic_reloc, "R_PARISC_GPREL16WF", false, 0, 0, false },
306 { R_PARISC_GPREL16DF, 0, 0, 16, false, 0, complain_overflow_bitfield,
307 bfd_elf_generic_reloc, "R_PARISC_GPREL16DF", false, 0, 0, false },
308 /* 96 */
309 { R_PARISC_LTOFF64, 0, 0, 64, false, 0, complain_overflow_bitfield,
310 bfd_elf_generic_reloc, "R_PARISC_LTOFF64", false, 0, 0, false },
311 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
312 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
313 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
314 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
315 { R_PARISC_DLTIND14WR, 0, 0, 14, false, 0, complain_overflow_bitfield,
316 bfd_elf_generic_reloc, "R_PARISC_DLTIND14WR", false, 0, 0, false },
317 { R_PARISC_DLTIND14DR, 0, 0, 14, false, 0, complain_overflow_bitfield,
318 bfd_elf_generic_reloc, "R_PARISC_DLTIND14DR", false, 0, 0, false },
319 { R_PARISC_LTOFF16F, 0, 0, 16, false, 0, complain_overflow_bitfield,
320 bfd_elf_generic_reloc, "R_PARISC_LTOFF16F", false, 0, 0, false },
321 { R_PARISC_LTOFF16WF, 0, 0, 16, false, 0, complain_overflow_bitfield,
322 bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", false, 0, 0, false },
323 { R_PARISC_LTOFF16DF, 0, 0, 16, false, 0, complain_overflow_bitfield,
324 bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", false, 0, 0, false },
325 /* 104 */
326 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
327 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
328 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
329 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
330 { R_PARISC_BASEREL14WR, 0, 0, 14, false, 0, complain_overflow_bitfield,
331 bfd_elf_generic_reloc, "R_PARISC_BASEREL14WR", false, 0, 0, false },
332 { R_PARISC_BASEREL14DR, 0, 0, 14, false, 0, complain_overflow_bitfield,
333 bfd_elf_generic_reloc, "R_PARISC_BASEREL14DR", false, 0, 0, false },
334 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
335 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
336 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
337 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 /* 112 */
343 { R_PARISC_SEGREL64, 0, 0, 64, false, 0, complain_overflow_bitfield,
344 bfd_elf_generic_reloc, "R_PARISC_SEGREL64", false, 0, 0, false },
345 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
346 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
347 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
348 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
349 { R_PARISC_PLTOFF14WR, 0, 0, 14, false, 0, complain_overflow_bitfield,
350 bfd_elf_generic_reloc, "R_PARISC_PLTOFF14WR", false, 0, 0, false },
351 { R_PARISC_PLTOFF14DR, 0, 0, 14, false, 0, complain_overflow_bitfield,
352 bfd_elf_generic_reloc, "R_PARISC_PLTOFF14DR", false, 0, 0, false },
353 { R_PARISC_PLTOFF16F, 0, 0, 16, false, 0, complain_overflow_bitfield,
354 bfd_elf_generic_reloc, "R_PARISC_PLTOFF16F", false, 0, 0, false },
355 { R_PARISC_PLTOFF16WF, 0, 0, 16, false, 0, complain_overflow_bitfield,
356 bfd_elf_generic_reloc, "R_PARISC_PLTOFF16WF", false, 0, 0, false },
357 { R_PARISC_PLTOFF16DF, 0, 0, 16, false, 0, complain_overflow_bitfield,
358 bfd_elf_generic_reloc, "R_PARISC_PLTOFF16DF", false, 0, 0, false },
359 /* 120 */
360 { R_PARISC_LTOFF_FPTR64, 0, 0, 64, false, 0, complain_overflow_bitfield,
361 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
362 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
363 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
364 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
365 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
366 { R_PARISC_LTOFF_FPTR14WR, 0, 0, 14, false, 0, complain_overflow_bitfield,
367 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14WR", false, 0, 0, false },
368 { R_PARISC_LTOFF_FPTR14DR, 0, 0, 14, false, 0, complain_overflow_bitfield,
369 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14DR", false, 0, 0, false },
370 { R_PARISC_LTOFF_FPTR16F, 0, 0, 16, false, 0, complain_overflow_bitfield,
371 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16F", false, 0, 0, false },
372 { R_PARISC_LTOFF_FPTR16WF, 0, 0, 16, false, 0, complain_overflow_bitfield,
373 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16WF", false, 0, 0, false },
374 { R_PARISC_LTOFF_FPTR16DF, 0, 0, 16, false, 0, complain_overflow_bitfield,
375 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
376 /* 128 */
377 { R_PARISC_COPY, 0, 0, 0, false, 0, complain_overflow_bitfield,
378 bfd_elf_generic_reloc, "R_PARISC_COPY", false, 0, 0, false },
379 { R_PARISC_IPLT, 0, 0, 0, false, 0, complain_overflow_bitfield,
380 bfd_elf_generic_reloc, "R_PARISC_IPLT", false, 0, 0, false },
381 { R_PARISC_EPLT, 0, 0, 0, false, 0, complain_overflow_bitfield,
382 bfd_elf_generic_reloc, "R_PARISC_EPLT", false, 0, 0, false },
383 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
384 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
385 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
386 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
387 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
388 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
389 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
390 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
391 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
392 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
393 /* 136 */
394 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
395 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
396 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
397 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
398 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
399 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
400 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
401 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
402 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
403 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
404 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
405 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
406 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
407 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
408 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
409 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
410 /* 144 */
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_bitfield,
416 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
417 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
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 },
421 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
422 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
423 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
424 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
425 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
426 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
427 /* 152 */
428 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
429 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
430 { R_PARISC_TPREL32, 0, 0, 32, false, 0, complain_overflow_dont,
431 bfd_elf_generic_reloc, "R_PARISC_TPREL32", false, 0, 0, false },
432 { R_PARISC_TPREL21L, 0, 0, 21, false, 0, complain_overflow_dont,
433 bfd_elf_generic_reloc, "R_PARISC_TPREL21L", false, 0, 0, false },
434 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
435 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
436 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
437 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
438 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
439 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
440 { R_PARISC_TPREL14R, 0, 0, 14, false, 0, complain_overflow_dont,
441 bfd_elf_generic_reloc, "R_PARISC_TPREL14R", false, 0, 0, false },
442 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
443 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
444 /* 160 */
445 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
446 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
447 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
448 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
449 { R_PARISC_LTOFF_TP21L, 0, 0, 21, false, 0, complain_overflow_bitfield,
450 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP21L", false, 0, 0, false },
451 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
452 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
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_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
456 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
457 { R_PARISC_LTOFF_TP14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
458 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
459 { R_PARISC_LTOFF_TP14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
460 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14F", false, 0, 0, false },
461 /* 168 */
462 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
463 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
464 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
465 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
466 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
467 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
468 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
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 /* 176 */
479 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
480 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
481 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
482 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
483 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
484 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
485 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
486 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
487 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
488 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
489 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
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 /* 184 */
496 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
497 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
498 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
499 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
500 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
501 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
502 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
503 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
504 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
505 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_bitfield,
509 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
510 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
511 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
512 /* 192 */
513 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
514 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
515 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
516 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
517 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
518 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
519 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
520 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
521 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
522 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
523 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
524 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
525 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
526 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 /* 200 */
530 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
531 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
532 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
533 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
534 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
535 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
536 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
537 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
538 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
539 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
540 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
541 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
542 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
543 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
544 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
545 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
546 /* 208 */
547 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
548 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
549 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
550 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
551 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
552 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
553 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
554 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
555 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
556 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
557 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
558 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
559 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
560 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
561 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
562 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
563 /* 216 */
564 { R_PARISC_TPREL64, 0, 0, 64, false, 0, complain_overflow_bitfield,
565 bfd_elf_generic_reloc, "R_PARISC_TPREL64", false, 0, 0, false },
566 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
567 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
568 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
569 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
570 { R_PARISC_TPREL14WR, 0, 0, 14, false, 0, complain_overflow_dont,
571 bfd_elf_generic_reloc, "R_PARISC_TPREL14WR", false, 0, 0, false },
572 { R_PARISC_TPREL14DR, 0, 0, 14, false, 0, complain_overflow_bitfield,
573 bfd_elf_generic_reloc, "R_PARISC_TPREL14DR", false, 0, 0, false },
574 { R_PARISC_TPREL16F, 0, 0, 16, false, 0, complain_overflow_bitfield,
575 bfd_elf_generic_reloc, "R_PARISC_TPREL16F", false, 0, 0, false },
576 { R_PARISC_TPREL16WF, 0, 0, 16, false, 0, complain_overflow_dont,
577 bfd_elf_generic_reloc, "R_PARISC_TPREL16WF", false, 0, 0, false },
578 { R_PARISC_TPREL16DF, 0, 0, 16, false, 0, complain_overflow_bitfield,
579 bfd_elf_generic_reloc, "R_PARISC_TPREL16DF", false, 0, 0, false },
580 /* 224 */
581 { R_PARISC_LTOFF_TP64, 0, 0, 64, false, 0, complain_overflow_bitfield,
582 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP64", false, 0, 0, false },
583 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
584 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
585 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
586 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
587 { R_PARISC_LTOFF_TP14WR, 0, 0, 14, false, 0, complain_overflow_bitfield,
588 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14WR", false, 0, 0, false },
589 { R_PARISC_LTOFF_TP14DR, 0, 0, 14, false, 0, complain_overflow_bitfield,
590 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14DR", false, 0, 0, false },
591 { R_PARISC_LTOFF_TP16F, 0, 0, 16, false, 0, complain_overflow_dont,
592 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16F", false, 0, 0, false },
593 { R_PARISC_LTOFF_TP16WF, 0, 0, 16, false, 0, complain_overflow_bitfield,
594 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16WF", false, 0, 0, false },
595 { R_PARISC_LTOFF_TP16DF, 0, 0, 16, false, 0, complain_overflow_bitfield,
596 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16DF", false, 0, 0, false },
597 /* 232 */
598 { R_PARISC_GNU_VTENTRY, 0, 0, 0, false, 0, complain_overflow_dont,
599 bfd_elf_generic_reloc, "R_PARISC_GNU_VTENTRY", false, 0, 0, false },
600 { R_PARISC_GNU_VTINHERIT, 0, 0, 0, false, 0, complain_overflow_dont,
601 bfd_elf_generic_reloc, "R_PARISC_GNU_VTINHERIT", false, 0, 0, false },
604 #define OFFSET_14R_FROM_21L 4
605 #define OFFSET_14F_FROM_21L 5
607 /* Return the final relocation type for the given base type, instruction
608 format, and field selector. */
610 elf_hppa_reloc_type
611 elf_hppa_reloc_final_type (abfd, base_type, format, field)
612 bfd *abfd;
613 elf_hppa_reloc_type base_type;
614 int format;
615 unsigned int field;
617 elf_hppa_reloc_type final_type = base_type;
619 /* Just a tangle of nested switch statements to deal with the braindamage
620 that a different field selector means a completely different relocation
621 for PA ELF. */
622 switch (base_type)
624 /* We have been using generic relocation types. However, that may not
625 really make sense. Anyway, we need to support both R_PARISC_DIR64
626 and R_PARISC_DIR32 here. */
627 case R_PARISC_DIR32:
628 case R_PARISC_DIR64:
629 case R_HPPA_ABS_CALL:
630 switch (format)
632 case 14:
633 switch (field)
635 case e_fsel:
636 final_type = R_PARISC_DIR14F;
637 break;
638 case e_rsel:
639 case e_rrsel:
640 case e_rdsel:
641 final_type = R_PARISC_DIR14R;
642 break;
643 case e_rtsel:
644 final_type = R_PARISC_DLTIND14R;
645 break;
646 case e_rtpsel:
647 final_type = R_PARISC_LTOFF_FPTR14DR;
648 break;
649 case e_tsel:
650 final_type = R_PARISC_DLTIND14F;
651 break;
652 case e_rpsel:
653 final_type = R_PARISC_PLABEL14R;
654 break;
655 default:
656 return R_PARISC_NONE;
658 break;
660 case 17:
661 switch (field)
663 case e_fsel:
664 final_type = R_PARISC_DIR17F;
665 break;
666 case e_rsel:
667 case e_rrsel:
668 case e_rdsel:
669 final_type = R_PARISC_DIR17R;
670 break;
671 default:
672 return R_PARISC_NONE;
674 break;
676 case 21:
677 switch (field)
679 case e_lsel:
680 case e_lrsel:
681 case e_ldsel:
682 case e_nlsel:
683 case e_nlrsel:
684 final_type = R_PARISC_DIR21L;
685 break;
686 case e_ltsel:
687 final_type = R_PARISC_DLTIND21L;
688 break;
689 case e_ltpsel:
690 final_type = R_PARISC_LTOFF_FPTR21L;
691 break;
692 case e_lpsel:
693 final_type = R_PARISC_PLABEL21L;
694 break;
695 default:
696 return R_PARISC_NONE;
698 break;
700 case 32:
701 switch (field)
703 case e_fsel:
704 final_type = R_PARISC_DIR32;
705 /* When in 64bit mode, a 32bit relocation is supposed to
706 be a section relative relocation. Dwarf2 (for example)
707 uses 32bit section relative relocations. */
708 if (bfd_get_arch_info (abfd)->bits_per_address != 32)
709 final_type = R_PARISC_SECREL32;
710 break;
711 case e_psel:
712 final_type = R_PARISC_PLABEL32;
713 break;
714 default:
715 return R_PARISC_NONE;
717 break;
719 case 64:
720 switch (field)
722 case e_fsel:
723 final_type = R_PARISC_DIR64;
724 break;
725 case e_psel:
726 final_type = R_PARISC_FPTR64;
727 break;
728 default:
729 return R_PARISC_NONE;
731 break;
733 default:
734 return R_PARISC_NONE;
736 break;
738 case R_HPPA_GOTOFF:
739 switch (format)
741 case 14:
742 switch (field)
744 case e_rsel:
745 case e_rrsel:
746 case e_rdsel:
747 /* R_PARISC_DLTREL14R for elf64, R_PARISC_DPREL14R for elf32 */
748 final_type = base_type + OFFSET_14R_FROM_21L;
749 break;
750 case e_fsel:
751 /* R_PARISC_DLTREL14F for elf64, R_PARISC_DPREL14F for elf32 */
752 final_type = base_type + OFFSET_14F_FROM_21L;
753 break;
754 default:
755 return R_PARISC_NONE;
757 break;
759 case 21:
760 switch (field)
762 case e_lsel:
763 case e_lrsel:
764 case e_ldsel:
765 case e_nlsel:
766 case e_nlrsel:
767 /* R_PARISC_DLTREL21L for elf64, R_PARISC_DPREL21L for elf32 */
768 final_type = base_type;
769 break;
770 default:
771 return R_PARISC_NONE;
773 break;
775 default:
776 return R_PARISC_NONE;
778 break;
780 case R_HPPA_PCREL_CALL:
781 switch (format)
783 case 12:
784 switch (field)
786 case e_fsel:
787 final_type = R_PARISC_PCREL12F;
788 break;
789 default:
790 return R_PARISC_NONE;
792 break;
794 case 14:
795 /* Contrary to appearances, these are not calls of any sort.
796 Rather, they are loads/stores with a pcrel reloc. */
797 switch (field)
799 case e_rsel:
800 case e_rrsel:
801 case e_rdsel:
802 final_type = R_PARISC_PCREL14R;
803 break;
804 case e_fsel:
805 final_type = R_PARISC_PCREL14F;
806 break;
807 default:
808 return R_PARISC_NONE;
810 break;
812 case 17:
813 switch (field)
815 case e_rsel:
816 case e_rrsel:
817 case e_rdsel:
818 final_type = R_PARISC_PCREL17R;
819 break;
820 case e_fsel:
821 final_type = R_PARISC_PCREL17F;
822 break;
823 default:
824 return R_PARISC_NONE;
826 break;
828 case 21:
829 switch (field)
831 case e_lsel:
832 case e_lrsel:
833 case e_ldsel:
834 case e_nlsel:
835 case e_nlrsel:
836 final_type = R_PARISC_PCREL21L;
837 break;
838 default:
839 return R_PARISC_NONE;
841 break;
843 case 22:
844 switch (field)
846 case e_fsel:
847 final_type = R_PARISC_PCREL22F;
848 break;
849 default:
850 return R_PARISC_NONE;
852 break;
854 default:
855 return R_PARISC_NONE;
857 break;
859 case R_PARISC_GNU_VTENTRY:
860 case R_PARISC_GNU_VTINHERIT:
861 case R_PARISC_SEGREL32:
862 case R_PARISC_SEGBASE:
863 /* The defaults are fine for these cases. */
864 break;
866 default:
867 return R_PARISC_NONE;
870 return final_type;
873 /* Return one (or more) BFD relocations which implement the base
874 relocation with modifications based on format and field. */
876 elf_hppa_reloc_type **
877 _bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
878 bfd *abfd;
879 elf_hppa_reloc_type base_type;
880 int format;
881 unsigned int field;
882 int ignore ATTRIBUTE_UNUSED;
883 asymbol *sym ATTRIBUTE_UNUSED;
885 elf_hppa_reloc_type *finaltype;
886 elf_hppa_reloc_type **final_types;
887 bfd_size_type amt = sizeof (elf_hppa_reloc_type *) * 2;
889 /* Allocate slots for the BFD relocation. */
890 final_types = (elf_hppa_reloc_type **) bfd_alloc (abfd, amt);
891 if (final_types == NULL)
892 return NULL;
894 /* Allocate space for the relocation itself. */
895 amt = sizeof (elf_hppa_reloc_type);
896 finaltype = (elf_hppa_reloc_type *) bfd_alloc (abfd, amt);
897 if (finaltype == NULL)
898 return NULL;
900 /* Some reasonable defaults. */
901 final_types[0] = finaltype;
902 final_types[1] = NULL;
904 *finaltype = elf_hppa_reloc_final_type (abfd, base_type, format, field);
906 return final_types;
909 /* Translate from an elf into field into a howto relocation pointer. */
911 static void
912 elf_hppa_info_to_howto (abfd, bfd_reloc, elf_reloc)
913 bfd *abfd ATTRIBUTE_UNUSED;
914 arelent *bfd_reloc;
915 Elf_Internal_Rela *elf_reloc;
917 BFD_ASSERT (ELF_R_TYPE(elf_reloc->r_info)
918 < (unsigned int) R_PARISC_UNIMPLEMENTED);
919 bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
922 /* Translate from an elf into field into a howto relocation pointer. */
924 static void
925 elf_hppa_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
926 bfd *abfd ATTRIBUTE_UNUSED;
927 arelent *bfd_reloc;
928 Elf_Internal_Rel *elf_reloc;
930 BFD_ASSERT (ELF_R_TYPE(elf_reloc->r_info)
931 < (unsigned int) R_PARISC_UNIMPLEMENTED);
932 bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
935 /* Return the address of the howto table entry to perform the CODE
936 relocation for an ARCH machine. */
938 static reloc_howto_type *
939 elf_hppa_reloc_type_lookup (abfd, code)
940 bfd *abfd ATTRIBUTE_UNUSED;
941 bfd_reloc_code_real_type code;
943 if ((int) code < (int) R_PARISC_UNIMPLEMENTED)
945 BFD_ASSERT ((int) elf_hppa_howto_table[(int) code].type == (int) code);
946 return &elf_hppa_howto_table[(int) code];
948 return NULL;
951 /* Return true if SYM represents a local label symbol. */
953 static boolean
954 elf_hppa_is_local_label_name (abfd, name)
955 bfd *abfd ATTRIBUTE_UNUSED;
956 const char *name;
958 if (name[0] == 'L' && name[1] == '$')
959 return 1;
960 return _bfd_elf_is_local_label_name (abfd, name);
963 /* Set the correct type for an ELF section. We do this by the
964 section name, which is a hack, but ought to work. */
966 static boolean
967 elf_hppa_fake_sections (abfd, hdr, sec)
968 bfd *abfd;
969 elf_hppa_internal_shdr *hdr;
970 asection *sec;
972 register const char *name;
974 name = bfd_get_section_name (abfd, sec);
976 if (strcmp (name, ".PARISC.unwind") == 0)
978 int indx;
979 asection *asec;
980 #if ARCH_SIZE == 64
981 hdr->sh_type = SHT_LOPROC + 1;
982 #else
983 hdr->sh_type = 1;
984 #endif
985 /* ?!? How are unwinds supposed to work for symbols in arbitrary
986 sections? Or what if we have multiple .text sections in a single
987 .o file? HP really messed up on this one.
989 Ugh. We can not use elf_section_data (sec)->this_idx at this
990 point because it is not initialized yet.
992 So we (gasp) recompute it here. Hopefully nobody ever changes the
993 way sections are numbered in elf.c! */
994 for (asec = abfd->sections, indx = 1; asec; asec = asec->next, indx++)
996 if (asec->name && strcmp (asec->name, ".text") == 0)
998 hdr->sh_info = indx;
999 break;
1003 /* I have no idea if this is really necessary or what it means. */
1004 hdr->sh_entsize = 4;
1006 return true;
1009 static void
1010 elf_hppa_final_write_processing (abfd, linker)
1011 bfd *abfd;
1012 boolean linker ATTRIBUTE_UNUSED;
1014 int mach = bfd_get_mach (abfd);
1016 elf_elfheader (abfd)->e_flags &= ~(EF_PARISC_ARCH | EF_PARISC_TRAPNIL
1017 | EF_PARISC_EXT | EF_PARISC_LSB
1018 | EF_PARISC_WIDE | EF_PARISC_NO_KABP
1019 | EF_PARISC_LAZYSWAP);
1021 if (mach == 10)
1022 elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_0;
1023 else if (mach == 11)
1024 elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_1;
1025 else if (mach == 20)
1026 elf_elfheader (abfd)->e_flags |= EFA_PARISC_2_0;
1027 else if (mach == 25)
1028 elf_elfheader (abfd)->e_flags |= (EF_PARISC_WIDE
1029 | EFA_PARISC_2_0
1030 /* The GNU tools have trapped without
1031 option since 1993, so need to take
1032 a step backwards with the ELF
1033 based toolchains. */
1034 | EF_PARISC_TRAPNIL);
1037 #if ARCH_SIZE == 64
1038 /* Hook called by the linker routine which adds symbols from an object
1039 file. HP's libraries define symbols with HP specific section
1040 indices, which we have to handle. */
1042 static boolean
1043 elf_hppa_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
1044 bfd *abfd;
1045 struct bfd_link_info *info ATTRIBUTE_UNUSED;
1046 const Elf_Internal_Sym *sym;
1047 const char **namep ATTRIBUTE_UNUSED;
1048 flagword *flagsp ATTRIBUTE_UNUSED;
1049 asection **secp;
1050 bfd_vma *valp;
1052 int index = sym->st_shndx;
1054 switch (index)
1056 case SHN_PARISC_ANSI_COMMON:
1057 *secp = bfd_make_section_old_way (abfd, ".PARISC.ansi.common");
1058 (*secp)->flags |= SEC_IS_COMMON;
1059 *valp = sym->st_size;
1060 break;
1062 case SHN_PARISC_HUGE_COMMON:
1063 *secp = bfd_make_section_old_way (abfd, ".PARISC.huge.common");
1064 (*secp)->flags |= SEC_IS_COMMON;
1065 *valp = sym->st_size;
1066 break;
1069 return true;
1072 static boolean
1073 elf_hppa_unmark_useless_dynamic_symbols (h, data)
1074 struct elf_link_hash_entry *h;
1075 PTR data;
1077 struct bfd_link_info *info = (struct bfd_link_info *)data;
1079 /* If we are not creating a shared library, and this symbol is
1080 referenced by a shared library but is not defined anywhere, then
1081 the generic code will warn that it is undefined.
1083 This behavior is undesirable on HPs since the standard shared
1084 libraries contain references to undefined symbols.
1086 So we twiddle the flags associated with such symbols so that they
1087 will not trigger the warning. ?!? FIXME. This is horribly fragile.
1089 Ultimately we should have better controls over the generic ELF BFD
1090 linker code. */
1091 if (! info->relocateable
1092 && ! (info->shared
1093 && !info->no_undefined)
1094 && h->root.type == bfd_link_hash_undefined
1095 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0
1096 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
1098 h->elf_link_hash_flags &= ~ELF_LINK_HASH_REF_DYNAMIC;
1099 h->elf_link_hash_flags |= 0x8000;
1102 return true;
1105 static boolean
1106 elf_hppa_remark_useless_dynamic_symbols (h, data)
1107 struct elf_link_hash_entry *h;
1108 PTR data;
1110 struct bfd_link_info *info = (struct bfd_link_info *)data;
1112 /* If we are not creating a shared library, and this symbol is
1113 referenced by a shared library but is not defined anywhere, then
1114 the generic code will warn that it is undefined.
1116 This behavior is undesirable on HPs since the standard shared
1117 libraries contain reerences to undefined symbols.
1119 So we twiddle the flags associated with such symbols so that they
1120 will not trigger the warning. ?!? FIXME. This is horribly fragile.
1122 Ultimately we should have better controls over the generic ELF BFD
1123 linker code. */
1124 if (! info->relocateable
1125 && ! (info->shared
1126 && !info->no_undefined)
1127 && h->root.type == bfd_link_hash_undefined
1128 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
1129 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0
1130 && (h->elf_link_hash_flags & 0x8000) != 0)
1132 h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
1133 h->elf_link_hash_flags &= ~0x8000;
1136 return true;
1139 /* Record the lowest address for the data and text segments. */
1140 static void
1141 elf_hppa_record_segment_addrs (abfd, section, data)
1142 bfd *abfd ATTRIBUTE_UNUSED;
1143 asection *section;
1144 PTR data;
1146 struct elf64_hppa_link_hash_table *hppa_info;
1147 bfd_vma value;
1149 hppa_info = (struct elf64_hppa_link_hash_table *)data;
1151 value = section->vma - section->filepos;
1153 if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
1154 == (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
1155 && value < hppa_info->text_segment_base)
1156 hppa_info->text_segment_base = value;
1157 else if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
1158 == (SEC_ALLOC | SEC_LOAD))
1159 && value < hppa_info->data_segment_base)
1160 hppa_info->data_segment_base = value;
1163 /* Called after we have seen all the input files/sections, but before
1164 final symbol resolution and section placement has been determined.
1166 We use this hook to (possibly) provide a value for __gp, then we
1167 fall back to the generic ELF final link routine. */
1169 static boolean
1170 elf_hppa_final_link (abfd, info)
1171 bfd *abfd;
1172 struct bfd_link_info *info;
1174 boolean retval;
1175 struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
1177 if (! info->relocateable)
1179 struct elf_link_hash_entry *gp;
1180 bfd_vma gp_val;
1182 /* The linker script defines a value for __gp iff it was referenced
1183 by one of the objects being linked. First try to find the symbol
1184 in the hash table. If that fails, just compute the value __gp
1185 should have had. */
1186 gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", false,
1187 false, false);
1189 if (gp)
1192 /* Adjust the value of __gp as we may want to slide it into the
1193 .plt section so that the stubs can access PLT entries without
1194 using an addil sequence. */
1195 gp->root.u.def.value += hppa_info->gp_offset;
1197 gp_val = (gp->root.u.def.section->output_section->vma
1198 + gp->root.u.def.section->output_offset
1199 + gp->root.u.def.value);
1201 else
1203 asection *sec;
1205 /* First look for a .plt section. If found, then __gp is the
1206 address of the .plt + gp_offset.
1208 If no .plt is found, then look for .dlt, .opd and .data (in
1209 that order) and set __gp to the base address of whichever section
1210 is found first. */
1212 sec = hppa_info->plt_sec;
1213 if (sec)
1214 gp_val = (sec->output_offset
1215 + sec->output_section->vma
1216 + hppa_info->gp_offset);
1217 else
1219 sec = hppa_info->dlt_sec;
1220 if (!sec)
1221 sec = hppa_info->opd_sec;
1222 if (!sec)
1223 sec = bfd_get_section_by_name (abfd, ".data");
1224 if (!sec)
1225 return false;
1227 gp_val = sec->output_offset + sec->output_section->vma;
1231 /* Install whatever value we found/computed for __gp. */
1232 _bfd_set_gp_value (abfd, gp_val);
1235 /* We need to know the base of the text and data segments so that we
1236 can perform SEGREL relocations. We will record the base addresses
1237 when we encounter the first SEGREL relocation. */
1238 hppa_info->text_segment_base = (bfd_vma)-1;
1239 hppa_info->data_segment_base = (bfd_vma)-1;
1241 /* HP's shared libraries have references to symbols that are not
1242 defined anywhere. The generic ELF BFD linker code will complaim
1243 about such symbols.
1245 So we detect the losing case and arrange for the flags on the symbol
1246 to indicate that it was never referenced. This keeps the generic
1247 ELF BFD link code happy and appears to not create any secondary
1248 problems. Ultimately we need a way to control the behavior of the
1249 generic ELF BFD link code better. */
1250 elf_link_hash_traverse (elf_hash_table (info),
1251 elf_hppa_unmark_useless_dynamic_symbols,
1252 info);
1254 /* Invoke the regular ELF backend linker to do all the work. */
1255 retval = bfd_elf_bfd_final_link (abfd, info);
1257 elf_link_hash_traverse (elf_hash_table (info),
1258 elf_hppa_remark_useless_dynamic_symbols,
1259 info);
1261 return retval;
1264 /* Relocate an HPPA ELF section. */
1266 static boolean
1267 elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
1268 contents, relocs, local_syms, local_sections)
1269 bfd *output_bfd;
1270 struct bfd_link_info *info;
1271 bfd *input_bfd;
1272 asection *input_section;
1273 bfd_byte *contents;
1274 Elf_Internal_Rela *relocs;
1275 Elf_Internal_Sym *local_syms;
1276 asection **local_sections;
1278 Elf_Internal_Shdr *symtab_hdr;
1279 Elf_Internal_Rela *rel;
1280 Elf_Internal_Rela *relend;
1281 struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
1283 symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
1285 rel = relocs;
1286 relend = relocs + input_section->reloc_count;
1287 for (; rel < relend; rel++)
1289 int r_type;
1290 reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
1291 unsigned long r_symndx;
1292 struct elf_link_hash_entry *h;
1293 Elf_Internal_Sym *sym;
1294 asection *sym_sec;
1295 bfd_vma relocation;
1296 bfd_reloc_status_type r;
1297 const char *sym_name;
1298 const char *dyn_name;
1299 char *dynh_buf = NULL;
1300 size_t dynh_buflen = 0;
1301 struct elf64_hppa_dyn_hash_entry *dyn_h = NULL;
1303 r_type = ELF_R_TYPE (rel->r_info);
1304 if (r_type < 0 || r_type >= (int) R_PARISC_UNIMPLEMENTED)
1306 bfd_set_error (bfd_error_bad_value);
1307 return false;
1310 r_symndx = ELF_R_SYM (rel->r_info);
1312 if (info->relocateable)
1314 /* This is a relocateable link. We don't have to change
1315 anything, unless the reloc is against a section symbol,
1316 in which case we have to adjust according to where the
1317 section symbol winds up in the output section. */
1318 if (r_symndx < symtab_hdr->sh_info)
1320 sym = local_syms + r_symndx;
1321 if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
1323 sym_sec = local_sections[r_symndx];
1324 rel->r_addend += sym_sec->output_offset;
1328 continue;
1331 /* This is a final link. */
1332 h = NULL;
1333 sym = NULL;
1334 sym_sec = NULL;
1335 if (r_symndx < symtab_hdr->sh_info)
1337 /* This is a local symbol. */
1338 sym = local_syms + r_symndx;
1339 sym_sec = local_sections[r_symndx];
1340 relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel);
1342 /* If this symbol has an entry in the PA64 dynamic hash
1343 table, then get it. */
1344 dyn_name = get_dyn_name (input_section, h, rel,
1345 &dynh_buf, &dynh_buflen);
1346 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1347 dyn_name, false, false);
1350 else
1352 /* This is not a local symbol. */
1353 long indx;
1355 indx = r_symndx - symtab_hdr->sh_info;
1356 h = elf_sym_hashes (input_bfd)[indx];
1357 while (h->root.type == bfd_link_hash_indirect
1358 || h->root.type == bfd_link_hash_warning)
1359 h = (struct elf_link_hash_entry *) h->root.u.i.link;
1360 if (h->root.type == bfd_link_hash_defined
1361 || h->root.type == bfd_link_hash_defweak)
1363 sym_sec = h->root.u.def.section;
1365 /* If this symbol has an entry in the PA64 dynamic hash
1366 table, then get it. */
1367 dyn_name = get_dyn_name (input_section, h, rel,
1368 &dynh_buf, &dynh_buflen);
1369 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1370 dyn_name, false, false);
1372 /* If we have a relocation against a symbol defined in a
1373 shared library and we have not created an entry in the
1374 PA64 dynamic symbol hash table for it, then we lose. */
1375 if (sym_sec->output_section == NULL && dyn_h == NULL)
1377 (*_bfd_error_handler)
1378 (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
1379 bfd_archive_filename (input_bfd), h->root.root.string,
1380 bfd_get_section_name (input_bfd, input_section));
1381 relocation = 0;
1383 else if (sym_sec->output_section)
1384 relocation = (h->root.u.def.value
1385 + sym_sec->output_offset
1386 + sym_sec->output_section->vma);
1387 /* Value will be provided via one of the offsets in the
1388 dyn_h hash table entry. */
1389 else
1390 relocation = 0;
1392 /* Allow undefined symbols in shared libraries. */
1393 else if (info->shared && !info->no_undefined
1394 && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
1396 if (info->symbolic)
1397 (*info->callbacks->undefined_symbol)
1398 (info, h->root.root.string, input_bfd,
1399 input_section, rel->r_offset, false);
1401 /* If this symbol has an entry in the PA64 dynamic hash
1402 table, then get it. */
1403 dyn_name = get_dyn_name (input_section, h, rel,
1404 &dynh_buf, &dynh_buflen);
1405 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1406 dyn_name, false, false);
1408 if (dyn_h == NULL)
1410 (*_bfd_error_handler)
1411 (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
1412 bfd_archive_filename (input_bfd), h->root.root.string,
1413 bfd_get_section_name (input_bfd, input_section));
1414 relocation = 0;
1416 relocation = 0;
1418 else if (h->root.type == bfd_link_hash_undefweak)
1419 relocation = 0;
1420 else
1422 if (!((*info->callbacks->undefined_symbol)
1423 (info, h->root.root.string, input_bfd,
1424 input_section, rel->r_offset, true)))
1425 return false;
1426 break;
1430 if (h != NULL)
1431 sym_name = h->root.root.string;
1432 else
1434 sym_name = bfd_elf_string_from_elf_section (input_bfd,
1435 symtab_hdr->sh_link,
1436 sym->st_name);
1437 if (sym_name == NULL)
1438 return false;
1439 if (*sym_name == '\0')
1440 sym_name = bfd_section_name (input_bfd, sym_sec);
1443 r = elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
1444 input_section, contents,
1445 relocation, info, sym_sec,
1446 h, dyn_h);
1448 if (r != bfd_reloc_ok)
1450 switch (r)
1452 default:
1453 abort ();
1454 case bfd_reloc_overflow:
1456 if (!((*info->callbacks->reloc_overflow)
1457 (info, sym_name, howto->name, (bfd_vma) 0,
1458 input_bfd, input_section, rel->r_offset)))
1459 return false;
1461 break;
1465 return true;
1468 /* Compute the value for a relocation (REL) during a final link stage,
1469 then insert the value into the proper location in CONTENTS.
1471 VALUE is a tentative value for the relocation and may be overridden
1472 and modified here based on the specific relocation to be performed.
1474 For example we do conversions for PC-relative branches in this routine
1475 or redirection of calls to external routines to stubs.
1477 The work of actually applying the relocation is left to a helper
1478 routine in an attempt to reduce the complexity and size of this
1479 function. */
1481 static bfd_reloc_status_type
1482 elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
1483 input_section, contents, value,
1484 info, sym_sec, h, dyn_h)
1485 Elf_Internal_Rela *rel;
1486 bfd *input_bfd;
1487 bfd *output_bfd;
1488 asection *input_section;
1489 bfd_byte *contents;
1490 bfd_vma value;
1491 struct bfd_link_info *info;
1492 asection *sym_sec;
1493 struct elf_link_hash_entry *h ATTRIBUTE_UNUSED;
1494 struct elf64_hppa_dyn_hash_entry *dyn_h;
1496 int insn;
1497 bfd_vma offset = rel->r_offset;
1498 bfd_signed_vma addend = rel->r_addend;
1499 reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
1500 unsigned int r_type = howto->type;
1501 bfd_byte *hit_data = contents + offset;
1502 struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
1504 insn = bfd_get_32 (input_bfd, hit_data);
1506 switch (r_type)
1508 case R_PARISC_NONE:
1509 break;
1511 /* Basic function call support. I'm not entirely sure if PCREL14F is
1512 actually needed or even handled correctly.
1514 Note for a call to a function defined in another dynamic library
1515 we want to redirect the call to a stub. */
1517 /* Random PC relative relocs. */
1518 case R_PARISC_PCREL21L:
1519 case R_PARISC_PCREL14R:
1520 case R_PARISC_PCREL14F:
1521 case R_PARISC_PCREL14WR:
1522 case R_PARISC_PCREL14DR:
1523 case R_PARISC_PCREL16F:
1524 case R_PARISC_PCREL16WF:
1525 case R_PARISC_PCREL16DF:
1527 /* If this is a call to a function defined in another dynamic
1528 library, then redirect the call to the local stub for this
1529 function. */
1530 if (sym_sec == NULL || sym_sec->output_section == NULL)
1531 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1532 + hppa_info->stub_sec->output_section->vma);
1534 /* Turn VALUE into a proper PC relative address. */
1535 value -= (offset + input_section->output_offset
1536 + input_section->output_section->vma);
1538 /* Adjust for any field selectors. */
1539 if (r_type == R_PARISC_PCREL21L)
1540 value = hppa_field_adjust (value, -8 + addend, e_lsel);
1541 else if (r_type == R_PARISC_PCREL14F
1542 || r_type == R_PARISC_PCREL16F
1543 || r_type == R_PARISC_PCREL16WF
1544 || r_type == R_PARISC_PCREL16DF)
1545 value = hppa_field_adjust (value, -8 + addend, e_fsel);
1546 else
1547 value = hppa_field_adjust (value, -8 + addend, e_rsel);
1549 /* Apply the relocation to the given instruction. */
1550 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1551 break;
1554 case R_PARISC_PCREL12F:
1555 case R_PARISC_PCREL22F:
1556 case R_PARISC_PCREL17F:
1557 case R_PARISC_PCREL22C:
1558 case R_PARISC_PCREL17C:
1559 case R_PARISC_PCREL17R:
1561 /* If this is a call to a function defined in another dynamic
1562 library, then redirect the call to the local stub for this
1563 function. */
1564 if (sym_sec == NULL || sym_sec->output_section == NULL)
1565 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1566 + hppa_info->stub_sec->output_section->vma);
1568 /* Turn VALUE into a proper PC relative address. */
1569 value -= (offset + input_section->output_offset
1570 + input_section->output_section->vma);
1572 /* Adjust for any field selectors. */
1573 if (r_type == R_PARISC_PCREL17R)
1574 value = hppa_field_adjust (value, -8 + addend, e_rsel);
1575 else
1576 value = hppa_field_adjust (value, -8 + addend, e_fsel);
1578 /* All branches are implicitly shifted by 2 places. */
1579 value >>= 2;
1581 /* Apply the relocation to the given instruction. */
1582 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1583 break;
1586 /* Indirect references to data through the DLT. */
1587 case R_PARISC_DLTIND14R:
1588 case R_PARISC_DLTIND14F:
1589 case R_PARISC_DLTIND14DR:
1590 case R_PARISC_DLTIND14WR:
1591 case R_PARISC_DLTIND21L:
1592 case R_PARISC_LTOFF_FPTR14R:
1593 case R_PARISC_LTOFF_FPTR14DR:
1594 case R_PARISC_LTOFF_FPTR14WR:
1595 case R_PARISC_LTOFF_FPTR21L:
1596 case R_PARISC_LTOFF_FPTR16F:
1597 case R_PARISC_LTOFF_FPTR16WF:
1598 case R_PARISC_LTOFF_FPTR16DF:
1599 case R_PARISC_LTOFF_TP21L:
1600 case R_PARISC_LTOFF_TP14R:
1601 case R_PARISC_LTOFF_TP14F:
1602 case R_PARISC_LTOFF_TP14WR:
1603 case R_PARISC_LTOFF_TP14DR:
1604 case R_PARISC_LTOFF_TP16F:
1605 case R_PARISC_LTOFF_TP16WF:
1606 case R_PARISC_LTOFF_TP16DF:
1607 case R_PARISC_LTOFF16F:
1608 case R_PARISC_LTOFF16WF:
1609 case R_PARISC_LTOFF16DF:
1611 /* If this relocation was against a local symbol, then we still
1612 have not set up the DLT entry (it's not convenient to do so
1613 in the "finalize_dlt" routine because it is difficult to get
1614 to the local symbol's value).
1616 So, if this is a local symbol (h == NULL), then we need to
1617 fill in its DLT entry.
1619 Similarly we may still need to set up an entry in .opd for
1620 a local function which had its address taken. */
1621 if (dyn_h->h == NULL)
1623 bfd_put_64 (hppa_info->dlt_sec->owner,
1624 value,
1625 hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
1627 /* Now handle .opd creation if needed. */
1628 if (r_type == R_PARISC_LTOFF_FPTR14R
1629 || r_type == R_PARISC_LTOFF_FPTR14DR
1630 || r_type == R_PARISC_LTOFF_FPTR14WR
1631 || r_type == R_PARISC_LTOFF_FPTR21L
1632 || r_type == R_PARISC_LTOFF_FPTR16F
1633 || r_type == R_PARISC_LTOFF_FPTR16WF
1634 || r_type == R_PARISC_LTOFF_FPTR16DF)
1636 /* The first two words of an .opd entry are zero. */
1637 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset,
1638 0, 16);
1640 /* The next word is the address of the function. */
1641 bfd_put_64 (hppa_info->opd_sec->owner, value,
1642 (hppa_info->opd_sec->contents
1643 + dyn_h->opd_offset + 16));
1645 /* The last word is our local __gp value. */
1646 value = _bfd_get_gp_value
1647 (hppa_info->opd_sec->output_section->owner);
1648 bfd_put_64 (hppa_info->opd_sec->owner, value,
1649 (hppa_info->opd_sec->contents
1650 + dyn_h->opd_offset + 24));
1654 /* We want the value of the DLT offset for this symbol, not
1655 the symbol's actual address. Note that __gp may not point
1656 to the start of the DLT, so we have to compute the absolute
1657 address, then subtract out the value of __gp. */
1658 value = (dyn_h->dlt_offset
1659 + hppa_info->dlt_sec->output_offset
1660 + hppa_info->dlt_sec->output_section->vma);
1661 value -= _bfd_get_gp_value (output_bfd);
1663 /* All DLTIND relocations are basically the same at this point,
1664 except that we need different field selectors for the 21bit
1665 version vs the 14bit versions. */
1666 if (r_type == R_PARISC_DLTIND21L
1667 || r_type == R_PARISC_LTOFF_FPTR21L
1668 || r_type == R_PARISC_LTOFF_TP21L)
1669 value = hppa_field_adjust (value, addend, e_lrsel);
1670 else if (r_type == R_PARISC_DLTIND14F
1671 || r_type == R_PARISC_LTOFF_FPTR16F
1672 || r_type == R_PARISC_LTOFF_FPTR16WF
1673 || r_type == R_PARISC_LTOFF_FPTR16DF
1674 || r_type == R_PARISC_LTOFF16F
1675 || r_type == R_PARISC_LTOFF16DF
1676 || r_type == R_PARISC_LTOFF16WF
1677 || r_type == R_PARISC_LTOFF_TP16F
1678 || r_type == R_PARISC_LTOFF_TP16WF
1679 || r_type == R_PARISC_LTOFF_TP16DF)
1680 value = hppa_field_adjust (value, addend, e_fsel);
1681 else
1682 value = hppa_field_adjust (value, addend, e_rrsel);
1684 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1685 break;
1688 case R_PARISC_DLTREL14R:
1689 case R_PARISC_DLTREL14F:
1690 case R_PARISC_DLTREL14DR:
1691 case R_PARISC_DLTREL14WR:
1692 case R_PARISC_DLTREL21L:
1693 case R_PARISC_DPREL21L:
1694 case R_PARISC_DPREL14WR:
1695 case R_PARISC_DPREL14DR:
1696 case R_PARISC_DPREL14R:
1697 case R_PARISC_DPREL14F:
1698 case R_PARISC_GPREL16F:
1699 case R_PARISC_GPREL16WF:
1700 case R_PARISC_GPREL16DF:
1702 /* Subtract out the global pointer value to make value a DLT
1703 relative address. */
1704 value -= _bfd_get_gp_value (output_bfd);
1706 /* All DLTREL relocations are basically the same at this point,
1707 except that we need different field selectors for the 21bit
1708 version vs the 14bit versions. */
1709 if (r_type == R_PARISC_DLTREL21L
1710 || r_type == R_PARISC_DPREL21L)
1711 value = hppa_field_adjust (value, addend, e_lrsel);
1712 else if (r_type == R_PARISC_DLTREL14F
1713 || r_type == R_PARISC_DPREL14F
1714 || r_type == R_PARISC_GPREL16F
1715 || r_type == R_PARISC_GPREL16WF
1716 || r_type == R_PARISC_GPREL16DF)
1717 value = hppa_field_adjust (value, addend, e_fsel);
1718 else
1719 value = hppa_field_adjust (value, addend, e_rrsel);
1721 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1722 break;
1725 case R_PARISC_DIR21L:
1726 case R_PARISC_DIR17R:
1727 case R_PARISC_DIR17F:
1728 case R_PARISC_DIR14R:
1729 case R_PARISC_DIR14F:
1730 case R_PARISC_DIR14WR:
1731 case R_PARISC_DIR14DR:
1732 case R_PARISC_DIR16F:
1733 case R_PARISC_DIR16WF:
1734 case R_PARISC_DIR16DF:
1736 /* All DIR relocations are basically the same at this point,
1737 except that branch offsets need to be divided by four, and
1738 we need different field selectors. Note that we don't
1739 redirect absolute calls to local stubs. */
1741 if (r_type == R_PARISC_DIR21L)
1742 value = hppa_field_adjust (value, addend, e_lrsel);
1743 else if (r_type == R_PARISC_DIR17F
1744 || r_type == R_PARISC_DIR16F
1745 || r_type == R_PARISC_DIR16WF
1746 || r_type == R_PARISC_DIR16DF
1747 || r_type == R_PARISC_DIR14F)
1748 value = hppa_field_adjust (value, addend, e_fsel);
1749 else
1750 value = hppa_field_adjust (value, addend, e_rrsel);
1752 if (r_type == R_PARISC_DIR17R || r_type == R_PARISC_DIR17F)
1754 /* All branches are implicitly shifted by 2 places. */
1755 value >>= 2;
1758 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1759 break;
1762 case R_PARISC_PLTOFF21L:
1763 case R_PARISC_PLTOFF14R:
1764 case R_PARISC_PLTOFF14F:
1765 case R_PARISC_PLTOFF14WR:
1766 case R_PARISC_PLTOFF14DR:
1767 case R_PARISC_PLTOFF16F:
1768 case R_PARISC_PLTOFF16WF:
1769 case R_PARISC_PLTOFF16DF:
1771 /* We want the value of the PLT offset for this symbol, not
1772 the symbol's actual address. Note that __gp may not point
1773 to the start of the DLT, so we have to compute the absolute
1774 address, then subtract out the value of __gp. */
1775 value = (dyn_h->plt_offset
1776 + hppa_info->plt_sec->output_offset
1777 + hppa_info->plt_sec->output_section->vma);
1778 value -= _bfd_get_gp_value (output_bfd);
1780 /* All PLTOFF relocations are basically the same at this point,
1781 except that we need different field selectors for the 21bit
1782 version vs the 14bit versions. */
1783 if (r_type == R_PARISC_PLTOFF21L)
1784 value = hppa_field_adjust (value, addend, e_lrsel);
1785 else if (r_type == R_PARISC_PLTOFF14F
1786 || r_type == R_PARISC_PLTOFF16F
1787 || r_type == R_PARISC_PLTOFF16WF
1788 || r_type == R_PARISC_PLTOFF16DF)
1789 value = hppa_field_adjust (value, addend, e_fsel);
1790 else
1791 value = hppa_field_adjust (value, addend, e_rrsel);
1793 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1794 break;
1797 case R_PARISC_LTOFF_FPTR32:
1799 /* We may still need to create the FPTR itself if it was for
1800 a local symbol. */
1801 if (dyn_h->h == NULL)
1803 /* The first two words of an .opd entry are zero. */
1804 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
1806 /* The next word is the address of the function. */
1807 bfd_put_64 (hppa_info->opd_sec->owner, value,
1808 (hppa_info->opd_sec->contents
1809 + dyn_h->opd_offset + 16));
1811 /* The last word is our local __gp value. */
1812 value = _bfd_get_gp_value
1813 (hppa_info->opd_sec->output_section->owner);
1814 bfd_put_64 (hppa_info->opd_sec->owner, value,
1815 hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
1818 /* We want the value of the DLT offset for this symbol, not
1819 the symbol's actual address. Note that __gp may not point
1820 to the start of the DLT, so we have to compute the absolute
1821 address, then subtract out the value of __gp. */
1822 value = (dyn_h->dlt_offset
1823 + hppa_info->dlt_sec->output_offset
1824 + hppa_info->dlt_sec->output_section->vma);
1825 value -= _bfd_get_gp_value (output_bfd);
1826 bfd_put_32 (input_bfd, value, hit_data);
1827 return bfd_reloc_ok;
1830 case R_PARISC_LTOFF_FPTR64:
1831 case R_PARISC_LTOFF_TP64:
1833 /* We may still need to create the FPTR itself if it was for
1834 a local symbol. */
1835 if (dyn_h->h == NULL && r_type == R_PARISC_LTOFF_FPTR64)
1837 /* The first two words of an .opd entry are zero. */
1838 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
1840 /* The next word is the address of the function. */
1841 bfd_put_64 (hppa_info->opd_sec->owner, value,
1842 (hppa_info->opd_sec->contents
1843 + dyn_h->opd_offset + 16));
1845 /* The last word is our local __gp value. */
1846 value = _bfd_get_gp_value
1847 (hppa_info->opd_sec->output_section->owner);
1848 bfd_put_64 (hppa_info->opd_sec->owner, value,
1849 hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
1852 /* We want the value of the DLT offset for this symbol, not
1853 the symbol's actual address. Note that __gp may not point
1854 to the start of the DLT, so we have to compute the absolute
1855 address, then subtract out the value of __gp. */
1856 value = (dyn_h->dlt_offset
1857 + hppa_info->dlt_sec->output_offset
1858 + hppa_info->dlt_sec->output_section->vma);
1859 value -= _bfd_get_gp_value (output_bfd);
1860 bfd_put_64 (input_bfd, value, hit_data);
1861 return bfd_reloc_ok;
1864 case R_PARISC_DIR32:
1865 bfd_put_32 (input_bfd, value + addend, hit_data);
1866 return bfd_reloc_ok;
1868 case R_PARISC_DIR64:
1869 bfd_put_64 (input_bfd, value + addend, hit_data);
1870 return bfd_reloc_ok;
1872 case R_PARISC_GPREL64:
1873 /* Subtract out the global pointer value to make value a DLT
1874 relative address. */
1875 value -= _bfd_get_gp_value (output_bfd);
1877 bfd_put_64 (input_bfd, value + addend, hit_data);
1878 return bfd_reloc_ok;
1880 case R_PARISC_LTOFF64:
1881 /* We want the value of the DLT offset for this symbol, not
1882 the symbol's actual address. Note that __gp may not point
1883 to the start of the DLT, so we have to compute the absolute
1884 address, then subtract out the value of __gp. */
1885 value = (dyn_h->dlt_offset
1886 + hppa_info->dlt_sec->output_offset
1887 + hppa_info->dlt_sec->output_section->vma);
1888 value -= _bfd_get_gp_value (output_bfd);
1890 bfd_put_64 (input_bfd, value + addend, hit_data);
1891 return bfd_reloc_ok;
1893 case R_PARISC_PCREL32:
1895 /* If this is a call to a function defined in another dynamic
1896 library, then redirect the call to the local stub for this
1897 function. */
1898 if (sym_sec == NULL || sym_sec->output_section == NULL)
1899 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1900 + hppa_info->stub_sec->output_section->vma);
1902 /* Turn VALUE into a proper PC relative address. */
1903 value -= (offset + input_section->output_offset
1904 + input_section->output_section->vma);
1906 value += addend;
1907 value -= 8;
1908 bfd_put_32 (input_bfd, value, hit_data);
1909 return bfd_reloc_ok;
1912 case R_PARISC_PCREL64:
1914 /* If this is a call to a function defined in another dynamic
1915 library, then redirect the call to the local stub for this
1916 function. */
1917 if (sym_sec == NULL || sym_sec->output_section == NULL)
1918 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1919 + hppa_info->stub_sec->output_section->vma);
1921 /* Turn VALUE into a proper PC relative address. */
1922 value -= (offset + input_section->output_offset
1923 + input_section->output_section->vma);
1925 value += addend;
1926 value -= 8;
1927 bfd_put_64 (input_bfd, value, hit_data);
1928 return bfd_reloc_ok;
1931 case R_PARISC_FPTR64:
1933 /* We may still need to create the FPTR itself if it was for
1934 a local symbol. */
1935 if (dyn_h->h == NULL)
1937 /* The first two words of an .opd entry are zero. */
1938 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
1940 /* The next word is the address of the function. */
1941 bfd_put_64 (hppa_info->opd_sec->owner, value,
1942 (hppa_info->opd_sec->contents
1943 + dyn_h->opd_offset + 16));
1945 /* The last word is our local __gp value. */
1946 value = _bfd_get_gp_value
1947 (hppa_info->opd_sec->output_section->owner);
1948 bfd_put_64 (hppa_info->opd_sec->owner, value,
1949 hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
1952 /* We want the value of the OPD offset for this symbol, not
1953 the symbol's actual address. */
1954 value = (dyn_h->opd_offset
1955 + hppa_info->opd_sec->output_offset
1956 + hppa_info->opd_sec->output_section->vma);
1958 bfd_put_64 (input_bfd, value + addend, hit_data);
1959 return bfd_reloc_ok;
1962 case R_PARISC_SECREL32:
1963 bfd_put_32 (input_bfd,
1964 value + addend - sym_sec->output_section->vma,
1965 hit_data);
1966 return bfd_reloc_ok;
1968 case R_PARISC_SEGREL32:
1969 case R_PARISC_SEGREL64:
1971 /* If this is the first SEGREL relocation, then initialize
1972 the segment base values. */
1973 if (hppa_info->text_segment_base == (bfd_vma) -1)
1974 bfd_map_over_sections (output_bfd, elf_hppa_record_segment_addrs,
1975 hppa_info);
1977 /* VALUE holds the absolute address. We want to include the
1978 addend, then turn it into a segment relative address.
1980 The segment is derived from SYM_SEC. We assume that there are
1981 only two segments of note in the resulting executable/shlib.
1982 A readonly segment (.text) and a readwrite segment (.data). */
1983 value += addend;
1985 if (sym_sec->flags & SEC_CODE)
1986 value -= hppa_info->text_segment_base;
1987 else
1988 value -= hppa_info->data_segment_base;
1990 if (r_type == R_PARISC_SEGREL32)
1991 bfd_put_32 (input_bfd, value, hit_data);
1992 else
1993 bfd_put_64 (input_bfd, value, hit_data);
1994 return bfd_reloc_ok;
1997 /* Something we don't know how to handle. */
1998 default:
1999 return bfd_reloc_notsupported;
2002 /* Update the instruction word. */
2003 bfd_put_32 (input_bfd, (bfd_vma) insn, hit_data);
2004 return bfd_reloc_ok;
2007 /* Relocate the given INSN. VALUE should be the actual value we want
2008 to insert into the instruction, ie by this point we should not be
2009 concerned with computing an offset relative to the DLT, PC, etc.
2010 Instead this routine is meant to handle the bit manipulations needed
2011 to insert the relocation into the given instruction. */
2013 static int
2014 elf_hppa_relocate_insn (insn, sym_value, r_type)
2015 int insn;
2016 int sym_value;
2017 unsigned int r_type;
2019 switch (r_type)
2021 /* This is any 22 bit branch. In PA2.0 syntax it corresponds to
2022 the "B" instruction. */
2023 case R_PARISC_PCREL22F:
2024 case R_PARISC_PCREL22C:
2025 return (insn & ~0x3ff1ffd) | re_assemble_22 (sym_value);
2027 /* This is any 12 bit branch. */
2028 case R_PARISC_PCREL12F:
2029 return (insn & ~0x1ffd) | re_assemble_12 (sym_value);
2031 /* This is any 17 bit branch. In PA2.0 syntax it also corresponds
2032 to the "B" instruction as well as BE. */
2033 case R_PARISC_PCREL17F:
2034 case R_PARISC_DIR17F:
2035 case R_PARISC_DIR17R:
2036 case R_PARISC_PCREL17C:
2037 case R_PARISC_PCREL17R:
2038 return (insn & ~0x1f1ffd) | re_assemble_17 (sym_value);
2040 /* ADDIL or LDIL instructions. */
2041 case R_PARISC_DLTREL21L:
2042 case R_PARISC_DLTIND21L:
2043 case R_PARISC_LTOFF_FPTR21L:
2044 case R_PARISC_PCREL21L:
2045 case R_PARISC_LTOFF_TP21L:
2046 case R_PARISC_DPREL21L:
2047 case R_PARISC_PLTOFF21L:
2048 case R_PARISC_DIR21L:
2049 return (insn & ~0x1fffff) | re_assemble_21 (sym_value);
2051 /* LDO and integer loads/stores with 14 bit displacements. */
2052 case R_PARISC_DLTREL14R:
2053 case R_PARISC_DLTREL14F:
2054 case R_PARISC_DLTIND14R:
2055 case R_PARISC_DLTIND14F:
2056 case R_PARISC_LTOFF_FPTR14R:
2057 case R_PARISC_LTOFF_FPTR16F:
2058 case R_PARISC_PCREL14R:
2059 case R_PARISC_PCREL14F:
2060 case R_PARISC_PCREL16F:
2061 case R_PARISC_LTOFF_TP14R:
2062 case R_PARISC_LTOFF_TP14F:
2063 case R_PARISC_LTOFF_TP16F:
2064 case R_PARISC_DPREL14R:
2065 case R_PARISC_DPREL14F:
2066 case R_PARISC_GPREL16F:
2067 case R_PARISC_PLTOFF14R:
2068 case R_PARISC_PLTOFF14F:
2069 case R_PARISC_PLTOFF16F:
2070 case R_PARISC_DIR14R:
2071 case R_PARISC_DIR14F:
2072 case R_PARISC_DIR16F:
2073 case R_PARISC_LTOFF16F:
2074 return (insn & ~0x3fff) | low_sign_unext (sym_value, 14);
2076 /* Doubleword loads and stores with a 14 bit displacement. */
2077 case R_PARISC_DLTREL14DR:
2078 case R_PARISC_DLTIND14DR:
2079 case R_PARISC_LTOFF_FPTR14DR:
2080 case R_PARISC_LTOFF_FPTR16DF:
2081 case R_PARISC_PCREL14DR:
2082 case R_PARISC_PCREL16DF:
2083 case R_PARISC_LTOFF_TP14DR:
2084 case R_PARISC_LTOFF_TP16DF:
2085 case R_PARISC_DPREL14DR:
2086 case R_PARISC_GPREL16DF:
2087 case R_PARISC_PLTOFF14DR:
2088 case R_PARISC_PLTOFF16DF:
2089 case R_PARISC_DIR14DR:
2090 case R_PARISC_DIR16DF:
2091 case R_PARISC_LTOFF16DF:
2092 return (insn & ~0x3ff1) | (((sym_value & 0x2000) >> 13)
2093 | ((sym_value & 0x1ff8) << 1));
2095 /* Floating point single word load/store instructions. */
2096 case R_PARISC_DLTREL14WR:
2097 case R_PARISC_DLTIND14WR:
2098 case R_PARISC_LTOFF_FPTR14WR:
2099 case R_PARISC_LTOFF_FPTR16WF:
2100 case R_PARISC_PCREL14WR:
2101 case R_PARISC_PCREL16WF:
2102 case R_PARISC_LTOFF_TP14WR:
2103 case R_PARISC_LTOFF_TP16WF:
2104 case R_PARISC_DPREL14WR:
2105 case R_PARISC_GPREL16WF:
2106 case R_PARISC_PLTOFF14WR:
2107 case R_PARISC_PLTOFF16WF:
2108 case R_PARISC_DIR16WF:
2109 case R_PARISC_DIR14WR:
2110 case R_PARISC_LTOFF16WF:
2111 return (insn & ~0x3ff9) | (((sym_value & 0x2000) >> 13)
2112 | ((sym_value & 0x1ffc) << 1));
2114 default:
2115 return insn;
2118 #endif