elf64-mips.c revision 1.1.1.4 1 1.1 christos /* MIPS-specific support for 64-bit ELF
2 1.1.1.4 christos Copyright (C) 1996-2018 Free Software Foundation, Inc.
3 1.1 christos Ian Lance Taylor, Cygnus Support
4 1.1 christos Linker support added by Mark Mitchell, CodeSourcery, LLC.
5 1.1 christos <mark (at) codesourcery.com>
6 1.1 christos
7 1.1 christos This file is part of BFD, the Binary File Descriptor library.
8 1.1 christos
9 1.1 christos This program is free software; you can redistribute it and/or modify
10 1.1 christos it under the terms of the GNU General Public License as published by
11 1.1 christos the Free Software Foundation; either version 3 of the License, or
12 1.1 christos (at your option) any later version.
13 1.1 christos
14 1.1 christos This program is distributed in the hope that it will be useful,
15 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of
16 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 1.1 christos GNU General Public License for more details.
18 1.1 christos
19 1.1 christos You should have received a copy of the GNU General Public License
20 1.1 christos along with this program; if not, write to the Free Software
21 1.1 christos Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
22 1.1 christos MA 02110-1301, USA. */
23 1.1 christos
24 1.1 christos
25 1.1 christos /* This file supports the 64-bit MIPS ELF ABI.
26 1.1 christos
27 1.1 christos The MIPS 64-bit ELF ABI uses an unusual reloc format. This file
28 1.1 christos overrides the usual ELF reloc handling, and handles reading and
29 1.1 christos writing the relocations here. */
30 1.1 christos
31 1.1 christos /* TODO: Many things are unsupported, even if there is some code for it
32 1.1 christos . (which was mostly stolen from elf32-mips.c and slightly adapted).
33 1.1 christos .
34 1.1 christos . - Relocation handling for REL relocs is wrong in many cases and
35 1.1 christos . generally untested.
36 1.1 christos . - Relocation handling for RELA relocs related to GOT support are
37 1.1 christos . also likely to be wrong.
38 1.1 christos . - Support for MIPS16 is untested.
39 1.1 christos . - Combined relocs with RSS_* entries are unsupported.
40 1.1 christos . - The whole GOT handling for NewABI is missing, some parts of
41 1.1 christos . the OldABI version is still lying around and should be removed.
42 1.1 christos */
43 1.1 christos
44 1.1 christos #include "sysdep.h"
45 1.1 christos #include "bfd.h"
46 1.1 christos #include "libbfd.h"
47 1.1 christos #include "aout/ar.h"
48 1.1 christos #include "bfdlink.h"
49 1.1 christos #include "genlink.h"
50 1.1 christos #include "elf-bfd.h"
51 1.1 christos #include "elfxx-mips.h"
52 1.1 christos #include "elf/mips.h"
53 1.1 christos
54 1.1 christos /* Get the ECOFF swapping routines. The 64-bit ABI is not supposed to
55 1.1 christos use ECOFF. However, we support it anyhow for an easier changeover. */
56 1.1 christos #include "coff/sym.h"
57 1.1 christos #include "coff/symconst.h"
58 1.1 christos #include "coff/internal.h"
59 1.1 christos #include "coff/ecoff.h"
60 1.1 christos /* The 64 bit versions of the mdebug data structures are in alpha.h. */
61 1.1 christos #include "coff/alpha.h"
62 1.1 christos #define ECOFF_SIGNED_64
63 1.1 christos #include "ecoffswap.h"
64 1.1 christos
65 1.1 christos static void mips_elf64_swap_reloc_in
66 1.1 christos (bfd *, const Elf64_Mips_External_Rel *, Elf64_Mips_Internal_Rela *);
67 1.1 christos static void mips_elf64_swap_reloca_in
68 1.1 christos (bfd *, const Elf64_Mips_External_Rela *, Elf64_Mips_Internal_Rela *);
69 1.1 christos static void mips_elf64_swap_reloc_out
70 1.1 christos (bfd *, const Elf64_Mips_Internal_Rela *, Elf64_Mips_External_Rel *);
71 1.1 christos static void mips_elf64_swap_reloca_out
72 1.1 christos (bfd *, const Elf64_Mips_Internal_Rela *, Elf64_Mips_External_Rela *);
73 1.1 christos static void mips_elf64_be_swap_reloc_in
74 1.1 christos (bfd *, const bfd_byte *, Elf_Internal_Rela *);
75 1.1 christos static void mips_elf64_be_swap_reloc_out
76 1.1 christos (bfd *, const Elf_Internal_Rela *, bfd_byte *);
77 1.1 christos static void mips_elf64_be_swap_reloca_in
78 1.1 christos (bfd *, const bfd_byte *, Elf_Internal_Rela *);
79 1.1 christos static void mips_elf64_be_swap_reloca_out
80 1.1 christos (bfd *, const Elf_Internal_Rela *, bfd_byte *);
81 1.1 christos static reloc_howto_type *bfd_elf64_bfd_reloc_type_lookup
82 1.1 christos (bfd *, bfd_reloc_code_real_type);
83 1.1.1.4 christos static bfd_boolean mips_elf64_info_to_howto_rela
84 1.1 christos (bfd *, arelent *, Elf_Internal_Rela *);
85 1.1 christos static long mips_elf64_get_dynamic_reloc_upper_bound
86 1.1 christos (bfd *);
87 1.1 christos static bfd_boolean mips_elf64_slurp_one_reloc_table
88 1.1 christos (bfd *, asection *, Elf_Internal_Shdr *, bfd_size_type, arelent *,
89 1.1 christos asymbol **, bfd_boolean);
90 1.1 christos static bfd_boolean mips_elf64_slurp_reloc_table
91 1.1 christos (bfd *, asection *, asymbol **, bfd_boolean);
92 1.1 christos static void mips_elf64_write_relocs
93 1.1 christos (bfd *, asection *, void *);
94 1.1 christos static void mips_elf64_write_rel
95 1.1 christos (bfd *, asection *, Elf_Internal_Shdr *, int *, void *);
96 1.1 christos static void mips_elf64_write_rela
97 1.1 christos (bfd *, asection *, Elf_Internal_Shdr *, int *, void *);
98 1.1 christos static bfd_reloc_status_type mips_elf64_gprel16_reloc
99 1.1 christos (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
100 1.1 christos static bfd_reloc_status_type mips_elf64_literal_reloc
101 1.1 christos (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
102 1.1 christos static bfd_reloc_status_type mips_elf64_gprel32_reloc
103 1.1 christos (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
104 1.1 christos static bfd_reloc_status_type mips_elf64_shift6_reloc
105 1.1 christos (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
106 1.1 christos static bfd_reloc_status_type mips16_gprel_reloc
107 1.1 christos (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
108 1.1 christos static bfd_boolean mips_elf64_assign_gp
109 1.1 christos (bfd *, bfd_vma *);
110 1.1 christos static bfd_reloc_status_type mips_elf64_final_gp
111 1.1 christos (bfd *, asymbol *, bfd_boolean, char **, bfd_vma *);
112 1.1 christos static bfd_boolean mips_elf64_object_p
113 1.1 christos (bfd *);
114 1.1 christos static bfd_boolean mips_elf64_is_local_label_name
115 1.1 christos (bfd *, const char *);
116 1.1 christos static irix_compat_t elf64_mips_irix_compat
117 1.1 christos (bfd *);
118 1.1 christos static bfd_boolean elf64_mips_grok_prstatus
119 1.1 christos (bfd *, Elf_Internal_Note *);
120 1.1 christos static bfd_boolean elf64_mips_grok_psinfo
121 1.1 christos (bfd *, Elf_Internal_Note *);
122 1.1 christos
123 1.1.1.2 christos extern const bfd_target mips_elf64_be_vec;
124 1.1.1.2 christos extern const bfd_target mips_elf64_le_vec;
125 1.1 christos
126 1.1 christos /* In case we're on a 32-bit machine, construct a 64-bit "-1" value
127 1.1 christos from smaller values. Start with zero, widen, *then* decrement. */
128 1.1 christos #define MINUS_ONE (((bfd_vma)0) - 1)
129 1.1 christos
130 1.1 christos /* The number of local .got entries we reserve. */
131 1.1 christos #define MIPS_RESERVED_GOTNO (2)
132 1.1 christos
133 1.1 christos /* The relocation table used for SHT_REL sections. */
135 1.1 christos
136 1.1 christos static reloc_howto_type mips_elf64_howto_table_rel[] =
137 1.1 christos {
138 1.1 christos /* No relocation. */
139 1.1 christos HOWTO (R_MIPS_NONE, /* type */
140 1.1.1.2 christos 0, /* rightshift */
141 1.1 christos 3, /* size (0 = byte, 1 = short, 2 = long) */
142 1.1 christos 0, /* bitsize */
143 1.1 christos FALSE, /* pc_relative */
144 1.1 christos 0, /* bitpos */
145 1.1 christos complain_overflow_dont, /* complain_on_overflow */
146 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
147 1.1 christos "R_MIPS_NONE", /* name */
148 1.1 christos FALSE, /* partial_inplace */
149 1.1 christos 0, /* src_mask */
150 1.1 christos 0, /* dst_mask */
151 1.1 christos FALSE), /* pcrel_offset */
152 1.1 christos
153 1.1 christos /* 16 bit relocation. */
154 1.1 christos HOWTO (R_MIPS_16, /* type */
155 1.1 christos 0, /* rightshift */
156 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
157 1.1 christos 16, /* bitsize */
158 1.1 christos FALSE, /* pc_relative */
159 1.1 christos 0, /* bitpos */
160 1.1 christos complain_overflow_signed, /* complain_on_overflow */
161 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
162 1.1 christos "R_MIPS_16", /* name */
163 1.1 christos TRUE, /* partial_inplace */
164 1.1 christos 0x0000ffff, /* src_mask */
165 1.1 christos 0x0000ffff, /* dst_mask */
166 1.1 christos FALSE), /* pcrel_offset */
167 1.1 christos
168 1.1 christos /* 32 bit relocation. */
169 1.1 christos HOWTO (R_MIPS_32, /* type */
170 1.1 christos 0, /* rightshift */
171 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
172 1.1 christos 32, /* bitsize */
173 1.1 christos FALSE, /* pc_relative */
174 1.1 christos 0, /* bitpos */
175 1.1 christos complain_overflow_dont, /* complain_on_overflow */
176 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
177 1.1 christos "R_MIPS_32", /* name */
178 1.1 christos TRUE, /* partial_inplace */
179 1.1 christos 0xffffffff, /* src_mask */
180 1.1 christos 0xffffffff, /* dst_mask */
181 1.1 christos FALSE), /* pcrel_offset */
182 1.1 christos
183 1.1 christos /* 32 bit symbol relative relocation. */
184 1.1 christos HOWTO (R_MIPS_REL32, /* type */
185 1.1 christos 0, /* rightshift */
186 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
187 1.1 christos 32, /* bitsize */
188 1.1 christos FALSE, /* pc_relative */
189 1.1 christos 0, /* bitpos */
190 1.1 christos complain_overflow_dont, /* complain_on_overflow */
191 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
192 1.1 christos "R_MIPS_REL32", /* name */
193 1.1 christos TRUE, /* partial_inplace */
194 1.1 christos 0xffffffff, /* src_mask */
195 1.1 christos 0xffffffff, /* dst_mask */
196 1.1 christos FALSE), /* pcrel_offset */
197 1.1 christos
198 1.1 christos /* 26 bit jump address. */
199 1.1 christos HOWTO (R_MIPS_26, /* type */
200 1.1 christos 2, /* rightshift */
201 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
202 1.1 christos 26, /* bitsize */
203 1.1 christos FALSE, /* pc_relative */
204 1.1 christos 0, /* bitpos */
205 1.1 christos complain_overflow_dont, /* complain_on_overflow */
206 1.1 christos /* This needs complex overflow
207 1.1 christos detection, because the upper 36
208 1.1 christos bits must match the PC + 4. */
209 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
210 1.1 christos "R_MIPS_26", /* name */
211 1.1 christos TRUE, /* partial_inplace */
212 1.1 christos 0x03ffffff, /* src_mask */
213 1.1 christos 0x03ffffff, /* dst_mask */
214 1.1 christos FALSE), /* pcrel_offset */
215 1.1 christos
216 1.1 christos /* R_MIPS_HI16 and R_MIPS_LO16 are unsupported for NewABI REL.
217 1.1 christos However, the native IRIX6 tools use them, so we try our best. */
218 1.1 christos
219 1.1 christos /* High 16 bits of symbol value. */
220 1.1 christos HOWTO (R_MIPS_HI16, /* type */
221 1.1 christos 16, /* rightshift */
222 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
223 1.1 christos 16, /* bitsize */
224 1.1 christos FALSE, /* pc_relative */
225 1.1 christos 0, /* bitpos */
226 1.1 christos complain_overflow_dont, /* complain_on_overflow */
227 1.1 christos _bfd_mips_elf_hi16_reloc, /* special_function */
228 1.1 christos "R_MIPS_HI16", /* name */
229 1.1 christos TRUE, /* partial_inplace */
230 1.1 christos 0x0000ffff, /* src_mask */
231 1.1 christos 0x0000ffff, /* dst_mask */
232 1.1 christos FALSE), /* pcrel_offset */
233 1.1 christos
234 1.1 christos /* Low 16 bits of symbol value. */
235 1.1 christos HOWTO (R_MIPS_LO16, /* type */
236 1.1 christos 0, /* rightshift */
237 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
238 1.1 christos 16, /* bitsize */
239 1.1 christos FALSE, /* pc_relative */
240 1.1 christos 0, /* bitpos */
241 1.1 christos complain_overflow_dont, /* complain_on_overflow */
242 1.1 christos _bfd_mips_elf_lo16_reloc, /* special_function */
243 1.1 christos "R_MIPS_LO16", /* name */
244 1.1 christos TRUE, /* partial_inplace */
245 1.1 christos 0x0000ffff, /* src_mask */
246 1.1 christos 0x0000ffff, /* dst_mask */
247 1.1 christos FALSE), /* pcrel_offset */
248 1.1 christos
249 1.1 christos /* GP relative reference. */
250 1.1 christos HOWTO (R_MIPS_GPREL16, /* type */
251 1.1 christos 0, /* rightshift */
252 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
253 1.1 christos 16, /* bitsize */
254 1.1 christos FALSE, /* pc_relative */
255 1.1 christos 0, /* bitpos */
256 1.1 christos complain_overflow_signed, /* complain_on_overflow */
257 1.1 christos mips_elf64_gprel16_reloc, /* special_function */
258 1.1 christos "R_MIPS_GPREL16", /* name */
259 1.1 christos TRUE, /* partial_inplace */
260 1.1 christos 0x0000ffff, /* src_mask */
261 1.1 christos 0x0000ffff, /* dst_mask */
262 1.1 christos FALSE), /* pcrel_offset */
263 1.1 christos
264 1.1 christos /* Reference to literal section. */
265 1.1 christos HOWTO (R_MIPS_LITERAL, /* type */
266 1.1 christos 0, /* rightshift */
267 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
268 1.1 christos 16, /* bitsize */
269 1.1 christos FALSE, /* pc_relative */
270 1.1 christos 0, /* bitpos */
271 1.1 christos complain_overflow_signed, /* complain_on_overflow */
272 1.1 christos mips_elf64_literal_reloc, /* special_function */
273 1.1 christos "R_MIPS_LITERAL", /* name */
274 1.1 christos TRUE, /* partial_inplace */
275 1.1 christos 0x0000ffff, /* src_mask */
276 1.1 christos 0x0000ffff, /* dst_mask */
277 1.1 christos FALSE), /* pcrel_offset */
278 1.1 christos
279 1.1 christos /* Reference to global offset table. */
280 1.1 christos HOWTO (R_MIPS_GOT16, /* type */
281 1.1 christos 0, /* rightshift */
282 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
283 1.1 christos 16, /* bitsize */
284 1.1 christos FALSE, /* pc_relative */
285 1.1 christos 0, /* bitpos */
286 1.1 christos complain_overflow_signed, /* complain_on_overflow */
287 1.1 christos _bfd_mips_elf_got16_reloc, /* special_function */
288 1.1 christos "R_MIPS_GOT16", /* name */
289 1.1 christos TRUE, /* partial_inplace */
290 1.1 christos 0x0000ffff, /* src_mask */
291 1.1 christos 0x0000ffff, /* dst_mask */
292 1.1 christos FALSE), /* pcrel_offset */
293 1.1 christos
294 1.1 christos /* 16 bit PC relative reference. Note that the ABI document has a typo
295 1.1 christos and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
296 1.1 christos We do the right thing here. */
297 1.1 christos HOWTO (R_MIPS_PC16, /* type */
298 1.1 christos 2, /* rightshift */
299 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
300 1.1 christos 16, /* bitsize */
301 1.1 christos TRUE, /* pc_relative */
302 1.1 christos 0, /* bitpos */
303 1.1 christos complain_overflow_signed, /* complain_on_overflow */
304 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
305 1.1 christos "R_MIPS_PC16", /* name */
306 1.1 christos TRUE, /* partial_inplace */
307 1.1 christos 0x0000ffff, /* src_mask */
308 1.1 christos 0x0000ffff, /* dst_mask */
309 1.1 christos TRUE), /* pcrel_offset */
310 1.1 christos
311 1.1 christos /* 16 bit call through global offset table. */
312 1.1 christos HOWTO (R_MIPS_CALL16, /* type */
313 1.1 christos 0, /* rightshift */
314 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
315 1.1 christos 16, /* bitsize */
316 1.1 christos FALSE, /* pc_relative */
317 1.1 christos 0, /* bitpos */
318 1.1 christos complain_overflow_signed, /* complain_on_overflow */
319 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
320 1.1 christos "R_MIPS_CALL16", /* name */
321 1.1 christos TRUE, /* partial_inplace */
322 1.1 christos 0x0000ffff, /* src_mask */
323 1.1 christos 0x0000ffff, /* dst_mask */
324 1.1 christos FALSE), /* pcrel_offset */
325 1.1 christos
326 1.1 christos /* 32 bit GP relative reference. */
327 1.1 christos HOWTO (R_MIPS_GPREL32, /* type */
328 1.1 christos 0, /* rightshift */
329 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
330 1.1 christos 32, /* bitsize */
331 1.1 christos FALSE, /* pc_relative */
332 1.1 christos 0, /* bitpos */
333 1.1 christos complain_overflow_dont, /* complain_on_overflow */
334 1.1 christos mips_elf64_gprel32_reloc, /* special_function */
335 1.1 christos "R_MIPS_GPREL32", /* name */
336 1.1 christos TRUE, /* partial_inplace */
337 1.1 christos 0xffffffff, /* src_mask */
338 1.1 christos 0xffffffff, /* dst_mask */
339 1.1 christos FALSE), /* pcrel_offset */
340 1.1 christos
341 1.1 christos EMPTY_HOWTO (13),
342 1.1 christos EMPTY_HOWTO (14),
343 1.1 christos EMPTY_HOWTO (15),
344 1.1 christos
345 1.1 christos /* A 5 bit shift field. */
346 1.1 christos HOWTO (R_MIPS_SHIFT5, /* type */
347 1.1 christos 0, /* rightshift */
348 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
349 1.1 christos 5, /* bitsize */
350 1.1 christos FALSE, /* pc_relative */
351 1.1 christos 6, /* bitpos */
352 1.1 christos complain_overflow_bitfield, /* complain_on_overflow */
353 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
354 1.1 christos "R_MIPS_SHIFT5", /* name */
355 1.1 christos TRUE, /* partial_inplace */
356 1.1 christos 0x000007c0, /* src_mask */
357 1.1 christos 0x000007c0, /* dst_mask */
358 1.1 christos FALSE), /* pcrel_offset */
359 1.1 christos
360 1.1 christos /* A 6 bit shift field. */
361 1.1 christos HOWTO (R_MIPS_SHIFT6, /* type */
362 1.1 christos 0, /* rightshift */
363 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
364 1.1 christos 6, /* bitsize */
365 1.1 christos FALSE, /* pc_relative */
366 1.1 christos 6, /* bitpos */
367 1.1 christos complain_overflow_bitfield, /* complain_on_overflow */
368 1.1 christos mips_elf64_shift6_reloc, /* special_function */
369 1.1 christos "R_MIPS_SHIFT6", /* name */
370 1.1 christos TRUE, /* partial_inplace */
371 1.1 christos 0x000007c4, /* src_mask */
372 1.1 christos 0x000007c4, /* dst_mask */
373 1.1 christos FALSE), /* pcrel_offset */
374 1.1 christos
375 1.1 christos /* 64 bit relocation. */
376 1.1 christos HOWTO (R_MIPS_64, /* type */
377 1.1 christos 0, /* rightshift */
378 1.1 christos 4, /* size (0 = byte, 1 = short, 2 = long) */
379 1.1 christos 64, /* bitsize */
380 1.1 christos FALSE, /* pc_relative */
381 1.1 christos 0, /* bitpos */
382 1.1 christos complain_overflow_dont, /* complain_on_overflow */
383 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
384 1.1 christos "R_MIPS_64", /* name */
385 1.1 christos TRUE, /* partial_inplace */
386 1.1 christos MINUS_ONE, /* src_mask */
387 1.1 christos MINUS_ONE, /* dst_mask */
388 1.1 christos FALSE), /* pcrel_offset */
389 1.1 christos
390 1.1 christos /* Displacement in the global offset table. */
391 1.1 christos HOWTO (R_MIPS_GOT_DISP, /* type */
392 1.1 christos 0, /* rightshift */
393 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
394 1.1 christos 16, /* bitsize */
395 1.1 christos FALSE, /* pc_relative */
396 1.1 christos 0, /* bitpos */
397 1.1 christos complain_overflow_signed, /* complain_on_overflow */
398 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
399 1.1 christos "R_MIPS_GOT_DISP", /* name */
400 1.1 christos TRUE, /* partial_inplace */
401 1.1 christos 0x0000ffff, /* src_mask */
402 1.1 christos 0x0000ffff, /* dst_mask */
403 1.1 christos FALSE), /* pcrel_offset */
404 1.1 christos
405 1.1 christos /* Displacement to page pointer in the global offset table. */
406 1.1 christos HOWTO (R_MIPS_GOT_PAGE, /* type */
407 1.1 christos 0, /* rightshift */
408 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
409 1.1 christos 16, /* bitsize */
410 1.1 christos FALSE, /* pc_relative */
411 1.1 christos 0, /* bitpos */
412 1.1 christos complain_overflow_signed, /* complain_on_overflow */
413 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
414 1.1 christos "R_MIPS_GOT_PAGE", /* name */
415 1.1 christos TRUE, /* partial_inplace */
416 1.1 christos 0x0000ffff, /* src_mask */
417 1.1 christos 0x0000ffff, /* dst_mask */
418 1.1 christos FALSE), /* pcrel_offset */
419 1.1 christos
420 1.1 christos /* Offset from page pointer in the global offset table. */
421 1.1 christos HOWTO (R_MIPS_GOT_OFST, /* type */
422 1.1 christos 0, /* rightshift */
423 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
424 1.1 christos 16, /* bitsize */
425 1.1 christos FALSE, /* pc_relative */
426 1.1 christos 0, /* bitpos */
427 1.1 christos complain_overflow_signed, /* complain_on_overflow */
428 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
429 1.1 christos "R_MIPS_GOT_OFST", /* name */
430 1.1 christos TRUE, /* partial_inplace */
431 1.1 christos 0x0000ffff, /* src_mask */
432 1.1 christos 0x0000ffff, /* dst_mask */
433 1.1 christos FALSE), /* pcrel_offset */
434 1.1 christos
435 1.1 christos /* High 16 bits of displacement in global offset table. */
436 1.1 christos HOWTO (R_MIPS_GOT_HI16, /* type */
437 1.1 christos 0, /* rightshift */
438 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
439 1.1 christos 16, /* bitsize */
440 1.1 christos FALSE, /* pc_relative */
441 1.1 christos 0, /* bitpos */
442 1.1 christos complain_overflow_dont, /* complain_on_overflow */
443 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
444 1.1 christos "R_MIPS_GOT_HI16", /* name */
445 1.1 christos TRUE, /* partial_inplace */
446 1.1 christos 0x0000ffff, /* src_mask */
447 1.1 christos 0x0000ffff, /* dst_mask */
448 1.1 christos FALSE), /* pcrel_offset */
449 1.1 christos
450 1.1 christos /* Low 16 bits of displacement in global offset table. */
451 1.1 christos HOWTO (R_MIPS_GOT_LO16, /* type */
452 1.1 christos 0, /* rightshift */
453 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
454 1.1 christos 16, /* bitsize */
455 1.1 christos FALSE, /* pc_relative */
456 1.1 christos 0, /* bitpos */
457 1.1 christos complain_overflow_dont, /* complain_on_overflow */
458 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
459 1.1 christos "R_MIPS_GOT_LO16", /* name */
460 1.1 christos TRUE, /* partial_inplace */
461 1.1 christos 0x0000ffff, /* src_mask */
462 1.1 christos 0x0000ffff, /* dst_mask */
463 1.1 christos FALSE), /* pcrel_offset */
464 1.1 christos
465 1.1 christos /* 64 bit subtraction. */
466 1.1 christos HOWTO (R_MIPS_SUB, /* type */
467 1.1 christos 0, /* rightshift */
468 1.1 christos 4, /* size (0 = byte, 1 = short, 2 = long) */
469 1.1 christos 64, /* bitsize */
470 1.1 christos FALSE, /* pc_relative */
471 1.1 christos 0, /* bitpos */
472 1.1 christos complain_overflow_dont, /* complain_on_overflow */
473 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
474 1.1 christos "R_MIPS_SUB", /* name */
475 1.1 christos TRUE, /* partial_inplace */
476 1.1 christos MINUS_ONE, /* src_mask */
477 1.1 christos MINUS_ONE, /* dst_mask */
478 1.1 christos FALSE), /* pcrel_offset */
479 1.1 christos
480 1.1 christos /* Insert the addend as an instruction. */
481 1.1 christos /* FIXME: Not handled correctly. */
482 1.1 christos HOWTO (R_MIPS_INSERT_A, /* type */
483 1.1 christos 0, /* rightshift */
484 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
485 1.1 christos 32, /* bitsize */
486 1.1 christos FALSE, /* pc_relative */
487 1.1 christos 0, /* bitpos */
488 1.1 christos complain_overflow_dont, /* complain_on_overflow */
489 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
490 1.1 christos "R_MIPS_INSERT_A", /* name */
491 1.1 christos TRUE, /* partial_inplace */
492 1.1 christos 0xffffffff, /* src_mask */
493 1.1 christos 0xffffffff, /* dst_mask */
494 1.1 christos FALSE), /* pcrel_offset */
495 1.1 christos
496 1.1 christos /* Insert the addend as an instruction, and change all relocations
497 1.1 christos to refer to the old instruction at the address. */
498 1.1 christos /* FIXME: Not handled correctly. */
499 1.1 christos HOWTO (R_MIPS_INSERT_B, /* type */
500 1.1 christos 0, /* rightshift */
501 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
502 1.1 christos 32, /* bitsize */
503 1.1 christos FALSE, /* pc_relative */
504 1.1 christos 0, /* bitpos */
505 1.1 christos complain_overflow_dont, /* complain_on_overflow */
506 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
507 1.1 christos "R_MIPS_INSERT_B", /* name */
508 1.1 christos TRUE, /* partial_inplace */
509 1.1 christos 0xffffffff, /* src_mask */
510 1.1 christos 0xffffffff, /* dst_mask */
511 1.1 christos FALSE), /* pcrel_offset */
512 1.1 christos
513 1.1 christos /* Delete a 32 bit instruction. */
514 1.1 christos /* FIXME: Not handled correctly. */
515 1.1 christos HOWTO (R_MIPS_DELETE, /* type */
516 1.1 christos 0, /* rightshift */
517 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
518 1.1 christos 32, /* bitsize */
519 1.1 christos FALSE, /* pc_relative */
520 1.1 christos 0, /* bitpos */
521 1.1 christos complain_overflow_dont, /* complain_on_overflow */
522 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
523 1.1 christos "R_MIPS_DELETE", /* name */
524 1.1 christos TRUE, /* partial_inplace */
525 1.1 christos 0xffffffff, /* src_mask */
526 1.1 christos 0xffffffff, /* dst_mask */
527 1.1 christos FALSE), /* pcrel_offset */
528 1.1 christos
529 1.1 christos /* The MIPS ELF64 ABI Draft wants us to support these for REL relocations.
530 1.1 christos We don't, because
531 1.1 christos a) It means building the addend from a R_MIPS_HIGHEST/R_MIPS_HIGHER/
532 1.1 christos R_MIPS_HI16/R_MIPS_LO16 sequence with varying ordering, using
533 1.1 christos fallable heuristics.
534 1.1 christos b) No other NewABI toolchain actually emits such relocations. */
535 1.1 christos EMPTY_HOWTO (R_MIPS_HIGHER),
536 1.1 christos EMPTY_HOWTO (R_MIPS_HIGHEST),
537 1.1 christos
538 1.1 christos /* High 16 bits of displacement in global offset table. */
539 1.1 christos HOWTO (R_MIPS_CALL_HI16, /* type */
540 1.1 christos 0, /* rightshift */
541 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
542 1.1 christos 16, /* bitsize */
543 1.1 christos FALSE, /* pc_relative */
544 1.1 christos 0, /* bitpos */
545 1.1 christos complain_overflow_dont, /* complain_on_overflow */
546 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
547 1.1 christos "R_MIPS_CALL_HI16", /* name */
548 1.1 christos TRUE, /* partial_inplace */
549 1.1 christos 0x0000ffff, /* src_mask */
550 1.1 christos 0x0000ffff, /* dst_mask */
551 1.1 christos FALSE), /* pcrel_offset */
552 1.1 christos
553 1.1 christos /* Low 16 bits of displacement in global offset table. */
554 1.1 christos HOWTO (R_MIPS_CALL_LO16, /* type */
555 1.1 christos 0, /* rightshift */
556 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
557 1.1 christos 16, /* bitsize */
558 1.1 christos FALSE, /* pc_relative */
559 1.1 christos 0, /* bitpos */
560 1.1 christos complain_overflow_dont, /* complain_on_overflow */
561 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
562 1.1 christos "R_MIPS_CALL_LO16", /* name */
563 1.1 christos TRUE, /* partial_inplace */
564 1.1 christos 0x0000ffff, /* src_mask */
565 1.1 christos 0x0000ffff, /* dst_mask */
566 1.1 christos FALSE), /* pcrel_offset */
567 1.1 christos
568 1.1 christos /* Section displacement, used by an associated event location section. */
569 1.1 christos HOWTO (R_MIPS_SCN_DISP, /* type */
570 1.1 christos 0, /* rightshift */
571 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
572 1.1 christos 32, /* bitsize */
573 1.1 christos FALSE, /* pc_relative */
574 1.1 christos 0, /* bitpos */
575 1.1 christos complain_overflow_dont, /* complain_on_overflow */
576 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
577 1.1 christos "R_MIPS_SCN_DISP", /* name */
578 1.1 christos TRUE, /* partial_inplace */
579 1.1 christos 0xffffffff, /* src_mask */
580 1.1 christos 0xffffffff, /* dst_mask */
581 1.1 christos FALSE), /* pcrel_offset */
582 1.1 christos
583 1.1 christos HOWTO (R_MIPS_REL16, /* type */
584 1.1 christos 0, /* rightshift */
585 1.1 christos 1, /* size (0 = byte, 1 = short, 2 = long) */
586 1.1 christos 16, /* bitsize */
587 1.1 christos FALSE, /* pc_relative */
588 1.1 christos 0, /* bitpos */
589 1.1 christos complain_overflow_signed, /* complain_on_overflow */
590 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
591 1.1 christos "R_MIPS_REL16", /* name */
592 1.1 christos TRUE, /* partial_inplace */
593 1.1 christos 0xffff, /* src_mask */
594 1.1 christos 0xffff, /* dst_mask */
595 1.1 christos FALSE), /* pcrel_offset */
596 1.1 christos
597 1.1 christos /* These two are obsolete. */
598 1.1 christos EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
599 1.1 christos EMPTY_HOWTO (R_MIPS_PJUMP),
600 1.1 christos
601 1.1 christos /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
602 1.1 christos It must be used for multigot GOT's (and only there). */
603 1.1 christos HOWTO (R_MIPS_RELGOT, /* type */
604 1.1 christos 0, /* rightshift */
605 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
606 1.1 christos 32, /* bitsize */
607 1.1 christos FALSE, /* pc_relative */
608 1.1 christos 0, /* bitpos */
609 1.1 christos complain_overflow_dont, /* complain_on_overflow */
610 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
611 1.1 christos "R_MIPS_RELGOT", /* name */
612 1.1 christos TRUE, /* partial_inplace */
613 1.1 christos 0xffffffff, /* src_mask */
614 1.1 christos 0xffffffff, /* dst_mask */
615 1.1 christos FALSE), /* pcrel_offset */
616 1.1 christos
617 1.1 christos /* Protected jump conversion. This is an optimization hint. No
618 1.1 christos relocation is required for correctness. */
619 1.1 christos HOWTO (R_MIPS_JALR, /* type */
620 1.1 christos 0, /* rightshift */
621 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
622 1.1 christos 32, /* bitsize */
623 1.1 christos FALSE, /* pc_relative */
624 1.1 christos 0, /* bitpos */
625 1.1 christos complain_overflow_dont, /* complain_on_overflow */
626 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
627 1.1 christos "R_MIPS_JALR", /* name */
628 1.1 christos FALSE, /* partial_inplace */
629 1.1 christos 0, /* src_mask */
630 1.1 christos 0x00000000, /* dst_mask */
631 1.1 christos FALSE), /* pcrel_offset */
632 1.1 christos
633 1.1 christos /* TLS relocations. */
634 1.1 christos EMPTY_HOWTO (R_MIPS_TLS_DTPMOD32),
635 1.1 christos EMPTY_HOWTO (R_MIPS_TLS_DTPREL32),
636 1.1 christos
637 1.1 christos HOWTO (R_MIPS_TLS_DTPMOD64, /* type */
638 1.1 christos 0, /* rightshift */
639 1.1 christos 4, /* size (0 = byte, 1 = short, 2 = long) */
640 1.1 christos 64, /* bitsize */
641 1.1 christos FALSE, /* pc_relative */
642 1.1 christos 0, /* bitpos */
643 1.1 christos complain_overflow_dont, /* complain_on_overflow */
644 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
645 1.1 christos "R_MIPS_TLS_DTPMOD64", /* name */
646 1.1 christos TRUE, /* partial_inplace */
647 1.1 christos MINUS_ONE, /* src_mask */
648 1.1 christos MINUS_ONE, /* dst_mask */
649 1.1 christos FALSE), /* pcrel_offset */
650 1.1 christos
651 1.1 christos HOWTO (R_MIPS_TLS_DTPREL64, /* type */
652 1.1 christos 0, /* rightshift */
653 1.1 christos 4, /* size (0 = byte, 1 = short, 2 = long) */
654 1.1 christos 64, /* bitsize */
655 1.1 christos FALSE, /* pc_relative */
656 1.1 christos 0, /* bitpos */
657 1.1 christos complain_overflow_dont, /* complain_on_overflow */
658 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
659 1.1 christos "R_MIPS_TLS_DTPREL64", /* name */
660 1.1 christos TRUE, /* partial_inplace */
661 1.1 christos MINUS_ONE, /* src_mask */
662 1.1 christos MINUS_ONE, /* dst_mask */
663 1.1 christos FALSE), /* pcrel_offset */
664 1.1 christos
665 1.1 christos /* TLS general dynamic variable reference. */
666 1.1 christos HOWTO (R_MIPS_TLS_GD, /* type */
667 1.1 christos 0, /* rightshift */
668 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
669 1.1 christos 16, /* bitsize */
670 1.1 christos FALSE, /* pc_relative */
671 1.1 christos 0, /* bitpos */
672 1.1 christos complain_overflow_signed, /* complain_on_overflow */
673 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
674 1.1 christos "R_MIPS_TLS_GD", /* name */
675 1.1 christos TRUE, /* partial_inplace */
676 1.1 christos 0x0000ffff, /* src_mask */
677 1.1 christos 0x0000ffff, /* dst_mask */
678 1.1 christos FALSE), /* pcrel_offset */
679 1.1 christos
680 1.1 christos /* TLS local dynamic variable reference. */
681 1.1 christos HOWTO (R_MIPS_TLS_LDM, /* type */
682 1.1 christos 0, /* rightshift */
683 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
684 1.1 christos 16, /* bitsize */
685 1.1 christos FALSE, /* pc_relative */
686 1.1 christos 0, /* bitpos */
687 1.1 christos complain_overflow_signed, /* complain_on_overflow */
688 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
689 1.1 christos "R_MIPS_TLS_LDM", /* name */
690 1.1 christos TRUE, /* partial_inplace */
691 1.1 christos 0x0000ffff, /* src_mask */
692 1.1 christos 0x0000ffff, /* dst_mask */
693 1.1 christos FALSE), /* pcrel_offset */
694 1.1 christos
695 1.1 christos /* TLS local dynamic offset. */
696 1.1 christos HOWTO (R_MIPS_TLS_DTPREL_HI16, /* type */
697 1.1 christos 0, /* rightshift */
698 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
699 1.1 christos 16, /* bitsize */
700 1.1 christos FALSE, /* pc_relative */
701 1.1 christos 0, /* bitpos */
702 1.1 christos complain_overflow_signed, /* complain_on_overflow */
703 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
704 1.1 christos "R_MIPS_TLS_DTPREL_HI16", /* name */
705 1.1 christos TRUE, /* partial_inplace */
706 1.1 christos 0x0000ffff, /* src_mask */
707 1.1 christos 0x0000ffff, /* dst_mask */
708 1.1 christos FALSE), /* pcrel_offset */
709 1.1 christos
710 1.1 christos /* TLS local dynamic offset. */
711 1.1 christos HOWTO (R_MIPS_TLS_DTPREL_LO16, /* type */
712 1.1 christos 0, /* rightshift */
713 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
714 1.1 christos 16, /* bitsize */
715 1.1 christos FALSE, /* pc_relative */
716 1.1 christos 0, /* bitpos */
717 1.1 christos complain_overflow_signed, /* complain_on_overflow */
718 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
719 1.1 christos "R_MIPS_TLS_DTPREL_LO16", /* name */
720 1.1 christos TRUE, /* partial_inplace */
721 1.1 christos 0x0000ffff, /* src_mask */
722 1.1 christos 0x0000ffff, /* dst_mask */
723 1.1 christos FALSE), /* pcrel_offset */
724 1.1 christos
725 1.1 christos /* TLS thread pointer offset. */
726 1.1 christos HOWTO (R_MIPS_TLS_GOTTPREL, /* type */
727 1.1 christos 0, /* rightshift */
728 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
729 1.1 christos 16, /* bitsize */
730 1.1 christos FALSE, /* pc_relative */
731 1.1 christos 0, /* bitpos */
732 1.1 christos complain_overflow_signed, /* complain_on_overflow */
733 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
734 1.1 christos "R_MIPS_TLS_GOTTPREL", /* name */
735 1.1 christos TRUE, /* partial_inplace */
736 1.1 christos 0x0000ffff, /* src_mask */
737 1.1 christos 0x0000ffff, /* dst_mask */
738 1.1 christos FALSE), /* pcrel_offset */
739 1.1 christos
740 1.1 christos /* TLS IE dynamic relocations. */
741 1.1 christos EMPTY_HOWTO (R_MIPS_TLS_TPREL32),
742 1.1 christos
743 1.1 christos HOWTO (R_MIPS_TLS_TPREL64, /* type */
744 1.1 christos 0, /* rightshift */
745 1.1 christos 4, /* size (0 = byte, 1 = short, 2 = long) */
746 1.1 christos 64, /* bitsize */
747 1.1 christos FALSE, /* pc_relative */
748 1.1 christos 0, /* bitpos */
749 1.1 christos complain_overflow_dont, /* complain_on_overflow */
750 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
751 1.1 christos "R_MIPS_TLS_TPREL64", /* name */
752 1.1 christos TRUE, /* partial_inplace */
753 1.1 christos MINUS_ONE, /* src_mask */
754 1.1 christos MINUS_ONE, /* dst_mask */
755 1.1 christos FALSE), /* pcrel_offset */
756 1.1 christos
757 1.1 christos /* TLS thread pointer offset. */
758 1.1 christos HOWTO (R_MIPS_TLS_TPREL_HI16, /* type */
759 1.1 christos 0, /* rightshift */
760 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
761 1.1 christos 16, /* bitsize */
762 1.1 christos FALSE, /* pc_relative */
763 1.1 christos 0, /* bitpos */
764 1.1 christos complain_overflow_signed, /* complain_on_overflow */
765 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
766 1.1 christos "R_MIPS_TLS_TPREL_HI16", /* name */
767 1.1 christos TRUE, /* partial_inplace */
768 1.1 christos 0x0000ffff, /* src_mask */
769 1.1 christos 0x0000ffff, /* dst_mask */
770 1.1 christos FALSE), /* pcrel_offset */
771 1.1 christos
772 1.1 christos /* TLS thread pointer offset. */
773 1.1 christos HOWTO (R_MIPS_TLS_TPREL_LO16, /* type */
774 1.1 christos 0, /* rightshift */
775 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
776 1.1 christos 16, /* bitsize */
777 1.1 christos FALSE, /* pc_relative */
778 1.1 christos 0, /* bitpos */
779 1.1 christos complain_overflow_signed, /* complain_on_overflow */
780 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
781 1.1 christos "R_MIPS_TLS_TPREL_LO16", /* name */
782 1.1 christos TRUE, /* partial_inplace */
783 1.1 christos 0x0000ffff, /* src_mask */
784 1.1 christos 0x0000ffff, /* dst_mask */
785 1.1 christos FALSE), /* pcrel_offset */
786 1.1 christos
787 1.1 christos /* 32 bit relocation with no addend. */
788 1.1 christos HOWTO (R_MIPS_GLOB_DAT, /* type */
789 1.1 christos 0, /* rightshift */
790 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
791 1.1 christos 32, /* bitsize */
792 1.1 christos FALSE, /* pc_relative */
793 1.1 christos 0, /* bitpos */
794 1.1 christos complain_overflow_dont, /* complain_on_overflow */
795 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
796 1.1 christos "R_MIPS_GLOB_DAT", /* name */
797 1.1 christos FALSE, /* partial_inplace */
798 1.1 christos 0x0, /* src_mask */
799 1.1 christos 0xffffffff, /* dst_mask */
800 1.1.1.2 christos FALSE), /* pcrel_offset */
801 1.1.1.2 christos
802 1.1.1.2 christos EMPTY_HOWTO (52),
803 1.1.1.2 christos EMPTY_HOWTO (53),
804 1.1.1.2 christos EMPTY_HOWTO (54),
805 1.1.1.2 christos EMPTY_HOWTO (55),
806 1.1.1.2 christos EMPTY_HOWTO (56),
807 1.1.1.2 christos EMPTY_HOWTO (57),
808 1.1.1.2 christos EMPTY_HOWTO (58),
809 1.1.1.2 christos EMPTY_HOWTO (59),
810 1.1.1.2 christos
811 1.1.1.2 christos HOWTO (R_MIPS_PC21_S2, /* type */
812 1.1.1.2 christos 2, /* rightshift */
813 1.1.1.2 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
814 1.1.1.2 christos 21, /* bitsize */
815 1.1.1.2 christos TRUE, /* pc_relative */
816 1.1.1.2 christos 0, /* bitpos */
817 1.1.1.2 christos complain_overflow_signed, /* complain_on_overflow */
818 1.1.1.2 christos _bfd_mips_elf_generic_reloc, /* special_function */
819 1.1.1.2 christos "R_MIPS_PC21_S2", /* name */
820 1.1.1.2 christos TRUE, /* partial_inplace */
821 1.1.1.2 christos 0x001fffff, /* src_mask */
822 1.1.1.2 christos 0x001fffff, /* dst_mask */
823 1.1.1.2 christos TRUE), /* pcrel_offset */
824 1.1.1.2 christos
825 1.1.1.2 christos HOWTO (R_MIPS_PC26_S2, /* type */
826 1.1.1.2 christos 2, /* rightshift */
827 1.1.1.2 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
828 1.1.1.2 christos 26, /* bitsize */
829 1.1.1.2 christos TRUE, /* pc_relative */
830 1.1.1.2 christos 0, /* bitpos */
831 1.1.1.2 christos complain_overflow_signed, /* complain_on_overflow */
832 1.1.1.2 christos _bfd_mips_elf_generic_reloc, /* special_function */
833 1.1.1.2 christos "R_MIPS_PC26_S2", /* name */
834 1.1.1.2 christos TRUE, /* partial_inplace */
835 1.1.1.2 christos 0x03ffffff, /* src_mask */
836 1.1.1.2 christos 0x03ffffff, /* dst_mask */
837 1.1.1.2 christos TRUE), /* pcrel_offset */
838 1.1.1.2 christos
839 1.1.1.2 christos HOWTO (R_MIPS_PC18_S3, /* type */
840 1.1.1.2 christos 3, /* rightshift */
841 1.1.1.2 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
842 1.1.1.2 christos 18, /* bitsize */
843 1.1.1.2 christos TRUE, /* pc_relative */
844 1.1.1.2 christos 0, /* bitpos */
845 1.1.1.2 christos complain_overflow_signed, /* complain_on_overflow */
846 1.1.1.2 christos _bfd_mips_elf_generic_reloc, /* special_function */
847 1.1.1.2 christos "R_MIPS_PC18_S3", /* name */
848 1.1.1.2 christos TRUE, /* partial_inplace */
849 1.1.1.2 christos 0x0003ffff, /* src_mask */
850 1.1.1.2 christos 0x0003ffff, /* dst_mask */
851 1.1.1.2 christos TRUE), /* pcrel_offset */
852 1.1.1.2 christos
853 1.1.1.2 christos HOWTO (R_MIPS_PC19_S2, /* type */
854 1.1.1.2 christos 2, /* rightshift */
855 1.1.1.2 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
856 1.1.1.2 christos 19, /* bitsize */
857 1.1.1.2 christos TRUE, /* pc_relative */
858 1.1.1.2 christos 0, /* bitpos */
859 1.1.1.2 christos complain_overflow_signed, /* complain_on_overflow */
860 1.1.1.2 christos _bfd_mips_elf_generic_reloc, /* special_function */
861 1.1.1.2 christos "R_MIPS_PC19_S2", /* name */
862 1.1.1.2 christos TRUE, /* partial_inplace */
863 1.1.1.2 christos 0x0007ffff, /* src_mask */
864 1.1.1.2 christos 0x0007ffff, /* dst_mask */
865 1.1.1.2 christos TRUE), /* pcrel_offset */
866 1.1.1.2 christos
867 1.1.1.2 christos HOWTO (R_MIPS_PCHI16, /* type */
868 1.1.1.2 christos 16, /* rightshift */
869 1.1.1.2 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
870 1.1.1.2 christos 16, /* bitsize */
871 1.1.1.2 christos TRUE, /* pc_relative */
872 1.1.1.2 christos 0, /* bitpos */
873 1.1.1.2 christos complain_overflow_signed, /* complain_on_overflow */
874 1.1.1.2 christos _bfd_mips_elf_generic_reloc, /* special_function */
875 1.1.1.2 christos "R_MIPS_PCHI16", /* name */
876 1.1.1.2 christos TRUE, /* partial_inplace */
877 1.1.1.2 christos 0x0000ffff, /* src_mask */
878 1.1.1.2 christos 0x0000ffff, /* dst_mask */
879 1.1.1.2 christos TRUE), /* pcrel_offset */
880 1.1.1.2 christos
881 1.1.1.2 christos HOWTO (R_MIPS_PCLO16, /* type */
882 1.1.1.2 christos 0, /* rightshift */
883 1.1.1.2 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
884 1.1.1.2 christos 16, /* bitsize */
885 1.1.1.2 christos TRUE, /* pc_relative */
886 1.1.1.2 christos 0, /* bitpos */
887 1.1.1.2 christos complain_overflow_dont, /* complain_on_overflow */
888 1.1.1.2 christos _bfd_mips_elf_generic_reloc, /* special_function */
889 1.1.1.2 christos "R_MIPS_PCLO16", /* name */
890 1.1.1.2 christos TRUE, /* partial_inplace */
891 1.1.1.2 christos 0x0000ffff, /* src_mask */
892 1.1.1.2 christos 0x0000ffff, /* dst_mask */
893 1.1.1.2 christos TRUE), /* pcrel_offset */
894 1.1 christos
895 1.1 christos };
896 1.1 christos
897 1.1 christos /* The relocation table used for SHT_RELA sections. */
898 1.1 christos
899 1.1 christos static reloc_howto_type mips_elf64_howto_table_rela[] =
900 1.1 christos {
901 1.1 christos /* No relocation. */
902 1.1 christos HOWTO (R_MIPS_NONE, /* type */
903 1.1.1.2 christos 0, /* rightshift */
904 1.1 christos 3, /* size (0 = byte, 1 = short, 2 = long) */
905 1.1 christos 0, /* bitsize */
906 1.1 christos FALSE, /* pc_relative */
907 1.1 christos 0, /* bitpos */
908 1.1 christos complain_overflow_dont, /* complain_on_overflow */
909 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
910 1.1 christos "R_MIPS_NONE", /* name */
911 1.1 christos FALSE, /* partial_inplace */
912 1.1 christos 0, /* src_mask */
913 1.1 christos 0, /* dst_mask */
914 1.1 christos FALSE), /* pcrel_offset */
915 1.1 christos
916 1.1 christos /* 16 bit relocation. */
917 1.1 christos HOWTO (R_MIPS_16, /* type */
918 1.1 christos 0, /* rightshift */
919 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
920 1.1 christos 16, /* bitsize */
921 1.1 christos FALSE, /* pc_relative */
922 1.1 christos 0, /* bitpos */
923 1.1 christos complain_overflow_signed, /* complain_on_overflow */
924 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
925 1.1 christos "R_MIPS_16", /* name */
926 1.1 christos FALSE, /* partial_inplace */
927 1.1 christos 0, /* src_mask */
928 1.1 christos 0x0000ffff, /* dst_mask */
929 1.1 christos FALSE), /* pcrel_offset */
930 1.1 christos
931 1.1 christos /* 32 bit relocation. */
932 1.1 christos HOWTO (R_MIPS_32, /* type */
933 1.1 christos 0, /* rightshift */
934 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
935 1.1 christos 32, /* bitsize */
936 1.1 christos FALSE, /* pc_relative */
937 1.1 christos 0, /* bitpos */
938 1.1 christos complain_overflow_dont, /* complain_on_overflow */
939 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
940 1.1 christos "R_MIPS_32", /* name */
941 1.1 christos FALSE, /* partial_inplace */
942 1.1 christos 0, /* src_mask */
943 1.1 christos 0xffffffff, /* dst_mask */
944 1.1 christos FALSE), /* pcrel_offset */
945 1.1 christos
946 1.1 christos /* 32 bit symbol relative relocation. */
947 1.1 christos HOWTO (R_MIPS_REL32, /* type */
948 1.1 christos 0, /* rightshift */
949 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
950 1.1 christos 32, /* bitsize */
951 1.1 christos FALSE, /* pc_relative */
952 1.1 christos 0, /* bitpos */
953 1.1 christos complain_overflow_dont, /* complain_on_overflow */
954 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
955 1.1 christos "R_MIPS_REL32", /* name */
956 1.1 christos FALSE, /* partial_inplace */
957 1.1 christos 0, /* src_mask */
958 1.1 christos 0xffffffff, /* dst_mask */
959 1.1 christos FALSE), /* pcrel_offset */
960 1.1 christos
961 1.1 christos /* 26 bit jump address. */
962 1.1 christos HOWTO (R_MIPS_26, /* type */
963 1.1 christos 2, /* rightshift */
964 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
965 1.1 christos 26, /* bitsize */
966 1.1 christos FALSE, /* pc_relative */
967 1.1 christos 0, /* bitpos */
968 1.1 christos complain_overflow_dont, /* complain_on_overflow */
969 1.1 christos /* This needs complex overflow
970 1.1 christos detection, because the upper 36
971 1.1 christos bits must match the PC + 4. */
972 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
973 1.1 christos "R_MIPS_26", /* name */
974 1.1 christos FALSE, /* partial_inplace */
975 1.1 christos 0, /* src_mask */
976 1.1 christos 0x03ffffff, /* dst_mask */
977 1.1 christos FALSE), /* pcrel_offset */
978 1.1 christos
979 1.1 christos /* High 16 bits of symbol value. */
980 1.1 christos HOWTO (R_MIPS_HI16, /* type */
981 1.1 christos 0, /* rightshift */
982 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
983 1.1 christos 16, /* bitsize */
984 1.1 christos FALSE, /* pc_relative */
985 1.1 christos 0, /* bitpos */
986 1.1 christos complain_overflow_dont, /* complain_on_overflow */
987 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
988 1.1 christos "R_MIPS_HI16", /* name */
989 1.1 christos FALSE, /* partial_inplace */
990 1.1 christos 0, /* src_mask */
991 1.1 christos 0x0000ffff, /* dst_mask */
992 1.1 christos FALSE), /* pcrel_offset */
993 1.1 christos
994 1.1 christos /* Low 16 bits of symbol value. */
995 1.1 christos HOWTO (R_MIPS_LO16, /* type */
996 1.1 christos 0, /* rightshift */
997 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
998 1.1 christos 16, /* bitsize */
999 1.1 christos FALSE, /* pc_relative */
1000 1.1 christos 0, /* bitpos */
1001 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1002 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1003 1.1 christos "R_MIPS_LO16", /* name */
1004 1.1 christos FALSE, /* partial_inplace */
1005 1.1 christos 0, /* src_mask */
1006 1.1 christos 0x0000ffff, /* dst_mask */
1007 1.1 christos FALSE), /* pcrel_offset */
1008 1.1 christos
1009 1.1 christos /* GP relative reference. */
1010 1.1 christos HOWTO (R_MIPS_GPREL16, /* type */
1011 1.1 christos 0, /* rightshift */
1012 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1013 1.1 christos 16, /* bitsize */
1014 1.1 christos FALSE, /* pc_relative */
1015 1.1 christos 0, /* bitpos */
1016 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1017 1.1 christos mips_elf64_gprel16_reloc, /* special_function */
1018 1.1 christos "R_MIPS_GPREL16", /* name */
1019 1.1 christos FALSE, /* partial_inplace */
1020 1.1 christos 0, /* src_mask */
1021 1.1 christos 0x0000ffff, /* dst_mask */
1022 1.1 christos FALSE), /* pcrel_offset */
1023 1.1 christos
1024 1.1 christos /* Reference to literal section. */
1025 1.1 christos HOWTO (R_MIPS_LITERAL, /* type */
1026 1.1 christos 0, /* rightshift */
1027 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1028 1.1 christos 16, /* bitsize */
1029 1.1 christos FALSE, /* pc_relative */
1030 1.1 christos 0, /* bitpos */
1031 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1032 1.1 christos mips_elf64_literal_reloc, /* special_function */
1033 1.1 christos "R_MIPS_LITERAL", /* name */
1034 1.1 christos FALSE, /* partial_inplace */
1035 1.1 christos 0, /* src_mask */
1036 1.1 christos 0x0000ffff, /* dst_mask */
1037 1.1 christos FALSE), /* pcrel_offset */
1038 1.1 christos
1039 1.1 christos /* Reference to global offset table. */
1040 1.1 christos HOWTO (R_MIPS_GOT16, /* type */
1041 1.1 christos 0, /* rightshift */
1042 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1043 1.1 christos 16, /* bitsize */
1044 1.1 christos FALSE, /* pc_relative */
1045 1.1 christos 0, /* bitpos */
1046 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1047 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1048 1.1 christos "R_MIPS_GOT16", /* name */
1049 1.1 christos FALSE, /* partial_inplace */
1050 1.1 christos 0, /* src_mask */
1051 1.1 christos 0x0000ffff, /* dst_mask */
1052 1.1 christos FALSE), /* pcrel_offset */
1053 1.1 christos
1054 1.1 christos /* 16 bit PC relative reference. Note that the ABI document has a typo
1055 1.1 christos and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
1056 1.1 christos We do the right thing here. */
1057 1.1 christos HOWTO (R_MIPS_PC16, /* type */
1058 1.1 christos 2, /* rightshift */
1059 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1060 1.1 christos 16, /* bitsize */
1061 1.1 christos TRUE, /* pc_relative */
1062 1.1 christos 0, /* bitpos */
1063 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1064 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1065 1.1 christos "R_MIPS_PC16", /* name */
1066 1.1 christos FALSE, /* partial_inplace */
1067 1.1 christos 0, /* src_mask */
1068 1.1 christos 0x0000ffff, /* dst_mask */
1069 1.1 christos TRUE), /* pcrel_offset */
1070 1.1 christos
1071 1.1 christos /* 16 bit call through global offset table. */
1072 1.1 christos HOWTO (R_MIPS_CALL16, /* type */
1073 1.1 christos 0, /* rightshift */
1074 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1075 1.1 christos 16, /* bitsize */
1076 1.1 christos FALSE, /* pc_relative */
1077 1.1 christos 0, /* bitpos */
1078 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1079 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1080 1.1 christos "R_MIPS_CALL16", /* name */
1081 1.1 christos FALSE, /* partial_inplace */
1082 1.1 christos 0, /* src_mask */
1083 1.1 christos 0x0000ffff, /* dst_mask */
1084 1.1 christos FALSE), /* pcrel_offset */
1085 1.1 christos
1086 1.1 christos /* 32 bit GP relative reference. */
1087 1.1 christos HOWTO (R_MIPS_GPREL32, /* type */
1088 1.1 christos 0, /* rightshift */
1089 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1090 1.1 christos 32, /* bitsize */
1091 1.1 christos FALSE, /* pc_relative */
1092 1.1 christos 0, /* bitpos */
1093 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1094 1.1 christos mips_elf64_gprel32_reloc, /* special_function */
1095 1.1 christos "R_MIPS_GPREL32", /* name */
1096 1.1 christos FALSE, /* partial_inplace */
1097 1.1 christos 0, /* src_mask */
1098 1.1 christos 0xffffffff, /* dst_mask */
1099 1.1 christos FALSE), /* pcrel_offset */
1100 1.1 christos
1101 1.1 christos EMPTY_HOWTO (13),
1102 1.1 christos EMPTY_HOWTO (14),
1103 1.1 christos EMPTY_HOWTO (15),
1104 1.1 christos
1105 1.1 christos /* A 5 bit shift field. */
1106 1.1 christos HOWTO (R_MIPS_SHIFT5, /* type */
1107 1.1 christos 0, /* rightshift */
1108 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1109 1.1 christos 5, /* bitsize */
1110 1.1 christos FALSE, /* pc_relative */
1111 1.1 christos 6, /* bitpos */
1112 1.1 christos complain_overflow_bitfield, /* complain_on_overflow */
1113 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1114 1.1 christos "R_MIPS_SHIFT5", /* name */
1115 1.1 christos FALSE, /* partial_inplace */
1116 1.1 christos 0, /* src_mask */
1117 1.1 christos 0x000007c0, /* dst_mask */
1118 1.1 christos FALSE), /* pcrel_offset */
1119 1.1 christos
1120 1.1 christos /* A 6 bit shift field. */
1121 1.1 christos HOWTO (R_MIPS_SHIFT6, /* type */
1122 1.1 christos 0, /* rightshift */
1123 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1124 1.1 christos 6, /* bitsize */
1125 1.1 christos FALSE, /* pc_relative */
1126 1.1 christos 6, /* bitpos */
1127 1.1 christos complain_overflow_bitfield, /* complain_on_overflow */
1128 1.1 christos mips_elf64_shift6_reloc, /* special_function */
1129 1.1 christos "R_MIPS_SHIFT6", /* name */
1130 1.1 christos FALSE, /* partial_inplace */
1131 1.1 christos 0, /* src_mask */
1132 1.1 christos 0x000007c4, /* dst_mask */
1133 1.1 christos FALSE), /* pcrel_offset */
1134 1.1 christos
1135 1.1 christos /* 64 bit relocation. */
1136 1.1 christos HOWTO (R_MIPS_64, /* type */
1137 1.1 christos 0, /* rightshift */
1138 1.1 christos 4, /* size (0 = byte, 1 = short, 2 = long) */
1139 1.1 christos 64, /* bitsize */
1140 1.1 christos FALSE, /* pc_relative */
1141 1.1 christos 0, /* bitpos */
1142 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1143 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1144 1.1 christos "R_MIPS_64", /* name */
1145 1.1 christos FALSE, /* partial_inplace */
1146 1.1 christos 0, /* src_mask */
1147 1.1 christos MINUS_ONE, /* dst_mask */
1148 1.1 christos FALSE), /* pcrel_offset */
1149 1.1 christos
1150 1.1 christos /* Displacement in the global offset table. */
1151 1.1 christos HOWTO (R_MIPS_GOT_DISP, /* type */
1152 1.1 christos 0, /* rightshift */
1153 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1154 1.1 christos 16, /* bitsize */
1155 1.1 christos FALSE, /* pc_relative */
1156 1.1 christos 0, /* bitpos */
1157 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1158 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1159 1.1 christos "R_MIPS_GOT_DISP", /* name */
1160 1.1 christos FALSE, /* partial_inplace */
1161 1.1 christos 0, /* src_mask */
1162 1.1 christos 0x0000ffff, /* dst_mask */
1163 1.1 christos FALSE), /* pcrel_offset */
1164 1.1 christos
1165 1.1 christos /* Displacement to page pointer in the global offset table. */
1166 1.1 christos HOWTO (R_MIPS_GOT_PAGE, /* type */
1167 1.1 christos 0, /* rightshift */
1168 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1169 1.1 christos 16, /* bitsize */
1170 1.1 christos FALSE, /* pc_relative */
1171 1.1 christos 0, /* bitpos */
1172 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1173 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1174 1.1 christos "R_MIPS_GOT_PAGE", /* name */
1175 1.1 christos FALSE, /* partial_inplace */
1176 1.1 christos 0, /* src_mask */
1177 1.1 christos 0x0000ffff, /* dst_mask */
1178 1.1 christos FALSE), /* pcrel_offset */
1179 1.1 christos
1180 1.1 christos /* Offset from page pointer in the global offset table. */
1181 1.1 christos HOWTO (R_MIPS_GOT_OFST, /* type */
1182 1.1 christos 0, /* rightshift */
1183 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1184 1.1 christos 16, /* bitsize */
1185 1.1 christos FALSE, /* pc_relative */
1186 1.1 christos 0, /* bitpos */
1187 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1188 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1189 1.1 christos "R_MIPS_GOT_OFST", /* name */
1190 1.1 christos FALSE, /* partial_inplace */
1191 1.1 christos 0, /* src_mask */
1192 1.1 christos 0x0000ffff, /* dst_mask */
1193 1.1 christos FALSE), /* pcrel_offset */
1194 1.1 christos
1195 1.1 christos /* High 16 bits of displacement in global offset table. */
1196 1.1 christos HOWTO (R_MIPS_GOT_HI16, /* type */
1197 1.1 christos 0, /* rightshift */
1198 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1199 1.1 christos 16, /* bitsize */
1200 1.1 christos FALSE, /* pc_relative */
1201 1.1 christos 0, /* bitpos */
1202 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1203 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1204 1.1 christos "R_MIPS_GOT_HI16", /* name */
1205 1.1 christos FALSE, /* partial_inplace */
1206 1.1 christos 0, /* src_mask */
1207 1.1 christos 0x0000ffff, /* dst_mask */
1208 1.1 christos FALSE), /* pcrel_offset */
1209 1.1 christos
1210 1.1 christos /* Low 16 bits of displacement in global offset table. */
1211 1.1 christos HOWTO (R_MIPS_GOT_LO16, /* type */
1212 1.1 christos 0, /* rightshift */
1213 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1214 1.1 christos 16, /* bitsize */
1215 1.1 christos FALSE, /* pc_relative */
1216 1.1 christos 0, /* bitpos */
1217 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1218 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1219 1.1 christos "R_MIPS_GOT_LO16", /* name */
1220 1.1 christos FALSE, /* partial_inplace */
1221 1.1 christos 0, /* src_mask */
1222 1.1 christos 0x0000ffff, /* dst_mask */
1223 1.1 christos FALSE), /* pcrel_offset */
1224 1.1 christos
1225 1.1 christos /* 64 bit subtraction. */
1226 1.1 christos HOWTO (R_MIPS_SUB, /* type */
1227 1.1 christos 0, /* rightshift */
1228 1.1 christos 4, /* size (0 = byte, 1 = short, 2 = long) */
1229 1.1 christos 64, /* bitsize */
1230 1.1 christos FALSE, /* pc_relative */
1231 1.1 christos 0, /* bitpos */
1232 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1233 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1234 1.1 christos "R_MIPS_SUB", /* name */
1235 1.1 christos FALSE, /* partial_inplace */
1236 1.1 christos 0, /* src_mask */
1237 1.1 christos MINUS_ONE, /* dst_mask */
1238 1.1 christos FALSE), /* pcrel_offset */
1239 1.1 christos
1240 1.1 christos /* Insert the addend as an instruction. */
1241 1.1 christos /* FIXME: Not handled correctly. */
1242 1.1 christos HOWTO (R_MIPS_INSERT_A, /* type */
1243 1.1 christos 0, /* rightshift */
1244 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1245 1.1 christos 32, /* bitsize */
1246 1.1 christos FALSE, /* pc_relative */
1247 1.1 christos 0, /* bitpos */
1248 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1249 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1250 1.1 christos "R_MIPS_INSERT_A", /* name */
1251 1.1 christos FALSE, /* partial_inplace */
1252 1.1 christos 0, /* src_mask */
1253 1.1 christos 0xffffffff, /* dst_mask */
1254 1.1 christos FALSE), /* pcrel_offset */
1255 1.1 christos
1256 1.1 christos /* Insert the addend as an instruction, and change all relocations
1257 1.1 christos to refer to the old instruction at the address. */
1258 1.1 christos /* FIXME: Not handled correctly. */
1259 1.1 christos HOWTO (R_MIPS_INSERT_B, /* type */
1260 1.1 christos 0, /* rightshift */
1261 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1262 1.1 christos 32, /* bitsize */
1263 1.1 christos FALSE, /* pc_relative */
1264 1.1 christos 0, /* bitpos */
1265 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1266 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1267 1.1 christos "R_MIPS_INSERT_B", /* name */
1268 1.1 christos FALSE, /* partial_inplace */
1269 1.1 christos 0, /* src_mask */
1270 1.1 christos 0xffffffff, /* dst_mask */
1271 1.1 christos FALSE), /* pcrel_offset */
1272 1.1 christos
1273 1.1 christos /* Delete a 32 bit instruction. */
1274 1.1 christos /* FIXME: Not handled correctly. */
1275 1.1 christos HOWTO (R_MIPS_DELETE, /* type */
1276 1.1 christos 0, /* rightshift */
1277 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1278 1.1 christos 32, /* bitsize */
1279 1.1 christos FALSE, /* pc_relative */
1280 1.1 christos 0, /* bitpos */
1281 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1282 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1283 1.1 christos "R_MIPS_DELETE", /* name */
1284 1.1 christos FALSE, /* partial_inplace */
1285 1.1 christos 0, /* src_mask */
1286 1.1 christos 0xffffffff, /* dst_mask */
1287 1.1 christos FALSE), /* pcrel_offset */
1288 1.1 christos
1289 1.1 christos /* Get the higher value of a 64 bit addend. */
1290 1.1 christos HOWTO (R_MIPS_HIGHER, /* type */
1291 1.1 christos 0, /* rightshift */
1292 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1293 1.1 christos 16, /* bitsize */
1294 1.1 christos FALSE, /* pc_relative */
1295 1.1 christos 0, /* bitpos */
1296 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1297 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1298 1.1 christos "R_MIPS_HIGHER", /* name */
1299 1.1 christos FALSE, /* partial_inplace */
1300 1.1 christos 0, /* src_mask */
1301 1.1 christos 0x0000ffff, /* dst_mask */
1302 1.1 christos FALSE), /* pcrel_offset */
1303 1.1 christos
1304 1.1 christos /* Get the highest value of a 64 bit addend. */
1305 1.1 christos HOWTO (R_MIPS_HIGHEST, /* type */
1306 1.1 christos 0, /* rightshift */
1307 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1308 1.1 christos 16, /* bitsize */
1309 1.1 christos FALSE, /* pc_relative */
1310 1.1 christos 0, /* bitpos */
1311 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1312 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1313 1.1 christos "R_MIPS_HIGHEST", /* name */
1314 1.1 christos FALSE, /* partial_inplace */
1315 1.1 christos 0, /* src_mask */
1316 1.1 christos 0x0000ffff, /* dst_mask */
1317 1.1 christos FALSE), /* pcrel_offset */
1318 1.1 christos
1319 1.1 christos /* High 16 bits of displacement in global offset table. */
1320 1.1 christos HOWTO (R_MIPS_CALL_HI16, /* type */
1321 1.1 christos 0, /* rightshift */
1322 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1323 1.1 christos 16, /* bitsize */
1324 1.1 christos FALSE, /* pc_relative */
1325 1.1 christos 0, /* bitpos */
1326 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1327 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1328 1.1 christos "R_MIPS_CALL_HI16", /* name */
1329 1.1 christos FALSE, /* partial_inplace */
1330 1.1 christos 0, /* src_mask */
1331 1.1 christos 0x0000ffff, /* dst_mask */
1332 1.1 christos FALSE), /* pcrel_offset */
1333 1.1 christos
1334 1.1 christos /* Low 16 bits of displacement in global offset table. */
1335 1.1 christos HOWTO (R_MIPS_CALL_LO16, /* type */
1336 1.1 christos 0, /* rightshift */
1337 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1338 1.1 christos 16, /* bitsize */
1339 1.1 christos FALSE, /* pc_relative */
1340 1.1 christos 0, /* bitpos */
1341 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1342 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1343 1.1 christos "R_MIPS_CALL_LO16", /* name */
1344 1.1 christos FALSE, /* partial_inplace */
1345 1.1 christos 0, /* src_mask */
1346 1.1 christos 0x0000ffff, /* dst_mask */
1347 1.1 christos FALSE), /* pcrel_offset */
1348 1.1 christos
1349 1.1 christos /* Section displacement, used by an associated event location section. */
1350 1.1 christos HOWTO (R_MIPS_SCN_DISP, /* type */
1351 1.1 christos 0, /* rightshift */
1352 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1353 1.1 christos 32, /* bitsize */
1354 1.1 christos FALSE, /* pc_relative */
1355 1.1 christos 0, /* bitpos */
1356 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1357 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1358 1.1 christos "R_MIPS_SCN_DISP", /* name */
1359 1.1 christos FALSE, /* partial_inplace */
1360 1.1 christos 0, /* src_mask */
1361 1.1 christos 0xffffffff, /* dst_mask */
1362 1.1 christos FALSE), /* pcrel_offset */
1363 1.1 christos
1364 1.1 christos HOWTO (R_MIPS_REL16, /* type */
1365 1.1 christos 0, /* rightshift */
1366 1.1 christos 1, /* size (0 = byte, 1 = short, 2 = long) */
1367 1.1 christos 16, /* bitsize */
1368 1.1 christos FALSE, /* pc_relative */
1369 1.1 christos 0, /* bitpos */
1370 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1371 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1372 1.1 christos "R_MIPS_REL16", /* name */
1373 1.1 christos FALSE, /* partial_inplace */
1374 1.1 christos 0, /* src_mask */
1375 1.1 christos 0xffff, /* dst_mask */
1376 1.1 christos FALSE), /* pcrel_offset */
1377 1.1 christos
1378 1.1 christos /* These two are obsolete. */
1379 1.1 christos EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
1380 1.1 christos EMPTY_HOWTO (R_MIPS_PJUMP),
1381 1.1 christos
1382 1.1 christos /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
1383 1.1 christos It must be used for multigot GOT's (and only there). */
1384 1.1 christos HOWTO (R_MIPS_RELGOT, /* type */
1385 1.1 christos 0, /* rightshift */
1386 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1387 1.1 christos 32, /* bitsize */
1388 1.1 christos FALSE, /* pc_relative */
1389 1.1 christos 0, /* bitpos */
1390 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1391 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1392 1.1 christos "R_MIPS_RELGOT", /* name */
1393 1.1 christos FALSE, /* partial_inplace */
1394 1.1 christos 0, /* src_mask */
1395 1.1 christos 0xffffffff, /* dst_mask */
1396 1.1 christos FALSE), /* pcrel_offset */
1397 1.1 christos
1398 1.1 christos /* Protected jump conversion. This is an optimization hint. No
1399 1.1 christos relocation is required for correctness. */
1400 1.1 christos HOWTO (R_MIPS_JALR, /* type */
1401 1.1 christos 0, /* rightshift */
1402 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1403 1.1 christos 32, /* bitsize */
1404 1.1 christos FALSE, /* pc_relative */
1405 1.1 christos 0, /* bitpos */
1406 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1407 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1408 1.1 christos "R_MIPS_JALR", /* name */
1409 1.1 christos FALSE, /* partial_inplace */
1410 1.1 christos 0, /* src_mask */
1411 1.1 christos 0x00000000, /* dst_mask */
1412 1.1 christos FALSE), /* pcrel_offset */
1413 1.1 christos
1414 1.1 christos /* TLS relocations. */
1415 1.1 christos EMPTY_HOWTO (R_MIPS_TLS_DTPMOD32),
1416 1.1 christos EMPTY_HOWTO (R_MIPS_TLS_DTPREL32),
1417 1.1 christos
1418 1.1 christos HOWTO (R_MIPS_TLS_DTPMOD64, /* type */
1419 1.1 christos 0, /* rightshift */
1420 1.1 christos 4, /* size (0 = byte, 1 = short, 2 = long) */
1421 1.1 christos 64, /* bitsize */
1422 1.1 christos FALSE, /* pc_relative */
1423 1.1 christos 0, /* bitpos */
1424 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1425 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1426 1.1 christos "R_MIPS_TLS_DTPMOD64", /* name */
1427 1.1 christos FALSE, /* partial_inplace */
1428 1.1 christos 0, /* src_mask */
1429 1.1 christos MINUS_ONE, /* dst_mask */
1430 1.1 christos FALSE), /* pcrel_offset */
1431 1.1 christos
1432 1.1 christos HOWTO (R_MIPS_TLS_DTPREL64, /* type */
1433 1.1 christos 0, /* rightshift */
1434 1.1 christos 4, /* size (0 = byte, 1 = short, 2 = long) */
1435 1.1 christos 64, /* bitsize */
1436 1.1 christos FALSE, /* pc_relative */
1437 1.1 christos 0, /* bitpos */
1438 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1439 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1440 1.1 christos "R_MIPS_TLS_DTPREL64", /* name */
1441 1.1 christos FALSE, /* partial_inplace */
1442 1.1 christos 0, /* src_mask */
1443 1.1 christos MINUS_ONE, /* dst_mask */
1444 1.1 christos FALSE), /* pcrel_offset */
1445 1.1 christos
1446 1.1 christos /* TLS general dynamic variable reference. */
1447 1.1 christos HOWTO (R_MIPS_TLS_GD, /* type */
1448 1.1 christos 0, /* rightshift */
1449 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1450 1.1 christos 16, /* bitsize */
1451 1.1 christos FALSE, /* pc_relative */
1452 1.1 christos 0, /* bitpos */
1453 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1454 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1455 1.1 christos "R_MIPS_TLS_GD", /* name */
1456 1.1 christos FALSE, /* partial_inplace */
1457 1.1 christos 0, /* src_mask */
1458 1.1 christos 0x0000ffff, /* dst_mask */
1459 1.1 christos FALSE), /* pcrel_offset */
1460 1.1 christos
1461 1.1 christos /* TLS local dynamic variable reference. */
1462 1.1 christos HOWTO (R_MIPS_TLS_LDM, /* type */
1463 1.1 christos 0, /* rightshift */
1464 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1465 1.1 christos 16, /* bitsize */
1466 1.1 christos FALSE, /* pc_relative */
1467 1.1 christos 0, /* bitpos */
1468 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1469 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1470 1.1 christos "R_MIPS_TLS_LDM", /* name */
1471 1.1 christos FALSE, /* partial_inplace */
1472 1.1 christos 0, /* src_mask */
1473 1.1 christos 0x0000ffff, /* dst_mask */
1474 1.1 christos FALSE), /* pcrel_offset */
1475 1.1 christos
1476 1.1 christos /* TLS local dynamic offset. */
1477 1.1 christos HOWTO (R_MIPS_TLS_DTPREL_HI16, /* type */
1478 1.1 christos 0, /* rightshift */
1479 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1480 1.1 christos 16, /* bitsize */
1481 1.1 christos FALSE, /* pc_relative */
1482 1.1 christos 0, /* bitpos */
1483 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1484 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1485 1.1 christos "R_MIPS_TLS_DTPREL_HI16", /* name */
1486 1.1 christos FALSE, /* partial_inplace */
1487 1.1 christos 0, /* src_mask */
1488 1.1 christos 0x0000ffff, /* dst_mask */
1489 1.1 christos FALSE), /* pcrel_offset */
1490 1.1 christos
1491 1.1 christos /* TLS local dynamic offset. */
1492 1.1 christos HOWTO (R_MIPS_TLS_DTPREL_LO16, /* type */
1493 1.1 christos 0, /* rightshift */
1494 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1495 1.1 christos 16, /* bitsize */
1496 1.1 christos FALSE, /* pc_relative */
1497 1.1 christos 0, /* bitpos */
1498 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1499 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1500 1.1 christos "R_MIPS_TLS_DTPREL_LO16", /* name */
1501 1.1 christos FALSE, /* partial_inplace */
1502 1.1 christos 0, /* src_mask */
1503 1.1 christos 0x0000ffff, /* dst_mask */
1504 1.1 christos FALSE), /* pcrel_offset */
1505 1.1 christos
1506 1.1 christos /* TLS thread pointer offset. */
1507 1.1 christos HOWTO (R_MIPS_TLS_GOTTPREL, /* type */
1508 1.1 christos 0, /* rightshift */
1509 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1510 1.1 christos 16, /* bitsize */
1511 1.1 christos FALSE, /* pc_relative */
1512 1.1 christos 0, /* bitpos */
1513 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1514 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1515 1.1 christos "R_MIPS_TLS_GOTTPREL", /* name */
1516 1.1 christos FALSE, /* partial_inplace */
1517 1.1 christos 0, /* src_mask */
1518 1.1 christos 0x0000ffff, /* dst_mask */
1519 1.1 christos FALSE), /* pcrel_offset */
1520 1.1 christos
1521 1.1 christos /* TLS IE dynamic relocations. */
1522 1.1 christos EMPTY_HOWTO (R_MIPS_TLS_TPREL32),
1523 1.1 christos
1524 1.1 christos HOWTO (R_MIPS_TLS_TPREL64, /* type */
1525 1.1 christos 0, /* rightshift */
1526 1.1 christos 4, /* size (0 = byte, 1 = short, 2 = long) */
1527 1.1 christos 64, /* bitsize */
1528 1.1 christos FALSE, /* pc_relative */
1529 1.1 christos 0, /* bitpos */
1530 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1531 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1532 1.1 christos "R_MIPS_TLS_TPREL64", /* name */
1533 1.1 christos FALSE, /* partial_inplace */
1534 1.1 christos 0, /* src_mask */
1535 1.1 christos MINUS_ONE, /* dst_mask */
1536 1.1 christos FALSE), /* pcrel_offset */
1537 1.1 christos
1538 1.1 christos /* TLS thread pointer offset. */
1539 1.1 christos HOWTO (R_MIPS_TLS_TPREL_HI16, /* type */
1540 1.1 christos 0, /* rightshift */
1541 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1542 1.1 christos 16, /* bitsize */
1543 1.1 christos FALSE, /* pc_relative */
1544 1.1 christos 0, /* bitpos */
1545 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1546 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1547 1.1 christos "R_MIPS_TLS_TPREL_HI16", /* name */
1548 1.1 christos FALSE, /* partial_inplace */
1549 1.1 christos 0, /* src_mask */
1550 1.1 christos 0x0000ffff, /* dst_mask */
1551 1.1 christos FALSE), /* pcrel_offset */
1552 1.1 christos
1553 1.1 christos /* TLS thread pointer offset. */
1554 1.1 christos HOWTO (R_MIPS_TLS_TPREL_LO16, /* type */
1555 1.1 christos 0, /* rightshift */
1556 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1557 1.1 christos 16, /* bitsize */
1558 1.1 christos FALSE, /* pc_relative */
1559 1.1 christos 0, /* bitpos */
1560 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1561 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1562 1.1 christos "R_MIPS_TLS_TPREL_LO16", /* name */
1563 1.1 christos FALSE, /* partial_inplace */
1564 1.1 christos 0, /* src_mask */
1565 1.1 christos 0x0000ffff, /* dst_mask */
1566 1.1 christos FALSE), /* pcrel_offset */
1567 1.1 christos
1568 1.1 christos /* 32 bit relocation with no addend. */
1569 1.1 christos HOWTO (R_MIPS_GLOB_DAT, /* type */
1570 1.1 christos 0, /* rightshift */
1571 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1572 1.1 christos 32, /* bitsize */
1573 1.1 christos FALSE, /* pc_relative */
1574 1.1 christos 0, /* bitpos */
1575 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1576 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1577 1.1 christos "R_MIPS_GLOB_DAT", /* name */
1578 1.1 christos FALSE, /* partial_inplace */
1579 1.1 christos 0x0, /* src_mask */
1580 1.1 christos 0xffffffff, /* dst_mask */
1581 1.1.1.2 christos FALSE), /* pcrel_offset */
1582 1.1.1.2 christos
1583 1.1.1.2 christos EMPTY_HOWTO (52),
1584 1.1.1.2 christos EMPTY_HOWTO (53),
1585 1.1.1.2 christos EMPTY_HOWTO (54),
1586 1.1.1.2 christos EMPTY_HOWTO (55),
1587 1.1.1.2 christos EMPTY_HOWTO (56),
1588 1.1.1.2 christos EMPTY_HOWTO (57),
1589 1.1.1.2 christos EMPTY_HOWTO (58),
1590 1.1.1.2 christos EMPTY_HOWTO (59),
1591 1.1.1.2 christos
1592 1.1.1.2 christos HOWTO (R_MIPS_PC21_S2, /* type */
1593 1.1.1.2 christos 2, /* rightshift */
1594 1.1.1.2 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1595 1.1.1.2 christos 21, /* bitsize */
1596 1.1.1.2 christos TRUE, /* pc_relative */
1597 1.1.1.2 christos 0, /* bitpos */
1598 1.1.1.2 christos complain_overflow_signed, /* complain_on_overflow */
1599 1.1.1.2 christos _bfd_mips_elf_generic_reloc, /* special_function */
1600 1.1.1.2 christos "R_MIPS_PC21_S2", /* name */
1601 1.1.1.2 christos FALSE, /* partial_inplace */
1602 1.1.1.2 christos 0, /* src_mask */
1603 1.1.1.2 christos 0x001fffff, /* dst_mask */
1604 1.1.1.2 christos TRUE), /* pcrel_offset */
1605 1.1.1.2 christos
1606 1.1.1.2 christos HOWTO (R_MIPS_PC26_S2, /* type */
1607 1.1.1.2 christos 2, /* rightshift */
1608 1.1.1.2 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1609 1.1.1.2 christos 26, /* bitsize */
1610 1.1.1.2 christos TRUE, /* pc_relative */
1611 1.1.1.2 christos 0, /* bitpos */
1612 1.1.1.2 christos complain_overflow_signed, /* complain_on_overflow */
1613 1.1.1.2 christos _bfd_mips_elf_generic_reloc, /* special_function */
1614 1.1.1.2 christos "R_MIPS_PC26_S2", /* name */
1615 1.1.1.2 christos FALSE, /* partial_inplace */
1616 1.1.1.2 christos 0, /* src_mask */
1617 1.1.1.2 christos 0x03ffffff, /* dst_mask */
1618 1.1.1.2 christos TRUE), /* pcrel_offset */
1619 1.1.1.2 christos
1620 1.1.1.2 christos HOWTO (R_MIPS_PC18_S3, /* type */
1621 1.1.1.2 christos 3, /* rightshift */
1622 1.1.1.2 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1623 1.1.1.2 christos 18, /* bitsize */
1624 1.1.1.2 christos TRUE, /* pc_relative */
1625 1.1.1.2 christos 0, /* bitpos */
1626 1.1.1.2 christos complain_overflow_signed, /* complain_on_overflow */
1627 1.1.1.2 christos _bfd_mips_elf_generic_reloc, /* special_function */
1628 1.1.1.2 christos "R_MIPS_PC18_S3", /* name */
1629 1.1.1.2 christos FALSE, /* partial_inplace */
1630 1.1.1.2 christos 0, /* src_mask */
1631 1.1.1.2 christos 0x0003ffff, /* dst_mask */
1632 1.1.1.2 christos TRUE), /* pcrel_offset */
1633 1.1.1.2 christos
1634 1.1.1.2 christos HOWTO (R_MIPS_PC19_S2, /* type */
1635 1.1.1.2 christos 2, /* rightshift */
1636 1.1.1.2 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1637 1.1.1.2 christos 19, /* bitsize */
1638 1.1.1.2 christos TRUE, /* pc_relative */
1639 1.1.1.2 christos 0, /* bitpos */
1640 1.1.1.2 christos complain_overflow_signed, /* complain_on_overflow */
1641 1.1.1.2 christos _bfd_mips_elf_generic_reloc, /* special_function */
1642 1.1.1.2 christos "R_MIPS_PC19_S2", /* name */
1643 1.1.1.2 christos FALSE, /* partial_inplace */
1644 1.1.1.2 christos 0, /* src_mask */
1645 1.1.1.2 christos 0x0007ffff, /* dst_mask */
1646 1.1.1.2 christos TRUE), /* pcrel_offset */
1647 1.1.1.2 christos
1648 1.1.1.2 christos HOWTO (R_MIPS_PCHI16, /* type */
1649 1.1.1.2 christos 16, /* rightshift */
1650 1.1.1.2 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1651 1.1.1.2 christos 16, /* bitsize */
1652 1.1.1.2 christos TRUE, /* pc_relative */
1653 1.1.1.2 christos 0, /* bitpos */
1654 1.1.1.2 christos complain_overflow_signed, /* complain_on_overflow */
1655 1.1.1.2 christos _bfd_mips_elf_generic_reloc, /* special_function */
1656 1.1.1.2 christos "R_MIPS_PCHI16", /* name */
1657 1.1.1.2 christos FALSE, /* partial_inplace */
1658 1.1.1.2 christos 0, /* src_mask */
1659 1.1.1.2 christos 0x0000ffff, /* dst_mask */
1660 1.1.1.2 christos TRUE), /* pcrel_offset */
1661 1.1.1.2 christos
1662 1.1.1.2 christos HOWTO (R_MIPS_PCLO16, /* type */
1663 1.1.1.2 christos 0, /* rightshift */
1664 1.1.1.2 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1665 1.1.1.2 christos 16, /* bitsize */
1666 1.1.1.2 christos TRUE, /* pc_relative */
1667 1.1.1.2 christos 0, /* bitpos */
1668 1.1.1.2 christos complain_overflow_dont, /* complain_on_overflow */
1669 1.1.1.2 christos _bfd_mips_elf_generic_reloc, /* special_function */
1670 1.1.1.2 christos "R_MIPS_PCLO16", /* name */
1671 1.1.1.2 christos FALSE, /* partial_inplace */
1672 1.1.1.2 christos 0, /* src_mask */
1673 1.1.1.2 christos 0x0000ffff, /* dst_mask */
1674 1.1.1.2 christos TRUE), /* pcrel_offset */
1675 1.1 christos
1676 1.1 christos };
1677 1.1 christos
1678 1.1 christos static reloc_howto_type mips16_elf64_howto_table_rel[] =
1679 1.1 christos {
1680 1.1 christos /* The reloc used for the mips16 jump instruction. */
1681 1.1 christos HOWTO (R_MIPS16_26, /* type */
1682 1.1 christos 2, /* rightshift */
1683 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1684 1.1 christos 26, /* bitsize */
1685 1.1 christos FALSE, /* pc_relative */
1686 1.1 christos 0, /* bitpos */
1687 1.1.1.4 christos complain_overflow_dont, /* complain_on_overflow */
1688 1.1 christos /* This needs complex overflow
1689 1.1 christos detection, because the upper four
1690 1.1 christos bits must match the PC. */
1691 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1692 1.1 christos "R_MIPS16_26", /* name */
1693 1.1 christos TRUE, /* partial_inplace */
1694 1.1 christos 0x3ffffff, /* src_mask */
1695 1.1 christos 0x3ffffff, /* dst_mask */
1696 1.1 christos FALSE), /* pcrel_offset */
1697 1.1 christos
1698 1.1 christos /* The reloc used for the mips16 gprel instruction. */
1699 1.1 christos HOWTO (R_MIPS16_GPREL, /* type */
1700 1.1 christos 0, /* rightshift */
1701 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1702 1.1 christos 16, /* bitsize */
1703 1.1 christos FALSE, /* pc_relative */
1704 1.1 christos 0, /* bitpos */
1705 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1706 1.1 christos mips16_gprel_reloc, /* special_function */
1707 1.1 christos "R_MIPS16_GPREL", /* name */
1708 1.1 christos TRUE, /* partial_inplace */
1709 1.1.1.4 christos 0x0000ffff, /* src_mask */
1710 1.1 christos 0x0000ffff, /* dst_mask */
1711 1.1 christos FALSE), /* pcrel_offset */
1712 1.1 christos
1713 1.1 christos /* A MIPS16 reference to the global offset table. */
1714 1.1 christos HOWTO (R_MIPS16_GOT16, /* type */
1715 1.1 christos 0, /* rightshift */
1716 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1717 1.1 christos 16, /* bitsize */
1718 1.1 christos FALSE, /* pc_relative */
1719 1.1 christos 0, /* bitpos */
1720 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1721 1.1 christos _bfd_mips_elf_got16_reloc, /* special_function */
1722 1.1 christos "R_MIPS16_GOT16", /* name */
1723 1.1 christos TRUE, /* partial_inplace */
1724 1.1.1.4 christos 0x0000ffff, /* src_mask */
1725 1.1 christos 0x0000ffff, /* dst_mask */
1726 1.1 christos FALSE), /* pcrel_offset */
1727 1.1 christos
1728 1.1 christos /* A MIPS16 call through the global offset table. */
1729 1.1 christos HOWTO (R_MIPS16_CALL16, /* type */
1730 1.1 christos 0, /* rightshift */
1731 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1732 1.1 christos 16, /* bitsize */
1733 1.1 christos FALSE, /* pc_relative */
1734 1.1 christos 0, /* bitpos */
1735 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1736 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1737 1.1 christos "R_MIPS16_CALL16", /* name */
1738 1.1 christos TRUE, /* partial_inplace */
1739 1.1.1.4 christos 0x0000ffff, /* src_mask */
1740 1.1 christos 0x0000ffff, /* dst_mask */
1741 1.1 christos FALSE), /* pcrel_offset */
1742 1.1 christos
1743 1.1 christos /* MIPS16 high 16 bits of symbol value. */
1744 1.1 christos HOWTO (R_MIPS16_HI16, /* type */
1745 1.1 christos 16, /* rightshift */
1746 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1747 1.1 christos 16, /* bitsize */
1748 1.1 christos FALSE, /* pc_relative */
1749 1.1 christos 0, /* bitpos */
1750 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1751 1.1 christos _bfd_mips_elf_hi16_reloc, /* special_function */
1752 1.1 christos "R_MIPS16_HI16", /* name */
1753 1.1 christos TRUE, /* partial_inplace */
1754 1.1 christos 0x0000ffff, /* src_mask */
1755 1.1 christos 0x0000ffff, /* dst_mask */
1756 1.1 christos FALSE), /* pcrel_offset */
1757 1.1 christos
1758 1.1 christos /* MIPS16 low 16 bits of symbol value. */
1759 1.1 christos HOWTO (R_MIPS16_LO16, /* type */
1760 1.1 christos 0, /* rightshift */
1761 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1762 1.1 christos 16, /* bitsize */
1763 1.1 christos FALSE, /* pc_relative */
1764 1.1 christos 0, /* bitpos */
1765 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1766 1.1 christos _bfd_mips_elf_lo16_reloc, /* special_function */
1767 1.1 christos "R_MIPS16_LO16", /* name */
1768 1.1 christos TRUE, /* partial_inplace */
1769 1.1 christos 0x0000ffff, /* src_mask */
1770 1.1 christos 0x0000ffff, /* dst_mask */
1771 1.1 christos FALSE), /* pcrel_offset */
1772 1.1 christos
1773 1.1 christos /* MIPS16 TLS general dynamic variable reference. */
1774 1.1 christos HOWTO (R_MIPS16_TLS_GD, /* type */
1775 1.1 christos 0, /* rightshift */
1776 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1777 1.1 christos 16, /* bitsize */
1778 1.1 christos FALSE, /* pc_relative */
1779 1.1 christos 0, /* bitpos */
1780 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1781 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1782 1.1 christos "R_MIPS16_TLS_GD", /* name */
1783 1.1 christos TRUE, /* partial_inplace */
1784 1.1 christos 0x0000ffff, /* src_mask */
1785 1.1 christos 0x0000ffff, /* dst_mask */
1786 1.1 christos FALSE), /* pcrel_offset */
1787 1.1 christos
1788 1.1 christos /* MIPS16 TLS local dynamic variable reference. */
1789 1.1 christos HOWTO (R_MIPS16_TLS_LDM, /* type */
1790 1.1 christos 0, /* rightshift */
1791 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1792 1.1 christos 16, /* bitsize */
1793 1.1 christos FALSE, /* pc_relative */
1794 1.1 christos 0, /* bitpos */
1795 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1796 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1797 1.1 christos "R_MIPS16_TLS_LDM", /* name */
1798 1.1 christos TRUE, /* partial_inplace */
1799 1.1 christos 0x0000ffff, /* src_mask */
1800 1.1 christos 0x0000ffff, /* dst_mask */
1801 1.1 christos FALSE), /* pcrel_offset */
1802 1.1 christos
1803 1.1 christos /* MIPS16 TLS local dynamic offset. */
1804 1.1 christos HOWTO (R_MIPS16_TLS_DTPREL_HI16, /* type */
1805 1.1 christos 0, /* rightshift */
1806 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1807 1.1 christos 16, /* bitsize */
1808 1.1 christos FALSE, /* pc_relative */
1809 1.1 christos 0, /* bitpos */
1810 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1811 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1812 1.1 christos "R_MIPS16_TLS_DTPREL_HI16", /* name */
1813 1.1 christos TRUE, /* partial_inplace */
1814 1.1 christos 0x0000ffff, /* src_mask */
1815 1.1 christos 0x0000ffff, /* dst_mask */
1816 1.1 christos FALSE), /* pcrel_offset */
1817 1.1 christos
1818 1.1 christos /* MIPS16 TLS local dynamic offset. */
1819 1.1 christos HOWTO (R_MIPS16_TLS_DTPREL_LO16, /* type */
1820 1.1 christos 0, /* rightshift */
1821 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1822 1.1 christos 16, /* bitsize */
1823 1.1 christos FALSE, /* pc_relative */
1824 1.1 christos 0, /* bitpos */
1825 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1826 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1827 1.1 christos "R_MIPS16_TLS_DTPREL_LO16", /* name */
1828 1.1 christos TRUE, /* partial_inplace */
1829 1.1 christos 0x0000ffff, /* src_mask */
1830 1.1 christos 0x0000ffff, /* dst_mask */
1831 1.1 christos FALSE), /* pcrel_offset */
1832 1.1 christos
1833 1.1 christos /* MIPS16 TLS thread pointer offset. */
1834 1.1 christos HOWTO (R_MIPS16_TLS_GOTTPREL, /* type */
1835 1.1 christos 0, /* rightshift */
1836 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1837 1.1 christos 16, /* bitsize */
1838 1.1 christos FALSE, /* pc_relative */
1839 1.1 christos 0, /* bitpos */
1840 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1841 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1842 1.1 christos "R_MIPS16_TLS_GOTTPREL", /* name */
1843 1.1 christos TRUE, /* partial_inplace */
1844 1.1 christos 0x0000ffff, /* src_mask */
1845 1.1 christos 0x0000ffff, /* dst_mask */
1846 1.1 christos FALSE), /* pcrel_offset */
1847 1.1 christos
1848 1.1 christos /* MIPS16 TLS thread pointer offset. */
1849 1.1 christos HOWTO (R_MIPS16_TLS_TPREL_HI16, /* type */
1850 1.1 christos 0, /* rightshift */
1851 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1852 1.1 christos 16, /* bitsize */
1853 1.1 christos FALSE, /* pc_relative */
1854 1.1 christos 0, /* bitpos */
1855 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1856 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1857 1.1 christos "R_MIPS16_TLS_TPREL_HI16", /* name */
1858 1.1 christos TRUE, /* partial_inplace */
1859 1.1 christos 0x0000ffff, /* src_mask */
1860 1.1 christos 0x0000ffff, /* dst_mask */
1861 1.1 christos FALSE), /* pcrel_offset */
1862 1.1 christos
1863 1.1 christos /* MIPS16 TLS thread pointer offset. */
1864 1.1 christos HOWTO (R_MIPS16_TLS_TPREL_LO16, /* type */
1865 1.1 christos 0, /* rightshift */
1866 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1867 1.1 christos 16, /* bitsize */
1868 1.1 christos FALSE, /* pc_relative */
1869 1.1 christos 0, /* bitpos */
1870 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1871 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1872 1.1 christos "R_MIPS16_TLS_TPREL_LO16", /* name */
1873 1.1 christos TRUE, /* partial_inplace */
1874 1.1 christos 0x0000ffff, /* src_mask */
1875 1.1 christos 0x0000ffff, /* dst_mask */
1876 1.1.1.3 christos FALSE), /* pcrel_offset */
1877 1.1.1.3 christos
1878 1.1.1.3 christos /* MIPS16 16-bit PC-relative branch offset. */
1879 1.1.1.3 christos HOWTO (R_MIPS16_PC16_S1, /* type */
1880 1.1.1.3 christos 1, /* rightshift */
1881 1.1.1.3 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1882 1.1.1.3 christos 16, /* bitsize */
1883 1.1.1.3 christos TRUE, /* pc_relative */
1884 1.1.1.3 christos 0, /* bitpos */
1885 1.1.1.3 christos complain_overflow_signed, /* complain_on_overflow */
1886 1.1.1.3 christos _bfd_mips_elf_generic_reloc, /* special_function */
1887 1.1.1.3 christos "R_MIPS16_PC16_S1", /* name */
1888 1.1.1.3 christos TRUE, /* partial_inplace */
1889 1.1.1.3 christos 0x0000ffff, /* src_mask */
1890 1.1.1.3 christos 0x0000ffff, /* dst_mask */
1891 1.1 christos TRUE), /* pcrel_offset */
1892 1.1 christos };
1893 1.1 christos
1894 1.1 christos static reloc_howto_type mips16_elf64_howto_table_rela[] =
1895 1.1 christos {
1896 1.1 christos /* The reloc used for the mips16 jump instruction. */
1897 1.1 christos HOWTO (R_MIPS16_26, /* type */
1898 1.1 christos 2, /* rightshift */
1899 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1900 1.1 christos 26, /* bitsize */
1901 1.1 christos FALSE, /* pc_relative */
1902 1.1 christos 0, /* bitpos */
1903 1.1.1.4 christos complain_overflow_dont, /* complain_on_overflow */
1904 1.1 christos /* This needs complex overflow
1905 1.1 christos detection, because the upper four
1906 1.1 christos bits must match the PC. */
1907 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1908 1.1 christos "R_MIPS16_26", /* name */
1909 1.1 christos FALSE, /* partial_inplace */
1910 1.1 christos 0, /* src_mask */
1911 1.1 christos 0x3ffffff, /* dst_mask */
1912 1.1 christos FALSE), /* pcrel_offset */
1913 1.1 christos
1914 1.1 christos /* The reloc used for the mips16 gprel instruction. */
1915 1.1 christos HOWTO (R_MIPS16_GPREL, /* type */
1916 1.1 christos 0, /* rightshift */
1917 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1918 1.1 christos 16, /* bitsize */
1919 1.1 christos FALSE, /* pc_relative */
1920 1.1 christos 0, /* bitpos */
1921 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1922 1.1 christos mips16_gprel_reloc, /* special_function */
1923 1.1 christos "R_MIPS16_GPREL", /* name */
1924 1.1 christos FALSE, /* partial_inplace */
1925 1.1.1.4 christos 0, /* src_mask */
1926 1.1 christos 0x0000ffff, /* dst_mask */
1927 1.1 christos FALSE), /* pcrel_offset */
1928 1.1 christos
1929 1.1 christos /* A MIPS16 reference to the global offset table. */
1930 1.1 christos HOWTO (R_MIPS16_GOT16, /* type */
1931 1.1 christos 0, /* rightshift */
1932 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1933 1.1 christos 16, /* bitsize */
1934 1.1 christos FALSE, /* pc_relative */
1935 1.1 christos 0, /* bitpos */
1936 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1937 1.1 christos _bfd_mips_elf_got16_reloc, /* special_function */
1938 1.1 christos "R_MIPS16_GOT16", /* name */
1939 1.1 christos FALSE, /* partial_inplace */
1940 1.1.1.4 christos 0, /* src_mask */
1941 1.1 christos 0x0000ffff, /* dst_mask */
1942 1.1 christos FALSE), /* pcrel_offset */
1943 1.1 christos
1944 1.1 christos /* A MIPS16 call through the global offset table. */
1945 1.1 christos HOWTO (R_MIPS16_CALL16, /* type */
1946 1.1 christos 0, /* rightshift */
1947 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1948 1.1 christos 16, /* bitsize */
1949 1.1 christos FALSE, /* pc_relative */
1950 1.1 christos 0, /* bitpos */
1951 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1952 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1953 1.1 christos "R_MIPS16_CALL16", /* name */
1954 1.1 christos FALSE, /* partial_inplace */
1955 1.1.1.4 christos 0, /* src_mask */
1956 1.1 christos 0x0000ffff, /* dst_mask */
1957 1.1 christos FALSE), /* pcrel_offset */
1958 1.1 christos
1959 1.1 christos /* MIPS16 high 16 bits of symbol value. */
1960 1.1 christos HOWTO (R_MIPS16_HI16, /* type */
1961 1.1 christos 16, /* rightshift */
1962 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1963 1.1 christos 16, /* bitsize */
1964 1.1 christos FALSE, /* pc_relative */
1965 1.1 christos 0, /* bitpos */
1966 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1967 1.1 christos _bfd_mips_elf_hi16_reloc, /* special_function */
1968 1.1 christos "R_MIPS16_HI16", /* name */
1969 1.1 christos FALSE, /* partial_inplace */
1970 1.1 christos 0, /* src_mask */
1971 1.1 christos 0x0000ffff, /* dst_mask */
1972 1.1 christos FALSE), /* pcrel_offset */
1973 1.1 christos
1974 1.1 christos /* MIPS16 low 16 bits of symbol value. */
1975 1.1 christos HOWTO (R_MIPS16_LO16, /* type */
1976 1.1 christos 0, /* rightshift */
1977 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1978 1.1 christos 16, /* bitsize */
1979 1.1 christos FALSE, /* pc_relative */
1980 1.1 christos 0, /* bitpos */
1981 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1982 1.1 christos _bfd_mips_elf_lo16_reloc, /* special_function */
1983 1.1 christos "R_MIPS16_LO16", /* name */
1984 1.1 christos FALSE, /* partial_inplace */
1985 1.1 christos 0, /* src_mask */
1986 1.1 christos 0x0000ffff, /* dst_mask */
1987 1.1 christos FALSE), /* pcrel_offset */
1988 1.1 christos
1989 1.1 christos /* MIPS16 TLS general dynamic variable reference. */
1990 1.1 christos HOWTO (R_MIPS16_TLS_GD, /* type */
1991 1.1 christos 0, /* rightshift */
1992 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1993 1.1 christos 16, /* bitsize */
1994 1.1 christos FALSE, /* pc_relative */
1995 1.1 christos 0, /* bitpos */
1996 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1997 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1998 1.1 christos "R_MIPS16_TLS_GD", /* name */
1999 1.1 christos FALSE, /* partial_inplace */
2000 1.1 christos 0, /* src_mask */
2001 1.1 christos 0x0000ffff, /* dst_mask */
2002 1.1 christos FALSE), /* pcrel_offset */
2003 1.1 christos
2004 1.1 christos /* MIPS16 TLS local dynamic variable reference. */
2005 1.1 christos HOWTO (R_MIPS16_TLS_LDM, /* type */
2006 1.1 christos 0, /* rightshift */
2007 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2008 1.1 christos 16, /* bitsize */
2009 1.1 christos FALSE, /* pc_relative */
2010 1.1 christos 0, /* bitpos */
2011 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2012 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2013 1.1 christos "R_MIPS16_TLS_LDM", /* name */
2014 1.1 christos FALSE, /* partial_inplace */
2015 1.1 christos 0, /* src_mask */
2016 1.1 christos 0x0000ffff, /* dst_mask */
2017 1.1 christos FALSE), /* pcrel_offset */
2018 1.1 christos
2019 1.1 christos /* MIPS16 TLS local dynamic offset. */
2020 1.1 christos HOWTO (R_MIPS16_TLS_DTPREL_HI16, /* type */
2021 1.1 christos 0, /* rightshift */
2022 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2023 1.1 christos 16, /* bitsize */
2024 1.1 christos FALSE, /* pc_relative */
2025 1.1 christos 0, /* bitpos */
2026 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2027 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2028 1.1 christos "R_MIPS16_TLS_DTPREL_HI16", /* name */
2029 1.1 christos FALSE, /* partial_inplace */
2030 1.1 christos 0, /* src_mask */
2031 1.1 christos 0x0000ffff, /* dst_mask */
2032 1.1 christos FALSE), /* pcrel_offset */
2033 1.1 christos
2034 1.1 christos /* MIPS16 TLS local dynamic offset. */
2035 1.1 christos HOWTO (R_MIPS16_TLS_DTPREL_LO16, /* type */
2036 1.1 christos 0, /* rightshift */
2037 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2038 1.1 christos 16, /* bitsize */
2039 1.1 christos FALSE, /* pc_relative */
2040 1.1 christos 0, /* bitpos */
2041 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2042 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2043 1.1 christos "R_MIPS16_TLS_DTPREL_LO16", /* name */
2044 1.1 christos FALSE, /* partial_inplace */
2045 1.1 christos 0, /* src_mask */
2046 1.1 christos 0x0000ffff, /* dst_mask */
2047 1.1 christos FALSE), /* pcrel_offset */
2048 1.1 christos
2049 1.1 christos /* MIPS16 TLS thread pointer offset. */
2050 1.1 christos HOWTO (R_MIPS16_TLS_GOTTPREL, /* type */
2051 1.1 christos 0, /* rightshift */
2052 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2053 1.1 christos 16, /* bitsize */
2054 1.1 christos FALSE, /* pc_relative */
2055 1.1 christos 0, /* bitpos */
2056 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2057 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2058 1.1 christos "R_MIPS16_TLS_GOTTPREL", /* name */
2059 1.1 christos FALSE, /* partial_inplace */
2060 1.1 christos 0, /* src_mask */
2061 1.1 christos 0x0000ffff, /* dst_mask */
2062 1.1 christos FALSE), /* pcrel_offset */
2063 1.1 christos
2064 1.1 christos /* MIPS16 TLS thread pointer offset. */
2065 1.1 christos HOWTO (R_MIPS16_TLS_TPREL_HI16, /* type */
2066 1.1 christos 0, /* rightshift */
2067 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2068 1.1 christos 16, /* bitsize */
2069 1.1 christos FALSE, /* pc_relative */
2070 1.1 christos 0, /* bitpos */
2071 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2072 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2073 1.1 christos "R_MIPS16_TLS_TPREL_HI16", /* name */
2074 1.1 christos FALSE, /* partial_inplace */
2075 1.1 christos 0, /* src_mask */
2076 1.1 christos 0x0000ffff, /* dst_mask */
2077 1.1 christos FALSE), /* pcrel_offset */
2078 1.1 christos
2079 1.1 christos /* MIPS16 TLS thread pointer offset. */
2080 1.1 christos HOWTO (R_MIPS16_TLS_TPREL_LO16, /* type */
2081 1.1 christos 0, /* rightshift */
2082 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2083 1.1 christos 16, /* bitsize */
2084 1.1 christos FALSE, /* pc_relative */
2085 1.1 christos 0, /* bitpos */
2086 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2087 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2088 1.1 christos "R_MIPS16_TLS_TPREL_LO16", /* name */
2089 1.1 christos FALSE, /* partial_inplace */
2090 1.1 christos 0, /* src_mask */
2091 1.1 christos 0x0000ffff, /* dst_mask */
2092 1.1.1.3 christos FALSE), /* pcrel_offset */
2093 1.1.1.3 christos
2094 1.1.1.3 christos /* MIPS16 16-bit PC-relative branch offset. */
2095 1.1.1.3 christos HOWTO (R_MIPS16_PC16_S1, /* type */
2096 1.1.1.3 christos 1, /* rightshift */
2097 1.1.1.3 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2098 1.1.1.3 christos 16, /* bitsize */
2099 1.1.1.3 christos TRUE, /* pc_relative */
2100 1.1.1.3 christos 0, /* bitpos */
2101 1.1.1.3 christos complain_overflow_signed, /* complain_on_overflow */
2102 1.1.1.3 christos _bfd_mips_elf_generic_reloc, /* special_function */
2103 1.1.1.3 christos "R_MIPS16_PC16_S1", /* name */
2104 1.1.1.3 christos FALSE, /* partial_inplace */
2105 1.1.1.3 christos 0, /* src_mask */
2106 1.1.1.3 christos 0x0000ffff, /* dst_mask */
2107 1.1 christos TRUE), /* pcrel_offset */
2108 1.1 christos };
2109 1.1 christos
2110 1.1 christos static reloc_howto_type micromips_elf64_howto_table_rel[] =
2111 1.1 christos {
2112 1.1 christos EMPTY_HOWTO (130),
2113 1.1 christos EMPTY_HOWTO (131),
2114 1.1 christos EMPTY_HOWTO (132),
2115 1.1 christos
2116 1.1 christos /* 26 bit jump address. */
2117 1.1 christos HOWTO (R_MICROMIPS_26_S1, /* type */
2118 1.1 christos 1, /* rightshift */
2119 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2120 1.1 christos 26, /* bitsize */
2121 1.1 christos FALSE, /* pc_relative */
2122 1.1 christos 0, /* bitpos */
2123 1.1.1.4 christos complain_overflow_dont, /* complain_on_overflow */
2124 1.1 christos /* This needs complex overflow
2125 1.1 christos detection, because the upper four
2126 1.1 christos bits must match the PC. */
2127 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2128 1.1 christos "R_MICROMIPS_26_S1", /* name */
2129 1.1 christos TRUE, /* partial_inplace */
2130 1.1 christos 0x3ffffff, /* src_mask */
2131 1.1 christos 0x3ffffff, /* dst_mask */
2132 1.1 christos FALSE), /* pcrel_offset */
2133 1.1 christos
2134 1.1 christos /* High 16 bits of symbol value. */
2135 1.1 christos HOWTO (R_MICROMIPS_HI16, /* type */
2136 1.1 christos 16, /* rightshift */
2137 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2138 1.1 christos 16, /* bitsize */
2139 1.1 christos FALSE, /* pc_relative */
2140 1.1 christos 0, /* bitpos */
2141 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2142 1.1 christos _bfd_mips_elf_hi16_reloc, /* special_function */
2143 1.1 christos "R_MICROMIPS_HI16", /* name */
2144 1.1 christos TRUE, /* partial_inplace */
2145 1.1 christos 0x0000ffff, /* src_mask */
2146 1.1 christos 0x0000ffff, /* dst_mask */
2147 1.1 christos FALSE), /* pcrel_offset */
2148 1.1 christos
2149 1.1 christos /* Low 16 bits of symbol value. */
2150 1.1 christos HOWTO (R_MICROMIPS_LO16, /* type */
2151 1.1 christos 0, /* rightshift */
2152 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2153 1.1 christos 16, /* bitsize */
2154 1.1 christos FALSE, /* pc_relative */
2155 1.1 christos 0, /* bitpos */
2156 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2157 1.1 christos _bfd_mips_elf_lo16_reloc, /* special_function */
2158 1.1 christos "R_MICROMIPS_LO16", /* name */
2159 1.1 christos TRUE, /* partial_inplace */
2160 1.1 christos 0x0000ffff, /* src_mask */
2161 1.1 christos 0x0000ffff, /* dst_mask */
2162 1.1 christos FALSE), /* pcrel_offset */
2163 1.1 christos
2164 1.1 christos /* GP relative reference. */
2165 1.1 christos HOWTO (R_MICROMIPS_GPREL16, /* type */
2166 1.1 christos 0, /* rightshift */
2167 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2168 1.1 christos 16, /* bitsize */
2169 1.1 christos FALSE, /* pc_relative */
2170 1.1 christos 0, /* bitpos */
2171 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2172 1.1 christos _bfd_mips_elf32_gprel16_reloc, /* special_function */
2173 1.1 christos "R_MICROMIPS_GPREL16", /* name */
2174 1.1 christos TRUE, /* partial_inplace */
2175 1.1 christos 0x0000ffff, /* src_mask */
2176 1.1 christos 0x0000ffff, /* dst_mask */
2177 1.1 christos FALSE), /* pcrel_offset */
2178 1.1 christos
2179 1.1 christos /* Reference to literal section. */
2180 1.1 christos HOWTO (R_MICROMIPS_LITERAL, /* type */
2181 1.1 christos 0, /* rightshift */
2182 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2183 1.1 christos 16, /* bitsize */
2184 1.1 christos FALSE, /* pc_relative */
2185 1.1 christos 0, /* bitpos */
2186 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2187 1.1 christos _bfd_mips_elf32_gprel16_reloc, /* special_function */
2188 1.1 christos "R_MICROMIPS_LITERAL", /* name */
2189 1.1 christos TRUE, /* partial_inplace */
2190 1.1 christos 0x0000ffff, /* src_mask */
2191 1.1 christos 0x0000ffff, /* dst_mask */
2192 1.1 christos FALSE), /* pcrel_offset */
2193 1.1 christos
2194 1.1 christos /* Reference to global offset table. */
2195 1.1 christos HOWTO (R_MICROMIPS_GOT16, /* type */
2196 1.1 christos 0, /* rightshift */
2197 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2198 1.1 christos 16, /* bitsize */
2199 1.1 christos FALSE, /* pc_relative */
2200 1.1 christos 0, /* bitpos */
2201 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2202 1.1 christos _bfd_mips_elf_got16_reloc, /* special_function */
2203 1.1 christos "R_MICROMIPS_GOT16", /* name */
2204 1.1 christos TRUE, /* partial_inplace */
2205 1.1 christos 0x0000ffff, /* src_mask */
2206 1.1 christos 0x0000ffff, /* dst_mask */
2207 1.1 christos FALSE), /* pcrel_offset */
2208 1.1 christos
2209 1.1 christos /* This is for microMIPS branches. */
2210 1.1 christos HOWTO (R_MICROMIPS_PC7_S1, /* type */
2211 1.1 christos 1, /* rightshift */
2212 1.1 christos 1, /* size (0 = byte, 1 = short, 2 = long) */
2213 1.1 christos 7, /* bitsize */
2214 1.1 christos TRUE, /* pc_relative */
2215 1.1 christos 0, /* bitpos */
2216 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2217 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2218 1.1 christos "R_MICROMIPS_PC7_S1", /* name */
2219 1.1 christos TRUE, /* partial_inplace */
2220 1.1 christos 0x0000007f, /* src_mask */
2221 1.1 christos 0x0000007f, /* dst_mask */
2222 1.1 christos TRUE), /* pcrel_offset */
2223 1.1 christos
2224 1.1 christos HOWTO (R_MICROMIPS_PC10_S1, /* type */
2225 1.1 christos 1, /* rightshift */
2226 1.1 christos 1, /* size (0 = byte, 1 = short, 2 = long) */
2227 1.1 christos 10, /* bitsize */
2228 1.1 christos TRUE, /* pc_relative */
2229 1.1 christos 0, /* bitpos */
2230 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2231 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2232 1.1 christos "R_MICROMIPS_PC10_S1", /* name */
2233 1.1 christos TRUE, /* partial_inplace */
2234 1.1 christos 0x000003ff, /* src_mask */
2235 1.1 christos 0x000003ff, /* dst_mask */
2236 1.1 christos TRUE), /* pcrel_offset */
2237 1.1 christos
2238 1.1 christos HOWTO (R_MICROMIPS_PC16_S1, /* type */
2239 1.1 christos 1, /* rightshift */
2240 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2241 1.1 christos 16, /* bitsize */
2242 1.1 christos TRUE, /* pc_relative */
2243 1.1 christos 0, /* bitpos */
2244 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2245 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2246 1.1 christos "R_MICROMIPS_PC16_S1", /* name */
2247 1.1 christos TRUE, /* partial_inplace */
2248 1.1 christos 0x0000ffff, /* src_mask */
2249 1.1 christos 0x0000ffff, /* dst_mask */
2250 1.1 christos TRUE), /* pcrel_offset */
2251 1.1 christos
2252 1.1 christos /* 16 bit call through global offset table. */
2253 1.1 christos HOWTO (R_MICROMIPS_CALL16, /* type */
2254 1.1 christos 0, /* rightshift */
2255 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2256 1.1 christos 16, /* bitsize */
2257 1.1 christos FALSE, /* pc_relative */
2258 1.1 christos 0, /* bitpos */
2259 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2260 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2261 1.1 christos "R_MICROMIPS_CALL16", /* name */
2262 1.1 christos TRUE, /* partial_inplace */
2263 1.1 christos 0x0000ffff, /* src_mask */
2264 1.1 christos 0x0000ffff, /* dst_mask */
2265 1.1 christos FALSE), /* pcrel_offset */
2266 1.1 christos
2267 1.1 christos EMPTY_HOWTO (143),
2268 1.1 christos EMPTY_HOWTO (144),
2269 1.1 christos
2270 1.1 christos /* Displacement in the global offset table. */
2271 1.1 christos HOWTO (R_MICROMIPS_GOT_DISP, /* type */
2272 1.1 christos 0, /* rightshift */
2273 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2274 1.1 christos 16, /* bitsize */
2275 1.1 christos FALSE, /* pc_relative */
2276 1.1 christos 0, /* bitpos */
2277 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2278 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2279 1.1 christos "R_MICROMIPS_GOT_DISP",/* name */
2280 1.1 christos TRUE, /* partial_inplace */
2281 1.1 christos 0x0000ffff, /* src_mask */
2282 1.1 christos 0x0000ffff, /* dst_mask */
2283 1.1 christos FALSE), /* pcrel_offset */
2284 1.1 christos
2285 1.1 christos /* Displacement to page pointer in the global offset table. */
2286 1.1 christos HOWTO (R_MICROMIPS_GOT_PAGE, /* type */
2287 1.1 christos 0, /* rightshift */
2288 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2289 1.1 christos 16, /* bitsize */
2290 1.1 christos FALSE, /* pc_relative */
2291 1.1 christos 0, /* bitpos */
2292 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2293 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2294 1.1 christos "R_MICROMIPS_GOT_PAGE",/* name */
2295 1.1 christos TRUE, /* partial_inplace */
2296 1.1 christos 0x0000ffff, /* src_mask */
2297 1.1 christos 0x0000ffff, /* dst_mask */
2298 1.1 christos FALSE), /* pcrel_offset */
2299 1.1 christos
2300 1.1 christos /* Offset from page pointer in the global offset table. */
2301 1.1 christos HOWTO (R_MICROMIPS_GOT_OFST, /* type */
2302 1.1 christos 0, /* rightshift */
2303 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2304 1.1 christos 16, /* bitsize */
2305 1.1 christos FALSE, /* pc_relative */
2306 1.1 christos 0, /* bitpos */
2307 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2308 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2309 1.1 christos "R_MICROMIPS_GOT_OFST",/* name */
2310 1.1 christos TRUE, /* partial_inplace */
2311 1.1 christos 0x0000ffff, /* src_mask */
2312 1.1 christos 0x0000ffff, /* dst_mask */
2313 1.1 christos FALSE), /* pcrel_offset */
2314 1.1 christos
2315 1.1 christos /* High 16 bits of displacement in global offset table. */
2316 1.1 christos HOWTO (R_MICROMIPS_GOT_HI16, /* type */
2317 1.1 christos 0, /* rightshift */
2318 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2319 1.1 christos 16, /* bitsize */
2320 1.1 christos FALSE, /* pc_relative */
2321 1.1 christos 0, /* bitpos */
2322 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2323 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2324 1.1 christos "R_MICROMIPS_GOT_HI16",/* name */
2325 1.1 christos TRUE, /* partial_inplace */
2326 1.1 christos 0x0000ffff, /* src_mask */
2327 1.1 christos 0x0000ffff, /* dst_mask */
2328 1.1 christos FALSE), /* pcrel_offset */
2329 1.1 christos
2330 1.1 christos /* Low 16 bits of displacement in global offset table. */
2331 1.1 christos HOWTO (R_MICROMIPS_GOT_LO16, /* type */
2332 1.1 christos 0, /* rightshift */
2333 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2334 1.1 christos 16, /* bitsize */
2335 1.1 christos FALSE, /* pc_relative */
2336 1.1 christos 0, /* bitpos */
2337 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2338 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2339 1.1 christos "R_MICROMIPS_GOT_LO16",/* name */
2340 1.1 christos TRUE, /* partial_inplace */
2341 1.1 christos 0x0000ffff, /* src_mask */
2342 1.1 christos 0x0000ffff, /* dst_mask */
2343 1.1 christos FALSE), /* pcrel_offset */
2344 1.1 christos
2345 1.1 christos /* 64 bit subtraction. Used in the N32 ABI. */
2346 1.1 christos HOWTO (R_MICROMIPS_SUB, /* type */
2347 1.1 christos 0, /* rightshift */
2348 1.1 christos 4, /* size (0 = byte, 1 = short, 2 = long) */
2349 1.1 christos 64, /* bitsize */
2350 1.1 christos FALSE, /* pc_relative */
2351 1.1 christos 0, /* bitpos */
2352 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2353 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2354 1.1 christos "R_MICROMIPS_SUB", /* name */
2355 1.1 christos TRUE, /* partial_inplace */
2356 1.1 christos MINUS_ONE, /* src_mask */
2357 1.1 christos MINUS_ONE, /* dst_mask */
2358 1.1 christos FALSE), /* pcrel_offset */
2359 1.1 christos
2360 1.1 christos /* We don't support these for REL relocations, because it means building
2361 1.1 christos the addend from a R_MICROMIPS_HIGHEST/R_MICROMIPS_HIGHER/
2362 1.1 christos R_MICROMIPS_HI16/R_MICROMIPS_LO16 sequence with varying ordering,
2363 1.1 christos using fallable heuristics. */
2364 1.1 christos EMPTY_HOWTO (R_MICROMIPS_HIGHER),
2365 1.1 christos EMPTY_HOWTO (R_MICROMIPS_HIGHEST),
2366 1.1 christos
2367 1.1 christos /* High 16 bits of displacement in global offset table. */
2368 1.1 christos HOWTO (R_MICROMIPS_CALL_HI16, /* type */
2369 1.1 christos 0, /* rightshift */
2370 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2371 1.1 christos 16, /* bitsize */
2372 1.1 christos FALSE, /* pc_relative */
2373 1.1 christos 0, /* bitpos */
2374 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2375 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2376 1.1 christos "R_MICROMIPS_CALL_HI16",/* name */
2377 1.1 christos TRUE, /* partial_inplace */
2378 1.1 christos 0x0000ffff, /* src_mask */
2379 1.1 christos 0x0000ffff, /* dst_mask */
2380 1.1 christos FALSE), /* pcrel_offset */
2381 1.1 christos
2382 1.1 christos /* Low 16 bits of displacement in global offset table. */
2383 1.1 christos HOWTO (R_MICROMIPS_CALL_LO16, /* type */
2384 1.1 christos 0, /* rightshift */
2385 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2386 1.1 christos 16, /* bitsize */
2387 1.1 christos FALSE, /* pc_relative */
2388 1.1 christos 0, /* bitpos */
2389 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2390 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2391 1.1 christos "R_MICROMIPS_CALL_LO16",/* name */
2392 1.1 christos TRUE, /* partial_inplace */
2393 1.1 christos 0x0000ffff, /* src_mask */
2394 1.1 christos 0x0000ffff, /* dst_mask */
2395 1.1.1.2 christos FALSE), /* pcrel_offset */
2396 1.1.1.2 christos
2397 1.1.1.2 christos /* Section displacement. */
2398 1.1.1.2 christos HOWTO (R_MICROMIPS_SCN_DISP, /* type */
2399 1.1.1.2 christos 0, /* rightshift */
2400 1.1.1.2 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2401 1.1.1.2 christos 32, /* bitsize */
2402 1.1.1.2 christos FALSE, /* pc_relative */
2403 1.1.1.2 christos 0, /* bitpos */
2404 1.1.1.2 christos complain_overflow_dont, /* complain_on_overflow */
2405 1.1.1.2 christos _bfd_mips_elf_generic_reloc, /* special_function */
2406 1.1.1.2 christos "R_MICROMIPS_SCN_DISP", /* name */
2407 1.1.1.2 christos TRUE, /* partial_inplace */
2408 1.1.1.2 christos 0xffffffff, /* src_mask */
2409 1.1.1.2 christos 0xffffffff, /* dst_mask */
2410 1.1.1.2 christos FALSE), /* pcrel_offset */
2411 1.1.1.2 christos
2412 1.1.1.2 christos /* Protected jump conversion. This is an optimization hint. No
2413 1.1.1.2 christos relocation is required for correctness. */
2414 1.1.1.2 christos HOWTO (R_MICROMIPS_JALR, /* type */
2415 1.1.1.2 christos 0, /* rightshift */
2416 1.1.1.2 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2417 1.1.1.2 christos 32, /* bitsize */
2418 1.1.1.2 christos FALSE, /* pc_relative */
2419 1.1.1.2 christos 0, /* bitpos */
2420 1.1.1.2 christos complain_overflow_dont, /* complain_on_overflow */
2421 1.1.1.2 christos _bfd_mips_elf_generic_reloc, /* special_function */
2422 1.1.1.2 christos "R_MICROMIPS_JALR", /* name */
2423 1.1.1.2 christos FALSE, /* partial_inplace */
2424 1.1.1.2 christos 0, /* src_mask */
2425 1.1.1.2 christos 0x00000000, /* dst_mask */
2426 1.1 christos FALSE), /* pcrel_offset */
2427 1.1 christos };
2428 1.1 christos
2429 1.1 christos static reloc_howto_type micromips_elf64_howto_table_rela[] =
2430 1.1 christos {
2431 1.1 christos EMPTY_HOWTO (130),
2432 1.1 christos EMPTY_HOWTO (131),
2433 1.1 christos EMPTY_HOWTO (132),
2434 1.1 christos
2435 1.1 christos /* 26 bit jump address. */
2436 1.1 christos HOWTO (R_MICROMIPS_26_S1, /* type */
2437 1.1 christos 1, /* rightshift */
2438 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2439 1.1 christos 26, /* bitsize */
2440 1.1 christos FALSE, /* pc_relative */
2441 1.1 christos 0, /* bitpos */
2442 1.1.1.4 christos complain_overflow_dont, /* complain_on_overflow */
2443 1.1 christos /* This needs complex overflow
2444 1.1 christos detection, because the upper four
2445 1.1 christos bits must match the PC. */
2446 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2447 1.1 christos "R_MICROMIPS_26_S1", /* name */
2448 1.1 christos FALSE, /* partial_inplace */
2449 1.1 christos 0, /* src_mask */
2450 1.1 christos 0x3ffffff, /* dst_mask */
2451 1.1 christos FALSE), /* pcrel_offset */
2452 1.1 christos
2453 1.1 christos /* High 16 bits of symbol value. */
2454 1.1 christos HOWTO (R_MICROMIPS_HI16, /* type */
2455 1.1 christos 16, /* rightshift */
2456 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2457 1.1 christos 16, /* bitsize */
2458 1.1 christos FALSE, /* pc_relative */
2459 1.1 christos 0, /* bitpos */
2460 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2461 1.1 christos _bfd_mips_elf_hi16_reloc, /* special_function */
2462 1.1 christos "R_MICROMIPS_HI16", /* name */
2463 1.1 christos FALSE, /* partial_inplace */
2464 1.1 christos 0, /* src_mask */
2465 1.1 christos 0x0000ffff, /* dst_mask */
2466 1.1 christos FALSE), /* pcrel_offset */
2467 1.1 christos
2468 1.1 christos /* Low 16 bits of symbol value. */
2469 1.1 christos HOWTO (R_MICROMIPS_LO16, /* type */
2470 1.1 christos 0, /* rightshift */
2471 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2472 1.1 christos 16, /* bitsize */
2473 1.1 christos FALSE, /* pc_relative */
2474 1.1 christos 0, /* bitpos */
2475 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2476 1.1 christos _bfd_mips_elf_lo16_reloc, /* special_function */
2477 1.1 christos "R_MICROMIPS_LO16", /* name */
2478 1.1 christos FALSE, /* partial_inplace */
2479 1.1 christos 0, /* src_mask */
2480 1.1 christos 0x0000ffff, /* dst_mask */
2481 1.1 christos FALSE), /* pcrel_offset */
2482 1.1 christos
2483 1.1 christos /* GP relative reference. */
2484 1.1 christos HOWTO (R_MICROMIPS_GPREL16, /* type */
2485 1.1 christos 0, /* rightshift */
2486 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2487 1.1 christos 16, /* bitsize */
2488 1.1 christos FALSE, /* pc_relative */
2489 1.1 christos 0, /* bitpos */
2490 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2491 1.1 christos _bfd_mips_elf32_gprel16_reloc, /* special_function */
2492 1.1 christos "R_MICROMIPS_GPREL16", /* name */
2493 1.1 christos FALSE, /* partial_inplace */
2494 1.1 christos 0, /* src_mask */
2495 1.1 christos 0x0000ffff, /* dst_mask */
2496 1.1 christos FALSE), /* pcrel_offset */
2497 1.1 christos
2498 1.1 christos /* Reference to literal section. */
2499 1.1 christos HOWTO (R_MICROMIPS_LITERAL, /* type */
2500 1.1 christos 0, /* rightshift */
2501 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2502 1.1 christos 16, /* bitsize */
2503 1.1 christos FALSE, /* pc_relative */
2504 1.1 christos 0, /* bitpos */
2505 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2506 1.1 christos _bfd_mips_elf32_gprel16_reloc, /* special_function */
2507 1.1 christos "R_MICROMIPS_LITERAL", /* name */
2508 1.1 christos FALSE, /* partial_inplace */
2509 1.1 christos 0, /* src_mask */
2510 1.1 christos 0x0000ffff, /* dst_mask */
2511 1.1 christos FALSE), /* pcrel_offset */
2512 1.1 christos
2513 1.1 christos /* Reference to global offset table. */
2514 1.1 christos HOWTO (R_MICROMIPS_GOT16, /* type */
2515 1.1 christos 0, /* rightshift */
2516 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2517 1.1 christos 16, /* bitsize */
2518 1.1 christos FALSE, /* pc_relative */
2519 1.1 christos 0, /* bitpos */
2520 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2521 1.1 christos _bfd_mips_elf_got16_reloc, /* special_function */
2522 1.1 christos "R_MICROMIPS_GOT16", /* name */
2523 1.1 christos FALSE, /* partial_inplace */
2524 1.1 christos 0, /* src_mask */
2525 1.1 christos 0x0000ffff, /* dst_mask */
2526 1.1 christos FALSE), /* pcrel_offset */
2527 1.1 christos
2528 1.1 christos /* This is for microMIPS branches. */
2529 1.1 christos HOWTO (R_MICROMIPS_PC7_S1, /* type */
2530 1.1 christos 1, /* rightshift */
2531 1.1 christos 1, /* size (0 = byte, 1 = short, 2 = long) */
2532 1.1 christos 7, /* bitsize */
2533 1.1 christos TRUE, /* pc_relative */
2534 1.1 christos 0, /* bitpos */
2535 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2536 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2537 1.1 christos "R_MICROMIPS_PC7_S1", /* name */
2538 1.1 christos FALSE, /* partial_inplace */
2539 1.1 christos 0, /* src_mask */
2540 1.1 christos 0x0000007f, /* dst_mask */
2541 1.1 christos TRUE), /* pcrel_offset */
2542 1.1 christos
2543 1.1 christos HOWTO (R_MICROMIPS_PC10_S1, /* type */
2544 1.1 christos 1, /* rightshift */
2545 1.1 christos 1, /* size (0 = byte, 1 = short, 2 = long) */
2546 1.1 christos 10, /* bitsize */
2547 1.1 christos TRUE, /* pc_relative */
2548 1.1 christos 0, /* bitpos */
2549 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2550 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2551 1.1 christos "R_MICROMIPS_PC10_S1", /* name */
2552 1.1 christos FALSE, /* partial_inplace */
2553 1.1 christos 0, /* src_mask */
2554 1.1 christos 0x000003ff, /* dst_mask */
2555 1.1 christos TRUE), /* pcrel_offset */
2556 1.1 christos
2557 1.1 christos HOWTO (R_MICROMIPS_PC16_S1, /* type */
2558 1.1 christos 1, /* rightshift */
2559 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2560 1.1 christos 16, /* bitsize */
2561 1.1 christos TRUE, /* pc_relative */
2562 1.1 christos 0, /* bitpos */
2563 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2564 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2565 1.1 christos "R_MICROMIPS_PC16_S1", /* name */
2566 1.1 christos FALSE, /* partial_inplace */
2567 1.1 christos 0, /* src_mask */
2568 1.1 christos 0x0000ffff, /* dst_mask */
2569 1.1 christos TRUE), /* pcrel_offset */
2570 1.1 christos
2571 1.1 christos /* 16 bit call through global offset table. */
2572 1.1 christos HOWTO (R_MICROMIPS_CALL16, /* type */
2573 1.1 christos 0, /* rightshift */
2574 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2575 1.1 christos 16, /* bitsize */
2576 1.1 christos FALSE, /* pc_relative */
2577 1.1 christos 0, /* bitpos */
2578 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2579 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2580 1.1 christos "R_MICROMIPS_CALL16", /* name */
2581 1.1 christos FALSE, /* partial_inplace */
2582 1.1 christos 0, /* src_mask */
2583 1.1 christos 0x0000ffff, /* dst_mask */
2584 1.1 christos FALSE), /* pcrel_offset */
2585 1.1 christos
2586 1.1 christos EMPTY_HOWTO (143),
2587 1.1 christos EMPTY_HOWTO (144),
2588 1.1 christos
2589 1.1 christos /* Displacement in the global offset table. */
2590 1.1 christos HOWTO (R_MICROMIPS_GOT_DISP, /* type */
2591 1.1 christos 0, /* rightshift */
2592 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2593 1.1 christos 16, /* bitsize */
2594 1.1 christos FALSE, /* pc_relative */
2595 1.1 christos 0, /* bitpos */
2596 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2597 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2598 1.1 christos "R_MICROMIPS_GOT_DISP",/* name */
2599 1.1 christos FALSE, /* partial_inplace */
2600 1.1 christos 0, /* src_mask */
2601 1.1 christos 0x0000ffff, /* dst_mask */
2602 1.1 christos FALSE), /* pcrel_offset */
2603 1.1 christos
2604 1.1 christos /* Displacement to page pointer in the global offset table. */
2605 1.1 christos HOWTO (R_MICROMIPS_GOT_PAGE, /* type */
2606 1.1 christos 0, /* rightshift */
2607 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2608 1.1 christos 16, /* bitsize */
2609 1.1 christos FALSE, /* pc_relative */
2610 1.1 christos 0, /* bitpos */
2611 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2612 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2613 1.1 christos "R_MICROMIPS_GOT_PAGE",/* name */
2614 1.1 christos FALSE, /* partial_inplace */
2615 1.1 christos 0, /* src_mask */
2616 1.1 christos 0x0000ffff, /* dst_mask */
2617 1.1 christos FALSE), /* pcrel_offset */
2618 1.1 christos
2619 1.1 christos /* Offset from page pointer in the global offset table. */
2620 1.1 christos HOWTO (R_MICROMIPS_GOT_OFST, /* type */
2621 1.1 christos 0, /* rightshift */
2622 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2623 1.1 christos 16, /* bitsize */
2624 1.1 christos FALSE, /* pc_relative */
2625 1.1 christos 0, /* bitpos */
2626 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2627 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2628 1.1 christos "R_MICROMIPS_GOT_OFST",/* name */
2629 1.1 christos FALSE, /* partial_inplace */
2630 1.1 christos 0, /* src_mask */
2631 1.1 christos 0x0000ffff, /* dst_mask */
2632 1.1 christos FALSE), /* pcrel_offset */
2633 1.1 christos
2634 1.1 christos /* High 16 bits of displacement in global offset table. */
2635 1.1 christos HOWTO (R_MICROMIPS_GOT_HI16, /* type */
2636 1.1 christos 0, /* rightshift */
2637 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2638 1.1 christos 16, /* bitsize */
2639 1.1 christos FALSE, /* pc_relative */
2640 1.1 christos 0, /* bitpos */
2641 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2642 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2643 1.1 christos "R_MICROMIPS_GOT_HI16",/* name */
2644 1.1 christos FALSE, /* partial_inplace */
2645 1.1 christos 0, /* src_mask */
2646 1.1 christos 0x0000ffff, /* dst_mask */
2647 1.1 christos FALSE), /* pcrel_offset */
2648 1.1 christos
2649 1.1 christos /* Low 16 bits of displacement in global offset table. */
2650 1.1 christos HOWTO (R_MICROMIPS_GOT_LO16, /* type */
2651 1.1 christos 0, /* rightshift */
2652 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2653 1.1 christos 16, /* bitsize */
2654 1.1 christos FALSE, /* pc_relative */
2655 1.1 christos 0, /* bitpos */
2656 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2657 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2658 1.1 christos "R_MICROMIPS_GOT_LO16",/* name */
2659 1.1 christos FALSE, /* partial_inplace */
2660 1.1 christos 0, /* src_mask */
2661 1.1 christos 0x0000ffff, /* dst_mask */
2662 1.1 christos FALSE), /* pcrel_offset */
2663 1.1 christos
2664 1.1 christos /* 64 bit subtraction. Used in the N32 ABI. */
2665 1.1 christos HOWTO (R_MICROMIPS_SUB, /* type */
2666 1.1 christos 0, /* rightshift */
2667 1.1 christos 4, /* size (0 = byte, 1 = short, 2 = long) */
2668 1.1 christos 64, /* bitsize */
2669 1.1 christos FALSE, /* pc_relative */
2670 1.1 christos 0, /* bitpos */
2671 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2672 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2673 1.1 christos "R_MICROMIPS_SUB", /* name */
2674 1.1 christos FALSE, /* partial_inplace */
2675 1.1 christos 0, /* src_mask */
2676 1.1 christos MINUS_ONE, /* dst_mask */
2677 1.1 christos FALSE), /* pcrel_offset */
2678 1.1 christos
2679 1.1 christos /* Get the higher value of a 64 bit addend. */
2680 1.1 christos HOWTO (R_MICROMIPS_HIGHER, /* type */
2681 1.1 christos 0, /* rightshift */
2682 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2683 1.1 christos 16, /* bitsize */
2684 1.1 christos FALSE, /* pc_relative */
2685 1.1 christos 0, /* bitpos */
2686 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2687 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2688 1.1 christos "R_MICROMIPS_HIGHER", /* name */
2689 1.1 christos FALSE, /* partial_inplace */
2690 1.1 christos 0, /* src_mask */
2691 1.1 christos 0x0000ffff, /* dst_mask */
2692 1.1 christos FALSE), /* pcrel_offset */
2693 1.1 christos
2694 1.1 christos /* Get the highest value of a 64 bit addend. */
2695 1.1 christos HOWTO (R_MICROMIPS_HIGHEST, /* type */
2696 1.1 christos 0, /* rightshift */
2697 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2698 1.1 christos 16, /* bitsize */
2699 1.1 christos FALSE, /* pc_relative */
2700 1.1 christos 0, /* bitpos */
2701 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2702 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2703 1.1 christos "R_MICROMIPS_HIGHEST", /* name */
2704 1.1 christos FALSE, /* partial_inplace */
2705 1.1 christos 0, /* src_mask */
2706 1.1 christos 0x0000ffff, /* dst_mask */
2707 1.1 christos FALSE), /* pcrel_offset */
2708 1.1 christos
2709 1.1 christos /* High 16 bits of displacement in global offset table. */
2710 1.1 christos HOWTO (R_MICROMIPS_CALL_HI16, /* type */
2711 1.1 christos 0, /* rightshift */
2712 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2713 1.1 christos 16, /* bitsize */
2714 1.1 christos FALSE, /* pc_relative */
2715 1.1 christos 0, /* bitpos */
2716 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2717 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2718 1.1 christos "R_MICROMIPS_CALL_HI16",/* name */
2719 1.1 christos FALSE, /* partial_inplace */
2720 1.1 christos 0, /* src_mask */
2721 1.1 christos 0x0000ffff, /* dst_mask */
2722 1.1 christos FALSE), /* pcrel_offset */
2723 1.1 christos
2724 1.1 christos /* Low 16 bits of displacement in global offset table. */
2725 1.1 christos HOWTO (R_MICROMIPS_CALL_LO16, /* type */
2726 1.1 christos 0, /* rightshift */
2727 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2728 1.1 christos 16, /* bitsize */
2729 1.1 christos FALSE, /* pc_relative */
2730 1.1 christos 0, /* bitpos */
2731 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2732 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2733 1.1 christos "R_MICROMIPS_CALL_LO16",/* name */
2734 1.1 christos FALSE, /* partial_inplace */
2735 1.1 christos 0, /* src_mask */
2736 1.1 christos 0x0000ffff, /* dst_mask */
2737 1.1.1.2 christos FALSE), /* pcrel_offset */
2738 1.1.1.2 christos
2739 1.1.1.2 christos /* Section displacement. */
2740 1.1.1.2 christos HOWTO (R_MICROMIPS_SCN_DISP, /* type */
2741 1.1.1.2 christos 0, /* rightshift */
2742 1.1.1.2 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2743 1.1.1.2 christos 32, /* bitsize */
2744 1.1.1.2 christos FALSE, /* pc_relative */
2745 1.1.1.2 christos 0, /* bitpos */
2746 1.1.1.2 christos complain_overflow_dont, /* complain_on_overflow */
2747 1.1.1.2 christos _bfd_mips_elf_generic_reloc, /* special_function */
2748 1.1.1.2 christos "R_MICROMIPS_SCN_DISP", /* name */
2749 1.1.1.2 christos FALSE, /* partial_inplace */
2750 1.1.1.2 christos 0, /* src_mask */
2751 1.1.1.2 christos 0xffffffff, /* dst_mask */
2752 1.1.1.2 christos FALSE), /* pcrel_offset */
2753 1.1.1.2 christos
2754 1.1.1.2 christos /* Protected jump conversion. This is an optimization hint. No
2755 1.1.1.2 christos relocation is required for correctness. */
2756 1.1.1.2 christos HOWTO (R_MICROMIPS_JALR, /* type */
2757 1.1.1.2 christos 0, /* rightshift */
2758 1.1.1.2 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2759 1.1.1.2 christos 32, /* bitsize */
2760 1.1.1.2 christos FALSE, /* pc_relative */
2761 1.1.1.2 christos 0, /* bitpos */
2762 1.1.1.2 christos complain_overflow_dont, /* complain_on_overflow */
2763 1.1.1.2 christos _bfd_mips_elf_generic_reloc, /* special_function */
2764 1.1.1.2 christos "R_MICROMIPS_JALR", /* name */
2765 1.1.1.2 christos FALSE, /* partial_inplace */
2766 1.1.1.2 christos 0, /* src_mask */
2767 1.1.1.2 christos 0x00000000, /* dst_mask */
2768 1.1 christos FALSE), /* pcrel_offset */
2769 1.1 christos };
2770 1.1 christos
2771 1.1 christos /* GNU extension to record C++ vtable hierarchy */
2772 1.1 christos static reloc_howto_type elf_mips_gnu_vtinherit_howto =
2773 1.1 christos HOWTO (R_MIPS_GNU_VTINHERIT, /* type */
2774 1.1 christos 0, /* rightshift */
2775 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2776 1.1 christos 0, /* bitsize */
2777 1.1 christos FALSE, /* pc_relative */
2778 1.1 christos 0, /* bitpos */
2779 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2780 1.1 christos NULL, /* special_function */
2781 1.1 christos "R_MIPS_GNU_VTINHERIT", /* name */
2782 1.1 christos FALSE, /* partial_inplace */
2783 1.1 christos 0, /* src_mask */
2784 1.1 christos 0, /* dst_mask */
2785 1.1 christos FALSE); /* pcrel_offset */
2786 1.1 christos
2787 1.1 christos /* GNU extension to record C++ vtable member usage */
2788 1.1 christos static reloc_howto_type elf_mips_gnu_vtentry_howto =
2789 1.1 christos HOWTO (R_MIPS_GNU_VTENTRY, /* type */
2790 1.1 christos 0, /* rightshift */
2791 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2792 1.1 christos 0, /* bitsize */
2793 1.1 christos FALSE, /* pc_relative */
2794 1.1 christos 0, /* bitpos */
2795 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2796 1.1 christos _bfd_elf_rel_vtable_reloc_fn, /* special_function */
2797 1.1 christos "R_MIPS_GNU_VTENTRY", /* name */
2798 1.1 christos FALSE, /* partial_inplace */
2799 1.1 christos 0, /* src_mask */
2800 1.1 christos 0, /* dst_mask */
2801 1.1 christos FALSE); /* pcrel_offset */
2802 1.1 christos
2803 1.1 christos /* 16 bit offset for pc-relative branches. */
2805 1.1 christos static reloc_howto_type elf_mips_gnu_rel16_s2 =
2806 1.1 christos HOWTO (R_MIPS_GNU_REL16_S2, /* type */
2807 1.1 christos 2, /* rightshift */
2808 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2809 1.1 christos 16, /* bitsize */
2810 1.1 christos TRUE, /* pc_relative */
2811 1.1 christos 0, /* bitpos */
2812 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2813 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2814 1.1 christos "R_MIPS_GNU_REL16_S2", /* name */
2815 1.1 christos TRUE, /* partial_inplace */
2816 1.1 christos 0x0000ffff, /* src_mask */
2817 1.1 christos 0x0000ffff, /* dst_mask */
2818 1.1 christos TRUE); /* pcrel_offset */
2819 1.1 christos
2820 1.1 christos /* 16 bit offset for pc-relative branches. */
2821 1.1 christos static reloc_howto_type elf_mips_gnu_rela16_s2 =
2822 1.1 christos HOWTO (R_MIPS_GNU_REL16_S2, /* type */
2823 1.1 christos 2, /* rightshift */
2824 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2825 1.1 christos 16, /* bitsize */
2826 1.1 christos TRUE, /* pc_relative */
2827 1.1 christos 0, /* bitpos */
2828 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2829 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2830 1.1 christos "R_MIPS_GNU_REL16_S2", /* name */
2831 1.1 christos FALSE, /* partial_inplace */
2832 1.1 christos 0, /* src_mask */
2833 1.1.1.2 christos 0x0000ffff, /* dst_mask */
2834 1.1.1.2 christos TRUE); /* pcrel_offset */
2835 1.1.1.2 christos
2836 1.1.1.2 christos /* 32 bit pc-relative. Used for compact EH tables. */
2837 1.1.1.2 christos static reloc_howto_type elf_mips_gnu_pcrel32 =
2838 1.1.1.2 christos HOWTO (R_MIPS_PC32, /* type */
2839 1.1.1.2 christos 0, /* rightshift */
2840 1.1.1.2 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2841 1.1.1.2 christos 32, /* bitsize */
2842 1.1.1.2 christos TRUE, /* pc_relative */
2843 1.1.1.2 christos 0, /* bitpos */
2844 1.1.1.2 christos complain_overflow_signed, /* complain_on_overflow */
2845 1.1.1.2 christos _bfd_mips_elf_generic_reloc, /* special_function */
2846 1.1.1.2 christos "R_MIPS_PC32", /* name */
2847 1.1.1.2 christos TRUE, /* partial_inplace */
2848 1.1.1.2 christos 0xffffffff, /* src_mask */
2849 1.1.1.2 christos 0xffffffff, /* dst_mask */
2850 1.1 christos TRUE); /* pcrel_offset */
2851 1.1 christos
2852 1.1 christos
2853 1.1 christos /* Originally a VxWorks extension, but now used for other systems too. */
2855 1.1 christos static reloc_howto_type elf_mips_copy_howto =
2856 1.1 christos HOWTO (R_MIPS_COPY, /* type */
2857 1.1 christos 0, /* rightshift */
2858 1.1 christos 0, /* this one is variable size */
2859 1.1 christos 0, /* bitsize */
2860 1.1.1.2 christos FALSE, /* pc_relative */
2861 1.1 christos 0, /* bitpos */
2862 1.1 christos complain_overflow_bitfield, /* complain_on_overflow */
2863 1.1.1.4 christos _bfd_mips_elf_generic_reloc, /* special_function */
2864 1.1.1.4 christos "R_MIPS_COPY", /* name */
2865 1.1 christos FALSE, /* partial_inplace */
2866 1.1 christos 0x0, /* src_mask */
2867 1.1 christos 0x0, /* dst_mask */
2868 1.1 christos FALSE); /* pcrel_offset */
2869 1.1 christos
2870 1.1 christos /* Originally a VxWorks extension, but now used for other systems too. */
2871 1.1 christos static reloc_howto_type elf_mips_jump_slot_howto =
2872 1.1 christos HOWTO (R_MIPS_JUMP_SLOT, /* type */
2873 1.1 christos 0, /* rightshift */
2874 1.1 christos 4, /* size (0 = byte, 1 = short, 2 = long) */
2875 1.1 christos 64, /* bitsize */
2876 1.1.1.2 christos FALSE, /* pc_relative */
2877 1.1 christos 0, /* bitpos */
2878 1.1 christos complain_overflow_bitfield, /* complain_on_overflow */
2879 1.1.1.4 christos _bfd_mips_elf_generic_reloc, /* special_function */
2880 1.1.1.4 christos "R_MIPS_JUMP_SLOT", /* name */
2881 1.1 christos FALSE, /* partial_inplace */
2882 1.1.1.2 christos 0x0, /* src_mask */
2883 1.1.1.2 christos 0x0, /* dst_mask */
2884 1.1.1.2 christos FALSE); /* pcrel_offset */
2885 1.1.1.2 christos
2886 1.1.1.2 christos /* Used in EH tables. */
2887 1.1.1.2 christos static reloc_howto_type elf_mips_eh_howto =
2888 1.1.1.2 christos HOWTO (R_MIPS_EH, /* type */
2889 1.1.1.2 christos 0, /* rightshift */
2890 1.1.1.2 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2891 1.1.1.2 christos 32, /* bitsize */
2892 1.1.1.2 christos FALSE, /* pc_relative */
2893 1.1.1.2 christos 0, /* bitpos */
2894 1.1.1.2 christos complain_overflow_signed, /* complain_on_overflow */
2895 1.1.1.2 christos _bfd_mips_elf_generic_reloc, /* special_function */
2896 1.1.1.4 christos "R_MIPS_EH", /* name */
2897 1.1.1.2 christos TRUE, /* partial_inplace */
2898 1.1.1.2 christos 0xffffffff, /* src_mask */
2899 1.1 christos 0xffffffff, /* dst_mask */
2900 1.1 christos FALSE); /* pcrel_offset */
2901 1.1 christos
2902 1.1 christos
2903 1.1 christos /* Swap in a MIPS 64-bit Rel reloc. */
2905 1.1 christos
2906 1.1 christos static void
2907 1.1 christos mips_elf64_swap_reloc_in (bfd *abfd, const Elf64_Mips_External_Rel *src,
2908 1.1 christos Elf64_Mips_Internal_Rela *dst)
2909 1.1 christos {
2910 1.1 christos dst->r_offset = H_GET_64 (abfd, src->r_offset);
2911 1.1 christos dst->r_sym = H_GET_32 (abfd, src->r_sym);
2912 1.1 christos dst->r_ssym = H_GET_8 (abfd, src->r_ssym);
2913 1.1 christos dst->r_type3 = H_GET_8 (abfd, src->r_type3);
2914 1.1 christos dst->r_type2 = H_GET_8 (abfd, src->r_type2);
2915 1.1 christos dst->r_type = H_GET_8 (abfd, src->r_type);
2916 1.1 christos dst->r_addend = 0;
2917 1.1 christos }
2918 1.1 christos
2919 1.1 christos /* Swap in a MIPS 64-bit Rela reloc. */
2920 1.1 christos
2921 1.1 christos static void
2922 1.1 christos mips_elf64_swap_reloca_in (bfd *abfd, const Elf64_Mips_External_Rela *src,
2923 1.1 christos Elf64_Mips_Internal_Rela *dst)
2924 1.1 christos {
2925 1.1 christos dst->r_offset = H_GET_64 (abfd, src->r_offset);
2926 1.1 christos dst->r_sym = H_GET_32 (abfd, src->r_sym);
2927 1.1 christos dst->r_ssym = H_GET_8 (abfd, src->r_ssym);
2928 1.1 christos dst->r_type3 = H_GET_8 (abfd, src->r_type3);
2929 1.1 christos dst->r_type2 = H_GET_8 (abfd, src->r_type2);
2930 1.1 christos dst->r_type = H_GET_8 (abfd, src->r_type);
2931 1.1 christos dst->r_addend = H_GET_S64 (abfd, src->r_addend);
2932 1.1 christos }
2933 1.1 christos
2934 1.1 christos /* Swap out a MIPS 64-bit Rel reloc. */
2935 1.1 christos
2936 1.1 christos static void
2937 1.1 christos mips_elf64_swap_reloc_out (bfd *abfd, const Elf64_Mips_Internal_Rela *src,
2938 1.1 christos Elf64_Mips_External_Rel *dst)
2939 1.1 christos {
2940 1.1 christos H_PUT_64 (abfd, src->r_offset, dst->r_offset);
2941 1.1 christos H_PUT_32 (abfd, src->r_sym, dst->r_sym);
2942 1.1 christos H_PUT_8 (abfd, src->r_ssym, dst->r_ssym);
2943 1.1 christos H_PUT_8 (abfd, src->r_type3, dst->r_type3);
2944 1.1 christos H_PUT_8 (abfd, src->r_type2, dst->r_type2);
2945 1.1 christos H_PUT_8 (abfd, src->r_type, dst->r_type);
2946 1.1 christos }
2947 1.1 christos
2948 1.1 christos /* Swap out a MIPS 64-bit Rela reloc. */
2949 1.1 christos
2950 1.1 christos static void
2951 1.1 christos mips_elf64_swap_reloca_out (bfd *abfd, const Elf64_Mips_Internal_Rela *src,
2952 1.1 christos Elf64_Mips_External_Rela *dst)
2953 1.1 christos {
2954 1.1 christos H_PUT_64 (abfd, src->r_offset, dst->r_offset);
2955 1.1 christos H_PUT_32 (abfd, src->r_sym, dst->r_sym);
2956 1.1 christos H_PUT_8 (abfd, src->r_ssym, dst->r_ssym);
2957 1.1 christos H_PUT_8 (abfd, src->r_type3, dst->r_type3);
2958 1.1 christos H_PUT_8 (abfd, src->r_type2, dst->r_type2);
2959 1.1 christos H_PUT_8 (abfd, src->r_type, dst->r_type);
2960 1.1 christos H_PUT_S64 (abfd, src->r_addend, dst->r_addend);
2961 1.1 christos }
2962 1.1 christos
2963 1.1 christos /* Swap in a MIPS 64-bit Rel reloc. */
2964 1.1 christos
2965 1.1 christos static void
2966 1.1 christos mips_elf64_be_swap_reloc_in (bfd *abfd, const bfd_byte *src,
2967 1.1 christos Elf_Internal_Rela *dst)
2968 1.1 christos {
2969 1.1 christos Elf64_Mips_Internal_Rela mirel;
2970 1.1 christos
2971 1.1 christos mips_elf64_swap_reloc_in (abfd,
2972 1.1 christos (const Elf64_Mips_External_Rel *) src,
2973 1.1 christos &mirel);
2974 1.1 christos
2975 1.1 christos dst[0].r_offset = mirel.r_offset;
2976 1.1 christos dst[0].r_info = ELF64_R_INFO (mirel.r_sym, mirel.r_type);
2977 1.1 christos dst[0].r_addend = 0;
2978 1.1 christos dst[1].r_offset = mirel.r_offset;
2979 1.1 christos dst[1].r_info = ELF64_R_INFO (mirel.r_ssym, mirel.r_type2);
2980 1.1 christos dst[1].r_addend = 0;
2981 1.1 christos dst[2].r_offset = mirel.r_offset;
2982 1.1 christos dst[2].r_info = ELF64_R_INFO (STN_UNDEF, mirel.r_type3);
2983 1.1 christos dst[2].r_addend = 0;
2984 1.1 christos }
2985 1.1 christos
2986 1.1 christos /* Swap in a MIPS 64-bit Rela reloc. */
2987 1.1 christos
2988 1.1 christos static void
2989 1.1 christos mips_elf64_be_swap_reloca_in (bfd *abfd, const bfd_byte *src,
2990 1.1 christos Elf_Internal_Rela *dst)
2991 1.1 christos {
2992 1.1 christos Elf64_Mips_Internal_Rela mirela;
2993 1.1 christos
2994 1.1 christos mips_elf64_swap_reloca_in (abfd,
2995 1.1 christos (const Elf64_Mips_External_Rela *) src,
2996 1.1 christos &mirela);
2997 1.1 christos
2998 1.1 christos dst[0].r_offset = mirela.r_offset;
2999 1.1 christos dst[0].r_info = ELF64_R_INFO (mirela.r_sym, mirela.r_type);
3000 1.1 christos dst[0].r_addend = mirela.r_addend;
3001 1.1 christos dst[1].r_offset = mirela.r_offset;
3002 1.1 christos dst[1].r_info = ELF64_R_INFO (mirela.r_ssym, mirela.r_type2);
3003 1.1 christos dst[1].r_addend = 0;
3004 1.1 christos dst[2].r_offset = mirela.r_offset;
3005 1.1 christos dst[2].r_info = ELF64_R_INFO (STN_UNDEF, mirela.r_type3);
3006 1.1 christos dst[2].r_addend = 0;
3007 1.1 christos }
3008 1.1 christos
3009 1.1 christos /* Swap out a MIPS 64-bit Rel reloc. */
3010 1.1 christos
3011 1.1 christos static void
3012 1.1 christos mips_elf64_be_swap_reloc_out (bfd *abfd, const Elf_Internal_Rela *src,
3013 1.1 christos bfd_byte *dst)
3014 1.1 christos {
3015 1.1 christos Elf64_Mips_Internal_Rela mirel;
3016 1.1 christos
3017 1.1 christos mirel.r_offset = src[0].r_offset;
3018 1.1 christos BFD_ASSERT(src[0].r_offset == src[1].r_offset);
3019 1.1 christos BFD_ASSERT(src[0].r_offset == src[2].r_offset);
3020 1.1 christos
3021 1.1 christos mirel.r_type = ELF64_MIPS_R_TYPE (src[0].r_info);
3022 1.1 christos mirel.r_sym = ELF64_R_SYM (src[0].r_info);
3023 1.1 christos mirel.r_type2 = ELF64_MIPS_R_TYPE (src[1].r_info);
3024 1.1 christos mirel.r_ssym = ELF64_MIPS_R_SSYM (src[1].r_info);
3025 1.1 christos mirel.r_type3 = ELF64_MIPS_R_TYPE (src[2].r_info);
3026 1.1 christos
3027 1.1 christos mips_elf64_swap_reloc_out (abfd, &mirel,
3028 1.1 christos (Elf64_Mips_External_Rel *) dst);
3029 1.1 christos }
3030 1.1 christos
3031 1.1 christos /* Swap out a MIPS 64-bit Rela reloc. */
3032 1.1 christos
3033 1.1 christos static void
3034 1.1 christos mips_elf64_be_swap_reloca_out (bfd *abfd, const Elf_Internal_Rela *src,
3035 1.1 christos bfd_byte *dst)
3036 1.1 christos {
3037 1.1 christos Elf64_Mips_Internal_Rela mirela;
3038 1.1 christos
3039 1.1 christos mirela.r_offset = src[0].r_offset;
3040 1.1 christos BFD_ASSERT(src[0].r_offset == src[1].r_offset);
3041 1.1 christos BFD_ASSERT(src[0].r_offset == src[2].r_offset);
3042 1.1 christos
3043 1.1 christos mirela.r_type = ELF64_MIPS_R_TYPE (src[0].r_info);
3044 1.1 christos mirela.r_sym = ELF64_R_SYM (src[0].r_info);
3045 1.1 christos mirela.r_addend = src[0].r_addend;
3046 1.1 christos BFD_ASSERT(src[1].r_addend == 0);
3047 1.1 christos BFD_ASSERT(src[2].r_addend == 0);
3048 1.1 christos
3049 1.1 christos mirela.r_type2 = ELF64_MIPS_R_TYPE (src[1].r_info);
3050 1.1 christos mirela.r_ssym = ELF64_MIPS_R_SSYM (src[1].r_info);
3051 1.1 christos mirela.r_type3 = ELF64_MIPS_R_TYPE (src[2].r_info);
3052 1.1 christos
3053 1.1 christos mips_elf64_swap_reloca_out (abfd, &mirela,
3054 1.1 christos (Elf64_Mips_External_Rela *) dst);
3055 1.1 christos }
3056 1.1 christos
3057 1.1 christos /* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a
3059 1.1 christos dangerous relocation. */
3060 1.1 christos
3061 1.1 christos static bfd_boolean
3062 1.1 christos mips_elf64_assign_gp (bfd *output_bfd, bfd_vma *pgp)
3063 1.1 christos {
3064 1.1 christos unsigned int count;
3065 1.1 christos asymbol **sym;
3066 1.1 christos unsigned int i;
3067 1.1 christos
3068 1.1 christos /* If we've already figured out what GP will be, just return it. */
3069 1.1 christos *pgp = _bfd_get_gp_value (output_bfd);
3070 1.1 christos if (*pgp)
3071 1.1 christos return TRUE;
3072 1.1 christos
3073 1.1 christos count = bfd_get_symcount (output_bfd);
3074 1.1 christos sym = bfd_get_outsymbols (output_bfd);
3075 1.1 christos
3076 1.1 christos /* The linker script will have created a symbol named `_gp' with the
3077 1.1 christos appropriate value. */
3078 1.1 christos if (sym == NULL)
3079 1.1 christos i = count;
3080 1.1 christos else
3081 1.1 christos {
3082 1.1 christos for (i = 0; i < count; i++, sym++)
3083 1.1 christos {
3084 1.1 christos register const char *name;
3085 1.1 christos
3086 1.1 christos name = bfd_asymbol_name (*sym);
3087 1.1 christos if (*name == '_' && strcmp (name, "_gp") == 0)
3088 1.1 christos {
3089 1.1 christos *pgp = bfd_asymbol_value (*sym);
3090 1.1 christos _bfd_set_gp_value (output_bfd, *pgp);
3091 1.1 christos break;
3092 1.1 christos }
3093 1.1 christos }
3094 1.1 christos }
3095 1.1 christos
3096 1.1 christos if (i >= count)
3097 1.1 christos {
3098 1.1 christos /* Only get the error once. */
3099 1.1 christos *pgp = 4;
3100 1.1 christos _bfd_set_gp_value (output_bfd, *pgp);
3101 1.1 christos return FALSE;
3102 1.1 christos }
3103 1.1 christos
3104 1.1 christos return TRUE;
3105 1.1 christos }
3106 1.1 christos
3107 1.1 christos /* We have to figure out the gp value, so that we can adjust the
3108 1.1 christos symbol value correctly. We look up the symbol _gp in the output
3109 1.1 christos BFD. If we can't find it, we're stuck. We cache it in the ELF
3110 1.1 christos target data. We don't need to adjust the symbol value for an
3111 1.1 christos external symbol if we are producing relocatable output. */
3112 1.1 christos
3113 1.1 christos static bfd_reloc_status_type
3114 1.1 christos mips_elf64_final_gp (bfd *output_bfd, asymbol *symbol, bfd_boolean relocatable,
3115 1.1 christos char **error_message, bfd_vma *pgp)
3116 1.1 christos {
3117 1.1 christos if (bfd_is_und_section (symbol->section)
3118 1.1 christos && ! relocatable)
3119 1.1 christos {
3120 1.1 christos *pgp = 0;
3121 1.1 christos return bfd_reloc_undefined;
3122 1.1 christos }
3123 1.1 christos
3124 1.1 christos *pgp = _bfd_get_gp_value (output_bfd);
3125 1.1 christos if (*pgp == 0
3126 1.1 christos && (! relocatable
3127 1.1 christos || (symbol->flags & BSF_SECTION_SYM) != 0))
3128 1.1 christos {
3129 1.1 christos if (relocatable)
3130 1.1 christos {
3131 1.1 christos /* Make up a value. */
3132 1.1 christos *pgp = symbol->section->output_section->vma /*+ 0x4000*/;
3133 1.1 christos _bfd_set_gp_value (output_bfd, *pgp);
3134 1.1 christos }
3135 1.1 christos else if (!mips_elf64_assign_gp (output_bfd, pgp))
3136 1.1 christos {
3137 1.1 christos *error_message =
3138 1.1 christos (char *) _("GP relative relocation when _gp not defined");
3139 1.1 christos return bfd_reloc_dangerous;
3140 1.1 christos }
3141 1.1 christos }
3142 1.1 christos
3143 1.1 christos return bfd_reloc_ok;
3144 1.1 christos }
3145 1.1 christos
3146 1.1 christos /* Do a R_MIPS_GPREL16 relocation. This is a 16 bit value which must
3147 1.1 christos become the offset from the gp register. */
3148 1.1 christos
3149 1.1 christos static bfd_reloc_status_type
3150 1.1 christos mips_elf64_gprel16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
3151 1.1 christos void *data, asection *input_section, bfd *output_bfd,
3152 1.1 christos char **error_message)
3153 1.1 christos {
3154 1.1 christos bfd_boolean relocatable;
3155 1.1 christos bfd_reloc_status_type ret;
3156 1.1 christos bfd_vma gp;
3157 1.1 christos
3158 1.1 christos /* If we're relocating, and this is an external symbol, we don't want
3159 1.1 christos to change anything. */
3160 1.1 christos if (output_bfd != NULL
3161 1.1 christos && (symbol->flags & BSF_SECTION_SYM) == 0
3162 1.1 christos && (symbol->flags & BSF_LOCAL) != 0)
3163 1.1 christos {
3164 1.1 christos reloc_entry->address += input_section->output_offset;
3165 1.1 christos return bfd_reloc_ok;
3166 1.1 christos }
3167 1.1 christos
3168 1.1 christos if (output_bfd != NULL)
3169 1.1 christos relocatable = TRUE;
3170 1.1 christos else
3171 1.1 christos {
3172 1.1 christos relocatable = FALSE;
3173 1.1 christos output_bfd = symbol->section->output_section->owner;
3174 1.1 christos }
3175 1.1 christos
3176 1.1 christos ret = mips_elf64_final_gp (output_bfd, symbol, relocatable, error_message,
3177 1.1 christos &gp);
3178 1.1 christos if (ret != bfd_reloc_ok)
3179 1.1 christos return ret;
3180 1.1 christos
3181 1.1 christos return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
3182 1.1 christos input_section, relocatable,
3183 1.1 christos data, gp);
3184 1.1 christos }
3185 1.1 christos
3186 1.1 christos /* Do a R_MIPS_LITERAL relocation. */
3187 1.1 christos
3188 1.1 christos static bfd_reloc_status_type
3189 1.1 christos mips_elf64_literal_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
3190 1.1 christos void *data, asection *input_section, bfd *output_bfd,
3191 1.1 christos char **error_message)
3192 1.1 christos {
3193 1.1 christos bfd_boolean relocatable;
3194 1.1 christos bfd_reloc_status_type ret;
3195 1.1 christos bfd_vma gp;
3196 1.1 christos
3197 1.1 christos /* R_MIPS_LITERAL relocations are defined for local symbols only. */
3198 1.1 christos if (output_bfd != NULL
3199 1.1 christos && (symbol->flags & BSF_SECTION_SYM) == 0
3200 1.1 christos && (symbol->flags & BSF_LOCAL) != 0)
3201 1.1 christos {
3202 1.1 christos *error_message = (char *)
3203 1.1 christos _("literal relocation occurs for an external symbol");
3204 1.1 christos return bfd_reloc_outofrange;
3205 1.1 christos }
3206 1.1 christos
3207 1.1 christos /* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */
3208 1.1 christos if (output_bfd != NULL)
3209 1.1 christos relocatable = TRUE;
3210 1.1 christos else
3211 1.1 christos {
3212 1.1 christos relocatable = FALSE;
3213 1.1 christos output_bfd = symbol->section->output_section->owner;
3214 1.1 christos }
3215 1.1 christos
3216 1.1 christos ret = mips_elf64_final_gp (output_bfd, symbol, relocatable, error_message,
3217 1.1 christos &gp);
3218 1.1 christos if (ret != bfd_reloc_ok)
3219 1.1 christos return ret;
3220 1.1 christos
3221 1.1 christos return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
3222 1.1 christos input_section, relocatable,
3223 1.1 christos data, gp);
3224 1.1 christos }
3225 1.1 christos
3226 1.1 christos /* Do a R_MIPS_GPREL32 relocation. This is a 32 bit value which must
3227 1.1 christos become the offset from the gp register. */
3228 1.1 christos
3229 1.1 christos static bfd_reloc_status_type
3230 1.1 christos mips_elf64_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
3231 1.1 christos void *data, asection *input_section, bfd *output_bfd,
3232 1.1 christos char **error_message)
3233 1.1 christos {
3234 1.1 christos bfd_boolean relocatable;
3235 1.1 christos bfd_reloc_status_type ret;
3236 1.1 christos bfd_vma gp;
3237 1.1 christos bfd_vma relocation;
3238 1.1 christos bfd_vma val;
3239 1.1 christos
3240 1.1 christos /* R_MIPS_GPREL32 relocations are defined for local symbols only. */
3241 1.1 christos if (output_bfd != NULL
3242 1.1 christos && (symbol->flags & BSF_SECTION_SYM) == 0
3243 1.1 christos && (symbol->flags & BSF_LOCAL) != 0)
3244 1.1 christos {
3245 1.1 christos *error_message = (char *)
3246 1.1 christos _("32bits gp relative relocation occurs for an external symbol");
3247 1.1 christos return bfd_reloc_outofrange;
3248 1.1 christos }
3249 1.1 christos
3250 1.1 christos if (output_bfd != NULL)
3251 1.1 christos relocatable = TRUE;
3252 1.1 christos else
3253 1.1 christos {
3254 1.1 christos relocatable = FALSE;
3255 1.1 christos output_bfd = symbol->section->output_section->owner;
3256 1.1 christos }
3257 1.1 christos
3258 1.1 christos ret = mips_elf64_final_gp (output_bfd, symbol, relocatable,
3259 1.1 christos error_message, &gp);
3260 1.1 christos if (ret != bfd_reloc_ok)
3261 1.1 christos return ret;
3262 1.1 christos
3263 1.1 christos if (bfd_is_com_section (symbol->section))
3264 1.1 christos relocation = 0;
3265 1.1 christos else
3266 1.1 christos relocation = symbol->value;
3267 1.1 christos
3268 1.1 christos relocation += symbol->section->output_section->vma;
3269 1.1 christos relocation += symbol->section->output_offset;
3270 1.1 christos
3271 1.1 christos if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
3272 1.1 christos return bfd_reloc_outofrange;
3273 1.1 christos
3274 1.1 christos /* Set val to the offset into the section or symbol. */
3275 1.1 christos val = reloc_entry->addend;
3276 1.1 christos
3277 1.1 christos if (reloc_entry->howto->partial_inplace)
3278 1.1 christos val += bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
3279 1.1 christos
3280 1.1 christos /* Adjust val for the final section location and GP value. If we
3281 1.1 christos are producing relocatable output, we don't want to do this for
3282 1.1 christos an external symbol. */
3283 1.1 christos if (! relocatable
3284 1.1 christos || (symbol->flags & BSF_SECTION_SYM) != 0)
3285 1.1 christos val += relocation - gp;
3286 1.1 christos
3287 1.1 christos if (reloc_entry->howto->partial_inplace)
3288 1.1 christos bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address);
3289 1.1 christos else
3290 1.1 christos reloc_entry->addend = val;
3291 1.1 christos
3292 1.1 christos if (relocatable)
3293 1.1 christos reloc_entry->address += input_section->output_offset;
3294 1.1 christos
3295 1.1 christos return bfd_reloc_ok;
3296 1.1 christos }
3297 1.1 christos
3298 1.1 christos /* Do a R_MIPS_SHIFT6 relocation. The MSB of the shift is stored at bit 2,
3299 1.1 christos the rest is at bits 6-10. The bitpos already got right by the howto. */
3300 1.1 christos
3301 1.1 christos static bfd_reloc_status_type
3302 1.1 christos mips_elf64_shift6_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
3303 1.1 christos void *data, asection *input_section, bfd *output_bfd,
3304 1.1 christos char **error_message)
3305 1.1 christos {
3306 1.1 christos if (reloc_entry->howto->partial_inplace)
3307 1.1 christos {
3308 1.1 christos reloc_entry->addend = ((reloc_entry->addend & 0x00007c0)
3309 1.1 christos | (reloc_entry->addend & 0x00000800) >> 9);
3310 1.1 christos }
3311 1.1 christos
3312 1.1 christos return _bfd_mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
3313 1.1 christos input_section, output_bfd,
3314 1.1 christos error_message);
3315 1.1 christos }
3316 1.1 christos
3317 1.1 christos /* Handle a mips16 GP relative reloc. */
3318 1.1 christos
3319 1.1 christos static bfd_reloc_status_type
3320 1.1 christos mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
3321 1.1 christos void *data, asection *input_section, bfd *output_bfd,
3322 1.1 christos char **error_message)
3323 1.1 christos {
3324 1.1 christos bfd_boolean relocatable;
3325 1.1 christos bfd_reloc_status_type ret;
3326 1.1 christos bfd_byte *location;
3327 1.1 christos bfd_vma gp;
3328 1.1 christos
3329 1.1 christos /* If we're relocating, and this is an external symbol, we don't want
3330 1.1 christos to change anything. */
3331 1.1 christos if (output_bfd != NULL
3332 1.1 christos && (symbol->flags & BSF_SECTION_SYM) == 0
3333 1.1 christos && (symbol->flags & BSF_LOCAL) != 0)
3334 1.1 christos {
3335 1.1 christos reloc_entry->address += input_section->output_offset;
3336 1.1 christos return bfd_reloc_ok;
3337 1.1 christos }
3338 1.1 christos
3339 1.1 christos if (output_bfd != NULL)
3340 1.1 christos relocatable = TRUE;
3341 1.1 christos else
3342 1.1 christos {
3343 1.1 christos relocatable = FALSE;
3344 1.1 christos output_bfd = symbol->section->output_section->owner;
3345 1.1 christos }
3346 1.1 christos
3347 1.1 christos ret = mips_elf64_final_gp (output_bfd, symbol, relocatable, error_message,
3348 1.1 christos &gp);
3349 1.1 christos if (ret != bfd_reloc_ok)
3350 1.1 christos return ret;
3351 1.1 christos
3352 1.1 christos location = (bfd_byte *) data + reloc_entry->address;
3353 1.1 christos _bfd_mips_elf_reloc_unshuffle (abfd, reloc_entry->howto->type, FALSE,
3354 1.1 christos location);
3355 1.1 christos ret = _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
3356 1.1 christos input_section, relocatable,
3357 1.1 christos data, gp);
3358 1.1 christos _bfd_mips_elf_reloc_shuffle (abfd, reloc_entry->howto->type, !relocatable,
3359 1.1 christos location);
3360 1.1 christos
3361 1.1 christos return ret;
3362 1.1 christos }
3363 1.1 christos
3364 1.1 christos /* A mapping from BFD reloc types to MIPS ELF reloc types. */
3366 1.1 christos
3367 1.1 christos struct elf_reloc_map {
3368 1.1 christos bfd_reloc_code_real_type bfd_val;
3369 1.1 christos enum elf_mips_reloc_type elf_val;
3370 1.1 christos };
3371 1.1 christos
3372 1.1 christos static const struct elf_reloc_map mips_reloc_map[] =
3373 1.1 christos {
3374 1.1 christos { BFD_RELOC_NONE, R_MIPS_NONE },
3375 1.1 christos { BFD_RELOC_16, R_MIPS_16 },
3376 1.1 christos { BFD_RELOC_32, R_MIPS_32 },
3377 1.1 christos /* There is no BFD reloc for R_MIPS_REL32. */
3378 1.1 christos { BFD_RELOC_64, R_MIPS_64 },
3379 1.1 christos { BFD_RELOC_CTOR, R_MIPS_64 },
3380 1.1 christos { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 },
3381 1.1 christos { BFD_RELOC_HI16_S, R_MIPS_HI16 },
3382 1.1 christos { BFD_RELOC_LO16, R_MIPS_LO16 },
3383 1.1 christos { BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
3384 1.1 christos { BFD_RELOC_GPREL32, R_MIPS_GPREL32 },
3385 1.1 christos { BFD_RELOC_MIPS_JMP, R_MIPS_26 },
3386 1.1 christos { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL },
3387 1.1 christos { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 },
3388 1.1 christos { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 },
3389 1.1 christos { BFD_RELOC_MIPS_SHIFT5, R_MIPS_SHIFT5 },
3390 1.1 christos { BFD_RELOC_MIPS_SHIFT6, R_MIPS_SHIFT6 },
3391 1.1 christos { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP },
3392 1.1 christos { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE },
3393 1.1 christos { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST },
3394 1.1 christos { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 },
3395 1.1 christos { BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 },
3396 1.1 christos { BFD_RELOC_MIPS_SUB, R_MIPS_SUB },
3397 1.1 christos { BFD_RELOC_MIPS_INSERT_A, R_MIPS_INSERT_A },
3398 1.1 christos { BFD_RELOC_MIPS_INSERT_B, R_MIPS_INSERT_B },
3399 1.1 christos { BFD_RELOC_MIPS_DELETE, R_MIPS_DELETE },
3400 1.1 christos { BFD_RELOC_MIPS_HIGHEST, R_MIPS_HIGHEST },
3401 1.1 christos { BFD_RELOC_MIPS_HIGHER, R_MIPS_HIGHER },
3402 1.1 christos { BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 },
3403 1.1 christos { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 },
3404 1.1 christos { BFD_RELOC_MIPS_SCN_DISP, R_MIPS_SCN_DISP },
3405 1.1 christos { BFD_RELOC_MIPS_REL16, R_MIPS_REL16 },
3406 1.1 christos /* Use of R_MIPS_ADD_IMMEDIATE and R_MIPS_PJUMP is deprecated. */
3407 1.1 christos { BFD_RELOC_MIPS_RELGOT, R_MIPS_RELGOT },
3408 1.1 christos { BFD_RELOC_MIPS_JALR, R_MIPS_JALR },
3409 1.1 christos { BFD_RELOC_MIPS_TLS_DTPMOD32, R_MIPS_TLS_DTPMOD32 },
3410 1.1 christos { BFD_RELOC_MIPS_TLS_DTPREL32, R_MIPS_TLS_DTPREL32 },
3411 1.1 christos { BFD_RELOC_MIPS_TLS_DTPMOD64, R_MIPS_TLS_DTPMOD64 },
3412 1.1 christos { BFD_RELOC_MIPS_TLS_DTPREL64, R_MIPS_TLS_DTPREL64 },
3413 1.1 christos { BFD_RELOC_MIPS_TLS_GD, R_MIPS_TLS_GD },
3414 1.1 christos { BFD_RELOC_MIPS_TLS_LDM, R_MIPS_TLS_LDM },
3415 1.1.1.2 christos { BFD_RELOC_MIPS_TLS_DTPREL_HI16, R_MIPS_TLS_DTPREL_HI16 },
3416 1.1.1.2 christos { BFD_RELOC_MIPS_TLS_DTPREL_LO16, R_MIPS_TLS_DTPREL_LO16 },
3417 1.1.1.2 christos { BFD_RELOC_MIPS_TLS_GOTTPREL, R_MIPS_TLS_GOTTPREL },
3418 1.1.1.2 christos { BFD_RELOC_MIPS_TLS_TPREL32, R_MIPS_TLS_TPREL32 },
3419 1.1.1.2 christos { BFD_RELOC_MIPS_TLS_TPREL64, R_MIPS_TLS_TPREL64 },
3420 1.1.1.2 christos { BFD_RELOC_MIPS_TLS_TPREL_HI16, R_MIPS_TLS_TPREL_HI16 },
3421 1.1.1.2 christos { BFD_RELOC_MIPS_TLS_TPREL_LO16, R_MIPS_TLS_TPREL_LO16 },
3422 1.1 christos { BFD_RELOC_MIPS_21_PCREL_S2, R_MIPS_PC21_S2 },
3423 1.1 christos { BFD_RELOC_MIPS_26_PCREL_S2, R_MIPS_PC26_S2 },
3424 1.1 christos { BFD_RELOC_MIPS_18_PCREL_S3, R_MIPS_PC18_S3 },
3425 1.1 christos { BFD_RELOC_MIPS_19_PCREL_S2, R_MIPS_PC19_S2 },
3426 1.1 christos { BFD_RELOC_HI16_S_PCREL, R_MIPS_PCHI16 },
3427 1.1 christos { BFD_RELOC_LO16_PCREL, R_MIPS_PCLO16 }
3428 1.1 christos };
3429 1.1 christos
3430 1.1 christos static const struct elf_reloc_map mips16_reloc_map[] =
3431 1.1 christos {
3432 1.1 christos { BFD_RELOC_MIPS16_JMP, R_MIPS16_26 - R_MIPS16_min },
3433 1.1 christos { BFD_RELOC_MIPS16_GPREL, R_MIPS16_GPREL - R_MIPS16_min },
3434 1.1 christos { BFD_RELOC_MIPS16_GOT16, R_MIPS16_GOT16 - R_MIPS16_min },
3435 1.1 christos { BFD_RELOC_MIPS16_CALL16, R_MIPS16_CALL16 - R_MIPS16_min },
3436 1.1 christos { BFD_RELOC_MIPS16_HI16_S, R_MIPS16_HI16 - R_MIPS16_min },
3437 1.1 christos { BFD_RELOC_MIPS16_LO16, R_MIPS16_LO16 - R_MIPS16_min },
3438 1.1 christos { BFD_RELOC_MIPS16_TLS_GD, R_MIPS16_TLS_GD - R_MIPS16_min },
3439 1.1 christos { BFD_RELOC_MIPS16_TLS_LDM, R_MIPS16_TLS_LDM - R_MIPS16_min },
3440 1.1.1.3 christos { BFD_RELOC_MIPS16_TLS_DTPREL_HI16,
3441 1.1.1.3 christos R_MIPS16_TLS_DTPREL_HI16 - R_MIPS16_min },
3442 1.1 christos { BFD_RELOC_MIPS16_TLS_DTPREL_LO16,
3443 1.1 christos R_MIPS16_TLS_DTPREL_LO16 - R_MIPS16_min },
3444 1.1 christos { BFD_RELOC_MIPS16_TLS_GOTTPREL, R_MIPS16_TLS_GOTTPREL - R_MIPS16_min },
3445 1.1 christos { BFD_RELOC_MIPS16_TLS_TPREL_HI16, R_MIPS16_TLS_TPREL_HI16 - R_MIPS16_min },
3446 1.1 christos { BFD_RELOC_MIPS16_TLS_TPREL_LO16, R_MIPS16_TLS_TPREL_LO16 - R_MIPS16_min },
3447 1.1 christos { BFD_RELOC_MIPS16_16_PCREL_S1, R_MIPS16_PC16_S1 - R_MIPS16_min }
3448 1.1 christos };
3449 1.1 christos
3450 1.1 christos static const struct elf_reloc_map micromips_reloc_map[] =
3451 1.1 christos {
3452 1.1 christos { BFD_RELOC_MICROMIPS_JMP, R_MICROMIPS_26_S1 - R_MICROMIPS_min },
3453 1.1 christos { BFD_RELOC_MICROMIPS_HI16_S, R_MICROMIPS_HI16 - R_MICROMIPS_min },
3454 1.1 christos { BFD_RELOC_MICROMIPS_LO16, R_MICROMIPS_LO16 - R_MICROMIPS_min },
3455 1.1 christos { BFD_RELOC_MICROMIPS_GPREL16, R_MICROMIPS_GPREL16 - R_MICROMIPS_min },
3456 1.1 christos { BFD_RELOC_MICROMIPS_LITERAL, R_MICROMIPS_LITERAL - R_MICROMIPS_min },
3457 1.1 christos { BFD_RELOC_MICROMIPS_GOT16, R_MICROMIPS_GOT16 - R_MICROMIPS_min },
3458 1.1 christos { BFD_RELOC_MICROMIPS_7_PCREL_S1, R_MICROMIPS_PC7_S1 - R_MICROMIPS_min },
3459 1.1 christos { BFD_RELOC_MICROMIPS_10_PCREL_S1, R_MICROMIPS_PC10_S1 - R_MICROMIPS_min },
3460 1.1 christos { BFD_RELOC_MICROMIPS_16_PCREL_S1, R_MICROMIPS_PC16_S1 - R_MICROMIPS_min },
3461 1.1 christos { BFD_RELOC_MICROMIPS_CALL16, R_MICROMIPS_CALL16 - R_MICROMIPS_min },
3462 1.1 christos { BFD_RELOC_MICROMIPS_GOT_DISP, R_MICROMIPS_GOT_DISP - R_MICROMIPS_min },
3463 1.1 christos { BFD_RELOC_MICROMIPS_GOT_PAGE, R_MICROMIPS_GOT_PAGE - R_MICROMIPS_min },
3464 1.1 christos { BFD_RELOC_MICROMIPS_GOT_OFST, R_MICROMIPS_GOT_OFST - R_MICROMIPS_min },
3465 1.1 christos { BFD_RELOC_MICROMIPS_GOT_HI16, R_MICROMIPS_GOT_HI16 - R_MICROMIPS_min },
3466 1.1.1.2 christos { BFD_RELOC_MICROMIPS_GOT_LO16, R_MICROMIPS_GOT_LO16 - R_MICROMIPS_min },
3467 1.1.1.2 christos { BFD_RELOC_MICROMIPS_SUB, R_MICROMIPS_SUB - R_MICROMIPS_min },
3468 1.1 christos { BFD_RELOC_MICROMIPS_HIGHER, R_MICROMIPS_HIGHER - R_MICROMIPS_min },
3469 1.1 christos { BFD_RELOC_MICROMIPS_HIGHEST, R_MICROMIPS_HIGHEST - R_MICROMIPS_min },
3470 1.1 christos { BFD_RELOC_MICROMIPS_CALL_HI16, R_MICROMIPS_CALL_HI16 - R_MICROMIPS_min },
3471 1.1 christos { BFD_RELOC_MICROMIPS_CALL_LO16, R_MICROMIPS_CALL_LO16 - R_MICROMIPS_min },
3472 1.1 christos { BFD_RELOC_MICROMIPS_SCN_DISP, R_MICROMIPS_SCN_DISP - R_MICROMIPS_min },
3473 1.1 christos { BFD_RELOC_MICROMIPS_JALR, R_MICROMIPS_JALR - R_MICROMIPS_min },
3474 1.1 christos };
3475 1.1 christos /* Given a BFD reloc type, return a howto structure. */
3476 1.1 christos
3477 1.1 christos static reloc_howto_type *
3478 1.1 christos bfd_elf64_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
3479 1.1 christos bfd_reloc_code_real_type code)
3480 1.1 christos {
3481 1.1 christos unsigned int i;
3482 1.1 christos /* FIXME: We default to RELA here instead of choosing the right
3483 1.1 christos relocation variant. */
3484 1.1 christos reloc_howto_type *howto_table = mips_elf64_howto_table_rela;
3485 1.1 christos reloc_howto_type *howto16_table = mips16_elf64_howto_table_rela;
3486 1.1 christos reloc_howto_type *howto_micromips_table = micromips_elf64_howto_table_rela;
3487 1.1 christos
3488 1.1 christos for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map);
3489 1.1 christos i++)
3490 1.1 christos {
3491 1.1 christos if (mips_reloc_map[i].bfd_val == code)
3492 1.1 christos return &howto_table[(int) mips_reloc_map[i].elf_val];
3493 1.1 christos }
3494 1.1 christos
3495 1.1 christos for (i = 0; i < sizeof (mips16_reloc_map) / sizeof (struct elf_reloc_map);
3496 1.1 christos i++)
3497 1.1 christos {
3498 1.1 christos if (mips16_reloc_map[i].bfd_val == code)
3499 1.1 christos return &howto16_table[(int) mips16_reloc_map[i].elf_val];
3500 1.1 christos }
3501 1.1 christos
3502 1.1 christos for (i = 0; i < sizeof (micromips_reloc_map) / sizeof (struct elf_reloc_map);
3503 1.1 christos i++)
3504 1.1 christos {
3505 1.1 christos if (micromips_reloc_map[i].bfd_val == code)
3506 1.1 christos return &howto_micromips_table[(int) micromips_reloc_map[i].elf_val];
3507 1.1 christos }
3508 1.1 christos
3509 1.1.1.2 christos switch (code)
3510 1.1.1.2 christos {
3511 1.1.1.2 christos case BFD_RELOC_VTABLE_INHERIT:
3512 1.1.1.2 christos return &elf_mips_gnu_vtinherit_howto;
3513 1.1 christos case BFD_RELOC_VTABLE_ENTRY:
3514 1.1 christos return &elf_mips_gnu_vtentry_howto;
3515 1.1 christos case BFD_RELOC_32_PCREL:
3516 1.1 christos return &elf_mips_gnu_pcrel32;
3517 1.1 christos case BFD_RELOC_MIPS_EH:
3518 1.1 christos return &elf_mips_eh_howto;
3519 1.1 christos case BFD_RELOC_MIPS_COPY:
3520 1.1 christos return &elf_mips_copy_howto;
3521 1.1 christos case BFD_RELOC_MIPS_JUMP_SLOT:
3522 1.1 christos return &elf_mips_jump_slot_howto;
3523 1.1 christos default:
3524 1.1 christos bfd_set_error (bfd_error_bad_value);
3525 1.1 christos return NULL;
3526 1.1 christos }
3527 1.1 christos }
3528 1.1 christos
3529 1.1 christos static reloc_howto_type *
3530 1.1 christos bfd_elf64_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
3531 1.1 christos const char *r_name)
3532 1.1 christos {
3533 1.1 christos unsigned int i;
3534 1.1 christos
3535 1.1 christos for (i = 0;
3536 1.1 christos i < (sizeof (mips_elf64_howto_table_rela)
3537 1.1 christos / sizeof (mips_elf64_howto_table_rela[0])); i++)
3538 1.1 christos if (mips_elf64_howto_table_rela[i].name != NULL
3539 1.1 christos && strcasecmp (mips_elf64_howto_table_rela[i].name, r_name) == 0)
3540 1.1 christos return &mips_elf64_howto_table_rela[i];
3541 1.1 christos
3542 1.1 christos for (i = 0;
3543 1.1 christos i < (sizeof (mips16_elf64_howto_table_rela)
3544 1.1 christos / sizeof (mips16_elf64_howto_table_rela[0]));
3545 1.1 christos i++)
3546 1.1 christos if (mips16_elf64_howto_table_rela[i].name != NULL
3547 1.1 christos && strcasecmp (mips16_elf64_howto_table_rela[i].name, r_name) == 0)
3548 1.1 christos return &mips16_elf64_howto_table_rela[i];
3549 1.1 christos
3550 1.1 christos for (i = 0;
3551 1.1 christos i < (sizeof (micromips_elf64_howto_table_rela)
3552 1.1 christos / sizeof (micromips_elf64_howto_table_rela[0]));
3553 1.1 christos i++)
3554 1.1 christos if (micromips_elf64_howto_table_rela[i].name != NULL
3555 1.1 christos && strcasecmp (micromips_elf64_howto_table_rela[i].name, r_name) == 0)
3556 1.1 christos return µmips_elf64_howto_table_rela[i];
3557 1.1 christos
3558 1.1 christos if (strcasecmp (elf_mips_gnu_vtinherit_howto.name, r_name) == 0)
3559 1.1 christos return &elf_mips_gnu_vtinherit_howto;
3560 1.1.1.2 christos if (strcasecmp (elf_mips_gnu_vtentry_howto.name, r_name) == 0)
3561 1.1.1.2 christos return &elf_mips_gnu_vtentry_howto;
3562 1.1.1.2 christos if (strcasecmp (elf_mips_gnu_rel16_s2.name, r_name) == 0)
3563 1.1.1.2 christos return &elf_mips_gnu_rel16_s2;
3564 1.1 christos if (strcasecmp (elf_mips_gnu_rela16_s2.name, r_name) == 0)
3565 1.1 christos return &elf_mips_gnu_rela16_s2;
3566 1.1 christos if (strcasecmp (elf_mips_gnu_pcrel32.name, r_name) == 0)
3567 1.1 christos return &elf_mips_gnu_pcrel32;
3568 1.1 christos if (strcasecmp (elf_mips_eh_howto.name, r_name) == 0)
3569 1.1 christos return &elf_mips_eh_howto;
3570 1.1 christos if (strcasecmp (elf_mips_copy_howto.name, r_name) == 0)
3571 1.1 christos return &elf_mips_copy_howto;
3572 1.1 christos if (strcasecmp (elf_mips_jump_slot_howto.name, r_name) == 0)
3573 1.1 christos return &elf_mips_jump_slot_howto;
3574 1.1 christos
3575 1.1.1.4 christos return NULL;
3576 1.1 christos }
3577 1.1.1.4 christos
3578 1.1.1.4 christos /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
3579 1.1 christos
3580 1.1 christos static reloc_howto_type *
3581 1.1 christos mips_elf64_rtype_to_howto (bfd *abfd, unsigned int r_type, bfd_boolean rela_p)
3582 1.1 christos {
3583 1.1 christos reloc_howto_type *howto = NULL;
3584 1.1 christos
3585 1.1 christos switch (r_type)
3586 1.1 christos {
3587 1.1 christos case R_MIPS_GNU_VTINHERIT:
3588 1.1 christos return &elf_mips_gnu_vtinherit_howto;
3589 1.1 christos case R_MIPS_GNU_VTENTRY:
3590 1.1.1.2 christos return &elf_mips_gnu_vtentry_howto;
3591 1.1.1.2 christos case R_MIPS_GNU_REL16_S2:
3592 1.1.1.2 christos if (rela_p)
3593 1.1.1.2 christos return &elf_mips_gnu_rela16_s2;
3594 1.1 christos else
3595 1.1 christos return &elf_mips_gnu_rel16_s2;
3596 1.1 christos case R_MIPS_PC32:
3597 1.1 christos return &elf_mips_gnu_pcrel32;
3598 1.1 christos case R_MIPS_EH:
3599 1.1 christos return &elf_mips_eh_howto;
3600 1.1 christos case R_MIPS_COPY:
3601 1.1 christos return &elf_mips_copy_howto;
3602 1.1.1.4 christos case R_MIPS_JUMP_SLOT:
3603 1.1.1.4 christos return &elf_mips_jump_slot_howto;
3604 1.1 christos default:
3605 1.1.1.4 christos if (r_type >= R_MICROMIPS_min && r_type < R_MICROMIPS_max)
3606 1.1.1.4 christos {
3607 1.1 christos if (rela_p)
3608 1.1 christos howto
3609 1.1 christos = µmips_elf64_howto_table_rela[r_type - R_MICROMIPS_min];
3610 1.1 christos else
3611 1.1.1.4 christos howto
3612 1.1 christos = µmips_elf64_howto_table_rel[r_type - R_MICROMIPS_min];
3613 1.1.1.4 christos }
3614 1.1 christos if (r_type >= R_MIPS16_min && r_type < R_MIPS16_max)
3615 1.1.1.4 christos {
3616 1.1.1.2 christos if (rela_p)
3617 1.1.1.4 christos howto = &mips16_elf64_howto_table_rela[r_type - R_MIPS16_min];
3618 1.1.1.4 christos else
3619 1.1.1.4 christos howto = &mips16_elf64_howto_table_rel[r_type - R_MIPS16_min];
3620 1.1.1.4 christos }
3621 1.1.1.2 christos if (r_type < R_MIPS_max)
3622 1.1.1.4 christos {
3623 1.1.1.4 christos if (rela_p)
3624 1.1.1.4 christos howto = &mips_elf64_howto_table_rela[r_type];
3625 1.1.1.4 christos else
3626 1.1.1.4 christos howto = &mips_elf64_howto_table_rel[r_type];
3627 1.1.1.4 christos }
3628 1.1.1.4 christos if (howto != NULL && howto->name != NULL)
3629 1.1 christos return howto;
3630 1.1 christos
3631 1.1 christos _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
3632 1.1 christos abfd, r_type);
3633 1.1 christos bfd_set_error (bfd_error_bad_value);
3634 1.1.1.4 christos return NULL;
3635 1.1.1.4 christos }
3636 1.1 christos }
3637 1.1.1.4 christos
3638 1.1 christos /* Prevent relocation handling by bfd for MIPS ELF64. */
3639 1.1.1.4 christos
3640 1.1.1.4 christos static bfd_boolean
3641 1.1.1.4 christos mips_elf64_info_to_howto_rela (bfd *abfd,
3642 1.1.1.4 christos arelent *cache_ptr ATTRIBUTE_UNUSED,
3643 1.1.1.4 christos Elf_Internal_Rela *dst)
3644 1.1.1.4 christos {
3645 1.1 christos unsigned int r_type = ELF32_R_TYPE (dst->r_info);
3646 1.1 christos /* xgettext:c-format */
3647 1.1 christos _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
3648 1.1 christos abfd, r_type);
3649 1.1 christos bfd_set_error (bfd_error_bad_value);
3650 1.1 christos return FALSE;
3651 1.1 christos }
3652 1.1 christos
3653 1.1 christos /* Since each entry in an SHT_REL or SHT_RELA section can represent up
3654 1.1 christos to three relocs, we must tell the user to allocate more space. */
3655 1.1 christos
3656 1.1 christos static long
3657 1.1 christos mips_elf64_get_dynamic_reloc_upper_bound (bfd *abfd)
3658 1.1.1.4 christos {
3659 1.1.1.4 christos return _bfd_elf_get_dynamic_reloc_upper_bound (abfd) * 3;
3660 1.1.1.4 christos }
3661 1.1.1.4 christos
3662 1.1.1.4 christos /* Read the relocations from one reloc section. This is mostly copied
3663 1.1.1.4 christos from elfcode.h, except for the changes to expand one external
3664 1.1 christos relocation to 3 internal ones. To reduce processing effort we
3665 1.1 christos could discard those R_MIPS_NONE relocations that occupy the second
3666 1.1 christos and the third entry of a triplet, as `mips_elf64_write_rel' and
3667 1.1 christos `mips_elf64_write_rela' recreate them in output automagically,
3668 1.1 christos however that would also remove them from `objdump -r' output,
3669 1.1 christos breaking a long-established tradition and likely confusing people. */
3670 1.1 christos
3671 1.1 christos static bfd_boolean
3672 1.1 christos mips_elf64_slurp_one_reloc_table (bfd *abfd, asection *asect,
3673 1.1 christos Elf_Internal_Shdr *rel_hdr,
3674 1.1.1.4 christos bfd_size_type reloc_count,
3675 1.1 christos arelent *relents, asymbol **symbols,
3676 1.1 christos bfd_boolean dynamic)
3677 1.1 christos {
3678 1.1 christos void *allocated;
3679 1.1 christos bfd_byte *native_relocs;
3680 1.1 christos unsigned int symcount;
3681 1.1 christos arelent *relent;
3682 1.1 christos bfd_vma i;
3683 1.1 christos int entsize;
3684 1.1 christos bfd_boolean rela_p;
3685 1.1 christos
3686 1.1 christos allocated = bfd_malloc (rel_hdr->sh_size);
3687 1.1 christos if (allocated == NULL)
3688 1.1 christos return FALSE;
3689 1.1 christos
3690 1.1 christos if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0
3691 1.1 christos || (bfd_bread (allocated, rel_hdr->sh_size, abfd)
3692 1.1 christos != rel_hdr->sh_size))
3693 1.1 christos goto error_return;
3694 1.1 christos
3695 1.1 christos native_relocs = allocated;
3696 1.1 christos
3697 1.1 christos entsize = rel_hdr->sh_entsize;
3698 1.1 christos BFD_ASSERT (entsize == sizeof (Elf64_Mips_External_Rel)
3699 1.1 christos || entsize == sizeof (Elf64_Mips_External_Rela));
3700 1.1.1.4 christos
3701 1.1.1.4 christos if (entsize == sizeof (Elf64_Mips_External_Rel))
3702 1.1.1.4 christos rela_p = FALSE;
3703 1.1.1.4 christos else
3704 1.1.1.4 christos rela_p = TRUE;
3705 1.1 christos
3706 1.1 christos if (dynamic)
3707 1.1 christos symcount = bfd_get_dynamic_symcount (abfd);
3708 1.1 christos else
3709 1.1 christos symcount = bfd_get_symcount (abfd);
3710 1.1 christos
3711 1.1 christos for (i = 0, relent = relents;
3712 1.1 christos i < reloc_count;
3713 1.1 christos i++, native_relocs += entsize)
3714 1.1 christos {
3715 1.1 christos Elf64_Mips_Internal_Rela rela;
3716 1.1 christos bfd_boolean used_sym, used_ssym;
3717 1.1 christos int ir;
3718 1.1 christos
3719 1.1 christos if (entsize == sizeof (Elf64_Mips_External_Rela))
3720 1.1 christos mips_elf64_swap_reloca_in (abfd,
3721 1.1 christos (Elf64_Mips_External_Rela *) native_relocs,
3722 1.1 christos &rela);
3723 1.1 christos else
3724 1.1 christos mips_elf64_swap_reloc_in (abfd,
3725 1.1 christos (Elf64_Mips_External_Rel *) native_relocs,
3726 1.1 christos &rela);
3727 1.1 christos
3728 1.1 christos /* Each entry represents exactly three actual relocations. */
3729 1.1 christos
3730 1.1 christos used_sym = FALSE;
3731 1.1 christos used_ssym = FALSE;
3732 1.1 christos for (ir = 0; ir < 3; ir++)
3733 1.1 christos {
3734 1.1 christos enum elf_mips_reloc_type type;
3735 1.1 christos
3736 1.1 christos switch (ir)
3737 1.1 christos {
3738 1.1 christos default:
3739 1.1 christos abort ();
3740 1.1 christos case 0:
3741 1.1 christos type = (enum elf_mips_reloc_type) rela.r_type;
3742 1.1 christos break;
3743 1.1 christos case 1:
3744 1.1 christos type = (enum elf_mips_reloc_type) rela.r_type2;
3745 1.1 christos break;
3746 1.1 christos case 2:
3747 1.1 christos type = (enum elf_mips_reloc_type) rela.r_type3;
3748 1.1 christos break;
3749 1.1 christos }
3750 1.1 christos
3751 1.1 christos /* Some types require symbols, whereas some do not. */
3752 1.1 christos switch (type)
3753 1.1 christos {
3754 1.1 christos case R_MIPS_NONE:
3755 1.1 christos case R_MIPS_LITERAL:
3756 1.1 christos case R_MIPS_INSERT_A:
3757 1.1 christos case R_MIPS_INSERT_B:
3758 1.1 christos case R_MIPS_DELETE:
3759 1.1 christos relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
3760 1.1 christos break;
3761 1.1.1.4 christos
3762 1.1.1.4 christos default:
3763 1.1.1.4 christos if (! used_sym)
3764 1.1.1.4 christos {
3765 1.1.1.4 christos if (rela.r_sym == STN_UNDEF)
3766 1.1.1.4 christos relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
3767 1.1.1.4 christos else if (rela.r_sym > symcount)
3768 1.1.1.4 christos {
3769 1.1.1.4 christos _bfd_error_handler
3770 1.1.1.4 christos /* xgettext:c-format */
3771 1.1.1.4 christos (_("%pB(%pA): relocation %" PRIu64
3772 1.1 christos " has invalid symbol index %ld"),
3773 1.1 christos abfd, asect, (uint64_t) i, rela.r_sym);
3774 1.1 christos bfd_set_error (bfd_error_bad_value);
3775 1.1 christos relent->sym_ptr_ptr
3776 1.1 christos = bfd_abs_section_ptr->symbol_ptr_ptr;
3777 1.1 christos }
3778 1.1 christos else
3779 1.1 christos {
3780 1.1 christos asymbol **ps, *s;
3781 1.1 christos
3782 1.1 christos ps = symbols + rela.r_sym - 1;
3783 1.1 christos s = *ps;
3784 1.1 christos if ((s->flags & BSF_SECTION_SYM) == 0)
3785 1.1 christos relent->sym_ptr_ptr = ps;
3786 1.1 christos else
3787 1.1 christos relent->sym_ptr_ptr = s->section->symbol_ptr_ptr;
3788 1.1 christos }
3789 1.1 christos
3790 1.1 christos used_sym = TRUE;
3791 1.1 christos }
3792 1.1 christos else if (! used_ssym)
3793 1.1 christos {
3794 1.1 christos switch (rela.r_ssym)
3795 1.1 christos {
3796 1.1 christos case RSS_UNDEF:
3797 1.1 christos relent->sym_ptr_ptr =
3798 1.1 christos bfd_abs_section_ptr->symbol_ptr_ptr;
3799 1.1 christos break;
3800 1.1 christos
3801 1.1 christos case RSS_GP:
3802 1.1 christos case RSS_GP0:
3803 1.1 christos case RSS_LOC:
3804 1.1 christos /* FIXME: I think these need to be handled using
3805 1.1 christos special howto structures. */
3806 1.1 christos BFD_ASSERT (0);
3807 1.1 christos break;
3808 1.1 christos
3809 1.1 christos default:
3810 1.1 christos BFD_ASSERT (0);
3811 1.1 christos break;
3812 1.1 christos }
3813 1.1 christos
3814 1.1 christos used_ssym = TRUE;
3815 1.1 christos }
3816 1.1 christos else
3817 1.1 christos relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
3818 1.1 christos
3819 1.1 christos break;
3820 1.1 christos }
3821 1.1 christos
3822 1.1 christos /* The address of an ELF reloc is section relative for an
3823 1.1 christos object file, and absolute for an executable file or
3824 1.1 christos shared library. The address of a BFD reloc is always
3825 1.1 christos section relative. */
3826 1.1 christos if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0 || dynamic)
3827 1.1.1.4 christos relent->address = rela.r_offset;
3828 1.1.1.4 christos else
3829 1.1.1.4 christos relent->address = rela.r_offset - asect->vma;
3830 1.1 christos
3831 1.1 christos relent->addend = rela.r_addend;
3832 1.1 christos
3833 1.1 christos relent->howto = mips_elf64_rtype_to_howto (abfd, type, rela_p);
3834 1.1 christos if (relent->howto == NULL)
3835 1.1 christos goto error_return;
3836 1.1 christos
3837 1.1 christos ++relent;
3838 1.1 christos }
3839 1.1 christos }
3840 1.1 christos
3841 1.1 christos if (allocated != NULL)
3842 1.1 christos free (allocated);
3843 1.1 christos
3844 1.1 christos return TRUE;
3845 1.1 christos
3846 1.1 christos error_return:
3847 1.1 christos if (allocated != NULL)
3848 1.1 christos free (allocated);
3849 1.1.1.4 christos return FALSE;
3850 1.1 christos }
3851 1.1 christos
3852 1.1 christos /* Read the relocations. On Irix 6, there can be two reloc sections
3853 1.1 christos associated with a single data section. This is copied from
3854 1.1 christos elfcode.h as well, with changes as small as accounting for 3
3855 1.1 christos internal relocs per external reloc. */
3856 1.1 christos
3857 1.1 christos static bfd_boolean
3858 1.1 christos mips_elf64_slurp_reloc_table (bfd *abfd, asection *asect,
3859 1.1 christos asymbol **symbols, bfd_boolean dynamic)
3860 1.1 christos {
3861 1.1 christos struct bfd_elf_section_data * const d = elf_section_data (asect);
3862 1.1 christos Elf_Internal_Shdr *rel_hdr;
3863 1.1 christos Elf_Internal_Shdr *rel_hdr2;
3864 1.1 christos bfd_size_type reloc_count;
3865 1.1 christos bfd_size_type reloc_count2;
3866 1.1 christos arelent *relents;
3867 1.1 christos bfd_size_type amt;
3868 1.1 christos
3869 1.1 christos if (asect->relocation != NULL)
3870 1.1 christos return TRUE;
3871 1.1 christos
3872 1.1 christos if (! dynamic)
3873 1.1 christos {
3874 1.1 christos if ((asect->flags & SEC_RELOC) == 0
3875 1.1 christos || asect->reloc_count == 0)
3876 1.1 christos return TRUE;
3877 1.1.1.4 christos
3878 1.1 christos rel_hdr = d->rel.hdr;
3879 1.1 christos reloc_count = rel_hdr ? NUM_SHDR_ENTRIES (rel_hdr) : 0;
3880 1.1 christos rel_hdr2 = d->rela.hdr;
3881 1.1 christos reloc_count2 = (rel_hdr2 ? NUM_SHDR_ENTRIES (rel_hdr2) : 0);
3882 1.1 christos
3883 1.1 christos BFD_ASSERT (asect->reloc_count == 3 * (reloc_count + reloc_count2));
3884 1.1 christos BFD_ASSERT ((rel_hdr && asect->rel_filepos == rel_hdr->sh_offset)
3885 1.1 christos || (rel_hdr2 && asect->rel_filepos == rel_hdr2->sh_offset));
3886 1.1 christos
3887 1.1 christos }
3888 1.1 christos else
3889 1.1 christos {
3890 1.1 christos /* Note that ASECT->RELOC_COUNT tends not to be accurate in this
3891 1.1 christos case because relocations against this section may use the
3892 1.1 christos dynamic symbol table, and in that case bfd_section_from_shdr
3893 1.1 christos in elf.c does not update the RELOC_COUNT. */
3894 1.1 christos if (asect->size == 0)
3895 1.1 christos return TRUE;
3896 1.1 christos
3897 1.1 christos rel_hdr = &d->this_hdr;
3898 1.1 christos reloc_count = NUM_SHDR_ENTRIES (rel_hdr);
3899 1.1 christos rel_hdr2 = NULL;
3900 1.1 christos reloc_count2 = 0;
3901 1.1 christos }
3902 1.1 christos
3903 1.1 christos /* Allocate space for 3 arelent structures for each Rel structure. */
3904 1.1 christos amt = (reloc_count + reloc_count2) * 3 * sizeof (arelent);
3905 1.1 christos relents = bfd_alloc (abfd, amt);
3906 1.1 christos if (relents == NULL)
3907 1.1 christos return FALSE;
3908 1.1 christos
3909 1.1 christos if (rel_hdr != NULL
3910 1.1 christos && ! mips_elf64_slurp_one_reloc_table (abfd, asect,
3911 1.1 christos rel_hdr, reloc_count,
3912 1.1 christos relents,
3913 1.1 christos symbols, dynamic))
3914 1.1 christos return FALSE;
3915 1.1 christos if (rel_hdr2 != NULL
3916 1.1 christos && ! mips_elf64_slurp_one_reloc_table (abfd, asect,
3917 1.1 christos rel_hdr2, reloc_count2,
3918 1.1 christos relents + reloc_count * 3,
3919 1.1 christos symbols, dynamic))
3920 1.1 christos return FALSE;
3921 1.1 christos
3922 1.1 christos asect->relocation = relents;
3923 1.1 christos return TRUE;
3924 1.1 christos }
3925 1.1 christos
3926 1.1 christos /* Write out the relocations. */
3927 1.1 christos
3928 1.1 christos static void
3929 1.1 christos mips_elf64_write_relocs (bfd *abfd, asection *sec, void *data)
3930 1.1 christos {
3931 1.1 christos bfd_boolean *failedp = data;
3932 1.1 christos int count;
3933 1.1 christos Elf_Internal_Shdr *rel_hdr;
3934 1.1 christos unsigned int idx;
3935 1.1 christos
3936 1.1 christos /* If we have already failed, don't do anything. */
3937 1.1 christos if (*failedp)
3938 1.1 christos return;
3939 1.1 christos
3940 1.1 christos if ((sec->flags & SEC_RELOC) == 0)
3941 1.1 christos return;
3942 1.1 christos
3943 1.1 christos /* The linker backend writes the relocs out itself, and sets the
3944 1.1 christos reloc_count field to zero to inhibit writing them here. Also,
3945 1.1 christos sometimes the SEC_RELOC flag gets set even when there aren't any
3946 1.1 christos relocs. */
3947 1.1 christos if (sec->reloc_count == 0)
3948 1.1 christos return;
3949 1.1 christos
3950 1.1 christos /* We can combine up to three relocs that refer to the same address
3951 1.1 christos if the latter relocs have no associated symbol. */
3952 1.1 christos count = 0;
3953 1.1 christos for (idx = 0; idx < sec->reloc_count; idx++)
3954 1.1 christos {
3955 1.1 christos bfd_vma addr;
3956 1.1 christos unsigned int i;
3957 1.1 christos
3958 1.1 christos ++count;
3959 1.1 christos
3960 1.1 christos addr = sec->orelocation[idx]->address;
3961 1.1 christos for (i = 0; i < 2; i++)
3962 1.1 christos {
3963 1.1 christos arelent *r;
3964 1.1 christos
3965 1.1 christos if (idx + 1 >= sec->reloc_count)
3966 1.1 christos break;
3967 1.1 christos r = sec->orelocation[idx + 1];
3968 1.1 christos if (r->address != addr
3969 1.1 christos || ! bfd_is_abs_section ((*r->sym_ptr_ptr)->section)
3970 1.1 christos || (*r->sym_ptr_ptr)->value != 0)
3971 1.1 christos break;
3972 1.1 christos
3973 1.1 christos /* We can merge the reloc at IDX + 1 with the reloc at IDX. */
3974 1.1 christos
3975 1.1 christos ++idx;
3976 1.1 christos }
3977 1.1 christos }
3978 1.1 christos
3979 1.1 christos rel_hdr = _bfd_elf_single_rel_hdr (sec);
3980 1.1 christos
3981 1.1 christos /* Do the actual relocation. */
3982 1.1 christos
3983 1.1 christos if (rel_hdr->sh_entsize == sizeof(Elf64_Mips_External_Rel))
3984 1.1 christos mips_elf64_write_rel (abfd, sec, rel_hdr, &count, data);
3985 1.1 christos else if (rel_hdr->sh_entsize == sizeof(Elf64_Mips_External_Rela))
3986 1.1 christos mips_elf64_write_rela (abfd, sec, rel_hdr, &count, data);
3987 1.1 christos else
3988 1.1 christos BFD_ASSERT (0);
3989 1.1 christos }
3990 1.1 christos
3991 1.1 christos static void
3992 1.1 christos mips_elf64_write_rel (bfd *abfd, asection *sec,
3993 1.1 christos Elf_Internal_Shdr *rel_hdr,
3994 1.1 christos int *count, void *data)
3995 1.1 christos {
3996 1.1 christos bfd_boolean *failedp = data;
3997 1.1 christos Elf64_Mips_External_Rel *ext_rel;
3998 1.1 christos unsigned int idx;
3999 1.1 christos asymbol *last_sym = 0;
4000 1.1 christos int last_sym_idx = 0;
4001 1.1 christos
4002 1.1 christos rel_hdr->sh_size = rel_hdr->sh_entsize * *count;
4003 1.1 christos rel_hdr->contents = bfd_alloc (abfd, rel_hdr->sh_size);
4004 1.1 christos if (rel_hdr->contents == NULL)
4005 1.1 christos {
4006 1.1 christos *failedp = TRUE;
4007 1.1 christos return;
4008 1.1 christos }
4009 1.1 christos
4010 1.1 christos ext_rel = (Elf64_Mips_External_Rel *) rel_hdr->contents;
4011 1.1 christos for (idx = 0; idx < sec->reloc_count; idx++, ext_rel++)
4012 1.1 christos {
4013 1.1 christos arelent *ptr;
4014 1.1 christos Elf64_Mips_Internal_Rela int_rel;
4015 1.1 christos asymbol *sym;
4016 1.1 christos int n;
4017 1.1 christos unsigned int i;
4018 1.1 christos
4019 1.1 christos ptr = sec->orelocation[idx];
4020 1.1 christos
4021 1.1 christos /* The address of an ELF reloc is section relative for an object
4022 1.1 christos file, and absolute for an executable file or shared library.
4023 1.1 christos The address of a BFD reloc is always section relative. */
4024 1.1 christos if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
4025 1.1 christos int_rel.r_offset = ptr->address;
4026 1.1 christos else
4027 1.1 christos int_rel.r_offset = ptr->address + sec->vma;
4028 1.1 christos
4029 1.1 christos sym = *ptr->sym_ptr_ptr;
4030 1.1 christos if (sym == last_sym)
4031 1.1 christos n = last_sym_idx;
4032 1.1 christos else if (bfd_is_abs_section (sym->section) && sym->value == 0)
4033 1.1 christos n = STN_UNDEF;
4034 1.1 christos else
4035 1.1 christos {
4036 1.1 christos last_sym = sym;
4037 1.1 christos n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
4038 1.1 christos if (n < 0)
4039 1.1 christos {
4040 1.1 christos *failedp = TRUE;
4041 1.1 christos return;
4042 1.1 christos }
4043 1.1.1.4 christos last_sym_idx = n;
4044 1.1.1.4 christos }
4045 1.1 christos
4046 1.1 christos int_rel.r_sym = n;
4047 1.1 christos int_rel.r_ssym = RSS_UNDEF;
4048 1.1 christos
4049 1.1 christos if ((*ptr->sym_ptr_ptr)->the_bfd != NULL
4050 1.1 christos && (*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
4051 1.1 christos && ! _bfd_elf_validate_reloc (abfd, ptr))
4052 1.1 christos {
4053 1.1 christos *failedp = TRUE;
4054 1.1 christos return;
4055 1.1 christos }
4056 1.1 christos
4057 1.1 christos int_rel.r_type = ptr->howto->type;
4058 1.1 christos int_rel.r_type2 = (int) R_MIPS_NONE;
4059 1.1 christos int_rel.r_type3 = (int) R_MIPS_NONE;
4060 1.1 christos
4061 1.1 christos for (i = 0; i < 2; i++)
4062 1.1 christos {
4063 1.1 christos arelent *r;
4064 1.1 christos
4065 1.1 christos if (idx + 1 >= sec->reloc_count)
4066 1.1 christos break;
4067 1.1 christos r = sec->orelocation[idx + 1];
4068 1.1 christos if (r->address != ptr->address
4069 1.1 christos || ! bfd_is_abs_section ((*r->sym_ptr_ptr)->section)
4070 1.1 christos || (*r->sym_ptr_ptr)->value != 0)
4071 1.1 christos break;
4072 1.1 christos
4073 1.1 christos /* We can merge the reloc at IDX + 1 with the reloc at IDX. */
4074 1.1 christos
4075 1.1 christos if (i == 0)
4076 1.1 christos int_rel.r_type2 = r->howto->type;
4077 1.1 christos else
4078 1.1 christos int_rel.r_type3 = r->howto->type;
4079 1.1 christos
4080 1.1 christos ++idx;
4081 1.1 christos }
4082 1.1 christos
4083 1.1 christos mips_elf64_swap_reloc_out (abfd, &int_rel, ext_rel);
4084 1.1 christos }
4085 1.1 christos
4086 1.1 christos BFD_ASSERT (ext_rel - (Elf64_Mips_External_Rel *) rel_hdr->contents
4087 1.1 christos == *count);
4088 1.1 christos }
4089 1.1 christos
4090 1.1 christos static void
4091 1.1 christos mips_elf64_write_rela (bfd *abfd, asection *sec,
4092 1.1 christos Elf_Internal_Shdr *rela_hdr,
4093 1.1 christos int *count, void *data)
4094 1.1 christos {
4095 1.1 christos bfd_boolean *failedp = data;
4096 1.1 christos Elf64_Mips_External_Rela *ext_rela;
4097 1.1 christos unsigned int idx;
4098 1.1 christos asymbol *last_sym = 0;
4099 1.1 christos int last_sym_idx = 0;
4100 1.1 christos
4101 1.1 christos rela_hdr->sh_size = rela_hdr->sh_entsize * *count;
4102 1.1 christos rela_hdr->contents = bfd_alloc (abfd, rela_hdr->sh_size);
4103 1.1 christos if (rela_hdr->contents == NULL)
4104 1.1 christos {
4105 1.1 christos *failedp = TRUE;
4106 1.1 christos return;
4107 1.1 christos }
4108 1.1 christos
4109 1.1 christos ext_rela = (Elf64_Mips_External_Rela *) rela_hdr->contents;
4110 1.1 christos for (idx = 0; idx < sec->reloc_count; idx++, ext_rela++)
4111 1.1 christos {
4112 1.1 christos arelent *ptr;
4113 1.1 christos Elf64_Mips_Internal_Rela int_rela;
4114 1.1 christos asymbol *sym;
4115 1.1 christos int n;
4116 1.1 christos unsigned int i;
4117 1.1 christos
4118 1.1 christos ptr = sec->orelocation[idx];
4119 1.1 christos
4120 1.1 christos /* The address of an ELF reloc is section relative for an object
4121 1.1 christos file, and absolute for an executable file or shared library.
4122 1.1 christos The address of a BFD reloc is always section relative. */
4123 1.1 christos if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
4124 1.1 christos int_rela.r_offset = ptr->address;
4125 1.1 christos else
4126 1.1 christos int_rela.r_offset = ptr->address + sec->vma;
4127 1.1 christos
4128 1.1 christos sym = *ptr->sym_ptr_ptr;
4129 1.1 christos if (sym == last_sym)
4130 1.1 christos n = last_sym_idx;
4131 1.1 christos else if (bfd_is_abs_section (sym->section) && sym->value == 0)
4132 1.1 christos n = STN_UNDEF;
4133 1.1 christos else
4134 1.1 christos {
4135 1.1 christos last_sym = sym;
4136 1.1 christos n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
4137 1.1 christos if (n < 0)
4138 1.1 christos {
4139 1.1 christos *failedp = TRUE;
4140 1.1 christos return;
4141 1.1 christos }
4142 1.1 christos last_sym_idx = n;
4143 1.1.1.4 christos }
4144 1.1.1.4 christos
4145 1.1 christos int_rela.r_sym = n;
4146 1.1 christos int_rela.r_addend = ptr->addend;
4147 1.1 christos int_rela.r_ssym = RSS_UNDEF;
4148 1.1 christos
4149 1.1 christos if ((*ptr->sym_ptr_ptr)->the_bfd != NULL
4150 1.1 christos && (*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
4151 1.1 christos && ! _bfd_elf_validate_reloc (abfd, ptr))
4152 1.1 christos {
4153 1.1 christos *failedp = TRUE;
4154 1.1 christos return;
4155 1.1 christos }
4156 1.1 christos
4157 1.1 christos int_rela.r_type = ptr->howto->type;
4158 1.1 christos int_rela.r_type2 = (int) R_MIPS_NONE;
4159 1.1 christos int_rela.r_type3 = (int) R_MIPS_NONE;
4160 1.1 christos
4161 1.1 christos for (i = 0; i < 2; i++)
4162 1.1 christos {
4163 1.1 christos arelent *r;
4164 1.1 christos
4165 1.1 christos if (idx + 1 >= sec->reloc_count)
4166 1.1 christos break;
4167 1.1 christos r = sec->orelocation[idx + 1];
4168 1.1 christos if (r->address != ptr->address
4169 1.1 christos || ! bfd_is_abs_section ((*r->sym_ptr_ptr)->section)
4170 1.1 christos || (*r->sym_ptr_ptr)->value != 0)
4171 1.1 christos break;
4172 1.1 christos
4173 1.1 christos /* We can merge the reloc at IDX + 1 with the reloc at IDX. */
4174 1.1 christos
4175 1.1 christos if (i == 0)
4176 1.1 christos int_rela.r_type2 = r->howto->type;
4177 1.1 christos else
4178 1.1 christos int_rela.r_type3 = r->howto->type;
4179 1.1 christos
4180 1.1 christos ++idx;
4181 1.1 christos }
4182 1.1 christos
4183 1.1 christos mips_elf64_swap_reloca_out (abfd, &int_rela, ext_rela);
4184 1.1 christos }
4185 1.1 christos
4186 1.1 christos BFD_ASSERT (ext_rela - (Elf64_Mips_External_Rela *) rela_hdr->contents
4187 1.1 christos == *count);
4188 1.1 christos }
4189 1.1 christos
4190 1.1 christos /* Set the right machine number for a MIPS ELF file. */
4192 1.1 christos
4193 1.1 christos static bfd_boolean
4194 1.1 christos mips_elf64_object_p (bfd *abfd)
4195 1.1 christos {
4196 1.1 christos unsigned long mach;
4197 1.1 christos
4198 1.1 christos /* Irix 6 is broken. Object file symbol tables are not always
4199 1.1 christos sorted correctly such that local symbols precede global symbols,
4200 1.1 christos and the sh_info field in the symbol table is not always right. */
4201 1.1 christos if (elf64_mips_irix_compat (abfd) != ict_none)
4202 1.1 christos elf_bad_symtab (abfd) = TRUE;
4203 1.1 christos
4204 1.1 christos mach = _bfd_elf_mips_mach (elf_elfheader (abfd)->e_flags);
4205 1.1 christos bfd_default_set_arch_mach (abfd, bfd_arch_mips, mach);
4206 1.1 christos return TRUE;
4207 1.1 christos }
4208 1.1 christos
4209 1.1 christos /* MIPS ELF local labels start with "$L". */
4211 1.1 christos static bfd_boolean
4212 1.1 christos mips_elf64_is_local_label_name (bfd *abfd, const char *name)
4213 1.1 christos {
4214 1.1 christos if (name[0] == '$' && name[1] == 'L')
4215 1.1 christos return TRUE;
4216 1.1 christos
4217 1.1 christos /* We accept the generic ELF local label syntax as well. */
4218 1.1.1.2 christos return _bfd_elf_is_local_label_name (abfd, name);
4219 1.1.1.2 christos }
4220 1.1 christos
4221 1.1 christos /* Depending on the target vector we generate some version of Irix
4223 1.1 christos executables or "normal" MIPS ELF ABI executables. */
4224 1.1 christos static irix_compat_t
4225 1.1 christos elf64_mips_irix_compat (bfd *abfd)
4226 1.1 christos {
4227 1.1 christos if ((abfd->xvec == &mips_elf64_be_vec)
4228 1.1 christos || (abfd->xvec == &mips_elf64_le_vec))
4229 1.1 christos return ict_irix6;
4230 1.1 christos else
4231 1.1 christos return ict_none;
4232 1.1 christos }
4233 1.1 christos
4234 1.1 christos /* Support for core dump NOTE sections. */
4236 1.1 christos static bfd_boolean
4237 1.1 christos elf64_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
4238 1.1 christos {
4239 1.1.1.2 christos int offset;
4240 1.1 christos unsigned int size;
4241 1.1 christos
4242 1.1.1.2 christos switch (note->descsz)
4243 1.1 christos {
4244 1.1 christos default:
4245 1.1 christos return FALSE;
4246 1.1 christos
4247 1.1 christos case 480: /* Linux/MIPS - N64 kernel */
4248 1.1 christos /* pr_cursig */
4249 1.1 christos elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
4250 1.1 christos
4251 1.1 christos /* pr_pid */
4252 1.1 christos elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 32);
4253 1.1 christos
4254 1.1 christos /* pr_reg */
4255 1.1 christos offset = 112;
4256 1.1 christos size = 360;
4257 1.1 christos
4258 1.1 christos break;
4259 1.1 christos }
4260 1.1 christos
4261 1.1 christos /* Make a ".reg/999" section. */
4262 1.1 christos return _bfd_elfcore_make_pseudosection (abfd, ".reg",
4263 1.1 christos size, note->descpos + offset);
4264 1.1 christos }
4265 1.1.1.4 christos
4266 1.1.1.4 christos static bfd_boolean
4267 1.1.1.2 christos elf64_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
4268 1.1 christos {
4269 1.1.1.2 christos switch (note->descsz)
4270 1.1 christos {
4271 1.1 christos default:
4272 1.1 christos return FALSE;
4273 1.1 christos
4274 1.1 christos case 136: /* Linux/MIPS - N64 kernel elf_prpsinfo */
4275 1.1 christos elf_tdata (abfd)->core->pid
4276 1.1 christos = bfd_get_32 (abfd, note->descdata + 24);
4277 1.1 christos elf_tdata (abfd)->core->program
4278 1.1.1.2 christos = _bfd_elfcore_strndup (abfd, note->descdata + 40, 16);
4279 1.1 christos elf_tdata (abfd)->core->command
4280 1.1 christos = _bfd_elfcore_strndup (abfd, note->descdata + 56, 80);
4281 1.1 christos }
4282 1.1 christos
4283 1.1 christos /* Note that for some reason, a spurious space is tacked
4284 1.1 christos onto the end of the args in some (at least one anyway)
4285 1.1 christos implementations, so strip it off if it exists. */
4286 1.1 christos
4287 1.1.1.4 christos {
4288 1.1.1.4 christos char *command = elf_tdata (abfd)->core->command;
4289 1.1.1.4 christos int n = strlen (command);
4290 1.1.1.4 christos
4291 1.1.1.4 christos if (0 < n && command[n - 1] == ' ')
4292 1.1.1.4 christos command[n - 1] = '\0';
4293 1.1.1.4 christos }
4294 1.1.1.4 christos
4295 1.1.1.4 christos return TRUE;
4296 1.1.1.4 christos }
4297 1.1.1.4 christos
4298 1.1.1.4 christos /* Write Linux core PRSTATUS note into core file. */
4299 1.1.1.4 christos
4300 1.1.1.4 christos static char *
4301 1.1.1.4 christos elf64_mips_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type,
4302 1.1.1.4 christos ...)
4303 1.1.1.4 christos {
4304 1.1.1.4 christos switch (note_type)
4305 1.1.1.4 christos {
4306 1.1.1.4 christos default:
4307 1.1.1.4 christos return NULL;
4308 1.1.1.4 christos
4309 1.1.1.4 christos case NT_PRPSINFO:
4310 1.1.1.4 christos BFD_FAIL ();
4311 1.1.1.4 christos return NULL;
4312 1.1.1.4 christos
4313 1.1.1.4 christos case NT_PRSTATUS:
4314 1.1.1.4 christos {
4315 1.1.1.4 christos char data[480];
4316 1.1.1.4 christos va_list ap;
4317 1.1.1.4 christos long pid;
4318 1.1.1.4 christos int cursig;
4319 1.1.1.4 christos const void *greg;
4320 1.1.1.4 christos
4321 1.1.1.4 christos va_start (ap, note_type);
4322 1.1.1.4 christos memset (data, 0, 112);
4323 1.1.1.4 christos pid = va_arg (ap, long);
4324 1.1.1.4 christos bfd_put_32 (abfd, pid, data + 32);
4325 1.1.1.4 christos cursig = va_arg (ap, int);
4326 1.1 christos bfd_put_16 (abfd, cursig, data + 12);
4327 1.1 christos greg = va_arg (ap, const void *);
4328 1.1 christos memcpy (data + 112, greg, 360);
4329 1.1 christos memset (data + 472, 0, 8);
4330 1.1 christos va_end (ap);
4331 1.1 christos return elfcore_write_note (abfd, buf, bufsiz,
4332 1.1 christos "CORE", note_type, data, sizeof (data));
4333 1.1 christos }
4334 1.1 christos }
4335 1.1 christos }
4336 1.1 christos
4337 1.1 christos /* ECOFF swapping routines. These are used when dealing with the
4339 1.1 christos .mdebug section, which is in the ECOFF debugging format. */
4340 1.1 christos static const struct ecoff_debug_swap mips_elf64_ecoff_debug_swap =
4341 1.1 christos {
4342 1.1 christos /* Symbol table magic number. */
4343 1.1 christos magicSym2,
4344 1.1 christos /* Alignment of debugging information. E.g., 4. */
4345 1.1 christos 8,
4346 1.1 christos /* Sizes of external symbolic information. */
4347 1.1 christos sizeof (struct hdr_ext),
4348 1.1 christos sizeof (struct dnr_ext),
4349 1.1 christos sizeof (struct pdr_ext),
4350 1.1 christos sizeof (struct sym_ext),
4351 1.1 christos sizeof (struct opt_ext),
4352 1.1 christos sizeof (struct fdr_ext),
4353 1.1 christos sizeof (struct rfd_ext),
4354 1.1 christos sizeof (struct ext_ext),
4355 1.1 christos /* Functions to swap in external symbolic data. */
4356 1.1 christos ecoff_swap_hdr_in,
4357 1.1 christos ecoff_swap_dnr_in,
4358 1.1 christos ecoff_swap_pdr_in,
4359 1.1 christos ecoff_swap_sym_in,
4360 1.1 christos ecoff_swap_opt_in,
4361 1.1 christos ecoff_swap_fdr_in,
4362 1.1 christos ecoff_swap_rfd_in,
4363 1.1 christos ecoff_swap_ext_in,
4364 1.1 christos _bfd_ecoff_swap_tir_in,
4365 1.1 christos _bfd_ecoff_swap_rndx_in,
4366 1.1 christos /* Functions to swap out external symbolic data. */
4367 1.1 christos ecoff_swap_hdr_out,
4368 1.1 christos ecoff_swap_dnr_out,
4369 1.1 christos ecoff_swap_pdr_out,
4370 1.1 christos ecoff_swap_sym_out,
4371 1.1 christos ecoff_swap_opt_out,
4372 1.1 christos ecoff_swap_fdr_out,
4373 1.1 christos ecoff_swap_rfd_out,
4374 1.1 christos ecoff_swap_ext_out,
4375 1.1 christos _bfd_ecoff_swap_tir_out,
4376 1.1 christos _bfd_ecoff_swap_rndx_out,
4377 1.1 christos /* Function to read in symbolic data. */
4378 1.1 christos _bfd_mips_elf_read_ecoff_info
4379 1.1 christos };
4380 1.1 christos
4381 1.1 christos /* Relocations in the 64 bit MIPS ELF ABI are more complex than in
4383 1.1 christos standard ELF. This structure is used to redirect the relocation
4384 1.1 christos handling routines. */
4385 1.1 christos
4386 1.1 christos const struct elf_size_info mips_elf64_size_info =
4387 1.1 christos {
4388 1.1 christos sizeof (Elf64_External_Ehdr),
4389 1.1 christos sizeof (Elf64_External_Phdr),
4390 1.1 christos sizeof (Elf64_External_Shdr),
4391 1.1 christos sizeof (Elf64_Mips_External_Rel),
4392 1.1 christos sizeof (Elf64_Mips_External_Rela),
4393 1.1 christos sizeof (Elf64_External_Sym),
4394 1.1 christos sizeof (Elf64_External_Dyn),
4395 1.1 christos sizeof (Elf_External_Note),
4396 1.1 christos 4, /* hash-table entry size */
4397 1.1 christos 3, /* internal relocations per external relocations */
4398 1.1 christos 64, /* arch_size */
4399 1.1 christos 3, /* log_file_align */
4400 1.1 christos ELFCLASS64,
4401 1.1 christos EV_CURRENT,
4402 1.1 christos bfd_elf64_write_out_phdrs,
4403 1.1 christos bfd_elf64_write_shdrs_and_ehdr,
4404 1.1 christos bfd_elf64_checksum_contents,
4405 1.1 christos mips_elf64_write_relocs,
4406 1.1 christos bfd_elf64_swap_symbol_in,
4407 1.1 christos bfd_elf64_swap_symbol_out,
4408 1.1 christos mips_elf64_slurp_reloc_table,
4409 1.1 christos bfd_elf64_slurp_symbol_table,
4410 1.1 christos bfd_elf64_swap_dyn_in,
4411 1.1 christos bfd_elf64_swap_dyn_out,
4412 1.1 christos mips_elf64_be_swap_reloc_in,
4413 1.1.1.2 christos mips_elf64_be_swap_reloc_out,
4414 1.1.1.2 christos mips_elf64_be_swap_reloca_in,
4415 1.1 christos mips_elf64_be_swap_reloca_out
4416 1.1.1.4 christos };
4417 1.1 christos
4418 1.1 christos #define ELF_ARCH bfd_arch_mips
4419 1.1 christos #define ELF_TARGET_ID MIPS_ELF_DATA
4420 1.1 christos #define ELF_MACHINE_CODE EM_MIPS
4421 1.1 christos
4422 1.1 christos #define elf_backend_collect TRUE
4423 1.1 christos #define elf_backend_type_change_ok TRUE
4424 1.1 christos #define elf_backend_can_gc_sections TRUE
4425 1.1 christos #define elf_backend_gc_mark_extra_sections \
4426 1.1 christos _bfd_mips_elf_gc_mark_extra_sections
4427 1.1 christos #define elf_info_to_howto mips_elf64_info_to_howto_rela
4428 1.1 christos #define elf_info_to_howto_rel mips_elf64_info_to_howto_rela
4429 1.1 christos #define elf_backend_object_p mips_elf64_object_p
4430 1.1 christos #define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing
4431 1.1 christos #define elf_backend_section_processing _bfd_mips_elf_section_processing
4432 1.1 christos #define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr
4433 1.1 christos #define elf_backend_fake_sections _bfd_mips_elf_fake_sections
4434 1.1 christos #define elf_backend_section_from_bfd_section \
4435 1.1 christos _bfd_mips_elf_section_from_bfd_section
4436 1.1 christos #define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook
4437 1.1 christos #define elf_backend_link_output_symbol_hook \
4438 1.1 christos _bfd_mips_elf_link_output_symbol_hook
4439 1.1 christos #define elf_backend_create_dynamic_sections \
4440 1.1 christos _bfd_mips_elf_create_dynamic_sections
4441 1.1 christos #define elf_backend_check_relocs _bfd_mips_elf_check_relocs
4442 1.1 christos #define elf_backend_merge_symbol_attribute \
4443 1.1 christos _bfd_mips_elf_merge_symbol_attribute
4444 1.1 christos #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag
4445 1.1 christos #define elf_backend_adjust_dynamic_symbol \
4446 1.1 christos _bfd_mips_elf_adjust_dynamic_symbol
4447 1.1 christos #define elf_backend_always_size_sections \
4448 1.1 christos _bfd_mips_elf_always_size_sections
4449 1.1 christos #define elf_backend_size_dynamic_sections \
4450 1.1 christos _bfd_mips_elf_size_dynamic_sections
4451 1.1 christos #define elf_backend_init_index_section _bfd_elf_init_1_index_section
4452 1.1 christos #define elf_backend_relocate_section _bfd_mips_elf_relocate_section
4453 1.1 christos #define elf_backend_finish_dynamic_symbol \
4454 1.1 christos _bfd_mips_elf_finish_dynamic_symbol
4455 1.1 christos #define elf_backend_finish_dynamic_sections \
4456 1.1 christos _bfd_mips_elf_finish_dynamic_sections
4457 1.1 christos #define elf_backend_final_write_processing \
4458 1.1 christos _bfd_mips_elf_final_write_processing
4459 1.1 christos #define elf_backend_additional_program_headers \
4460 1.1 christos _bfd_mips_elf_additional_program_headers
4461 1.1 christos #define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map
4462 1.1 christos #define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook
4463 1.1 christos #define elf_backend_copy_indirect_symbol \
4464 1.1.1.4 christos _bfd_mips_elf_copy_indirect_symbol
4465 1.1 christos #define elf_backend_ignore_discarded_relocs \
4466 1.1 christos _bfd_mips_elf_ignore_discarded_relocs
4467 1.1 christos #define elf_backend_mips_irix_compat elf64_mips_irix_compat
4468 1.1 christos #define elf_backend_mips_rtype_to_howto mips_elf64_rtype_to_howto
4469 1.1 christos #define elf_backend_ecoff_debug_swap &mips_elf64_ecoff_debug_swap
4470 1.1 christos #define elf_backend_size_info mips_elf64_size_info
4471 1.1 christos
4472 1.1 christos #define elf_backend_grok_prstatus elf64_mips_grok_prstatus
4473 1.1 christos #define elf_backend_grok_psinfo elf64_mips_grok_psinfo
4474 1.1 christos
4475 1.1 christos #define elf_backend_got_header_size (8 * MIPS_RESERVED_GOTNO)
4476 1.1 christos #define elf_backend_want_dynrelro 1
4477 1.1 christos
4478 1.1.1.2 christos /* MIPS ELF64 can use a mixture of REL and RELA, but some Relocations
4479 1.1 christos work better/work only in RELA, so we default to this. */
4480 1.1 christos #define elf_backend_may_use_rel_p 1
4481 1.1 christos #define elf_backend_may_use_rela_p 1
4482 1.1 christos #define elf_backend_default_use_rela_p 1
4483 1.1 christos #define elf_backend_rela_plts_and_copies_p 0
4484 1.1 christos #define elf_backend_plt_readonly 1
4485 1.1 christos #define elf_backend_plt_sym_val _bfd_mips_elf_plt_sym_val
4486 1.1 christos
4487 1.1 christos #define elf_backend_sign_extend_vma TRUE
4488 1.1 christos
4489 1.1 christos #define elf_backend_write_section _bfd_mips_elf_write_section
4490 1.1 christos #define elf_backend_sort_relocs_p _bfd_mips_elf_sort_relocs_p
4491 1.1 christos
4492 1.1 christos #define bfd_elf64_bfd_is_local_label_name \
4493 1.1 christos mips_elf64_is_local_label_name
4494 1.1 christos #define bfd_elf64_bfd_is_target_special_symbol \
4495 1.1 christos _bfd_mips_elf_is_target_special_symbol
4496 1.1 christos #define bfd_elf64_find_nearest_line _bfd_mips_elf_find_nearest_line
4497 1.1 christos #define bfd_elf64_find_inliner_info _bfd_mips_elf_find_inliner_info
4498 1.1 christos #define bfd_elf64_new_section_hook _bfd_mips_elf_new_section_hook
4499 1.1 christos #define bfd_elf64_set_section_contents _bfd_mips_elf_set_section_contents
4500 1.1.1.2 christos #define bfd_elf64_bfd_get_relocated_section_contents \
4501 1.1 christos _bfd_elf_mips_get_relocated_section_contents
4502 1.1 christos #define bfd_elf64_bfd_link_hash_table_create \
4503 1.1.1.2 christos _bfd_mips_elf_link_hash_table_create
4504 1.1 christos #define bfd_elf64_bfd_final_link _bfd_mips_elf_final_link
4505 1.1.1.2 christos #define bfd_elf64_bfd_merge_private_bfd_data \
4506 1.1 christos _bfd_mips_elf_merge_private_bfd_data
4507 1.1 christos #define bfd_elf64_bfd_set_private_flags _bfd_mips_elf_set_private_flags
4508 1.1 christos #define bfd_elf64_bfd_print_private_bfd_data \
4509 1.1 christos _bfd_mips_elf_print_private_bfd_data
4510 1.1 christos
4511 1.1 christos #define bfd_elf64_get_dynamic_reloc_upper_bound mips_elf64_get_dynamic_reloc_upper_bound
4512 1.1 christos #define bfd_elf64_mkobject _bfd_mips_elf_mkobject
4513 1.1 christos
4514 1.1 christos /* The SGI style (n)64 NewABI. */
4515 1.1 christos #define TARGET_LITTLE_SYM mips_elf64_le_vec
4516 1.1 christos #define TARGET_LITTLE_NAME "elf64-littlemips"
4517 1.1 christos #define TARGET_BIG_SYM mips_elf64_be_vec
4518 1.1 christos #define TARGET_BIG_NAME "elf64-bigmips"
4519 1.1 christos
4520 1.1 christos #define ELF_MAXPAGESIZE 0x10000
4521 1.1 christos #define ELF_COMMONPAGESIZE 0x1000
4522 1.1.1.2 christos
4523 1.1 christos #include "elf64-target.h"
4524 1.1.1.2 christos
4525 1.1 christos /* The SYSV-style 'traditional' (n)64 NewABI. */
4526 1.1 christos #undef TARGET_LITTLE_SYM
4527 1.1 christos #undef TARGET_LITTLE_NAME
4528 1.1 christos #undef TARGET_BIG_SYM
4529 1.1 christos #undef TARGET_BIG_NAME
4530 1.1 christos
4531 1.1.1.4 christos #undef ELF_MAXPAGESIZE
4532 1.1.1.4 christos #undef ELF_COMMONPAGESIZE
4533 1.1.1.4 christos
4534 1.1 christos #define TARGET_LITTLE_SYM mips_elf64_trad_le_vec
4535 1.1 christos #define TARGET_LITTLE_NAME "elf64-tradlittlemips"
4536 1.1 christos #define TARGET_BIG_SYM mips_elf64_trad_be_vec
4537 1.1 christos #define TARGET_BIG_NAME "elf64-tradbigmips"
4538 1.1 christos
4539 1.1 christos #define ELF_MAXPAGESIZE 0x10000
4540 1.1 christos #define ELF_COMMONPAGESIZE 0x1000
4541 1.1 christos #define elf64_bed elf64_tradbed
4542 1.1 christos
4543 1.1 christos #undef elf_backend_write_core_note
4544 1.1 christos #define elf_backend_write_core_note elf64_mips_write_core_note
4545 1.1.1.2 christos
4546 1.1 christos /* Include the target file again for this target. */
4547 1.1.1.2 christos #include "elf64-target.h"
4548 1.1 christos
4549 1.1 christos
4550 1.1 christos /* FreeBSD support. */
4551 1.1 christos
4552 1.1 christos #undef TARGET_LITTLE_SYM
4553 1.1 christos #undef TARGET_LITTLE_NAME
4554 1.1 christos #undef TARGET_BIG_SYM
4555 1.1 christos #undef TARGET_BIG_NAME
4556 1.1.1.4 christos
4557 1.1.1.4 christos #define TARGET_LITTLE_SYM mips_elf64_tradfbsd_le_vec
4558 1.1 christos #define TARGET_LITTLE_NAME "elf64-tradlittlemips-freebsd"
4559 #define TARGET_BIG_SYM mips_elf64_tradfbsd_be_vec
4560 #define TARGET_BIG_NAME "elf64-tradbigmips-freebsd"
4561
4562 #undef ELF_OSABI
4563 #define ELF_OSABI ELFOSABI_FREEBSD
4564
4565 #undef elf64_bed
4566 #define elf64_bed elf64_fbsd_tradbed
4567
4568 #undef elf64_mips_write_core_note
4569
4570 #include "elf64-target.h"
4571