1 /* MIPS-specific support for 64-bit ELF
2 Copyright (C) 1996-2017 Free Software Foundation, Inc.
3 Ian Lance Taylor, Cygnus Support
4 Linker support added by Mark Mitchell, CodeSourcery, LLC.
5 <mark@codesourcery.com>
7 This file is part of BFD, the Binary File Descriptor library.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
22 MA 02110-1301, USA. */
25 /* This file supports the 64-bit MIPS ELF ABI.
27 The MIPS 64-bit ELF ABI uses an unusual reloc format. This file
28 overrides the usual ELF reloc handling, and handles reading and
29 writing the relocations here. */
31 /* TODO: Many things are unsupported, even if there is some code for it
32 . (which was mostly stolen from elf32-mips.c and slightly adapted).
34 . - Relocation handling for REL relocs is wrong in many cases and
36 . - Relocation handling for RELA relocs related to GOT support are
37 . also likely to be wrong.
38 . - Support for MIPS16 is untested.
39 . - Combined relocs with RSS_* entries are unsupported.
40 . - The whole GOT handling for NewABI is missing, some parts of
41 . the OldABI version is still lying around and should be removed.
51 #include "elfxx-mips.h"
54 /* Get the ECOFF swapping routines. The 64-bit ABI is not supposed to
55 use ECOFF. However, we support it anyhow for an easier changeover. */
57 #include "coff/symconst.h"
58 #include "coff/internal.h"
59 #include "coff/ecoff.h"
60 /* The 64 bit versions of the mdebug data structures are in alpha.h. */
61 #include "coff/alpha.h"
62 #define ECOFF_SIGNED_64
63 #include "ecoffswap.h"
65 static void mips_elf64_swap_reloc_in
66 (bfd
*, const Elf64_Mips_External_Rel
*, Elf64_Mips_Internal_Rela
*);
67 static void mips_elf64_swap_reloca_in
68 (bfd
*, const Elf64_Mips_External_Rela
*, Elf64_Mips_Internal_Rela
*);
69 static void mips_elf64_swap_reloc_out
70 (bfd
*, const Elf64_Mips_Internal_Rela
*, Elf64_Mips_External_Rel
*);
71 static void mips_elf64_swap_reloca_out
72 (bfd
*, const Elf64_Mips_Internal_Rela
*, Elf64_Mips_External_Rela
*);
73 static void mips_elf64_be_swap_reloc_in
74 (bfd
*, const bfd_byte
*, Elf_Internal_Rela
*);
75 static void mips_elf64_be_swap_reloc_out
76 (bfd
*, const Elf_Internal_Rela
*, bfd_byte
*);
77 static void mips_elf64_be_swap_reloca_in
78 (bfd
*, const bfd_byte
*, Elf_Internal_Rela
*);
79 static void mips_elf64_be_swap_reloca_out
80 (bfd
*, const Elf_Internal_Rela
*, bfd_byte
*);
81 static reloc_howto_type
*bfd_elf64_bfd_reloc_type_lookup
82 (bfd
*, bfd_reloc_code_real_type
);
83 static reloc_howto_type
*mips_elf64_rtype_to_howto
84 (unsigned int, bfd_boolean
);
85 static void mips_elf64_info_to_howto_rel
86 (bfd
*, arelent
*, Elf_Internal_Rela
*);
87 static void mips_elf64_info_to_howto_rela
88 (bfd
*, arelent
*, Elf_Internal_Rela
*);
89 static long mips_elf64_get_reloc_upper_bound
91 static long mips_elf64_get_dynamic_reloc_upper_bound
93 static bfd_boolean mips_elf64_slurp_one_reloc_table
94 (bfd
*, asection
*, Elf_Internal_Shdr
*, bfd_size_type
, arelent
*,
95 asymbol
**, bfd_boolean
);
96 static bfd_boolean mips_elf64_slurp_reloc_table
97 (bfd
*, asection
*, asymbol
**, bfd_boolean
);
98 static void mips_elf64_write_relocs
99 (bfd
*, asection
*, void *);
100 static void mips_elf64_write_rel
101 (bfd
*, asection
*, Elf_Internal_Shdr
*, int *, void *);
102 static void mips_elf64_write_rela
103 (bfd
*, asection
*, Elf_Internal_Shdr
*, int *, void *);
104 static bfd_reloc_status_type mips_elf64_gprel16_reloc
105 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
106 static bfd_reloc_status_type mips_elf64_literal_reloc
107 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
108 static bfd_reloc_status_type mips_elf64_gprel32_reloc
109 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
110 static bfd_reloc_status_type mips_elf64_shift6_reloc
111 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
112 static bfd_reloc_status_type mips16_gprel_reloc
113 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
114 static bfd_boolean mips_elf64_assign_gp
116 static bfd_reloc_status_type mips_elf64_final_gp
117 (bfd
*, asymbol
*, bfd_boolean
, char **, bfd_vma
*);
118 static bfd_boolean mips_elf64_object_p
120 static irix_compat_t elf64_mips_irix_compat
122 static bfd_boolean elf64_mips_grok_prstatus
123 (bfd
*, Elf_Internal_Note
*);
124 static bfd_boolean elf64_mips_grok_psinfo
125 (bfd
*, Elf_Internal_Note
*);
127 extern const bfd_target mips_elf64_be_vec
;
128 extern const bfd_target mips_elf64_le_vec
;
130 /* In case we're on a 32-bit machine, construct a 64-bit "-1" value
131 from smaller values. Start with zero, widen, *then* decrement. */
132 #define MINUS_ONE (((bfd_vma)0) - 1)
134 /* The number of local .got entries we reserve. */
135 #define MIPS_RESERVED_GOTNO (2)
137 /* The relocation table used for SHT_REL sections. */
139 static reloc_howto_type mips_elf64_howto_table_rel
[] =
142 HOWTO (R_MIPS_NONE
, /* type */
144 3, /* size (0 = byte, 1 = short, 2 = long) */
146 FALSE
, /* pc_relative */
148 complain_overflow_dont
, /* complain_on_overflow */
149 _bfd_mips_elf_generic_reloc
, /* special_function */
150 "R_MIPS_NONE", /* name */
151 FALSE
, /* partial_inplace */
154 FALSE
), /* pcrel_offset */
156 /* 16 bit relocation. */
157 HOWTO (R_MIPS_16
, /* type */
159 2, /* size (0 = byte, 1 = short, 2 = long) */
161 FALSE
, /* pc_relative */
163 complain_overflow_signed
, /* complain_on_overflow */
164 _bfd_mips_elf_generic_reloc
, /* special_function */
165 "R_MIPS_16", /* name */
166 TRUE
, /* partial_inplace */
167 0x0000ffff, /* src_mask */
168 0x0000ffff, /* dst_mask */
169 FALSE
), /* pcrel_offset */
171 /* 32 bit relocation. */
172 HOWTO (R_MIPS_32
, /* type */
174 2, /* size (0 = byte, 1 = short, 2 = long) */
176 FALSE
, /* pc_relative */
178 complain_overflow_dont
, /* complain_on_overflow */
179 _bfd_mips_elf_generic_reloc
, /* special_function */
180 "R_MIPS_32", /* name */
181 TRUE
, /* partial_inplace */
182 0xffffffff, /* src_mask */
183 0xffffffff, /* dst_mask */
184 FALSE
), /* pcrel_offset */
186 /* 32 bit symbol relative relocation. */
187 HOWTO (R_MIPS_REL32
, /* type */
189 2, /* size (0 = byte, 1 = short, 2 = long) */
191 FALSE
, /* pc_relative */
193 complain_overflow_dont
, /* complain_on_overflow */
194 _bfd_mips_elf_generic_reloc
, /* special_function */
195 "R_MIPS_REL32", /* name */
196 TRUE
, /* partial_inplace */
197 0xffffffff, /* src_mask */
198 0xffffffff, /* dst_mask */
199 FALSE
), /* pcrel_offset */
201 /* 26 bit jump address. */
202 HOWTO (R_MIPS_26
, /* type */
204 2, /* size (0 = byte, 1 = short, 2 = long) */
206 FALSE
, /* pc_relative */
208 complain_overflow_dont
, /* complain_on_overflow */
209 /* This needs complex overflow
210 detection, because the upper 36
211 bits must match the PC + 4. */
212 _bfd_mips_elf_generic_reloc
, /* special_function */
213 "R_MIPS_26", /* name */
214 TRUE
, /* partial_inplace */
215 0x03ffffff, /* src_mask */
216 0x03ffffff, /* dst_mask */
217 FALSE
), /* pcrel_offset */
219 /* R_MIPS_HI16 and R_MIPS_LO16 are unsupported for NewABI REL.
220 However, the native IRIX6 tools use them, so we try our best. */
222 /* High 16 bits of symbol value. */
223 HOWTO (R_MIPS_HI16
, /* type */
225 2, /* size (0 = byte, 1 = short, 2 = long) */
227 FALSE
, /* pc_relative */
229 complain_overflow_dont
, /* complain_on_overflow */
230 _bfd_mips_elf_hi16_reloc
, /* special_function */
231 "R_MIPS_HI16", /* name */
232 TRUE
, /* partial_inplace */
233 0x0000ffff, /* src_mask */
234 0x0000ffff, /* dst_mask */
235 FALSE
), /* pcrel_offset */
237 /* Low 16 bits of symbol value. */
238 HOWTO (R_MIPS_LO16
, /* type */
240 2, /* size (0 = byte, 1 = short, 2 = long) */
242 FALSE
, /* pc_relative */
244 complain_overflow_dont
, /* complain_on_overflow */
245 _bfd_mips_elf_lo16_reloc
, /* special_function */
246 "R_MIPS_LO16", /* name */
247 TRUE
, /* partial_inplace */
248 0x0000ffff, /* src_mask */
249 0x0000ffff, /* dst_mask */
250 FALSE
), /* pcrel_offset */
252 /* GP relative reference. */
253 HOWTO (R_MIPS_GPREL16
, /* type */
255 2, /* size (0 = byte, 1 = short, 2 = long) */
257 FALSE
, /* pc_relative */
259 complain_overflow_signed
, /* complain_on_overflow */
260 mips_elf64_gprel16_reloc
, /* special_function */
261 "R_MIPS_GPREL16", /* name */
262 TRUE
, /* partial_inplace */
263 0x0000ffff, /* src_mask */
264 0x0000ffff, /* dst_mask */
265 FALSE
), /* pcrel_offset */
267 /* Reference to literal section. */
268 HOWTO (R_MIPS_LITERAL
, /* type */
270 2, /* size (0 = byte, 1 = short, 2 = long) */
272 FALSE
, /* pc_relative */
274 complain_overflow_signed
, /* complain_on_overflow */
275 mips_elf64_literal_reloc
, /* special_function */
276 "R_MIPS_LITERAL", /* name */
277 TRUE
, /* partial_inplace */
278 0x0000ffff, /* src_mask */
279 0x0000ffff, /* dst_mask */
280 FALSE
), /* pcrel_offset */
282 /* Reference to global offset table. */
283 HOWTO (R_MIPS_GOT16
, /* type */
285 2, /* size (0 = byte, 1 = short, 2 = long) */
287 FALSE
, /* pc_relative */
289 complain_overflow_signed
, /* complain_on_overflow */
290 _bfd_mips_elf_got16_reloc
, /* special_function */
291 "R_MIPS_GOT16", /* name */
292 TRUE
, /* partial_inplace */
293 0x0000ffff, /* src_mask */
294 0x0000ffff, /* dst_mask */
295 FALSE
), /* pcrel_offset */
297 /* 16 bit PC relative reference. Note that the ABI document has a typo
298 and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
299 We do the right thing here. */
300 HOWTO (R_MIPS_PC16
, /* type */
302 2, /* size (0 = byte, 1 = short, 2 = long) */
304 TRUE
, /* pc_relative */
306 complain_overflow_signed
, /* complain_on_overflow */
307 _bfd_mips_elf_generic_reloc
, /* special_function */
308 "R_MIPS_PC16", /* name */
309 TRUE
, /* partial_inplace */
310 0x0000ffff, /* src_mask */
311 0x0000ffff, /* dst_mask */
312 TRUE
), /* pcrel_offset */
314 /* 16 bit call through global offset table. */
315 HOWTO (R_MIPS_CALL16
, /* type */
317 2, /* size (0 = byte, 1 = short, 2 = long) */
319 FALSE
, /* pc_relative */
321 complain_overflow_signed
, /* complain_on_overflow */
322 _bfd_mips_elf_generic_reloc
, /* special_function */
323 "R_MIPS_CALL16", /* name */
324 TRUE
, /* partial_inplace */
325 0x0000ffff, /* src_mask */
326 0x0000ffff, /* dst_mask */
327 FALSE
), /* pcrel_offset */
329 /* 32 bit GP relative reference. */
330 HOWTO (R_MIPS_GPREL32
, /* type */
332 2, /* size (0 = byte, 1 = short, 2 = long) */
334 FALSE
, /* pc_relative */
336 complain_overflow_dont
, /* complain_on_overflow */
337 mips_elf64_gprel32_reloc
, /* special_function */
338 "R_MIPS_GPREL32", /* name */
339 TRUE
, /* partial_inplace */
340 0xffffffff, /* src_mask */
341 0xffffffff, /* dst_mask */
342 FALSE
), /* pcrel_offset */
348 /* A 5 bit shift field. */
349 HOWTO (R_MIPS_SHIFT5
, /* type */
351 2, /* size (0 = byte, 1 = short, 2 = long) */
353 FALSE
, /* pc_relative */
355 complain_overflow_bitfield
, /* complain_on_overflow */
356 _bfd_mips_elf_generic_reloc
, /* special_function */
357 "R_MIPS_SHIFT5", /* name */
358 TRUE
, /* partial_inplace */
359 0x000007c0, /* src_mask */
360 0x000007c0, /* dst_mask */
361 FALSE
), /* pcrel_offset */
363 /* A 6 bit shift field. */
364 HOWTO (R_MIPS_SHIFT6
, /* type */
366 2, /* size (0 = byte, 1 = short, 2 = long) */
368 FALSE
, /* pc_relative */
370 complain_overflow_bitfield
, /* complain_on_overflow */
371 mips_elf64_shift6_reloc
, /* special_function */
372 "R_MIPS_SHIFT6", /* name */
373 TRUE
, /* partial_inplace */
374 0x000007c4, /* src_mask */
375 0x000007c4, /* dst_mask */
376 FALSE
), /* pcrel_offset */
378 /* 64 bit relocation. */
379 HOWTO (R_MIPS_64
, /* type */
381 4, /* size (0 = byte, 1 = short, 2 = long) */
383 FALSE
, /* pc_relative */
385 complain_overflow_dont
, /* complain_on_overflow */
386 _bfd_mips_elf_generic_reloc
, /* special_function */
387 "R_MIPS_64", /* name */
388 TRUE
, /* partial_inplace */
389 MINUS_ONE
, /* src_mask */
390 MINUS_ONE
, /* dst_mask */
391 FALSE
), /* pcrel_offset */
393 /* Displacement in the global offset table. */
394 HOWTO (R_MIPS_GOT_DISP
, /* type */
396 2, /* size (0 = byte, 1 = short, 2 = long) */
398 FALSE
, /* pc_relative */
400 complain_overflow_signed
, /* complain_on_overflow */
401 _bfd_mips_elf_generic_reloc
, /* special_function */
402 "R_MIPS_GOT_DISP", /* name */
403 TRUE
, /* partial_inplace */
404 0x0000ffff, /* src_mask */
405 0x0000ffff, /* dst_mask */
406 FALSE
), /* pcrel_offset */
408 /* Displacement to page pointer in the global offset table. */
409 HOWTO (R_MIPS_GOT_PAGE
, /* type */
411 2, /* size (0 = byte, 1 = short, 2 = long) */
413 FALSE
, /* pc_relative */
415 complain_overflow_signed
, /* complain_on_overflow */
416 _bfd_mips_elf_generic_reloc
, /* special_function */
417 "R_MIPS_GOT_PAGE", /* name */
418 TRUE
, /* partial_inplace */
419 0x0000ffff, /* src_mask */
420 0x0000ffff, /* dst_mask */
421 FALSE
), /* pcrel_offset */
423 /* Offset from page pointer in the global offset table. */
424 HOWTO (R_MIPS_GOT_OFST
, /* type */
426 2, /* size (0 = byte, 1 = short, 2 = long) */
428 FALSE
, /* pc_relative */
430 complain_overflow_signed
, /* complain_on_overflow */
431 _bfd_mips_elf_generic_reloc
, /* special_function */
432 "R_MIPS_GOT_OFST", /* name */
433 TRUE
, /* partial_inplace */
434 0x0000ffff, /* src_mask */
435 0x0000ffff, /* dst_mask */
436 FALSE
), /* pcrel_offset */
438 /* High 16 bits of displacement in global offset table. */
439 HOWTO (R_MIPS_GOT_HI16
, /* type */
441 2, /* size (0 = byte, 1 = short, 2 = long) */
443 FALSE
, /* pc_relative */
445 complain_overflow_dont
, /* complain_on_overflow */
446 _bfd_mips_elf_generic_reloc
, /* special_function */
447 "R_MIPS_GOT_HI16", /* name */
448 TRUE
, /* partial_inplace */
449 0x0000ffff, /* src_mask */
450 0x0000ffff, /* dst_mask */
451 FALSE
), /* pcrel_offset */
453 /* Low 16 bits of displacement in global offset table. */
454 HOWTO (R_MIPS_GOT_LO16
, /* type */
456 2, /* size (0 = byte, 1 = short, 2 = long) */
458 FALSE
, /* pc_relative */
460 complain_overflow_dont
, /* complain_on_overflow */
461 _bfd_mips_elf_generic_reloc
, /* special_function */
462 "R_MIPS_GOT_LO16", /* name */
463 TRUE
, /* partial_inplace */
464 0x0000ffff, /* src_mask */
465 0x0000ffff, /* dst_mask */
466 FALSE
), /* pcrel_offset */
468 /* 64 bit subtraction. */
469 HOWTO (R_MIPS_SUB
, /* type */
471 4, /* size (0 = byte, 1 = short, 2 = long) */
473 FALSE
, /* pc_relative */
475 complain_overflow_dont
, /* complain_on_overflow */
476 _bfd_mips_elf_generic_reloc
, /* special_function */
477 "R_MIPS_SUB", /* name */
478 TRUE
, /* partial_inplace */
479 MINUS_ONE
, /* src_mask */
480 MINUS_ONE
, /* dst_mask */
481 FALSE
), /* pcrel_offset */
483 /* Insert the addend as an instruction. */
484 /* FIXME: Not handled correctly. */
485 HOWTO (R_MIPS_INSERT_A
, /* type */
487 2, /* size (0 = byte, 1 = short, 2 = long) */
489 FALSE
, /* pc_relative */
491 complain_overflow_dont
, /* complain_on_overflow */
492 _bfd_mips_elf_generic_reloc
, /* special_function */
493 "R_MIPS_INSERT_A", /* name */
494 TRUE
, /* partial_inplace */
495 0xffffffff, /* src_mask */
496 0xffffffff, /* dst_mask */
497 FALSE
), /* pcrel_offset */
499 /* Insert the addend as an instruction, and change all relocations
500 to refer to the old instruction at the address. */
501 /* FIXME: Not handled correctly. */
502 HOWTO (R_MIPS_INSERT_B
, /* type */
504 2, /* size (0 = byte, 1 = short, 2 = long) */
506 FALSE
, /* pc_relative */
508 complain_overflow_dont
, /* complain_on_overflow */
509 _bfd_mips_elf_generic_reloc
, /* special_function */
510 "R_MIPS_INSERT_B", /* name */
511 TRUE
, /* partial_inplace */
512 0xffffffff, /* src_mask */
513 0xffffffff, /* dst_mask */
514 FALSE
), /* pcrel_offset */
516 /* Delete a 32 bit instruction. */
517 /* FIXME: Not handled correctly. */
518 HOWTO (R_MIPS_DELETE
, /* type */
520 2, /* size (0 = byte, 1 = short, 2 = long) */
522 FALSE
, /* pc_relative */
524 complain_overflow_dont
, /* complain_on_overflow */
525 _bfd_mips_elf_generic_reloc
, /* special_function */
526 "R_MIPS_DELETE", /* name */
527 TRUE
, /* partial_inplace */
528 0xffffffff, /* src_mask */
529 0xffffffff, /* dst_mask */
530 FALSE
), /* pcrel_offset */
532 /* The MIPS ELF64 ABI Draft wants us to support these for REL relocations.
534 a) It means building the addend from a R_MIPS_HIGHEST/R_MIPS_HIGHER/
535 R_MIPS_HI16/R_MIPS_LO16 sequence with varying ordering, using
537 b) No other NewABI toolchain actually emits such relocations. */
538 EMPTY_HOWTO (R_MIPS_HIGHER
),
539 EMPTY_HOWTO (R_MIPS_HIGHEST
),
541 /* High 16 bits of displacement in global offset table. */
542 HOWTO (R_MIPS_CALL_HI16
, /* type */
544 2, /* size (0 = byte, 1 = short, 2 = long) */
546 FALSE
, /* pc_relative */
548 complain_overflow_dont
, /* complain_on_overflow */
549 _bfd_mips_elf_generic_reloc
, /* special_function */
550 "R_MIPS_CALL_HI16", /* name */
551 TRUE
, /* partial_inplace */
552 0x0000ffff, /* src_mask */
553 0x0000ffff, /* dst_mask */
554 FALSE
), /* pcrel_offset */
556 /* Low 16 bits of displacement in global offset table. */
557 HOWTO (R_MIPS_CALL_LO16
, /* type */
559 2, /* size (0 = byte, 1 = short, 2 = long) */
561 FALSE
, /* pc_relative */
563 complain_overflow_dont
, /* complain_on_overflow */
564 _bfd_mips_elf_generic_reloc
, /* special_function */
565 "R_MIPS_CALL_LO16", /* name */
566 TRUE
, /* partial_inplace */
567 0x0000ffff, /* src_mask */
568 0x0000ffff, /* dst_mask */
569 FALSE
), /* pcrel_offset */
571 /* Section displacement, used by an associated event location section. */
572 HOWTO (R_MIPS_SCN_DISP
, /* type */
574 2, /* size (0 = byte, 1 = short, 2 = long) */
576 FALSE
, /* pc_relative */
578 complain_overflow_dont
, /* complain_on_overflow */
579 _bfd_mips_elf_generic_reloc
, /* special_function */
580 "R_MIPS_SCN_DISP", /* name */
581 TRUE
, /* partial_inplace */
582 0xffffffff, /* src_mask */
583 0xffffffff, /* dst_mask */
584 FALSE
), /* pcrel_offset */
586 HOWTO (R_MIPS_REL16
, /* type */
588 1, /* size (0 = byte, 1 = short, 2 = long) */
590 FALSE
, /* pc_relative */
592 complain_overflow_signed
, /* complain_on_overflow */
593 _bfd_mips_elf_generic_reloc
, /* special_function */
594 "R_MIPS_REL16", /* name */
595 TRUE
, /* partial_inplace */
596 0xffff, /* src_mask */
597 0xffff, /* dst_mask */
598 FALSE
), /* pcrel_offset */
600 /* These two are obsolete. */
601 EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE
),
602 EMPTY_HOWTO (R_MIPS_PJUMP
),
604 /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
605 It must be used for multigot GOT's (and only there). */
606 HOWTO (R_MIPS_RELGOT
, /* type */
608 2, /* size (0 = byte, 1 = short, 2 = long) */
610 FALSE
, /* pc_relative */
612 complain_overflow_dont
, /* complain_on_overflow */
613 _bfd_mips_elf_generic_reloc
, /* special_function */
614 "R_MIPS_RELGOT", /* name */
615 TRUE
, /* partial_inplace */
616 0xffffffff, /* src_mask */
617 0xffffffff, /* dst_mask */
618 FALSE
), /* pcrel_offset */
620 /* Protected jump conversion. This is an optimization hint. No
621 relocation is required for correctness. */
622 HOWTO (R_MIPS_JALR
, /* type */
624 2, /* size (0 = byte, 1 = short, 2 = long) */
626 FALSE
, /* pc_relative */
628 complain_overflow_dont
, /* complain_on_overflow */
629 _bfd_mips_elf_generic_reloc
, /* special_function */
630 "R_MIPS_JALR", /* name */
631 FALSE
, /* partial_inplace */
633 0x00000000, /* dst_mask */
634 FALSE
), /* pcrel_offset */
636 /* TLS relocations. */
637 EMPTY_HOWTO (R_MIPS_TLS_DTPMOD32
),
638 EMPTY_HOWTO (R_MIPS_TLS_DTPREL32
),
640 HOWTO (R_MIPS_TLS_DTPMOD64
, /* type */
642 4, /* size (0 = byte, 1 = short, 2 = long) */
644 FALSE
, /* pc_relative */
646 complain_overflow_dont
, /* complain_on_overflow */
647 _bfd_mips_elf_generic_reloc
, /* special_function */
648 "R_MIPS_TLS_DTPMOD64", /* name */
649 TRUE
, /* partial_inplace */
650 MINUS_ONE
, /* src_mask */
651 MINUS_ONE
, /* dst_mask */
652 FALSE
), /* pcrel_offset */
654 HOWTO (R_MIPS_TLS_DTPREL64
, /* type */
656 4, /* size (0 = byte, 1 = short, 2 = long) */
658 FALSE
, /* pc_relative */
660 complain_overflow_dont
, /* complain_on_overflow */
661 _bfd_mips_elf_generic_reloc
, /* special_function */
662 "R_MIPS_TLS_DTPREL64", /* name */
663 TRUE
, /* partial_inplace */
664 MINUS_ONE
, /* src_mask */
665 MINUS_ONE
, /* dst_mask */
666 FALSE
), /* pcrel_offset */
668 /* TLS general dynamic variable reference. */
669 HOWTO (R_MIPS_TLS_GD
, /* type */
671 2, /* size (0 = byte, 1 = short, 2 = long) */
673 FALSE
, /* pc_relative */
675 complain_overflow_signed
, /* complain_on_overflow */
676 _bfd_mips_elf_generic_reloc
, /* special_function */
677 "R_MIPS_TLS_GD", /* name */
678 TRUE
, /* partial_inplace */
679 0x0000ffff, /* src_mask */
680 0x0000ffff, /* dst_mask */
681 FALSE
), /* pcrel_offset */
683 /* TLS local dynamic variable reference. */
684 HOWTO (R_MIPS_TLS_LDM
, /* type */
686 2, /* size (0 = byte, 1 = short, 2 = long) */
688 FALSE
, /* pc_relative */
690 complain_overflow_signed
, /* complain_on_overflow */
691 _bfd_mips_elf_generic_reloc
, /* special_function */
692 "R_MIPS_TLS_LDM", /* name */
693 TRUE
, /* partial_inplace */
694 0x0000ffff, /* src_mask */
695 0x0000ffff, /* dst_mask */
696 FALSE
), /* pcrel_offset */
698 /* TLS local dynamic offset. */
699 HOWTO (R_MIPS_TLS_DTPREL_HI16
, /* type */
701 2, /* size (0 = byte, 1 = short, 2 = long) */
703 FALSE
, /* pc_relative */
705 complain_overflow_signed
, /* complain_on_overflow */
706 _bfd_mips_elf_generic_reloc
, /* special_function */
707 "R_MIPS_TLS_DTPREL_HI16", /* name */
708 TRUE
, /* partial_inplace */
709 0x0000ffff, /* src_mask */
710 0x0000ffff, /* dst_mask */
711 FALSE
), /* pcrel_offset */
713 /* TLS local dynamic offset. */
714 HOWTO (R_MIPS_TLS_DTPREL_LO16
, /* type */
716 2, /* size (0 = byte, 1 = short, 2 = long) */
718 FALSE
, /* pc_relative */
720 complain_overflow_signed
, /* complain_on_overflow */
721 _bfd_mips_elf_generic_reloc
, /* special_function */
722 "R_MIPS_TLS_DTPREL_LO16", /* name */
723 TRUE
, /* partial_inplace */
724 0x0000ffff, /* src_mask */
725 0x0000ffff, /* dst_mask */
726 FALSE
), /* pcrel_offset */
728 /* TLS thread pointer offset. */
729 HOWTO (R_MIPS_TLS_GOTTPREL
, /* type */
731 2, /* size (0 = byte, 1 = short, 2 = long) */
733 FALSE
, /* pc_relative */
735 complain_overflow_signed
, /* complain_on_overflow */
736 _bfd_mips_elf_generic_reloc
, /* special_function */
737 "R_MIPS_TLS_GOTTPREL", /* name */
738 TRUE
, /* partial_inplace */
739 0x0000ffff, /* src_mask */
740 0x0000ffff, /* dst_mask */
741 FALSE
), /* pcrel_offset */
743 /* TLS IE dynamic relocations. */
744 EMPTY_HOWTO (R_MIPS_TLS_TPREL32
),
746 HOWTO (R_MIPS_TLS_TPREL64
, /* type */
748 4, /* size (0 = byte, 1 = short, 2 = long) */
750 FALSE
, /* pc_relative */
752 complain_overflow_dont
, /* complain_on_overflow */
753 _bfd_mips_elf_generic_reloc
, /* special_function */
754 "R_MIPS_TLS_TPREL64", /* name */
755 TRUE
, /* partial_inplace */
756 MINUS_ONE
, /* src_mask */
757 MINUS_ONE
, /* dst_mask */
758 FALSE
), /* pcrel_offset */
760 /* TLS thread pointer offset. */
761 HOWTO (R_MIPS_TLS_TPREL_HI16
, /* type */
763 2, /* size (0 = byte, 1 = short, 2 = long) */
765 FALSE
, /* pc_relative */
767 complain_overflow_signed
, /* complain_on_overflow */
768 _bfd_mips_elf_generic_reloc
, /* special_function */
769 "R_MIPS_TLS_TPREL_HI16", /* name */
770 TRUE
, /* partial_inplace */
771 0x0000ffff, /* src_mask */
772 0x0000ffff, /* dst_mask */
773 FALSE
), /* pcrel_offset */
775 /* TLS thread pointer offset. */
776 HOWTO (R_MIPS_TLS_TPREL_LO16
, /* type */
778 2, /* size (0 = byte, 1 = short, 2 = long) */
780 FALSE
, /* pc_relative */
782 complain_overflow_signed
, /* complain_on_overflow */
783 _bfd_mips_elf_generic_reloc
, /* special_function */
784 "R_MIPS_TLS_TPREL_LO16", /* name */
785 TRUE
, /* partial_inplace */
786 0x0000ffff, /* src_mask */
787 0x0000ffff, /* dst_mask */
788 FALSE
), /* pcrel_offset */
790 /* 32 bit relocation with no addend. */
791 HOWTO (R_MIPS_GLOB_DAT
, /* type */
793 2, /* size (0 = byte, 1 = short, 2 = long) */
795 FALSE
, /* pc_relative */
797 complain_overflow_dont
, /* complain_on_overflow */
798 _bfd_mips_elf_generic_reloc
, /* special_function */
799 "R_MIPS_GLOB_DAT", /* name */
800 FALSE
, /* partial_inplace */
802 0xffffffff, /* dst_mask */
803 FALSE
), /* pcrel_offset */
814 HOWTO (R_MIPS_PC21_S2
, /* type */
816 2, /* size (0 = byte, 1 = short, 2 = long) */
818 TRUE
, /* pc_relative */
820 complain_overflow_signed
, /* complain_on_overflow */
821 _bfd_mips_elf_generic_reloc
, /* special_function */
822 "R_MIPS_PC21_S2", /* name */
823 TRUE
, /* partial_inplace */
824 0x001fffff, /* src_mask */
825 0x001fffff, /* dst_mask */
826 TRUE
), /* pcrel_offset */
828 HOWTO (R_MIPS_PC26_S2
, /* type */
830 2, /* size (0 = byte, 1 = short, 2 = long) */
832 TRUE
, /* pc_relative */
834 complain_overflow_signed
, /* complain_on_overflow */
835 _bfd_mips_elf_generic_reloc
, /* special_function */
836 "R_MIPS_PC26_S2", /* name */
837 TRUE
, /* partial_inplace */
838 0x03ffffff, /* src_mask */
839 0x03ffffff, /* dst_mask */
840 TRUE
), /* pcrel_offset */
842 HOWTO (R_MIPS_PC18_S3
, /* type */
844 2, /* size (0 = byte, 1 = short, 2 = long) */
846 TRUE
, /* pc_relative */
848 complain_overflow_signed
, /* complain_on_overflow */
849 _bfd_mips_elf_generic_reloc
, /* special_function */
850 "R_MIPS_PC18_S3", /* name */
851 TRUE
, /* partial_inplace */
852 0x0003ffff, /* src_mask */
853 0x0003ffff, /* dst_mask */
854 TRUE
), /* pcrel_offset */
856 HOWTO (R_MIPS_PC19_S2
, /* type */
858 2, /* size (0 = byte, 1 = short, 2 = long) */
860 TRUE
, /* pc_relative */
862 complain_overflow_signed
, /* complain_on_overflow */
863 _bfd_mips_elf_generic_reloc
, /* special_function */
864 "R_MIPS_PC19_S2", /* name */
865 TRUE
, /* partial_inplace */
866 0x0007ffff, /* src_mask */
867 0x0007ffff, /* dst_mask */
868 TRUE
), /* pcrel_offset */
870 HOWTO (R_MIPS_PCHI16
, /* type */
872 2, /* size (0 = byte, 1 = short, 2 = long) */
874 TRUE
, /* pc_relative */
876 complain_overflow_signed
, /* complain_on_overflow */
877 _bfd_mips_elf_generic_reloc
, /* special_function */
878 "R_MIPS_PCHI16", /* name */
879 TRUE
, /* partial_inplace */
880 0x0000ffff, /* src_mask */
881 0x0000ffff, /* dst_mask */
882 TRUE
), /* pcrel_offset */
884 HOWTO (R_MIPS_PCLO16
, /* type */
886 2, /* size (0 = byte, 1 = short, 2 = long) */
888 TRUE
, /* pc_relative */
890 complain_overflow_dont
, /* complain_on_overflow */
891 _bfd_mips_elf_generic_reloc
, /* special_function */
892 "R_MIPS_PCLO16", /* name */
893 TRUE
, /* partial_inplace */
894 0x0000ffff, /* src_mask */
895 0x0000ffff, /* dst_mask */
896 TRUE
), /* pcrel_offset */
900 /* The relocation table used for SHT_RELA sections. */
902 static reloc_howto_type mips_elf64_howto_table_rela
[] =
905 HOWTO (R_MIPS_NONE
, /* type */
907 3, /* size (0 = byte, 1 = short, 2 = long) */
909 FALSE
, /* pc_relative */
911 complain_overflow_dont
, /* complain_on_overflow */
912 _bfd_mips_elf_generic_reloc
, /* special_function */
913 "R_MIPS_NONE", /* name */
914 FALSE
, /* partial_inplace */
917 FALSE
), /* pcrel_offset */
919 /* 16 bit relocation. */
920 HOWTO (R_MIPS_16
, /* type */
922 2, /* size (0 = byte, 1 = short, 2 = long) */
924 FALSE
, /* pc_relative */
926 complain_overflow_signed
, /* complain_on_overflow */
927 _bfd_mips_elf_generic_reloc
, /* special_function */
928 "R_MIPS_16", /* name */
929 FALSE
, /* partial_inplace */
931 0x0000ffff, /* dst_mask */
932 FALSE
), /* pcrel_offset */
934 /* 32 bit relocation. */
935 HOWTO (R_MIPS_32
, /* type */
937 2, /* size (0 = byte, 1 = short, 2 = long) */
939 FALSE
, /* pc_relative */
941 complain_overflow_dont
, /* complain_on_overflow */
942 _bfd_mips_elf_generic_reloc
, /* special_function */
943 "R_MIPS_32", /* name */
944 FALSE
, /* partial_inplace */
946 0xffffffff, /* dst_mask */
947 FALSE
), /* pcrel_offset */
949 /* 32 bit symbol relative relocation. */
950 HOWTO (R_MIPS_REL32
, /* type */
952 2, /* size (0 = byte, 1 = short, 2 = long) */
954 FALSE
, /* pc_relative */
956 complain_overflow_dont
, /* complain_on_overflow */
957 _bfd_mips_elf_generic_reloc
, /* special_function */
958 "R_MIPS_REL32", /* name */
959 FALSE
, /* partial_inplace */
961 0xffffffff, /* dst_mask */
962 FALSE
), /* pcrel_offset */
964 /* 26 bit jump address. */
965 HOWTO (R_MIPS_26
, /* type */
967 2, /* size (0 = byte, 1 = short, 2 = long) */
969 FALSE
, /* pc_relative */
971 complain_overflow_dont
, /* complain_on_overflow */
972 /* This needs complex overflow
973 detection, because the upper 36
974 bits must match the PC + 4. */
975 _bfd_mips_elf_generic_reloc
, /* special_function */
976 "R_MIPS_26", /* name */
977 FALSE
, /* partial_inplace */
979 0x03ffffff, /* dst_mask */
980 FALSE
), /* pcrel_offset */
982 /* High 16 bits of symbol value. */
983 HOWTO (R_MIPS_HI16
, /* type */
985 2, /* size (0 = byte, 1 = short, 2 = long) */
987 FALSE
, /* pc_relative */
989 complain_overflow_dont
, /* complain_on_overflow */
990 _bfd_mips_elf_generic_reloc
, /* special_function */
991 "R_MIPS_HI16", /* name */
992 FALSE
, /* partial_inplace */
994 0x0000ffff, /* dst_mask */
995 FALSE
), /* pcrel_offset */
997 /* Low 16 bits of symbol value. */
998 HOWTO (R_MIPS_LO16
, /* type */
1000 2, /* size (0 = byte, 1 = short, 2 = long) */
1002 FALSE
, /* pc_relative */
1004 complain_overflow_dont
, /* complain_on_overflow */
1005 _bfd_mips_elf_generic_reloc
, /* special_function */
1006 "R_MIPS_LO16", /* name */
1007 FALSE
, /* partial_inplace */
1009 0x0000ffff, /* dst_mask */
1010 FALSE
), /* pcrel_offset */
1012 /* GP relative reference. */
1013 HOWTO (R_MIPS_GPREL16
, /* type */
1015 2, /* size (0 = byte, 1 = short, 2 = long) */
1017 FALSE
, /* pc_relative */
1019 complain_overflow_signed
, /* complain_on_overflow */
1020 mips_elf64_gprel16_reloc
, /* special_function */
1021 "R_MIPS_GPREL16", /* name */
1022 FALSE
, /* partial_inplace */
1024 0x0000ffff, /* dst_mask */
1025 FALSE
), /* pcrel_offset */
1027 /* Reference to literal section. */
1028 HOWTO (R_MIPS_LITERAL
, /* type */
1030 2, /* size (0 = byte, 1 = short, 2 = long) */
1032 FALSE
, /* pc_relative */
1034 complain_overflow_signed
, /* complain_on_overflow */
1035 mips_elf64_literal_reloc
, /* special_function */
1036 "R_MIPS_LITERAL", /* name */
1037 FALSE
, /* partial_inplace */
1039 0x0000ffff, /* dst_mask */
1040 FALSE
), /* pcrel_offset */
1042 /* Reference to global offset table. */
1043 HOWTO (R_MIPS_GOT16
, /* type */
1045 2, /* size (0 = byte, 1 = short, 2 = long) */
1047 FALSE
, /* pc_relative */
1049 complain_overflow_signed
, /* complain_on_overflow */
1050 _bfd_mips_elf_generic_reloc
, /* special_function */
1051 "R_MIPS_GOT16", /* name */
1052 FALSE
, /* partial_inplace */
1054 0x0000ffff, /* dst_mask */
1055 FALSE
), /* pcrel_offset */
1057 /* 16 bit PC relative reference. Note that the ABI document has a typo
1058 and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
1059 We do the right thing here. */
1060 HOWTO (R_MIPS_PC16
, /* type */
1062 2, /* size (0 = byte, 1 = short, 2 = long) */
1064 TRUE
, /* pc_relative */
1066 complain_overflow_signed
, /* complain_on_overflow */
1067 _bfd_mips_elf_generic_reloc
, /* special_function */
1068 "R_MIPS_PC16", /* name */
1069 FALSE
, /* partial_inplace */
1071 0x0000ffff, /* dst_mask */
1072 TRUE
), /* pcrel_offset */
1074 /* 16 bit call through global offset table. */
1075 HOWTO (R_MIPS_CALL16
, /* type */
1077 2, /* size (0 = byte, 1 = short, 2 = long) */
1079 FALSE
, /* pc_relative */
1081 complain_overflow_signed
, /* complain_on_overflow */
1082 _bfd_mips_elf_generic_reloc
, /* special_function */
1083 "R_MIPS_CALL16", /* name */
1084 FALSE
, /* partial_inplace */
1086 0x0000ffff, /* dst_mask */
1087 FALSE
), /* pcrel_offset */
1089 /* 32 bit GP relative reference. */
1090 HOWTO (R_MIPS_GPREL32
, /* type */
1092 2, /* size (0 = byte, 1 = short, 2 = long) */
1094 FALSE
, /* pc_relative */
1096 complain_overflow_dont
, /* complain_on_overflow */
1097 mips_elf64_gprel32_reloc
, /* special_function */
1098 "R_MIPS_GPREL32", /* name */
1099 FALSE
, /* partial_inplace */
1101 0xffffffff, /* dst_mask */
1102 FALSE
), /* pcrel_offset */
1108 /* A 5 bit shift field. */
1109 HOWTO (R_MIPS_SHIFT5
, /* type */
1111 2, /* size (0 = byte, 1 = short, 2 = long) */
1113 FALSE
, /* pc_relative */
1115 complain_overflow_bitfield
, /* complain_on_overflow */
1116 _bfd_mips_elf_generic_reloc
, /* special_function */
1117 "R_MIPS_SHIFT5", /* name */
1118 FALSE
, /* partial_inplace */
1120 0x000007c0, /* dst_mask */
1121 FALSE
), /* pcrel_offset */
1123 /* A 6 bit shift field. */
1124 HOWTO (R_MIPS_SHIFT6
, /* type */
1126 2, /* size (0 = byte, 1 = short, 2 = long) */
1128 FALSE
, /* pc_relative */
1130 complain_overflow_bitfield
, /* complain_on_overflow */
1131 mips_elf64_shift6_reloc
, /* special_function */
1132 "R_MIPS_SHIFT6", /* name */
1133 FALSE
, /* partial_inplace */
1135 0x000007c4, /* dst_mask */
1136 FALSE
), /* pcrel_offset */
1138 /* 64 bit relocation. */
1139 HOWTO (R_MIPS_64
, /* type */
1141 4, /* size (0 = byte, 1 = short, 2 = long) */
1143 FALSE
, /* pc_relative */
1145 complain_overflow_dont
, /* complain_on_overflow */
1146 _bfd_mips_elf_generic_reloc
, /* special_function */
1147 "R_MIPS_64", /* name */
1148 FALSE
, /* partial_inplace */
1150 MINUS_ONE
, /* dst_mask */
1151 FALSE
), /* pcrel_offset */
1153 /* Displacement in the global offset table. */
1154 HOWTO (R_MIPS_GOT_DISP
, /* type */
1156 2, /* size (0 = byte, 1 = short, 2 = long) */
1158 FALSE
, /* pc_relative */
1160 complain_overflow_signed
, /* complain_on_overflow */
1161 _bfd_mips_elf_generic_reloc
, /* special_function */
1162 "R_MIPS_GOT_DISP", /* name */
1163 FALSE
, /* partial_inplace */
1165 0x0000ffff, /* dst_mask */
1166 FALSE
), /* pcrel_offset */
1168 /* Displacement to page pointer in the global offset table. */
1169 HOWTO (R_MIPS_GOT_PAGE
, /* type */
1171 2, /* size (0 = byte, 1 = short, 2 = long) */
1173 FALSE
, /* pc_relative */
1175 complain_overflow_signed
, /* complain_on_overflow */
1176 _bfd_mips_elf_generic_reloc
, /* special_function */
1177 "R_MIPS_GOT_PAGE", /* name */
1178 FALSE
, /* partial_inplace */
1180 0x0000ffff, /* dst_mask */
1181 FALSE
), /* pcrel_offset */
1183 /* Offset from page pointer in the global offset table. */
1184 HOWTO (R_MIPS_GOT_OFST
, /* type */
1186 2, /* size (0 = byte, 1 = short, 2 = long) */
1188 FALSE
, /* pc_relative */
1190 complain_overflow_signed
, /* complain_on_overflow */
1191 _bfd_mips_elf_generic_reloc
, /* special_function */
1192 "R_MIPS_GOT_OFST", /* name */
1193 FALSE
, /* partial_inplace */
1195 0x0000ffff, /* dst_mask */
1196 FALSE
), /* pcrel_offset */
1198 /* High 16 bits of displacement in global offset table. */
1199 HOWTO (R_MIPS_GOT_HI16
, /* type */
1201 2, /* size (0 = byte, 1 = short, 2 = long) */
1203 FALSE
, /* pc_relative */
1205 complain_overflow_dont
, /* complain_on_overflow */
1206 _bfd_mips_elf_generic_reloc
, /* special_function */
1207 "R_MIPS_GOT_HI16", /* name */
1208 FALSE
, /* partial_inplace */
1210 0x0000ffff, /* dst_mask */
1211 FALSE
), /* pcrel_offset */
1213 /* Low 16 bits of displacement in global offset table. */
1214 HOWTO (R_MIPS_GOT_LO16
, /* type */
1216 2, /* size (0 = byte, 1 = short, 2 = long) */
1218 FALSE
, /* pc_relative */
1220 complain_overflow_dont
, /* complain_on_overflow */
1221 _bfd_mips_elf_generic_reloc
, /* special_function */
1222 "R_MIPS_GOT_LO16", /* name */
1223 FALSE
, /* partial_inplace */
1225 0x0000ffff, /* dst_mask */
1226 FALSE
), /* pcrel_offset */
1228 /* 64 bit subtraction. */
1229 HOWTO (R_MIPS_SUB
, /* type */
1231 4, /* size (0 = byte, 1 = short, 2 = long) */
1233 FALSE
, /* pc_relative */
1235 complain_overflow_dont
, /* complain_on_overflow */
1236 _bfd_mips_elf_generic_reloc
, /* special_function */
1237 "R_MIPS_SUB", /* name */
1238 FALSE
, /* partial_inplace */
1240 MINUS_ONE
, /* dst_mask */
1241 FALSE
), /* pcrel_offset */
1243 /* Insert the addend as an instruction. */
1244 /* FIXME: Not handled correctly. */
1245 HOWTO (R_MIPS_INSERT_A
, /* type */
1247 2, /* size (0 = byte, 1 = short, 2 = long) */
1249 FALSE
, /* pc_relative */
1251 complain_overflow_dont
, /* complain_on_overflow */
1252 _bfd_mips_elf_generic_reloc
, /* special_function */
1253 "R_MIPS_INSERT_A", /* name */
1254 FALSE
, /* partial_inplace */
1256 0xffffffff, /* dst_mask */
1257 FALSE
), /* pcrel_offset */
1259 /* Insert the addend as an instruction, and change all relocations
1260 to refer to the old instruction at the address. */
1261 /* FIXME: Not handled correctly. */
1262 HOWTO (R_MIPS_INSERT_B
, /* type */
1264 2, /* size (0 = byte, 1 = short, 2 = long) */
1266 FALSE
, /* pc_relative */
1268 complain_overflow_dont
, /* complain_on_overflow */
1269 _bfd_mips_elf_generic_reloc
, /* special_function */
1270 "R_MIPS_INSERT_B", /* name */
1271 FALSE
, /* partial_inplace */
1273 0xffffffff, /* dst_mask */
1274 FALSE
), /* pcrel_offset */
1276 /* Delete a 32 bit instruction. */
1277 /* FIXME: Not handled correctly. */
1278 HOWTO (R_MIPS_DELETE
, /* type */
1280 2, /* size (0 = byte, 1 = short, 2 = long) */
1282 FALSE
, /* pc_relative */
1284 complain_overflow_dont
, /* complain_on_overflow */
1285 _bfd_mips_elf_generic_reloc
, /* special_function */
1286 "R_MIPS_DELETE", /* name */
1287 FALSE
, /* partial_inplace */
1289 0xffffffff, /* dst_mask */
1290 FALSE
), /* pcrel_offset */
1292 /* Get the higher value of a 64 bit addend. */
1293 HOWTO (R_MIPS_HIGHER
, /* type */
1295 2, /* size (0 = byte, 1 = short, 2 = long) */
1297 FALSE
, /* pc_relative */
1299 complain_overflow_dont
, /* complain_on_overflow */
1300 _bfd_mips_elf_generic_reloc
, /* special_function */
1301 "R_MIPS_HIGHER", /* name */
1302 FALSE
, /* partial_inplace */
1304 0x0000ffff, /* dst_mask */
1305 FALSE
), /* pcrel_offset */
1307 /* Get the highest value of a 64 bit addend. */
1308 HOWTO (R_MIPS_HIGHEST
, /* type */
1310 2, /* size (0 = byte, 1 = short, 2 = long) */
1312 FALSE
, /* pc_relative */
1314 complain_overflow_dont
, /* complain_on_overflow */
1315 _bfd_mips_elf_generic_reloc
, /* special_function */
1316 "R_MIPS_HIGHEST", /* name */
1317 FALSE
, /* partial_inplace */
1319 0x0000ffff, /* dst_mask */
1320 FALSE
), /* pcrel_offset */
1322 /* High 16 bits of displacement in global offset table. */
1323 HOWTO (R_MIPS_CALL_HI16
, /* type */
1325 2, /* size (0 = byte, 1 = short, 2 = long) */
1327 FALSE
, /* pc_relative */
1329 complain_overflow_dont
, /* complain_on_overflow */
1330 _bfd_mips_elf_generic_reloc
, /* special_function */
1331 "R_MIPS_CALL_HI16", /* name */
1332 FALSE
, /* partial_inplace */
1334 0x0000ffff, /* dst_mask */
1335 FALSE
), /* pcrel_offset */
1337 /* Low 16 bits of displacement in global offset table. */
1338 HOWTO (R_MIPS_CALL_LO16
, /* type */
1340 2, /* size (0 = byte, 1 = short, 2 = long) */
1342 FALSE
, /* pc_relative */
1344 complain_overflow_dont
, /* complain_on_overflow */
1345 _bfd_mips_elf_generic_reloc
, /* special_function */
1346 "R_MIPS_CALL_LO16", /* name */
1347 FALSE
, /* partial_inplace */
1349 0x0000ffff, /* dst_mask */
1350 FALSE
), /* pcrel_offset */
1352 /* Section displacement, used by an associated event location section. */
1353 HOWTO (R_MIPS_SCN_DISP
, /* type */
1355 2, /* size (0 = byte, 1 = short, 2 = long) */
1357 FALSE
, /* pc_relative */
1359 complain_overflow_dont
, /* complain_on_overflow */
1360 _bfd_mips_elf_generic_reloc
, /* special_function */
1361 "R_MIPS_SCN_DISP", /* name */
1362 FALSE
, /* partial_inplace */
1364 0xffffffff, /* dst_mask */
1365 FALSE
), /* pcrel_offset */
1367 HOWTO (R_MIPS_REL16
, /* type */
1369 1, /* size (0 = byte, 1 = short, 2 = long) */
1371 FALSE
, /* pc_relative */
1373 complain_overflow_signed
, /* complain_on_overflow */
1374 _bfd_mips_elf_generic_reloc
, /* special_function */
1375 "R_MIPS_REL16", /* name */
1376 FALSE
, /* partial_inplace */
1378 0xffff, /* dst_mask */
1379 FALSE
), /* pcrel_offset */
1381 /* These two are obsolete. */
1382 EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE
),
1383 EMPTY_HOWTO (R_MIPS_PJUMP
),
1385 /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
1386 It must be used for multigot GOT's (and only there). */
1387 HOWTO (R_MIPS_RELGOT
, /* type */
1389 2, /* size (0 = byte, 1 = short, 2 = long) */
1391 FALSE
, /* pc_relative */
1393 complain_overflow_dont
, /* complain_on_overflow */
1394 _bfd_mips_elf_generic_reloc
, /* special_function */
1395 "R_MIPS_RELGOT", /* name */
1396 FALSE
, /* partial_inplace */
1398 0xffffffff, /* dst_mask */
1399 FALSE
), /* pcrel_offset */
1401 /* Protected jump conversion. This is an optimization hint. No
1402 relocation is required for correctness. */
1403 HOWTO (R_MIPS_JALR
, /* type */
1405 2, /* size (0 = byte, 1 = short, 2 = long) */
1407 FALSE
, /* pc_relative */
1409 complain_overflow_dont
, /* complain_on_overflow */
1410 _bfd_mips_elf_generic_reloc
, /* special_function */
1411 "R_MIPS_JALR", /* name */
1412 FALSE
, /* partial_inplace */
1414 0x00000000, /* dst_mask */
1415 FALSE
), /* pcrel_offset */
1417 /* TLS relocations. */
1418 EMPTY_HOWTO (R_MIPS_TLS_DTPMOD32
),
1419 EMPTY_HOWTO (R_MIPS_TLS_DTPREL32
),
1421 HOWTO (R_MIPS_TLS_DTPMOD64
, /* type */
1423 4, /* size (0 = byte, 1 = short, 2 = long) */
1425 FALSE
, /* pc_relative */
1427 complain_overflow_dont
, /* complain_on_overflow */
1428 _bfd_mips_elf_generic_reloc
, /* special_function */
1429 "R_MIPS_TLS_DTPMOD64", /* name */
1430 FALSE
, /* partial_inplace */
1432 MINUS_ONE
, /* dst_mask */
1433 FALSE
), /* pcrel_offset */
1435 HOWTO (R_MIPS_TLS_DTPREL64
, /* type */
1437 4, /* size (0 = byte, 1 = short, 2 = long) */
1439 FALSE
, /* pc_relative */
1441 complain_overflow_dont
, /* complain_on_overflow */
1442 _bfd_mips_elf_generic_reloc
, /* special_function */
1443 "R_MIPS_TLS_DTPREL64", /* name */
1444 FALSE
, /* partial_inplace */
1446 MINUS_ONE
, /* dst_mask */
1447 FALSE
), /* pcrel_offset */
1449 /* TLS general dynamic variable reference. */
1450 HOWTO (R_MIPS_TLS_GD
, /* type */
1452 2, /* size (0 = byte, 1 = short, 2 = long) */
1454 FALSE
, /* pc_relative */
1456 complain_overflow_signed
, /* complain_on_overflow */
1457 _bfd_mips_elf_generic_reloc
, /* special_function */
1458 "R_MIPS_TLS_GD", /* name */
1459 FALSE
, /* partial_inplace */
1461 0x0000ffff, /* dst_mask */
1462 FALSE
), /* pcrel_offset */
1464 /* TLS local dynamic variable reference. */
1465 HOWTO (R_MIPS_TLS_LDM
, /* type */
1467 2, /* size (0 = byte, 1 = short, 2 = long) */
1469 FALSE
, /* pc_relative */
1471 complain_overflow_signed
, /* complain_on_overflow */
1472 _bfd_mips_elf_generic_reloc
, /* special_function */
1473 "R_MIPS_TLS_LDM", /* name */
1474 FALSE
, /* partial_inplace */
1476 0x0000ffff, /* dst_mask */
1477 FALSE
), /* pcrel_offset */
1479 /* TLS local dynamic offset. */
1480 HOWTO (R_MIPS_TLS_DTPREL_HI16
, /* type */
1482 2, /* size (0 = byte, 1 = short, 2 = long) */
1484 FALSE
, /* pc_relative */
1486 complain_overflow_signed
, /* complain_on_overflow */
1487 _bfd_mips_elf_generic_reloc
, /* special_function */
1488 "R_MIPS_TLS_DTPREL_HI16", /* name */
1489 FALSE
, /* partial_inplace */
1491 0x0000ffff, /* dst_mask */
1492 FALSE
), /* pcrel_offset */
1494 /* TLS local dynamic offset. */
1495 HOWTO (R_MIPS_TLS_DTPREL_LO16
, /* type */
1497 2, /* size (0 = byte, 1 = short, 2 = long) */
1499 FALSE
, /* pc_relative */
1501 complain_overflow_signed
, /* complain_on_overflow */
1502 _bfd_mips_elf_generic_reloc
, /* special_function */
1503 "R_MIPS_TLS_DTPREL_LO16", /* name */
1504 FALSE
, /* partial_inplace */
1506 0x0000ffff, /* dst_mask */
1507 FALSE
), /* pcrel_offset */
1509 /* TLS thread pointer offset. */
1510 HOWTO (R_MIPS_TLS_GOTTPREL
, /* type */
1512 2, /* size (0 = byte, 1 = short, 2 = long) */
1514 FALSE
, /* pc_relative */
1516 complain_overflow_signed
, /* complain_on_overflow */
1517 _bfd_mips_elf_generic_reloc
, /* special_function */
1518 "R_MIPS_TLS_GOTTPREL", /* name */
1519 FALSE
, /* partial_inplace */
1521 0x0000ffff, /* dst_mask */
1522 FALSE
), /* pcrel_offset */
1524 /* TLS IE dynamic relocations. */
1525 EMPTY_HOWTO (R_MIPS_TLS_TPREL32
),
1527 HOWTO (R_MIPS_TLS_TPREL64
, /* type */
1529 4, /* size (0 = byte, 1 = short, 2 = long) */
1531 FALSE
, /* pc_relative */
1533 complain_overflow_dont
, /* complain_on_overflow */
1534 _bfd_mips_elf_generic_reloc
, /* special_function */
1535 "R_MIPS_TLS_TPREL64", /* name */
1536 FALSE
, /* partial_inplace */
1538 MINUS_ONE
, /* dst_mask */
1539 FALSE
), /* pcrel_offset */
1541 /* TLS thread pointer offset. */
1542 HOWTO (R_MIPS_TLS_TPREL_HI16
, /* type */
1544 2, /* size (0 = byte, 1 = short, 2 = long) */
1546 FALSE
, /* pc_relative */
1548 complain_overflow_signed
, /* complain_on_overflow */
1549 _bfd_mips_elf_generic_reloc
, /* special_function */
1550 "R_MIPS_TLS_TPREL_HI16", /* name */
1551 FALSE
, /* partial_inplace */
1553 0x0000ffff, /* dst_mask */
1554 FALSE
), /* pcrel_offset */
1556 /* TLS thread pointer offset. */
1557 HOWTO (R_MIPS_TLS_TPREL_LO16
, /* type */
1559 2, /* size (0 = byte, 1 = short, 2 = long) */
1561 FALSE
, /* pc_relative */
1563 complain_overflow_signed
, /* complain_on_overflow */
1564 _bfd_mips_elf_generic_reloc
, /* special_function */
1565 "R_MIPS_TLS_TPREL_LO16", /* name */
1566 FALSE
, /* partial_inplace */
1568 0x0000ffff, /* dst_mask */
1569 FALSE
), /* pcrel_offset */
1571 /* 32 bit relocation with no addend. */
1572 HOWTO (R_MIPS_GLOB_DAT
, /* type */
1574 2, /* size (0 = byte, 1 = short, 2 = long) */
1576 FALSE
, /* pc_relative */
1578 complain_overflow_dont
, /* complain_on_overflow */
1579 _bfd_mips_elf_generic_reloc
, /* special_function */
1580 "R_MIPS_GLOB_DAT", /* name */
1581 FALSE
, /* partial_inplace */
1583 0xffffffff, /* dst_mask */
1584 FALSE
), /* pcrel_offset */
1595 HOWTO (R_MIPS_PC21_S2
, /* type */
1597 2, /* size (0 = byte, 1 = short, 2 = long) */
1599 TRUE
, /* pc_relative */
1601 complain_overflow_signed
, /* complain_on_overflow */
1602 _bfd_mips_elf_generic_reloc
, /* special_function */
1603 "R_MIPS_PC21_S2", /* name */
1604 FALSE
, /* partial_inplace */
1606 0x001fffff, /* dst_mask */
1607 TRUE
), /* pcrel_offset */
1609 HOWTO (R_MIPS_PC26_S2
, /* type */
1611 2, /* size (0 = byte, 1 = short, 2 = long) */
1613 TRUE
, /* pc_relative */
1615 complain_overflow_signed
, /* complain_on_overflow */
1616 _bfd_mips_elf_generic_reloc
, /* special_function */
1617 "R_MIPS_PC26_S2", /* name */
1618 FALSE
, /* partial_inplace */
1620 0x03ffffff, /* dst_mask */
1621 TRUE
), /* pcrel_offset */
1623 HOWTO (R_MIPS_PC18_S3
, /* type */
1625 2, /* size (0 = byte, 1 = short, 2 = long) */
1627 TRUE
, /* pc_relative */
1629 complain_overflow_signed
, /* complain_on_overflow */
1630 _bfd_mips_elf_generic_reloc
, /* special_function */
1631 "R_MIPS_PC18_S3", /* name */
1632 FALSE
, /* partial_inplace */
1634 0x0003ffff, /* dst_mask */
1635 TRUE
), /* pcrel_offset */
1637 HOWTO (R_MIPS_PC19_S2
, /* type */
1639 2, /* size (0 = byte, 1 = short, 2 = long) */
1641 TRUE
, /* pc_relative */
1643 complain_overflow_signed
, /* complain_on_overflow */
1644 _bfd_mips_elf_generic_reloc
, /* special_function */
1645 "R_MIPS_PC19_S2", /* name */
1646 FALSE
, /* partial_inplace */
1648 0x0007ffff, /* dst_mask */
1649 TRUE
), /* pcrel_offset */
1651 HOWTO (R_MIPS_PCHI16
, /* type */
1652 16, /* rightshift */
1653 2, /* size (0 = byte, 1 = short, 2 = long) */
1655 TRUE
, /* pc_relative */
1657 complain_overflow_signed
, /* complain_on_overflow */
1658 _bfd_mips_elf_generic_reloc
, /* special_function */
1659 "R_MIPS_PCHI16", /* name */
1660 FALSE
, /* partial_inplace */
1662 0x0000ffff, /* dst_mask */
1663 TRUE
), /* pcrel_offset */
1665 HOWTO (R_MIPS_PCLO16
, /* type */
1667 2, /* size (0 = byte, 1 = short, 2 = long) */
1669 TRUE
, /* pc_relative */
1671 complain_overflow_dont
, /* complain_on_overflow */
1672 _bfd_mips_elf_generic_reloc
, /* special_function */
1673 "R_MIPS_PCLO16", /* name */
1674 FALSE
, /* partial_inplace */
1676 0x0000ffff, /* dst_mask */
1677 TRUE
), /* pcrel_offset */
1681 static reloc_howto_type mips16_elf64_howto_table_rel
[] =
1683 /* The reloc used for the mips16 jump instruction. */
1684 HOWTO (R_MIPS16_26
, /* type */
1686 2, /* size (0 = byte, 1 = short, 2 = long) */
1688 FALSE
, /* pc_relative */
1690 complain_overflow_dont
, /* complain_on_overflow */
1691 /* This needs complex overflow
1692 detection, because the upper four
1693 bits must match the PC. */
1694 _bfd_mips_elf_generic_reloc
, /* special_function */
1695 "R_MIPS16_26", /* name */
1696 TRUE
, /* partial_inplace */
1697 0x3ffffff, /* src_mask */
1698 0x3ffffff, /* dst_mask */
1699 FALSE
), /* pcrel_offset */
1701 /* The reloc used for the mips16 gprel instruction. */
1702 HOWTO (R_MIPS16_GPREL
, /* type */
1704 2, /* size (0 = byte, 1 = short, 2 = long) */
1706 FALSE
, /* pc_relative */
1708 complain_overflow_signed
, /* complain_on_overflow */
1709 mips16_gprel_reloc
, /* special_function */
1710 "R_MIPS16_GPREL", /* name */
1711 TRUE
, /* partial_inplace */
1712 0x0000ffff, /* src_mask */
1713 0x0000ffff, /* dst_mask */
1714 FALSE
), /* pcrel_offset */
1716 /* A MIPS16 reference to the global offset table. */
1717 HOWTO (R_MIPS16_GOT16
, /* type */
1719 2, /* size (0 = byte, 1 = short, 2 = long) */
1721 FALSE
, /* pc_relative */
1723 complain_overflow_dont
, /* complain_on_overflow */
1724 _bfd_mips_elf_got16_reloc
, /* special_function */
1725 "R_MIPS16_GOT16", /* name */
1726 TRUE
, /* partial_inplace */
1727 0x0000ffff, /* src_mask */
1728 0x0000ffff, /* dst_mask */
1729 FALSE
), /* pcrel_offset */
1731 /* A MIPS16 call through the global offset table. */
1732 HOWTO (R_MIPS16_CALL16
, /* type */
1734 2, /* size (0 = byte, 1 = short, 2 = long) */
1736 FALSE
, /* pc_relative */
1738 complain_overflow_dont
, /* complain_on_overflow */
1739 _bfd_mips_elf_generic_reloc
, /* special_function */
1740 "R_MIPS16_CALL16", /* name */
1741 TRUE
, /* partial_inplace */
1742 0x0000ffff, /* src_mask */
1743 0x0000ffff, /* dst_mask */
1744 FALSE
), /* pcrel_offset */
1746 /* MIPS16 high 16 bits of symbol value. */
1747 HOWTO (R_MIPS16_HI16
, /* type */
1748 16, /* rightshift */
1749 2, /* size (0 = byte, 1 = short, 2 = long) */
1751 FALSE
, /* pc_relative */
1753 complain_overflow_dont
, /* complain_on_overflow */
1754 _bfd_mips_elf_hi16_reloc
, /* special_function */
1755 "R_MIPS16_HI16", /* name */
1756 TRUE
, /* partial_inplace */
1757 0x0000ffff, /* src_mask */
1758 0x0000ffff, /* dst_mask */
1759 FALSE
), /* pcrel_offset */
1761 /* MIPS16 low 16 bits of symbol value. */
1762 HOWTO (R_MIPS16_LO16
, /* type */
1764 2, /* size (0 = byte, 1 = short, 2 = long) */
1766 FALSE
, /* pc_relative */
1768 complain_overflow_dont
, /* complain_on_overflow */
1769 _bfd_mips_elf_lo16_reloc
, /* special_function */
1770 "R_MIPS16_LO16", /* name */
1771 TRUE
, /* partial_inplace */
1772 0x0000ffff, /* src_mask */
1773 0x0000ffff, /* dst_mask */
1774 FALSE
), /* pcrel_offset */
1776 /* MIPS16 TLS general dynamic variable reference. */
1777 HOWTO (R_MIPS16_TLS_GD
, /* type */
1779 2, /* size (0 = byte, 1 = short, 2 = long) */
1781 FALSE
, /* pc_relative */
1783 complain_overflow_signed
, /* complain_on_overflow */
1784 _bfd_mips_elf_generic_reloc
, /* special_function */
1785 "R_MIPS16_TLS_GD", /* name */
1786 TRUE
, /* partial_inplace */
1787 0x0000ffff, /* src_mask */
1788 0x0000ffff, /* dst_mask */
1789 FALSE
), /* pcrel_offset */
1791 /* MIPS16 TLS local dynamic variable reference. */
1792 HOWTO (R_MIPS16_TLS_LDM
, /* type */
1794 2, /* size (0 = byte, 1 = short, 2 = long) */
1796 FALSE
, /* pc_relative */
1798 complain_overflow_signed
, /* complain_on_overflow */
1799 _bfd_mips_elf_generic_reloc
, /* special_function */
1800 "R_MIPS16_TLS_LDM", /* name */
1801 TRUE
, /* partial_inplace */
1802 0x0000ffff, /* src_mask */
1803 0x0000ffff, /* dst_mask */
1804 FALSE
), /* pcrel_offset */
1806 /* MIPS16 TLS local dynamic offset. */
1807 HOWTO (R_MIPS16_TLS_DTPREL_HI16
, /* type */
1809 2, /* size (0 = byte, 1 = short, 2 = long) */
1811 FALSE
, /* pc_relative */
1813 complain_overflow_signed
, /* complain_on_overflow */
1814 _bfd_mips_elf_generic_reloc
, /* special_function */
1815 "R_MIPS16_TLS_DTPREL_HI16", /* name */
1816 TRUE
, /* partial_inplace */
1817 0x0000ffff, /* src_mask */
1818 0x0000ffff, /* dst_mask */
1819 FALSE
), /* pcrel_offset */
1821 /* MIPS16 TLS local dynamic offset. */
1822 HOWTO (R_MIPS16_TLS_DTPREL_LO16
, /* type */
1824 2, /* size (0 = byte, 1 = short, 2 = long) */
1826 FALSE
, /* pc_relative */
1828 complain_overflow_signed
, /* complain_on_overflow */
1829 _bfd_mips_elf_generic_reloc
, /* special_function */
1830 "R_MIPS16_TLS_DTPREL_LO16", /* name */
1831 TRUE
, /* partial_inplace */
1832 0x0000ffff, /* src_mask */
1833 0x0000ffff, /* dst_mask */
1834 FALSE
), /* pcrel_offset */
1836 /* MIPS16 TLS thread pointer offset. */
1837 HOWTO (R_MIPS16_TLS_GOTTPREL
, /* type */
1839 2, /* size (0 = byte, 1 = short, 2 = long) */
1841 FALSE
, /* pc_relative */
1843 complain_overflow_signed
, /* complain_on_overflow */
1844 _bfd_mips_elf_generic_reloc
, /* special_function */
1845 "R_MIPS16_TLS_GOTTPREL", /* name */
1846 TRUE
, /* partial_inplace */
1847 0x0000ffff, /* src_mask */
1848 0x0000ffff, /* dst_mask */
1849 FALSE
), /* pcrel_offset */
1851 /* MIPS16 TLS thread pointer offset. */
1852 HOWTO (R_MIPS16_TLS_TPREL_HI16
, /* type */
1854 2, /* size (0 = byte, 1 = short, 2 = long) */
1856 FALSE
, /* pc_relative */
1858 complain_overflow_signed
, /* complain_on_overflow */
1859 _bfd_mips_elf_generic_reloc
, /* special_function */
1860 "R_MIPS16_TLS_TPREL_HI16", /* name */
1861 TRUE
, /* partial_inplace */
1862 0x0000ffff, /* src_mask */
1863 0x0000ffff, /* dst_mask */
1864 FALSE
), /* pcrel_offset */
1866 /* MIPS16 TLS thread pointer offset. */
1867 HOWTO (R_MIPS16_TLS_TPREL_LO16
, /* type */
1869 2, /* size (0 = byte, 1 = short, 2 = long) */
1871 FALSE
, /* pc_relative */
1873 complain_overflow_signed
, /* complain_on_overflow */
1874 _bfd_mips_elf_generic_reloc
, /* special_function */
1875 "R_MIPS16_TLS_TPREL_LO16", /* name */
1876 TRUE
, /* partial_inplace */
1877 0x0000ffff, /* src_mask */
1878 0x0000ffff, /* dst_mask */
1879 FALSE
), /* pcrel_offset */
1881 /* MIPS16 16-bit PC-relative branch offset. */
1882 HOWTO (R_MIPS16_PC16_S1
, /* type */
1884 2, /* size (0 = byte, 1 = short, 2 = long) */
1886 TRUE
, /* pc_relative */
1888 complain_overflow_signed
, /* complain_on_overflow */
1889 _bfd_mips_elf_generic_reloc
, /* special_function */
1890 "R_MIPS16_PC16_S1", /* name */
1891 TRUE
, /* partial_inplace */
1892 0x0000ffff, /* src_mask */
1893 0x0000ffff, /* dst_mask */
1894 TRUE
), /* pcrel_offset */
1897 static reloc_howto_type mips16_elf64_howto_table_rela
[] =
1899 /* The reloc used for the mips16 jump instruction. */
1900 HOWTO (R_MIPS16_26
, /* type */
1902 2, /* size (0 = byte, 1 = short, 2 = long) */
1904 FALSE
, /* pc_relative */
1906 complain_overflow_dont
, /* complain_on_overflow */
1907 /* This needs complex overflow
1908 detection, because the upper four
1909 bits must match the PC. */
1910 _bfd_mips_elf_generic_reloc
, /* special_function */
1911 "R_MIPS16_26", /* name */
1912 FALSE
, /* partial_inplace */
1914 0x3ffffff, /* dst_mask */
1915 FALSE
), /* pcrel_offset */
1917 /* The reloc used for the mips16 gprel instruction. */
1918 HOWTO (R_MIPS16_GPREL
, /* type */
1920 2, /* size (0 = byte, 1 = short, 2 = long) */
1922 FALSE
, /* pc_relative */
1924 complain_overflow_signed
, /* complain_on_overflow */
1925 mips16_gprel_reloc
, /* special_function */
1926 "R_MIPS16_GPREL", /* name */
1927 FALSE
, /* partial_inplace */
1929 0x0000ffff, /* dst_mask */
1930 FALSE
), /* pcrel_offset */
1932 /* A MIPS16 reference to the global offset table. */
1933 HOWTO (R_MIPS16_GOT16
, /* type */
1935 2, /* size (0 = byte, 1 = short, 2 = long) */
1937 FALSE
, /* pc_relative */
1939 complain_overflow_dont
, /* complain_on_overflow */
1940 _bfd_mips_elf_got16_reloc
, /* special_function */
1941 "R_MIPS16_GOT16", /* name */
1942 FALSE
, /* partial_inplace */
1944 0x0000ffff, /* dst_mask */
1945 FALSE
), /* pcrel_offset */
1947 /* A MIPS16 call through the global offset table. */
1948 HOWTO (R_MIPS16_CALL16
, /* type */
1950 2, /* size (0 = byte, 1 = short, 2 = long) */
1952 FALSE
, /* pc_relative */
1954 complain_overflow_dont
, /* complain_on_overflow */
1955 _bfd_mips_elf_generic_reloc
, /* special_function */
1956 "R_MIPS16_CALL16", /* name */
1957 FALSE
, /* partial_inplace */
1959 0x0000ffff, /* dst_mask */
1960 FALSE
), /* pcrel_offset */
1962 /* MIPS16 high 16 bits of symbol value. */
1963 HOWTO (R_MIPS16_HI16
, /* type */
1964 16, /* rightshift */
1965 2, /* size (0 = byte, 1 = short, 2 = long) */
1967 FALSE
, /* pc_relative */
1969 complain_overflow_dont
, /* complain_on_overflow */
1970 _bfd_mips_elf_hi16_reloc
, /* special_function */
1971 "R_MIPS16_HI16", /* name */
1972 FALSE
, /* partial_inplace */
1974 0x0000ffff, /* dst_mask */
1975 FALSE
), /* pcrel_offset */
1977 /* MIPS16 low 16 bits of symbol value. */
1978 HOWTO (R_MIPS16_LO16
, /* type */
1980 2, /* size (0 = byte, 1 = short, 2 = long) */
1982 FALSE
, /* pc_relative */
1984 complain_overflow_dont
, /* complain_on_overflow */
1985 _bfd_mips_elf_lo16_reloc
, /* special_function */
1986 "R_MIPS16_LO16", /* name */
1987 FALSE
, /* partial_inplace */
1989 0x0000ffff, /* dst_mask */
1990 FALSE
), /* pcrel_offset */
1992 /* MIPS16 TLS general dynamic variable reference. */
1993 HOWTO (R_MIPS16_TLS_GD
, /* type */
1995 2, /* size (0 = byte, 1 = short, 2 = long) */
1997 FALSE
, /* pc_relative */
1999 complain_overflow_signed
, /* complain_on_overflow */
2000 _bfd_mips_elf_generic_reloc
, /* special_function */
2001 "R_MIPS16_TLS_GD", /* name */
2002 FALSE
, /* partial_inplace */
2004 0x0000ffff, /* dst_mask */
2005 FALSE
), /* pcrel_offset */
2007 /* MIPS16 TLS local dynamic variable reference. */
2008 HOWTO (R_MIPS16_TLS_LDM
, /* type */
2010 2, /* size (0 = byte, 1 = short, 2 = long) */
2012 FALSE
, /* pc_relative */
2014 complain_overflow_signed
, /* complain_on_overflow */
2015 _bfd_mips_elf_generic_reloc
, /* special_function */
2016 "R_MIPS16_TLS_LDM", /* name */
2017 FALSE
, /* partial_inplace */
2019 0x0000ffff, /* dst_mask */
2020 FALSE
), /* pcrel_offset */
2022 /* MIPS16 TLS local dynamic offset. */
2023 HOWTO (R_MIPS16_TLS_DTPREL_HI16
, /* type */
2025 2, /* size (0 = byte, 1 = short, 2 = long) */
2027 FALSE
, /* pc_relative */
2029 complain_overflow_signed
, /* complain_on_overflow */
2030 _bfd_mips_elf_generic_reloc
, /* special_function */
2031 "R_MIPS16_TLS_DTPREL_HI16", /* name */
2032 FALSE
, /* partial_inplace */
2034 0x0000ffff, /* dst_mask */
2035 FALSE
), /* pcrel_offset */
2037 /* MIPS16 TLS local dynamic offset. */
2038 HOWTO (R_MIPS16_TLS_DTPREL_LO16
, /* type */
2040 2, /* size (0 = byte, 1 = short, 2 = long) */
2042 FALSE
, /* pc_relative */
2044 complain_overflow_signed
, /* complain_on_overflow */
2045 _bfd_mips_elf_generic_reloc
, /* special_function */
2046 "R_MIPS16_TLS_DTPREL_LO16", /* name */
2047 FALSE
, /* partial_inplace */
2049 0x0000ffff, /* dst_mask */
2050 FALSE
), /* pcrel_offset */
2052 /* MIPS16 TLS thread pointer offset. */
2053 HOWTO (R_MIPS16_TLS_GOTTPREL
, /* type */
2055 2, /* size (0 = byte, 1 = short, 2 = long) */
2057 FALSE
, /* pc_relative */
2059 complain_overflow_signed
, /* complain_on_overflow */
2060 _bfd_mips_elf_generic_reloc
, /* special_function */
2061 "R_MIPS16_TLS_GOTTPREL", /* name */
2062 FALSE
, /* partial_inplace */
2064 0x0000ffff, /* dst_mask */
2065 FALSE
), /* pcrel_offset */
2067 /* MIPS16 TLS thread pointer offset. */
2068 HOWTO (R_MIPS16_TLS_TPREL_HI16
, /* type */
2070 2, /* size (0 = byte, 1 = short, 2 = long) */
2072 FALSE
, /* pc_relative */
2074 complain_overflow_signed
, /* complain_on_overflow */
2075 _bfd_mips_elf_generic_reloc
, /* special_function */
2076 "R_MIPS16_TLS_TPREL_HI16", /* name */
2077 FALSE
, /* partial_inplace */
2079 0x0000ffff, /* dst_mask */
2080 FALSE
), /* pcrel_offset */
2082 /* MIPS16 TLS thread pointer offset. */
2083 HOWTO (R_MIPS16_TLS_TPREL_LO16
, /* type */
2085 2, /* size (0 = byte, 1 = short, 2 = long) */
2087 FALSE
, /* pc_relative */
2089 complain_overflow_signed
, /* complain_on_overflow */
2090 _bfd_mips_elf_generic_reloc
, /* special_function */
2091 "R_MIPS16_TLS_TPREL_LO16", /* name */
2092 FALSE
, /* partial_inplace */
2094 0x0000ffff, /* dst_mask */
2095 FALSE
), /* pcrel_offset */
2097 /* MIPS16 16-bit PC-relative branch offset. */
2098 HOWTO (R_MIPS16_PC16_S1
, /* type */
2100 2, /* size (0 = byte, 1 = short, 2 = long) */
2102 TRUE
, /* pc_relative */
2104 complain_overflow_signed
, /* complain_on_overflow */
2105 _bfd_mips_elf_generic_reloc
, /* special_function */
2106 "R_MIPS16_PC16_S1", /* name */
2107 FALSE
, /* partial_inplace */
2109 0x0000ffff, /* dst_mask */
2110 TRUE
), /* pcrel_offset */
2113 static reloc_howto_type micromips_elf64_howto_table_rel
[] =
2119 /* 26 bit jump address. */
2120 HOWTO (R_MICROMIPS_26_S1
, /* type */
2122 2, /* size (0 = byte, 1 = short, 2 = long) */
2124 FALSE
, /* pc_relative */
2126 complain_overflow_dont
, /* complain_on_overflow */
2127 /* This needs complex overflow
2128 detection, because the upper four
2129 bits must match the PC. */
2130 _bfd_mips_elf_generic_reloc
, /* special_function */
2131 "R_MICROMIPS_26_S1", /* name */
2132 TRUE
, /* partial_inplace */
2133 0x3ffffff, /* src_mask */
2134 0x3ffffff, /* dst_mask */
2135 FALSE
), /* pcrel_offset */
2137 /* High 16 bits of symbol value. */
2138 HOWTO (R_MICROMIPS_HI16
, /* type */
2139 16, /* rightshift */
2140 2, /* size (0 = byte, 1 = short, 2 = long) */
2142 FALSE
, /* pc_relative */
2144 complain_overflow_dont
, /* complain_on_overflow */
2145 _bfd_mips_elf_hi16_reloc
, /* special_function */
2146 "R_MICROMIPS_HI16", /* name */
2147 TRUE
, /* partial_inplace */
2148 0x0000ffff, /* src_mask */
2149 0x0000ffff, /* dst_mask */
2150 FALSE
), /* pcrel_offset */
2152 /* Low 16 bits of symbol value. */
2153 HOWTO (R_MICROMIPS_LO16
, /* type */
2155 2, /* size (0 = byte, 1 = short, 2 = long) */
2157 FALSE
, /* pc_relative */
2159 complain_overflow_dont
, /* complain_on_overflow */
2160 _bfd_mips_elf_lo16_reloc
, /* special_function */
2161 "R_MICROMIPS_LO16", /* name */
2162 TRUE
, /* partial_inplace */
2163 0x0000ffff, /* src_mask */
2164 0x0000ffff, /* dst_mask */
2165 FALSE
), /* pcrel_offset */
2167 /* GP relative reference. */
2168 HOWTO (R_MICROMIPS_GPREL16
, /* type */
2170 2, /* size (0 = byte, 1 = short, 2 = long) */
2172 FALSE
, /* pc_relative */
2174 complain_overflow_signed
, /* complain_on_overflow */
2175 _bfd_mips_elf32_gprel16_reloc
, /* special_function */
2176 "R_MICROMIPS_GPREL16", /* name */
2177 TRUE
, /* partial_inplace */
2178 0x0000ffff, /* src_mask */
2179 0x0000ffff, /* dst_mask */
2180 FALSE
), /* pcrel_offset */
2182 /* Reference to literal section. */
2183 HOWTO (R_MICROMIPS_LITERAL
, /* type */
2185 2, /* size (0 = byte, 1 = short, 2 = long) */
2187 FALSE
, /* pc_relative */
2189 complain_overflow_signed
, /* complain_on_overflow */
2190 _bfd_mips_elf32_gprel16_reloc
, /* special_function */
2191 "R_MICROMIPS_LITERAL", /* name */
2192 TRUE
, /* partial_inplace */
2193 0x0000ffff, /* src_mask */
2194 0x0000ffff, /* dst_mask */
2195 FALSE
), /* pcrel_offset */
2197 /* Reference to global offset table. */
2198 HOWTO (R_MICROMIPS_GOT16
, /* type */
2200 2, /* size (0 = byte, 1 = short, 2 = long) */
2202 FALSE
, /* pc_relative */
2204 complain_overflow_signed
, /* complain_on_overflow */
2205 _bfd_mips_elf_got16_reloc
, /* special_function */
2206 "R_MICROMIPS_GOT16", /* name */
2207 TRUE
, /* partial_inplace */
2208 0x0000ffff, /* src_mask */
2209 0x0000ffff, /* dst_mask */
2210 FALSE
), /* pcrel_offset */
2212 /* This is for microMIPS branches. */
2213 HOWTO (R_MICROMIPS_PC7_S1
, /* type */
2215 1, /* size (0 = byte, 1 = short, 2 = long) */
2217 TRUE
, /* pc_relative */
2219 complain_overflow_signed
, /* complain_on_overflow */
2220 _bfd_mips_elf_generic_reloc
, /* special_function */
2221 "R_MICROMIPS_PC7_S1", /* name */
2222 TRUE
, /* partial_inplace */
2223 0x0000007f, /* src_mask */
2224 0x0000007f, /* dst_mask */
2225 TRUE
), /* pcrel_offset */
2227 HOWTO (R_MICROMIPS_PC10_S1
, /* type */
2229 1, /* size (0 = byte, 1 = short, 2 = long) */
2231 TRUE
, /* pc_relative */
2233 complain_overflow_signed
, /* complain_on_overflow */
2234 _bfd_mips_elf_generic_reloc
, /* special_function */
2235 "R_MICROMIPS_PC10_S1", /* name */
2236 TRUE
, /* partial_inplace */
2237 0x000003ff, /* src_mask */
2238 0x000003ff, /* dst_mask */
2239 TRUE
), /* pcrel_offset */
2241 HOWTO (R_MICROMIPS_PC16_S1
, /* type */
2243 2, /* size (0 = byte, 1 = short, 2 = long) */
2245 TRUE
, /* pc_relative */
2247 complain_overflow_signed
, /* complain_on_overflow */
2248 _bfd_mips_elf_generic_reloc
, /* special_function */
2249 "R_MICROMIPS_PC16_S1", /* name */
2250 TRUE
, /* partial_inplace */
2251 0x0000ffff, /* src_mask */
2252 0x0000ffff, /* dst_mask */
2253 TRUE
), /* pcrel_offset */
2255 /* 16 bit call through global offset table. */
2256 HOWTO (R_MICROMIPS_CALL16
, /* type */
2258 2, /* size (0 = byte, 1 = short, 2 = long) */
2260 FALSE
, /* pc_relative */
2262 complain_overflow_signed
, /* complain_on_overflow */
2263 _bfd_mips_elf_generic_reloc
, /* special_function */
2264 "R_MICROMIPS_CALL16", /* name */
2265 TRUE
, /* partial_inplace */
2266 0x0000ffff, /* src_mask */
2267 0x0000ffff, /* dst_mask */
2268 FALSE
), /* pcrel_offset */
2273 /* Displacement in the global offset table. */
2274 HOWTO (R_MICROMIPS_GOT_DISP
, /* type */
2276 2, /* size (0 = byte, 1 = short, 2 = long) */
2278 FALSE
, /* pc_relative */
2280 complain_overflow_signed
, /* complain_on_overflow */
2281 _bfd_mips_elf_generic_reloc
, /* special_function */
2282 "R_MICROMIPS_GOT_DISP",/* name */
2283 TRUE
, /* partial_inplace */
2284 0x0000ffff, /* src_mask */
2285 0x0000ffff, /* dst_mask */
2286 FALSE
), /* pcrel_offset */
2288 /* Displacement to page pointer in the global offset table. */
2289 HOWTO (R_MICROMIPS_GOT_PAGE
, /* type */
2291 2, /* size (0 = byte, 1 = short, 2 = long) */
2293 FALSE
, /* pc_relative */
2295 complain_overflow_signed
, /* complain_on_overflow */
2296 _bfd_mips_elf_generic_reloc
, /* special_function */
2297 "R_MICROMIPS_GOT_PAGE",/* name */
2298 TRUE
, /* partial_inplace */
2299 0x0000ffff, /* src_mask */
2300 0x0000ffff, /* dst_mask */
2301 FALSE
), /* pcrel_offset */
2303 /* Offset from page pointer in the global offset table. */
2304 HOWTO (R_MICROMIPS_GOT_OFST
, /* type */
2306 2, /* size (0 = byte, 1 = short, 2 = long) */
2308 FALSE
, /* pc_relative */
2310 complain_overflow_signed
, /* complain_on_overflow */
2311 _bfd_mips_elf_generic_reloc
, /* special_function */
2312 "R_MICROMIPS_GOT_OFST",/* name */
2313 TRUE
, /* partial_inplace */
2314 0x0000ffff, /* src_mask */
2315 0x0000ffff, /* dst_mask */
2316 FALSE
), /* pcrel_offset */
2318 /* High 16 bits of displacement in global offset table. */
2319 HOWTO (R_MICROMIPS_GOT_HI16
, /* type */
2321 2, /* size (0 = byte, 1 = short, 2 = long) */
2323 FALSE
, /* pc_relative */
2325 complain_overflow_dont
, /* complain_on_overflow */
2326 _bfd_mips_elf_generic_reloc
, /* special_function */
2327 "R_MICROMIPS_GOT_HI16",/* name */
2328 TRUE
, /* partial_inplace */
2329 0x0000ffff, /* src_mask */
2330 0x0000ffff, /* dst_mask */
2331 FALSE
), /* pcrel_offset */
2333 /* Low 16 bits of displacement in global offset table. */
2334 HOWTO (R_MICROMIPS_GOT_LO16
, /* type */
2336 2, /* size (0 = byte, 1 = short, 2 = long) */
2338 FALSE
, /* pc_relative */
2340 complain_overflow_dont
, /* complain_on_overflow */
2341 _bfd_mips_elf_generic_reloc
, /* special_function */
2342 "R_MICROMIPS_GOT_LO16",/* name */
2343 TRUE
, /* partial_inplace */
2344 0x0000ffff, /* src_mask */
2345 0x0000ffff, /* dst_mask */
2346 FALSE
), /* pcrel_offset */
2348 /* 64 bit subtraction. Used in the N32 ABI. */
2349 HOWTO (R_MICROMIPS_SUB
, /* type */
2351 4, /* size (0 = byte, 1 = short, 2 = long) */
2353 FALSE
, /* pc_relative */
2355 complain_overflow_dont
, /* complain_on_overflow */
2356 _bfd_mips_elf_generic_reloc
, /* special_function */
2357 "R_MICROMIPS_SUB", /* name */
2358 TRUE
, /* partial_inplace */
2359 MINUS_ONE
, /* src_mask */
2360 MINUS_ONE
, /* dst_mask */
2361 FALSE
), /* pcrel_offset */
2363 /* We don't support these for REL relocations, because it means building
2364 the addend from a R_MICROMIPS_HIGHEST/R_MICROMIPS_HIGHER/
2365 R_MICROMIPS_HI16/R_MICROMIPS_LO16 sequence with varying ordering,
2366 using fallable heuristics. */
2367 EMPTY_HOWTO (R_MICROMIPS_HIGHER
),
2368 EMPTY_HOWTO (R_MICROMIPS_HIGHEST
),
2370 /* High 16 bits of displacement in global offset table. */
2371 HOWTO (R_MICROMIPS_CALL_HI16
, /* type */
2373 2, /* size (0 = byte, 1 = short, 2 = long) */
2375 FALSE
, /* pc_relative */
2377 complain_overflow_dont
, /* complain_on_overflow */
2378 _bfd_mips_elf_generic_reloc
, /* special_function */
2379 "R_MICROMIPS_CALL_HI16",/* name */
2380 TRUE
, /* partial_inplace */
2381 0x0000ffff, /* src_mask */
2382 0x0000ffff, /* dst_mask */
2383 FALSE
), /* pcrel_offset */
2385 /* Low 16 bits of displacement in global offset table. */
2386 HOWTO (R_MICROMIPS_CALL_LO16
, /* type */
2388 2, /* size (0 = byte, 1 = short, 2 = long) */
2390 FALSE
, /* pc_relative */
2392 complain_overflow_dont
, /* complain_on_overflow */
2393 _bfd_mips_elf_generic_reloc
, /* special_function */
2394 "R_MICROMIPS_CALL_LO16",/* name */
2395 TRUE
, /* partial_inplace */
2396 0x0000ffff, /* src_mask */
2397 0x0000ffff, /* dst_mask */
2398 FALSE
), /* pcrel_offset */
2400 /* Section displacement. */
2401 HOWTO (R_MICROMIPS_SCN_DISP
, /* type */
2403 2, /* size (0 = byte, 1 = short, 2 = long) */
2405 FALSE
, /* pc_relative */
2407 complain_overflow_dont
, /* complain_on_overflow */
2408 _bfd_mips_elf_generic_reloc
, /* special_function */
2409 "R_MICROMIPS_SCN_DISP", /* name */
2410 TRUE
, /* partial_inplace */
2411 0xffffffff, /* src_mask */
2412 0xffffffff, /* dst_mask */
2413 FALSE
), /* pcrel_offset */
2415 /* Protected jump conversion. This is an optimization hint. No
2416 relocation is required for correctness. */
2417 HOWTO (R_MICROMIPS_JALR
, /* type */
2419 2, /* size (0 = byte, 1 = short, 2 = long) */
2421 FALSE
, /* pc_relative */
2423 complain_overflow_dont
, /* complain_on_overflow */
2424 _bfd_mips_elf_generic_reloc
, /* special_function */
2425 "R_MICROMIPS_JALR", /* name */
2426 FALSE
, /* partial_inplace */
2428 0x00000000, /* dst_mask */
2429 FALSE
), /* pcrel_offset */
2432 static reloc_howto_type micromips_elf64_howto_table_rela
[] =
2438 /* 26 bit jump address. */
2439 HOWTO (R_MICROMIPS_26_S1
, /* type */
2441 2, /* size (0 = byte, 1 = short, 2 = long) */
2443 FALSE
, /* pc_relative */
2445 complain_overflow_dont
, /* complain_on_overflow */
2446 /* This needs complex overflow
2447 detection, because the upper four
2448 bits must match the PC. */
2449 _bfd_mips_elf_generic_reloc
, /* special_function */
2450 "R_MICROMIPS_26_S1", /* name */
2451 FALSE
, /* partial_inplace */
2453 0x3ffffff, /* dst_mask */
2454 FALSE
), /* pcrel_offset */
2456 /* High 16 bits of symbol value. */
2457 HOWTO (R_MICROMIPS_HI16
, /* type */
2458 16, /* rightshift */
2459 2, /* size (0 = byte, 1 = short, 2 = long) */
2461 FALSE
, /* pc_relative */
2463 complain_overflow_dont
, /* complain_on_overflow */
2464 _bfd_mips_elf_hi16_reloc
, /* special_function */
2465 "R_MICROMIPS_HI16", /* name */
2466 FALSE
, /* partial_inplace */
2468 0x0000ffff, /* dst_mask */
2469 FALSE
), /* pcrel_offset */
2471 /* Low 16 bits of symbol value. */
2472 HOWTO (R_MICROMIPS_LO16
, /* type */
2474 2, /* size (0 = byte, 1 = short, 2 = long) */
2476 FALSE
, /* pc_relative */
2478 complain_overflow_dont
, /* complain_on_overflow */
2479 _bfd_mips_elf_lo16_reloc
, /* special_function */
2480 "R_MICROMIPS_LO16", /* name */
2481 FALSE
, /* partial_inplace */
2483 0x0000ffff, /* dst_mask */
2484 FALSE
), /* pcrel_offset */
2486 /* GP relative reference. */
2487 HOWTO (R_MICROMIPS_GPREL16
, /* type */
2489 2, /* size (0 = byte, 1 = short, 2 = long) */
2491 FALSE
, /* pc_relative */
2493 complain_overflow_signed
, /* complain_on_overflow */
2494 _bfd_mips_elf32_gprel16_reloc
, /* special_function */
2495 "R_MICROMIPS_GPREL16", /* name */
2496 FALSE
, /* partial_inplace */
2498 0x0000ffff, /* dst_mask */
2499 FALSE
), /* pcrel_offset */
2501 /* Reference to literal section. */
2502 HOWTO (R_MICROMIPS_LITERAL
, /* type */
2504 2, /* size (0 = byte, 1 = short, 2 = long) */
2506 FALSE
, /* pc_relative */
2508 complain_overflow_signed
, /* complain_on_overflow */
2509 _bfd_mips_elf32_gprel16_reloc
, /* special_function */
2510 "R_MICROMIPS_LITERAL", /* name */
2511 FALSE
, /* partial_inplace */
2513 0x0000ffff, /* dst_mask */
2514 FALSE
), /* pcrel_offset */
2516 /* Reference to global offset table. */
2517 HOWTO (R_MICROMIPS_GOT16
, /* type */
2519 2, /* size (0 = byte, 1 = short, 2 = long) */
2521 FALSE
, /* pc_relative */
2523 complain_overflow_signed
, /* complain_on_overflow */
2524 _bfd_mips_elf_got16_reloc
, /* special_function */
2525 "R_MICROMIPS_GOT16", /* name */
2526 FALSE
, /* partial_inplace */
2528 0x0000ffff, /* dst_mask */
2529 FALSE
), /* pcrel_offset */
2531 /* This is for microMIPS branches. */
2532 HOWTO (R_MICROMIPS_PC7_S1
, /* type */
2534 1, /* size (0 = byte, 1 = short, 2 = long) */
2536 TRUE
, /* pc_relative */
2538 complain_overflow_signed
, /* complain_on_overflow */
2539 _bfd_mips_elf_generic_reloc
, /* special_function */
2540 "R_MICROMIPS_PC7_S1", /* name */
2541 FALSE
, /* partial_inplace */
2543 0x0000007f, /* dst_mask */
2544 TRUE
), /* pcrel_offset */
2546 HOWTO (R_MICROMIPS_PC10_S1
, /* type */
2548 1, /* size (0 = byte, 1 = short, 2 = long) */
2550 TRUE
, /* pc_relative */
2552 complain_overflow_signed
, /* complain_on_overflow */
2553 _bfd_mips_elf_generic_reloc
, /* special_function */
2554 "R_MICROMIPS_PC10_S1", /* name */
2555 FALSE
, /* partial_inplace */
2557 0x000003ff, /* dst_mask */
2558 TRUE
), /* pcrel_offset */
2560 HOWTO (R_MICROMIPS_PC16_S1
, /* type */
2562 2, /* size (0 = byte, 1 = short, 2 = long) */
2564 TRUE
, /* pc_relative */
2566 complain_overflow_signed
, /* complain_on_overflow */
2567 _bfd_mips_elf_generic_reloc
, /* special_function */
2568 "R_MICROMIPS_PC16_S1", /* name */
2569 FALSE
, /* partial_inplace */
2571 0x0000ffff, /* dst_mask */
2572 TRUE
), /* pcrel_offset */
2574 /* 16 bit call through global offset table. */
2575 HOWTO (R_MICROMIPS_CALL16
, /* type */
2577 2, /* size (0 = byte, 1 = short, 2 = long) */
2579 FALSE
, /* pc_relative */
2581 complain_overflow_signed
, /* complain_on_overflow */
2582 _bfd_mips_elf_generic_reloc
, /* special_function */
2583 "R_MICROMIPS_CALL16", /* name */
2584 FALSE
, /* partial_inplace */
2586 0x0000ffff, /* dst_mask */
2587 FALSE
), /* pcrel_offset */
2592 /* Displacement in the global offset table. */
2593 HOWTO (R_MICROMIPS_GOT_DISP
, /* type */
2595 2, /* size (0 = byte, 1 = short, 2 = long) */
2597 FALSE
, /* pc_relative */
2599 complain_overflow_signed
, /* complain_on_overflow */
2600 _bfd_mips_elf_generic_reloc
, /* special_function */
2601 "R_MICROMIPS_GOT_DISP",/* name */
2602 FALSE
, /* partial_inplace */
2604 0x0000ffff, /* dst_mask */
2605 FALSE
), /* pcrel_offset */
2607 /* Displacement to page pointer in the global offset table. */
2608 HOWTO (R_MICROMIPS_GOT_PAGE
, /* type */
2610 2, /* size (0 = byte, 1 = short, 2 = long) */
2612 FALSE
, /* pc_relative */
2614 complain_overflow_signed
, /* complain_on_overflow */
2615 _bfd_mips_elf_generic_reloc
, /* special_function */
2616 "R_MICROMIPS_GOT_PAGE",/* name */
2617 FALSE
, /* partial_inplace */
2619 0x0000ffff, /* dst_mask */
2620 FALSE
), /* pcrel_offset */
2622 /* Offset from page pointer in the global offset table. */
2623 HOWTO (R_MICROMIPS_GOT_OFST
, /* type */
2625 2, /* size (0 = byte, 1 = short, 2 = long) */
2627 FALSE
, /* pc_relative */
2629 complain_overflow_signed
, /* complain_on_overflow */
2630 _bfd_mips_elf_generic_reloc
, /* special_function */
2631 "R_MICROMIPS_GOT_OFST",/* name */
2632 FALSE
, /* partial_inplace */
2634 0x0000ffff, /* dst_mask */
2635 FALSE
), /* pcrel_offset */
2637 /* High 16 bits of displacement in global offset table. */
2638 HOWTO (R_MICROMIPS_GOT_HI16
, /* type */
2640 2, /* size (0 = byte, 1 = short, 2 = long) */
2642 FALSE
, /* pc_relative */
2644 complain_overflow_dont
, /* complain_on_overflow */
2645 _bfd_mips_elf_generic_reloc
, /* special_function */
2646 "R_MICROMIPS_GOT_HI16",/* name */
2647 FALSE
, /* partial_inplace */
2649 0x0000ffff, /* dst_mask */
2650 FALSE
), /* pcrel_offset */
2652 /* Low 16 bits of displacement in global offset table. */
2653 HOWTO (R_MICROMIPS_GOT_LO16
, /* type */
2655 2, /* size (0 = byte, 1 = short, 2 = long) */
2657 FALSE
, /* pc_relative */
2659 complain_overflow_dont
, /* complain_on_overflow */
2660 _bfd_mips_elf_generic_reloc
, /* special_function */
2661 "R_MICROMIPS_GOT_LO16",/* name */
2662 FALSE
, /* partial_inplace */
2664 0x0000ffff, /* dst_mask */
2665 FALSE
), /* pcrel_offset */
2667 /* 64 bit subtraction. Used in the N32 ABI. */
2668 HOWTO (R_MICROMIPS_SUB
, /* type */
2670 4, /* size (0 = byte, 1 = short, 2 = long) */
2672 FALSE
, /* pc_relative */
2674 complain_overflow_dont
, /* complain_on_overflow */
2675 _bfd_mips_elf_generic_reloc
, /* special_function */
2676 "R_MICROMIPS_SUB", /* name */
2677 FALSE
, /* partial_inplace */
2679 MINUS_ONE
, /* dst_mask */
2680 FALSE
), /* pcrel_offset */
2682 /* Get the higher value of a 64 bit addend. */
2683 HOWTO (R_MICROMIPS_HIGHER
, /* type */
2685 2, /* size (0 = byte, 1 = short, 2 = long) */
2687 FALSE
, /* pc_relative */
2689 complain_overflow_dont
, /* complain_on_overflow */
2690 _bfd_mips_elf_generic_reloc
, /* special_function */
2691 "R_MICROMIPS_HIGHER", /* name */
2692 FALSE
, /* partial_inplace */
2694 0x0000ffff, /* dst_mask */
2695 FALSE
), /* pcrel_offset */
2697 /* Get the highest value of a 64 bit addend. */
2698 HOWTO (R_MICROMIPS_HIGHEST
, /* type */
2700 2, /* size (0 = byte, 1 = short, 2 = long) */
2702 FALSE
, /* pc_relative */
2704 complain_overflow_dont
, /* complain_on_overflow */
2705 _bfd_mips_elf_generic_reloc
, /* special_function */
2706 "R_MICROMIPS_HIGHEST", /* name */
2707 FALSE
, /* partial_inplace */
2709 0x0000ffff, /* dst_mask */
2710 FALSE
), /* pcrel_offset */
2712 /* High 16 bits of displacement in global offset table. */
2713 HOWTO (R_MICROMIPS_CALL_HI16
, /* type */
2715 2, /* size (0 = byte, 1 = short, 2 = long) */
2717 FALSE
, /* pc_relative */
2719 complain_overflow_dont
, /* complain_on_overflow */
2720 _bfd_mips_elf_generic_reloc
, /* special_function */
2721 "R_MICROMIPS_CALL_HI16",/* name */
2722 FALSE
, /* partial_inplace */
2724 0x0000ffff, /* dst_mask */
2725 FALSE
), /* pcrel_offset */
2727 /* Low 16 bits of displacement in global offset table. */
2728 HOWTO (R_MICROMIPS_CALL_LO16
, /* type */
2730 2, /* size (0 = byte, 1 = short, 2 = long) */
2732 FALSE
, /* pc_relative */
2734 complain_overflow_dont
, /* complain_on_overflow */
2735 _bfd_mips_elf_generic_reloc
, /* special_function */
2736 "R_MICROMIPS_CALL_LO16",/* name */
2737 FALSE
, /* partial_inplace */
2739 0x0000ffff, /* dst_mask */
2740 FALSE
), /* pcrel_offset */
2742 /* Section displacement. */
2743 HOWTO (R_MICROMIPS_SCN_DISP
, /* type */
2745 2, /* size (0 = byte, 1 = short, 2 = long) */
2747 FALSE
, /* pc_relative */
2749 complain_overflow_dont
, /* complain_on_overflow */
2750 _bfd_mips_elf_generic_reloc
, /* special_function */
2751 "R_MICROMIPS_SCN_DISP", /* name */
2752 FALSE
, /* partial_inplace */
2754 0xffffffff, /* dst_mask */
2755 FALSE
), /* pcrel_offset */
2757 /* Protected jump conversion. This is an optimization hint. No
2758 relocation is required for correctness. */
2759 HOWTO (R_MICROMIPS_JALR
, /* type */
2761 2, /* size (0 = byte, 1 = short, 2 = long) */
2763 FALSE
, /* pc_relative */
2765 complain_overflow_dont
, /* complain_on_overflow */
2766 _bfd_mips_elf_generic_reloc
, /* special_function */
2767 "R_MICROMIPS_JALR", /* name */
2768 FALSE
, /* partial_inplace */
2770 0x00000000, /* dst_mask */
2771 FALSE
), /* pcrel_offset */
2774 /* GNU extension to record C++ vtable hierarchy */
2775 static reloc_howto_type elf_mips_gnu_vtinherit_howto
=
2776 HOWTO (R_MIPS_GNU_VTINHERIT
, /* type */
2778 2, /* size (0 = byte, 1 = short, 2 = long) */
2780 FALSE
, /* pc_relative */
2782 complain_overflow_dont
, /* complain_on_overflow */
2783 NULL
, /* special_function */
2784 "R_MIPS_GNU_VTINHERIT", /* name */
2785 FALSE
, /* partial_inplace */
2788 FALSE
); /* pcrel_offset */
2790 /* GNU extension to record C++ vtable member usage */
2791 static reloc_howto_type elf_mips_gnu_vtentry_howto
=
2792 HOWTO (R_MIPS_GNU_VTENTRY
, /* type */
2794 2, /* size (0 = byte, 1 = short, 2 = long) */
2796 FALSE
, /* pc_relative */
2798 complain_overflow_dont
, /* complain_on_overflow */
2799 _bfd_elf_rel_vtable_reloc_fn
, /* special_function */
2800 "R_MIPS_GNU_VTENTRY", /* name */
2801 FALSE
, /* partial_inplace */
2804 FALSE
); /* pcrel_offset */
2806 /* 16 bit offset for pc-relative branches. */
2807 static reloc_howto_type elf_mips_gnu_rel16_s2
=
2808 HOWTO (R_MIPS_GNU_REL16_S2
, /* type */
2810 2, /* size (0 = byte, 1 = short, 2 = long) */
2812 TRUE
, /* pc_relative */
2814 complain_overflow_signed
, /* complain_on_overflow */
2815 _bfd_mips_elf_generic_reloc
, /* special_function */
2816 "R_MIPS_GNU_REL16_S2", /* name */
2817 TRUE
, /* partial_inplace */
2818 0x0000ffff, /* src_mask */
2819 0x0000ffff, /* dst_mask */
2820 TRUE
); /* pcrel_offset */
2822 /* 16 bit offset for pc-relative branches. */
2823 static reloc_howto_type elf_mips_gnu_rela16_s2
=
2824 HOWTO (R_MIPS_GNU_REL16_S2
, /* type */
2826 2, /* size (0 = byte, 1 = short, 2 = long) */
2828 TRUE
, /* pc_relative */
2830 complain_overflow_signed
, /* complain_on_overflow */
2831 _bfd_mips_elf_generic_reloc
, /* special_function */
2832 "R_MIPS_GNU_REL16_S2", /* name */
2833 FALSE
, /* partial_inplace */
2835 0x0000ffff, /* dst_mask */
2836 TRUE
); /* pcrel_offset */
2838 /* 32 bit pc-relative. Used for compact EH tables. */
2839 static reloc_howto_type elf_mips_gnu_pcrel32
=
2840 HOWTO (R_MIPS_PC32
, /* type */
2842 2, /* size (0 = byte, 1 = short, 2 = long) */
2844 TRUE
, /* pc_relative */
2846 complain_overflow_signed
, /* complain_on_overflow */
2847 _bfd_mips_elf_generic_reloc
, /* special_function */
2848 "R_MIPS_PC32", /* name */
2849 TRUE
, /* partial_inplace */
2850 0xffffffff, /* src_mask */
2851 0xffffffff, /* dst_mask */
2852 TRUE
); /* pcrel_offset */
2855 /* Originally a VxWorks extension, but now used for other systems too. */
2856 static reloc_howto_type elf_mips_copy_howto
=
2857 HOWTO (R_MIPS_COPY
, /* type */
2859 0, /* this one is variable size */
2861 FALSE
, /* pc_relative */
2863 complain_overflow_bitfield
, /* complain_on_overflow */
2864 _bfd_mips_elf_generic_reloc
, /* special_function */
2865 "R_MIPS_COPY", /* name */
2866 FALSE
, /* partial_inplace */
2869 FALSE
); /* pcrel_offset */
2871 /* Originally a VxWorks extension, but now used for other systems too. */
2872 static reloc_howto_type elf_mips_jump_slot_howto
=
2873 HOWTO (R_MIPS_JUMP_SLOT
, /* type */
2875 4, /* size (0 = byte, 1 = short, 2 = long) */
2877 FALSE
, /* pc_relative */
2879 complain_overflow_bitfield
, /* complain_on_overflow */
2880 _bfd_mips_elf_generic_reloc
, /* special_function */
2881 "R_MIPS_JUMP_SLOT", /* name */
2882 FALSE
, /* partial_inplace */
2885 FALSE
); /* pcrel_offset */
2887 /* Used in EH tables. */
2888 static reloc_howto_type elf_mips_eh_howto
=
2889 HOWTO (R_MIPS_EH
, /* type */
2891 2, /* size (0 = byte, 1 = short, 2 = long) */
2893 FALSE
, /* pc_relative */
2895 complain_overflow_signed
, /* complain_on_overflow */
2896 _bfd_mips_elf_generic_reloc
, /* special_function */
2897 "R_MIPS_EH", /* name */
2898 TRUE
, /* partial_inplace */
2899 0xffffffff, /* src_mask */
2900 0xffffffff, /* dst_mask */
2901 FALSE
); /* pcrel_offset */
2904 /* Swap in a MIPS 64-bit Rel reloc. */
2907 mips_elf64_swap_reloc_in (bfd
*abfd
, const Elf64_Mips_External_Rel
*src
,
2908 Elf64_Mips_Internal_Rela
*dst
)
2910 dst
->r_offset
= H_GET_64 (abfd
, src
->r_offset
);
2911 dst
->r_sym
= H_GET_32 (abfd
, src
->r_sym
);
2912 dst
->r_ssym
= H_GET_8 (abfd
, src
->r_ssym
);
2913 dst
->r_type3
= H_GET_8 (abfd
, src
->r_type3
);
2914 dst
->r_type2
= H_GET_8 (abfd
, src
->r_type2
);
2915 dst
->r_type
= H_GET_8 (abfd
, src
->r_type
);
2919 /* Swap in a MIPS 64-bit Rela reloc. */
2922 mips_elf64_swap_reloca_in (bfd
*abfd
, const Elf64_Mips_External_Rela
*src
,
2923 Elf64_Mips_Internal_Rela
*dst
)
2925 dst
->r_offset
= H_GET_64 (abfd
, src
->r_offset
);
2926 dst
->r_sym
= H_GET_32 (abfd
, src
->r_sym
);
2927 dst
->r_ssym
= H_GET_8 (abfd
, src
->r_ssym
);
2928 dst
->r_type3
= H_GET_8 (abfd
, src
->r_type3
);
2929 dst
->r_type2
= H_GET_8 (abfd
, src
->r_type2
);
2930 dst
->r_type
= H_GET_8 (abfd
, src
->r_type
);
2931 dst
->r_addend
= H_GET_S64 (abfd
, src
->r_addend
);
2934 /* Swap out a MIPS 64-bit Rel reloc. */
2937 mips_elf64_swap_reloc_out (bfd
*abfd
, const Elf64_Mips_Internal_Rela
*src
,
2938 Elf64_Mips_External_Rel
*dst
)
2940 H_PUT_64 (abfd
, src
->r_offset
, dst
->r_offset
);
2941 H_PUT_32 (abfd
, src
->r_sym
, dst
->r_sym
);
2942 H_PUT_8 (abfd
, src
->r_ssym
, dst
->r_ssym
);
2943 H_PUT_8 (abfd
, src
->r_type3
, dst
->r_type3
);
2944 H_PUT_8 (abfd
, src
->r_type2
, dst
->r_type2
);
2945 H_PUT_8 (abfd
, src
->r_type
, dst
->r_type
);
2948 /* Swap out a MIPS 64-bit Rela reloc. */
2951 mips_elf64_swap_reloca_out (bfd
*abfd
, const Elf64_Mips_Internal_Rela
*src
,
2952 Elf64_Mips_External_Rela
*dst
)
2954 H_PUT_64 (abfd
, src
->r_offset
, dst
->r_offset
);
2955 H_PUT_32 (abfd
, src
->r_sym
, dst
->r_sym
);
2956 H_PUT_8 (abfd
, src
->r_ssym
, dst
->r_ssym
);
2957 H_PUT_8 (abfd
, src
->r_type3
, dst
->r_type3
);
2958 H_PUT_8 (abfd
, src
->r_type2
, dst
->r_type2
);
2959 H_PUT_8 (abfd
, src
->r_type
, dst
->r_type
);
2960 H_PUT_S64 (abfd
, src
->r_addend
, dst
->r_addend
);
2963 /* Swap in a MIPS 64-bit Rel reloc. */
2966 mips_elf64_be_swap_reloc_in (bfd
*abfd
, const bfd_byte
*src
,
2967 Elf_Internal_Rela
*dst
)
2969 Elf64_Mips_Internal_Rela mirel
;
2971 mips_elf64_swap_reloc_in (abfd
,
2972 (const Elf64_Mips_External_Rel
*) src
,
2975 dst
[0].r_offset
= mirel
.r_offset
;
2976 dst
[0].r_info
= ELF64_R_INFO (mirel
.r_sym
, mirel
.r_type
);
2977 dst
[0].r_addend
= 0;
2978 dst
[1].r_offset
= mirel
.r_offset
;
2979 dst
[1].r_info
= ELF64_R_INFO (mirel
.r_ssym
, mirel
.r_type2
);
2980 dst
[1].r_addend
= 0;
2981 dst
[2].r_offset
= mirel
.r_offset
;
2982 dst
[2].r_info
= ELF64_R_INFO (STN_UNDEF
, mirel
.r_type3
);
2983 dst
[2].r_addend
= 0;
2986 /* Swap in a MIPS 64-bit Rela reloc. */
2989 mips_elf64_be_swap_reloca_in (bfd
*abfd
, const bfd_byte
*src
,
2990 Elf_Internal_Rela
*dst
)
2992 Elf64_Mips_Internal_Rela mirela
;
2994 mips_elf64_swap_reloca_in (abfd
,
2995 (const Elf64_Mips_External_Rela
*) src
,
2998 dst
[0].r_offset
= mirela
.r_offset
;
2999 dst
[0].r_info
= ELF64_R_INFO (mirela
.r_sym
, mirela
.r_type
);
3000 dst
[0].r_addend
= mirela
.r_addend
;
3001 dst
[1].r_offset
= mirela
.r_offset
;
3002 dst
[1].r_info
= ELF64_R_INFO (mirela
.r_ssym
, mirela
.r_type2
);
3003 dst
[1].r_addend
= 0;
3004 dst
[2].r_offset
= mirela
.r_offset
;
3005 dst
[2].r_info
= ELF64_R_INFO (STN_UNDEF
, mirela
.r_type3
);
3006 dst
[2].r_addend
= 0;
3009 /* Swap out a MIPS 64-bit Rel reloc. */
3012 mips_elf64_be_swap_reloc_out (bfd
*abfd
, const Elf_Internal_Rela
*src
,
3015 Elf64_Mips_Internal_Rela mirel
;
3017 mirel
.r_offset
= src
[0].r_offset
;
3018 BFD_ASSERT(src
[0].r_offset
== src
[1].r_offset
);
3019 BFD_ASSERT(src
[0].r_offset
== src
[2].r_offset
);
3021 mirel
.r_type
= ELF64_MIPS_R_TYPE (src
[0].r_info
);
3022 mirel
.r_sym
= ELF64_R_SYM (src
[0].r_info
);
3023 mirel
.r_type2
= ELF64_MIPS_R_TYPE (src
[1].r_info
);
3024 mirel
.r_ssym
= ELF64_MIPS_R_SSYM (src
[1].r_info
);
3025 mirel
.r_type3
= ELF64_MIPS_R_TYPE (src
[2].r_info
);
3027 mips_elf64_swap_reloc_out (abfd
, &mirel
,
3028 (Elf64_Mips_External_Rel
*) dst
);
3031 /* Swap out a MIPS 64-bit Rela reloc. */
3034 mips_elf64_be_swap_reloca_out (bfd
*abfd
, const Elf_Internal_Rela
*src
,
3037 Elf64_Mips_Internal_Rela mirela
;
3039 mirela
.r_offset
= src
[0].r_offset
;
3040 BFD_ASSERT(src
[0].r_offset
== src
[1].r_offset
);
3041 BFD_ASSERT(src
[0].r_offset
== src
[2].r_offset
);
3043 mirela
.r_type
= ELF64_MIPS_R_TYPE (src
[0].r_info
);
3044 mirela
.r_sym
= ELF64_R_SYM (src
[0].r_info
);
3045 mirela
.r_addend
= src
[0].r_addend
;
3046 BFD_ASSERT(src
[1].r_addend
== 0);
3047 BFD_ASSERT(src
[2].r_addend
== 0);
3049 mirela
.r_type2
= ELF64_MIPS_R_TYPE (src
[1].r_info
);
3050 mirela
.r_ssym
= ELF64_MIPS_R_SSYM (src
[1].r_info
);
3051 mirela
.r_type3
= ELF64_MIPS_R_TYPE (src
[2].r_info
);
3053 mips_elf64_swap_reloca_out (abfd
, &mirela
,
3054 (Elf64_Mips_External_Rela
*) dst
);
3057 /* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a
3058 dangerous relocation. */
3061 mips_elf64_assign_gp (bfd
*output_bfd
, bfd_vma
*pgp
)
3067 /* If we've already figured out what GP will be, just return it. */
3068 *pgp
= _bfd_get_gp_value (output_bfd
);
3072 count
= bfd_get_symcount (output_bfd
);
3073 sym
= bfd_get_outsymbols (output_bfd
);
3075 /* The linker script will have created a symbol named `_gp' with the
3076 appropriate value. */
3081 for (i
= 0; i
< count
; i
++, sym
++)
3083 register const char *name
;
3085 name
= bfd_asymbol_name (*sym
);
3086 if (*name
== '_' && strcmp (name
, "_gp") == 0)
3088 *pgp
= bfd_asymbol_value (*sym
);
3089 _bfd_set_gp_value (output_bfd
, *pgp
);
3097 /* Only get the error once. */
3099 _bfd_set_gp_value (output_bfd
, *pgp
);
3106 /* We have to figure out the gp value, so that we can adjust the
3107 symbol value correctly. We look up the symbol _gp in the output
3108 BFD. If we can't find it, we're stuck. We cache it in the ELF
3109 target data. We don't need to adjust the symbol value for an
3110 external symbol if we are producing relocatable output. */
3112 static bfd_reloc_status_type
3113 mips_elf64_final_gp (bfd
*output_bfd
, asymbol
*symbol
, bfd_boolean relocatable
,
3114 char **error_message
, bfd_vma
*pgp
)
3116 if (bfd_is_und_section (symbol
->section
)
3120 return bfd_reloc_undefined
;
3123 *pgp
= _bfd_get_gp_value (output_bfd
);
3126 || (symbol
->flags
& BSF_SECTION_SYM
) != 0))
3130 /* Make up a value. */
3131 *pgp
= symbol
->section
->output_section
->vma
/*+ 0x4000*/;
3132 _bfd_set_gp_value (output_bfd
, *pgp
);
3134 else if (!mips_elf64_assign_gp (output_bfd
, pgp
))
3137 (char *) _("GP relative relocation when _gp not defined");
3138 return bfd_reloc_dangerous
;
3142 return bfd_reloc_ok
;
3145 /* Do a R_MIPS_GPREL16 relocation. This is a 16 bit value which must
3146 become the offset from the gp register. */
3148 static bfd_reloc_status_type
3149 mips_elf64_gprel16_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
3150 void *data
, asection
*input_section
, bfd
*output_bfd
,
3151 char **error_message
)
3153 bfd_boolean relocatable
;
3154 bfd_reloc_status_type ret
;
3157 /* If we're relocating, and this is an external symbol, we don't want
3158 to change anything. */
3159 if (output_bfd
!= NULL
3160 && (symbol
->flags
& BSF_SECTION_SYM
) == 0
3161 && (symbol
->flags
& BSF_LOCAL
) != 0)
3163 reloc_entry
->address
+= input_section
->output_offset
;
3164 return bfd_reloc_ok
;
3167 if (output_bfd
!= NULL
)
3171 relocatable
= FALSE
;
3172 output_bfd
= symbol
->section
->output_section
->owner
;
3175 ret
= mips_elf64_final_gp (output_bfd
, symbol
, relocatable
, error_message
,
3177 if (ret
!= bfd_reloc_ok
)
3180 return _bfd_mips_elf_gprel16_with_gp (abfd
, symbol
, reloc_entry
,
3181 input_section
, relocatable
,
3185 /* Do a R_MIPS_LITERAL relocation. */
3187 static bfd_reloc_status_type
3188 mips_elf64_literal_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
3189 void *data
, asection
*input_section
, bfd
*output_bfd
,
3190 char **error_message
)
3192 bfd_boolean relocatable
;
3193 bfd_reloc_status_type ret
;
3196 /* R_MIPS_LITERAL relocations are defined for local symbols only. */
3197 if (output_bfd
!= NULL
3198 && (symbol
->flags
& BSF_SECTION_SYM
) == 0
3199 && (symbol
->flags
& BSF_LOCAL
) != 0)
3201 *error_message
= (char *)
3202 _("literal relocation occurs for an external symbol");
3203 return bfd_reloc_outofrange
;
3206 /* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */
3207 if (output_bfd
!= NULL
)
3211 relocatable
= FALSE
;
3212 output_bfd
= symbol
->section
->output_section
->owner
;
3215 ret
= mips_elf64_final_gp (output_bfd
, symbol
, relocatable
, error_message
,
3217 if (ret
!= bfd_reloc_ok
)
3220 return _bfd_mips_elf_gprel16_with_gp (abfd
, symbol
, reloc_entry
,
3221 input_section
, relocatable
,
3225 /* Do a R_MIPS_GPREL32 relocation. This is a 32 bit value which must
3226 become the offset from the gp register. */
3228 static bfd_reloc_status_type
3229 mips_elf64_gprel32_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
3230 void *data
, asection
*input_section
, bfd
*output_bfd
,
3231 char **error_message
)
3233 bfd_boolean relocatable
;
3234 bfd_reloc_status_type ret
;
3239 /* R_MIPS_GPREL32 relocations are defined for local symbols only. */
3240 if (output_bfd
!= NULL
3241 && (symbol
->flags
& BSF_SECTION_SYM
) == 0
3242 && (symbol
->flags
& BSF_LOCAL
) != 0)
3244 *error_message
= (char *)
3245 _("32bits gp relative relocation occurs for an external symbol");
3246 return bfd_reloc_outofrange
;
3249 if (output_bfd
!= NULL
)
3253 relocatable
= FALSE
;
3254 output_bfd
= symbol
->section
->output_section
->owner
;
3257 ret
= mips_elf64_final_gp (output_bfd
, symbol
, relocatable
,
3258 error_message
, &gp
);
3259 if (ret
!= bfd_reloc_ok
)
3262 if (bfd_is_com_section (symbol
->section
))
3265 relocation
= symbol
->value
;
3267 relocation
+= symbol
->section
->output_section
->vma
;
3268 relocation
+= symbol
->section
->output_offset
;
3270 if (reloc_entry
->address
> bfd_get_section_limit (abfd
, input_section
))
3271 return bfd_reloc_outofrange
;
3273 /* Set val to the offset into the section or symbol. */
3274 val
= reloc_entry
->addend
;
3276 if (reloc_entry
->howto
->partial_inplace
)
3277 val
+= bfd_get_32 (abfd
, (bfd_byte
*) data
+ reloc_entry
->address
);
3279 /* Adjust val for the final section location and GP value. If we
3280 are producing relocatable output, we don't want to do this for
3281 an external symbol. */
3283 || (symbol
->flags
& BSF_SECTION_SYM
) != 0)
3284 val
+= relocation
- gp
;
3286 if (reloc_entry
->howto
->partial_inplace
)
3287 bfd_put_32 (abfd
, val
, (bfd_byte
*) data
+ reloc_entry
->address
);
3289 reloc_entry
->addend
= val
;
3292 reloc_entry
->address
+= input_section
->output_offset
;
3294 return bfd_reloc_ok
;
3297 /* Do a R_MIPS_SHIFT6 relocation. The MSB of the shift is stored at bit 2,
3298 the rest is at bits 6-10. The bitpos already got right by the howto. */
3300 static bfd_reloc_status_type
3301 mips_elf64_shift6_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
3302 void *data
, asection
*input_section
, bfd
*output_bfd
,
3303 char **error_message
)
3305 if (reloc_entry
->howto
->partial_inplace
)
3307 reloc_entry
->addend
= ((reloc_entry
->addend
& 0x00007c0)
3308 | (reloc_entry
->addend
& 0x00000800) >> 9);
3311 return _bfd_mips_elf_generic_reloc (abfd
, reloc_entry
, symbol
, data
,
3312 input_section
, output_bfd
,
3316 /* Handle a mips16 GP relative reloc. */
3318 static bfd_reloc_status_type
3319 mips16_gprel_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
3320 void *data
, asection
*input_section
, bfd
*output_bfd
,
3321 char **error_message
)
3323 bfd_boolean relocatable
;
3324 bfd_reloc_status_type ret
;
3328 /* If we're relocating, and this is an external symbol, we don't want
3329 to change anything. */
3330 if (output_bfd
!= NULL
3331 && (symbol
->flags
& BSF_SECTION_SYM
) == 0
3332 && (symbol
->flags
& BSF_LOCAL
) != 0)
3334 reloc_entry
->address
+= input_section
->output_offset
;
3335 return bfd_reloc_ok
;
3338 if (output_bfd
!= NULL
)
3342 relocatable
= FALSE
;
3343 output_bfd
= symbol
->section
->output_section
->owner
;
3346 ret
= mips_elf64_final_gp (output_bfd
, symbol
, relocatable
, error_message
,
3348 if (ret
!= bfd_reloc_ok
)
3351 location
= (bfd_byte
*) data
+ reloc_entry
->address
;
3352 _bfd_mips_elf_reloc_unshuffle (abfd
, reloc_entry
->howto
->type
, FALSE
,
3354 ret
= _bfd_mips_elf_gprel16_with_gp (abfd
, symbol
, reloc_entry
,
3355 input_section
, relocatable
,
3357 _bfd_mips_elf_reloc_shuffle (abfd
, reloc_entry
->howto
->type
, !relocatable
,
3363 /* A mapping from BFD reloc types to MIPS ELF reloc types. */
3365 struct elf_reloc_map
{
3366 bfd_reloc_code_real_type bfd_val
;
3367 enum elf_mips_reloc_type elf_val
;
3370 static const struct elf_reloc_map mips_reloc_map
[] =
3372 { BFD_RELOC_NONE
, R_MIPS_NONE
},
3373 { BFD_RELOC_16
, R_MIPS_16
},
3374 { BFD_RELOC_32
, R_MIPS_32
},
3375 /* There is no BFD reloc for R_MIPS_REL32. */
3376 { BFD_RELOC_64
, R_MIPS_64
},
3377 { BFD_RELOC_CTOR
, R_MIPS_64
},
3378 { BFD_RELOC_16_PCREL_S2
, R_MIPS_PC16
},
3379 { BFD_RELOC_HI16_S
, R_MIPS_HI16
},
3380 { BFD_RELOC_LO16
, R_MIPS_LO16
},
3381 { BFD_RELOC_GPREL16
, R_MIPS_GPREL16
},
3382 { BFD_RELOC_GPREL32
, R_MIPS_GPREL32
},
3383 { BFD_RELOC_MIPS_JMP
, R_MIPS_26
},
3384 { BFD_RELOC_MIPS_LITERAL
, R_MIPS_LITERAL
},
3385 { BFD_RELOC_MIPS_GOT16
, R_MIPS_GOT16
},
3386 { BFD_RELOC_MIPS_CALL16
, R_MIPS_CALL16
},
3387 { BFD_RELOC_MIPS_SHIFT5
, R_MIPS_SHIFT5
},
3388 { BFD_RELOC_MIPS_SHIFT6
, R_MIPS_SHIFT6
},
3389 { BFD_RELOC_MIPS_GOT_DISP
, R_MIPS_GOT_DISP
},
3390 { BFD_RELOC_MIPS_GOT_PAGE
, R_MIPS_GOT_PAGE
},
3391 { BFD_RELOC_MIPS_GOT_OFST
, R_MIPS_GOT_OFST
},
3392 { BFD_RELOC_MIPS_GOT_HI16
, R_MIPS_GOT_HI16
},
3393 { BFD_RELOC_MIPS_GOT_LO16
, R_MIPS_GOT_LO16
},
3394 { BFD_RELOC_MIPS_SUB
, R_MIPS_SUB
},
3395 { BFD_RELOC_MIPS_INSERT_A
, R_MIPS_INSERT_A
},
3396 { BFD_RELOC_MIPS_INSERT_B
, R_MIPS_INSERT_B
},
3397 { BFD_RELOC_MIPS_DELETE
, R_MIPS_DELETE
},
3398 { BFD_RELOC_MIPS_HIGHEST
, R_MIPS_HIGHEST
},
3399 { BFD_RELOC_MIPS_HIGHER
, R_MIPS_HIGHER
},
3400 { BFD_RELOC_MIPS_CALL_HI16
, R_MIPS_CALL_HI16
},
3401 { BFD_RELOC_MIPS_CALL_LO16
, R_MIPS_CALL_LO16
},
3402 { BFD_RELOC_MIPS_SCN_DISP
, R_MIPS_SCN_DISP
},
3403 { BFD_RELOC_MIPS_REL16
, R_MIPS_REL16
},
3404 /* Use of R_MIPS_ADD_IMMEDIATE and R_MIPS_PJUMP is deprecated. */
3405 { BFD_RELOC_MIPS_RELGOT
, R_MIPS_RELGOT
},
3406 { BFD_RELOC_MIPS_JALR
, R_MIPS_JALR
},
3407 { BFD_RELOC_MIPS_TLS_DTPMOD32
, R_MIPS_TLS_DTPMOD32
},
3408 { BFD_RELOC_MIPS_TLS_DTPREL32
, R_MIPS_TLS_DTPREL32
},
3409 { BFD_RELOC_MIPS_TLS_DTPMOD64
, R_MIPS_TLS_DTPMOD64
},
3410 { BFD_RELOC_MIPS_TLS_DTPREL64
, R_MIPS_TLS_DTPREL64
},
3411 { BFD_RELOC_MIPS_TLS_GD
, R_MIPS_TLS_GD
},
3412 { BFD_RELOC_MIPS_TLS_LDM
, R_MIPS_TLS_LDM
},
3413 { BFD_RELOC_MIPS_TLS_DTPREL_HI16
, R_MIPS_TLS_DTPREL_HI16
},
3414 { BFD_RELOC_MIPS_TLS_DTPREL_LO16
, R_MIPS_TLS_DTPREL_LO16
},
3415 { BFD_RELOC_MIPS_TLS_GOTTPREL
, R_MIPS_TLS_GOTTPREL
},
3416 { BFD_RELOC_MIPS_TLS_TPREL32
, R_MIPS_TLS_TPREL32
},
3417 { BFD_RELOC_MIPS_TLS_TPREL64
, R_MIPS_TLS_TPREL64
},
3418 { BFD_RELOC_MIPS_TLS_TPREL_HI16
, R_MIPS_TLS_TPREL_HI16
},
3419 { BFD_RELOC_MIPS_TLS_TPREL_LO16
, R_MIPS_TLS_TPREL_LO16
},
3420 { BFD_RELOC_MIPS_21_PCREL_S2
, R_MIPS_PC21_S2
},
3421 { BFD_RELOC_MIPS_26_PCREL_S2
, R_MIPS_PC26_S2
},
3422 { BFD_RELOC_MIPS_18_PCREL_S3
, R_MIPS_PC18_S3
},
3423 { BFD_RELOC_MIPS_19_PCREL_S2
, R_MIPS_PC19_S2
},
3424 { BFD_RELOC_HI16_S_PCREL
, R_MIPS_PCHI16
},
3425 { BFD_RELOC_LO16_PCREL
, R_MIPS_PCLO16
}
3428 static const struct elf_reloc_map mips16_reloc_map
[] =
3430 { BFD_RELOC_MIPS16_JMP
, R_MIPS16_26
- R_MIPS16_min
},
3431 { BFD_RELOC_MIPS16_GPREL
, R_MIPS16_GPREL
- R_MIPS16_min
},
3432 { BFD_RELOC_MIPS16_GOT16
, R_MIPS16_GOT16
- R_MIPS16_min
},
3433 { BFD_RELOC_MIPS16_CALL16
, R_MIPS16_CALL16
- R_MIPS16_min
},
3434 { BFD_RELOC_MIPS16_HI16_S
, R_MIPS16_HI16
- R_MIPS16_min
},
3435 { BFD_RELOC_MIPS16_LO16
, R_MIPS16_LO16
- R_MIPS16_min
},
3436 { BFD_RELOC_MIPS16_TLS_GD
, R_MIPS16_TLS_GD
- R_MIPS16_min
},
3437 { BFD_RELOC_MIPS16_TLS_LDM
, R_MIPS16_TLS_LDM
- R_MIPS16_min
},
3438 { BFD_RELOC_MIPS16_TLS_DTPREL_HI16
,
3439 R_MIPS16_TLS_DTPREL_HI16
- R_MIPS16_min
},
3440 { BFD_RELOC_MIPS16_TLS_DTPREL_LO16
,
3441 R_MIPS16_TLS_DTPREL_LO16
- R_MIPS16_min
},
3442 { BFD_RELOC_MIPS16_TLS_GOTTPREL
, R_MIPS16_TLS_GOTTPREL
- R_MIPS16_min
},
3443 { BFD_RELOC_MIPS16_TLS_TPREL_HI16
, R_MIPS16_TLS_TPREL_HI16
- R_MIPS16_min
},
3444 { BFD_RELOC_MIPS16_TLS_TPREL_LO16
, R_MIPS16_TLS_TPREL_LO16
- R_MIPS16_min
},
3445 { BFD_RELOC_MIPS16_16_PCREL_S1
, R_MIPS16_PC16_S1
- R_MIPS16_min
}
3448 static const struct elf_reloc_map micromips_reloc_map
[] =
3450 { BFD_RELOC_MICROMIPS_JMP
, R_MICROMIPS_26_S1
- R_MICROMIPS_min
},
3451 { BFD_RELOC_MICROMIPS_HI16_S
, R_MICROMIPS_HI16
- R_MICROMIPS_min
},
3452 { BFD_RELOC_MICROMIPS_LO16
, R_MICROMIPS_LO16
- R_MICROMIPS_min
},
3453 { BFD_RELOC_MICROMIPS_GPREL16
, R_MICROMIPS_GPREL16
- R_MICROMIPS_min
},
3454 { BFD_RELOC_MICROMIPS_LITERAL
, R_MICROMIPS_LITERAL
- R_MICROMIPS_min
},
3455 { BFD_RELOC_MICROMIPS_GOT16
, R_MICROMIPS_GOT16
- R_MICROMIPS_min
},
3456 { BFD_RELOC_MICROMIPS_7_PCREL_S1
, R_MICROMIPS_PC7_S1
- R_MICROMIPS_min
},
3457 { BFD_RELOC_MICROMIPS_10_PCREL_S1
, R_MICROMIPS_PC10_S1
- R_MICROMIPS_min
},
3458 { BFD_RELOC_MICROMIPS_16_PCREL_S1
, R_MICROMIPS_PC16_S1
- R_MICROMIPS_min
},
3459 { BFD_RELOC_MICROMIPS_CALL16
, R_MICROMIPS_CALL16
- R_MICROMIPS_min
},
3460 { BFD_RELOC_MICROMIPS_GOT_DISP
, R_MICROMIPS_GOT_DISP
- R_MICROMIPS_min
},
3461 { BFD_RELOC_MICROMIPS_GOT_PAGE
, R_MICROMIPS_GOT_PAGE
- R_MICROMIPS_min
},
3462 { BFD_RELOC_MICROMIPS_GOT_OFST
, R_MICROMIPS_GOT_OFST
- R_MICROMIPS_min
},
3463 { BFD_RELOC_MICROMIPS_GOT_HI16
, R_MICROMIPS_GOT_HI16
- R_MICROMIPS_min
},
3464 { BFD_RELOC_MICROMIPS_GOT_LO16
, R_MICROMIPS_GOT_LO16
- R_MICROMIPS_min
},
3465 { BFD_RELOC_MICROMIPS_SUB
, R_MICROMIPS_SUB
- R_MICROMIPS_min
},
3466 { BFD_RELOC_MICROMIPS_HIGHER
, R_MICROMIPS_HIGHER
- R_MICROMIPS_min
},
3467 { BFD_RELOC_MICROMIPS_HIGHEST
, R_MICROMIPS_HIGHEST
- R_MICROMIPS_min
},
3468 { BFD_RELOC_MICROMIPS_CALL_HI16
, R_MICROMIPS_CALL_HI16
- R_MICROMIPS_min
},
3469 { BFD_RELOC_MICROMIPS_CALL_LO16
, R_MICROMIPS_CALL_LO16
- R_MICROMIPS_min
},
3470 { BFD_RELOC_MICROMIPS_SCN_DISP
, R_MICROMIPS_SCN_DISP
- R_MICROMIPS_min
},
3471 { BFD_RELOC_MICROMIPS_JALR
, R_MICROMIPS_JALR
- R_MICROMIPS_min
},
3473 /* Given a BFD reloc type, return a howto structure. */
3475 static reloc_howto_type
*
3476 bfd_elf64_bfd_reloc_type_lookup (bfd
*abfd ATTRIBUTE_UNUSED
,
3477 bfd_reloc_code_real_type code
)
3480 /* FIXME: We default to RELA here instead of choosing the right
3481 relocation variant. */
3482 reloc_howto_type
*howto_table
= mips_elf64_howto_table_rela
;
3483 reloc_howto_type
*howto16_table
= mips16_elf64_howto_table_rela
;
3484 reloc_howto_type
*howto_micromips_table
= micromips_elf64_howto_table_rela
;
3486 for (i
= 0; i
< sizeof (mips_reloc_map
) / sizeof (struct elf_reloc_map
);
3489 if (mips_reloc_map
[i
].bfd_val
== code
)
3490 return &howto_table
[(int) mips_reloc_map
[i
].elf_val
];
3493 for (i
= 0; i
< sizeof (mips16_reloc_map
) / sizeof (struct elf_reloc_map
);
3496 if (mips16_reloc_map
[i
].bfd_val
== code
)
3497 return &howto16_table
[(int) mips16_reloc_map
[i
].elf_val
];
3500 for (i
= 0; i
< sizeof (micromips_reloc_map
) / sizeof (struct elf_reloc_map
);
3503 if (micromips_reloc_map
[i
].bfd_val
== code
)
3504 return &howto_micromips_table
[(int) micromips_reloc_map
[i
].elf_val
];
3509 case BFD_RELOC_VTABLE_INHERIT
:
3510 return &elf_mips_gnu_vtinherit_howto
;
3511 case BFD_RELOC_VTABLE_ENTRY
:
3512 return &elf_mips_gnu_vtentry_howto
;
3513 case BFD_RELOC_32_PCREL
:
3514 return &elf_mips_gnu_pcrel32
;
3515 case BFD_RELOC_MIPS_EH
:
3516 return &elf_mips_eh_howto
;
3517 case BFD_RELOC_MIPS_COPY
:
3518 return &elf_mips_copy_howto
;
3519 case BFD_RELOC_MIPS_JUMP_SLOT
:
3520 return &elf_mips_jump_slot_howto
;
3522 bfd_set_error (bfd_error_bad_value
);
3527 static reloc_howto_type
*
3528 bfd_elf64_bfd_reloc_name_lookup (bfd
*abfd ATTRIBUTE_UNUSED
,
3534 i
< (sizeof (mips_elf64_howto_table_rela
)
3535 / sizeof (mips_elf64_howto_table_rela
[0])); i
++)
3536 if (mips_elf64_howto_table_rela
[i
].name
!= NULL
3537 && strcasecmp (mips_elf64_howto_table_rela
[i
].name
, r_name
) == 0)
3538 return &mips_elf64_howto_table_rela
[i
];
3541 i
< (sizeof (mips16_elf64_howto_table_rela
)
3542 / sizeof (mips16_elf64_howto_table_rela
[0]));
3544 if (mips16_elf64_howto_table_rela
[i
].name
!= NULL
3545 && strcasecmp (mips16_elf64_howto_table_rela
[i
].name
, r_name
) == 0)
3546 return &mips16_elf64_howto_table_rela
[i
];
3549 i
< (sizeof (micromips_elf64_howto_table_rela
)
3550 / sizeof (micromips_elf64_howto_table_rela
[0]));
3552 if (micromips_elf64_howto_table_rela
[i
].name
!= NULL
3553 && strcasecmp (micromips_elf64_howto_table_rela
[i
].name
, r_name
) == 0)
3554 return µmips_elf64_howto_table_rela
[i
];
3556 if (strcasecmp (elf_mips_gnu_vtinherit_howto
.name
, r_name
) == 0)
3557 return &elf_mips_gnu_vtinherit_howto
;
3558 if (strcasecmp (elf_mips_gnu_vtentry_howto
.name
, r_name
) == 0)
3559 return &elf_mips_gnu_vtentry_howto
;
3560 if (strcasecmp (elf_mips_gnu_rel16_s2
.name
, r_name
) == 0)
3561 return &elf_mips_gnu_rel16_s2
;
3562 if (strcasecmp (elf_mips_gnu_rela16_s2
.name
, r_name
) == 0)
3563 return &elf_mips_gnu_rela16_s2
;
3564 if (strcasecmp (elf_mips_gnu_pcrel32
.name
, r_name
) == 0)
3565 return &elf_mips_gnu_pcrel32
;
3566 if (strcasecmp (elf_mips_eh_howto
.name
, r_name
) == 0)
3567 return &elf_mips_eh_howto
;
3568 if (strcasecmp (elf_mips_copy_howto
.name
, r_name
) == 0)
3569 return &elf_mips_copy_howto
;
3570 if (strcasecmp (elf_mips_jump_slot_howto
.name
, r_name
) == 0)
3571 return &elf_mips_jump_slot_howto
;
3576 /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
3578 static reloc_howto_type
*
3579 mips_elf64_rtype_to_howto (unsigned int r_type
, bfd_boolean rela_p
)
3583 case R_MIPS_GNU_VTINHERIT
:
3584 return &elf_mips_gnu_vtinherit_howto
;
3585 case R_MIPS_GNU_VTENTRY
:
3586 return &elf_mips_gnu_vtentry_howto
;
3587 case R_MIPS_GNU_REL16_S2
:
3589 return &elf_mips_gnu_rela16_s2
;
3591 return &elf_mips_gnu_rel16_s2
;
3593 return &elf_mips_gnu_pcrel32
;
3595 return &elf_mips_eh_howto
;
3597 return &elf_mips_copy_howto
;
3598 case R_MIPS_JUMP_SLOT
:
3599 return &elf_mips_jump_slot_howto
;
3601 if (r_type
>= R_MICROMIPS_min
&& r_type
< R_MICROMIPS_max
)
3604 return µmips_elf64_howto_table_rela
[r_type
- R_MICROMIPS_min
];
3606 return µmips_elf64_howto_table_rel
[r_type
- R_MICROMIPS_min
];
3608 if (r_type
>= R_MIPS16_min
&& r_type
< R_MIPS16_max
)
3611 return &mips16_elf64_howto_table_rela
[r_type
- R_MIPS16_min
];
3613 return &mips16_elf64_howto_table_rel
[r_type
- R_MIPS16_min
];
3615 if (r_type
>= R_MIPS_max
)
3617 _bfd_error_handler (_("unrecognised MIPS reloc number: %d"), r_type
);
3618 bfd_set_error (bfd_error_bad_value
);
3619 r_type
= R_MIPS_NONE
;
3622 return &mips_elf64_howto_table_rela
[r_type
];
3624 return &mips_elf64_howto_table_rel
[r_type
];
3629 /* Prevent relocation handling by bfd for MIPS ELF64. */
3632 mips_elf64_info_to_howto_rel (bfd
*abfd ATTRIBUTE_UNUSED
,
3633 arelent
*cache_ptr ATTRIBUTE_UNUSED
,
3634 Elf_Internal_Rela
*dst ATTRIBUTE_UNUSED
)
3640 mips_elf64_info_to_howto_rela (bfd
*abfd ATTRIBUTE_UNUSED
,
3641 arelent
*cache_ptr ATTRIBUTE_UNUSED
,
3642 Elf_Internal_Rela
*dst ATTRIBUTE_UNUSED
)
3647 /* Since each entry in an SHT_REL or SHT_RELA section can represent up
3648 to three relocs, we must tell the user to allocate more space. */
3651 mips_elf64_get_reloc_upper_bound (bfd
*abfd ATTRIBUTE_UNUSED
, asection
*sec
)
3653 return (sec
->reloc_count
* 3 + 1) * sizeof (arelent
*);
3657 mips_elf64_get_dynamic_reloc_upper_bound (bfd
*abfd
)
3659 return _bfd_elf_get_dynamic_reloc_upper_bound (abfd
) * 3;
3662 /* Read the relocations from one reloc section. This is mostly copied
3663 from elfcode.h, except for the changes to expand one external
3664 relocation to 3 internal ones. To reduce processing effort we
3665 could discard those R_MIPS_NONE relocations that occupy the second
3666 and the third entry of a triplet, as `mips_elf64_write_rel' and
3667 `mips_elf64_write_rela' recreate them in output automagically,
3668 however that would also remove them from `objdump -r' output,
3669 breaking a long-established tradition and likely confusing people. */
3672 mips_elf64_slurp_one_reloc_table (bfd
*abfd
, asection
*asect
,
3673 Elf_Internal_Shdr
*rel_hdr
,
3674 bfd_size_type reloc_count
,
3675 arelent
*relents
, asymbol
**symbols
,
3676 bfd_boolean dynamic
)
3679 bfd_byte
*native_relocs
;
3685 allocated
= bfd_malloc (rel_hdr
->sh_size
);
3686 if (allocated
== NULL
)
3689 if (bfd_seek (abfd
, rel_hdr
->sh_offset
, SEEK_SET
) != 0
3690 || (bfd_bread (allocated
, rel_hdr
->sh_size
, abfd
)
3691 != rel_hdr
->sh_size
))
3694 native_relocs
= allocated
;
3696 entsize
= rel_hdr
->sh_entsize
;
3697 BFD_ASSERT (entsize
== sizeof (Elf64_Mips_External_Rel
)
3698 || entsize
== sizeof (Elf64_Mips_External_Rela
));
3700 if (entsize
== sizeof (Elf64_Mips_External_Rel
))
3705 for (i
= 0, relent
= relents
;
3707 i
++, native_relocs
+= entsize
)
3709 Elf64_Mips_Internal_Rela rela
;
3710 bfd_boolean used_sym
, used_ssym
;
3713 if (entsize
== sizeof (Elf64_Mips_External_Rela
))
3714 mips_elf64_swap_reloca_in (abfd
,
3715 (Elf64_Mips_External_Rela
*) native_relocs
,
3718 mips_elf64_swap_reloc_in (abfd
,
3719 (Elf64_Mips_External_Rel
*) native_relocs
,
3722 /* Each entry represents exactly three actual relocations. */
3726 for (ir
= 0; ir
< 3; ir
++)
3728 enum elf_mips_reloc_type type
;
3735 type
= (enum elf_mips_reloc_type
) rela
.r_type
;
3738 type
= (enum elf_mips_reloc_type
) rela
.r_type2
;
3741 type
= (enum elf_mips_reloc_type
) rela
.r_type3
;
3745 /* Some types require symbols, whereas some do not. */
3749 case R_MIPS_LITERAL
:
3750 case R_MIPS_INSERT_A
:
3751 case R_MIPS_INSERT_B
:
3753 relent
->sym_ptr_ptr
= bfd_abs_section_ptr
->symbol_ptr_ptr
;
3759 if (rela
.r_sym
== STN_UNDEF
)
3760 relent
->sym_ptr_ptr
= bfd_abs_section_ptr
->symbol_ptr_ptr
;
3765 ps
= symbols
+ rela
.r_sym
- 1;
3767 if ((s
->flags
& BSF_SECTION_SYM
) == 0)
3768 relent
->sym_ptr_ptr
= ps
;
3770 relent
->sym_ptr_ptr
= s
->section
->symbol_ptr_ptr
;
3775 else if (! used_ssym
)
3777 switch (rela
.r_ssym
)
3780 relent
->sym_ptr_ptr
=
3781 bfd_abs_section_ptr
->symbol_ptr_ptr
;
3787 /* FIXME: I think these need to be handled using
3788 special howto structures. */
3800 relent
->sym_ptr_ptr
= bfd_abs_section_ptr
->symbol_ptr_ptr
;
3805 /* The address of an ELF reloc is section relative for an
3806 object file, and absolute for an executable file or
3807 shared library. The address of a BFD reloc is always
3808 section relative. */
3809 if ((abfd
->flags
& (EXEC_P
| DYNAMIC
)) == 0 || dynamic
)
3810 relent
->address
= rela
.r_offset
;
3812 relent
->address
= rela
.r_offset
- asect
->vma
;
3814 relent
->addend
= rela
.r_addend
;
3816 relent
->howto
= mips_elf64_rtype_to_howto (type
, rela_p
);
3822 asect
->reloc_count
+= relent
- relents
;
3824 if (allocated
!= NULL
)
3830 if (allocated
!= NULL
)
3835 /* Read the relocations. On Irix 6, there can be two reloc sections
3836 associated with a single data section. This is copied from
3837 elfcode.h as well, with changes as small as accounting for 3
3838 internal relocs per external reloc and resetting reloc_count to
3839 zero before processing the relocs of a section. */
3842 mips_elf64_slurp_reloc_table (bfd
*abfd
, asection
*asect
,
3843 asymbol
**symbols
, bfd_boolean dynamic
)
3845 struct bfd_elf_section_data
* const d
= elf_section_data (asect
);
3846 Elf_Internal_Shdr
*rel_hdr
;
3847 Elf_Internal_Shdr
*rel_hdr2
;
3848 bfd_size_type reloc_count
;
3849 bfd_size_type reloc_count2
;
3853 if (asect
->relocation
!= NULL
)
3858 if ((asect
->flags
& SEC_RELOC
) == 0
3859 || asect
->reloc_count
== 0)
3862 rel_hdr
= d
->rel
.hdr
;
3863 reloc_count
= rel_hdr
? NUM_SHDR_ENTRIES (rel_hdr
) : 0;
3864 rel_hdr2
= d
->rela
.hdr
;
3865 reloc_count2
= (rel_hdr2
? NUM_SHDR_ENTRIES (rel_hdr2
) : 0);
3867 BFD_ASSERT (asect
->reloc_count
== reloc_count
+ reloc_count2
);
3868 BFD_ASSERT ((rel_hdr
&& asect
->rel_filepos
== rel_hdr
->sh_offset
)
3869 || (rel_hdr2
&& asect
->rel_filepos
== rel_hdr2
->sh_offset
));
3874 /* Note that ASECT->RELOC_COUNT tends not to be accurate in this
3875 case because relocations against this section may use the
3876 dynamic symbol table, and in that case bfd_section_from_shdr
3877 in elf.c does not update the RELOC_COUNT. */
3878 if (asect
->size
== 0)
3881 rel_hdr
= &d
->this_hdr
;
3882 reloc_count
= NUM_SHDR_ENTRIES (rel_hdr
);
3887 /* Allocate space for 3 arelent structures for each Rel structure. */
3888 amt
= (reloc_count
+ reloc_count2
) * 3 * sizeof (arelent
);
3889 relents
= bfd_alloc (abfd
, amt
);
3890 if (relents
== NULL
)
3893 /* The slurp_one_reloc_table routine increments reloc_count. */
3894 asect
->reloc_count
= 0;
3897 && ! mips_elf64_slurp_one_reloc_table (abfd
, asect
,
3898 rel_hdr
, reloc_count
,
3902 if (rel_hdr2
!= NULL
3903 && ! mips_elf64_slurp_one_reloc_table (abfd
, asect
,
3904 rel_hdr2
, reloc_count2
,
3905 relents
+ reloc_count
* 3,
3909 asect
->relocation
= relents
;
3913 /* Write out the relocations. */
3916 mips_elf64_write_relocs (bfd
*abfd
, asection
*sec
, void *data
)
3918 bfd_boolean
*failedp
= data
;
3920 Elf_Internal_Shdr
*rel_hdr
;
3923 /* If we have already failed, don't do anything. */
3927 if ((sec
->flags
& SEC_RELOC
) == 0)
3930 /* The linker backend writes the relocs out itself, and sets the
3931 reloc_count field to zero to inhibit writing them here. Also,
3932 sometimes the SEC_RELOC flag gets set even when there aren't any
3934 if (sec
->reloc_count
== 0)
3937 /* We can combine up to three relocs that refer to the same address
3938 if the latter relocs have no associated symbol. */
3940 for (idx
= 0; idx
< sec
->reloc_count
; idx
++)
3947 addr
= sec
->orelocation
[idx
]->address
;
3948 for (i
= 0; i
< 2; i
++)
3952 if (idx
+ 1 >= sec
->reloc_count
)
3954 r
= sec
->orelocation
[idx
+ 1];
3955 if (r
->address
!= addr
3956 || ! bfd_is_abs_section ((*r
->sym_ptr_ptr
)->section
)
3957 || (*r
->sym_ptr_ptr
)->value
!= 0)
3960 /* We can merge the reloc at IDX + 1 with the reloc at IDX. */
3966 rel_hdr
= _bfd_elf_single_rel_hdr (sec
);
3968 /* Do the actual relocation. */
3970 if (rel_hdr
->sh_entsize
== sizeof(Elf64_Mips_External_Rel
))
3971 mips_elf64_write_rel (abfd
, sec
, rel_hdr
, &count
, data
);
3972 else if (rel_hdr
->sh_entsize
== sizeof(Elf64_Mips_External_Rela
))
3973 mips_elf64_write_rela (abfd
, sec
, rel_hdr
, &count
, data
);
3979 mips_elf64_write_rel (bfd
*abfd
, asection
*sec
,
3980 Elf_Internal_Shdr
*rel_hdr
,
3981 int *count
, void *data
)
3983 bfd_boolean
*failedp
= data
;
3984 Elf64_Mips_External_Rel
*ext_rel
;
3986 asymbol
*last_sym
= 0;
3987 int last_sym_idx
= 0;
3989 rel_hdr
->sh_size
= rel_hdr
->sh_entsize
* *count
;
3990 rel_hdr
->contents
= bfd_alloc (abfd
, rel_hdr
->sh_size
);
3991 if (rel_hdr
->contents
== NULL
)
3997 ext_rel
= (Elf64_Mips_External_Rel
*) rel_hdr
->contents
;
3998 for (idx
= 0; idx
< sec
->reloc_count
; idx
++, ext_rel
++)
4001 Elf64_Mips_Internal_Rela int_rel
;
4006 ptr
= sec
->orelocation
[idx
];
4008 /* The address of an ELF reloc is section relative for an object
4009 file, and absolute for an executable file or shared library.
4010 The address of a BFD reloc is always section relative. */
4011 if ((abfd
->flags
& (EXEC_P
| DYNAMIC
)) == 0)
4012 int_rel
.r_offset
= ptr
->address
;
4014 int_rel
.r_offset
= ptr
->address
+ sec
->vma
;
4016 sym
= *ptr
->sym_ptr_ptr
;
4017 if (sym
== last_sym
)
4019 else if (bfd_is_abs_section (sym
->section
) && sym
->value
== 0)
4024 n
= _bfd_elf_symbol_from_bfd_symbol (abfd
, &sym
);
4034 int_rel
.r_ssym
= RSS_UNDEF
;
4036 if ((*ptr
->sym_ptr_ptr
)->the_bfd
->xvec
!= abfd
->xvec
4037 && ! _bfd_elf_validate_reloc (abfd
, ptr
))
4043 int_rel
.r_type
= ptr
->howto
->type
;
4044 int_rel
.r_type2
= (int) R_MIPS_NONE
;
4045 int_rel
.r_type3
= (int) R_MIPS_NONE
;
4047 for (i
= 0; i
< 2; i
++)
4051 if (idx
+ 1 >= sec
->reloc_count
)
4053 r
= sec
->orelocation
[idx
+ 1];
4054 if (r
->address
!= ptr
->address
4055 || ! bfd_is_abs_section ((*r
->sym_ptr_ptr
)->section
)
4056 || (*r
->sym_ptr_ptr
)->value
!= 0)
4059 /* We can merge the reloc at IDX + 1 with the reloc at IDX. */
4062 int_rel
.r_type2
= r
->howto
->type
;
4064 int_rel
.r_type3
= r
->howto
->type
;
4069 mips_elf64_swap_reloc_out (abfd
, &int_rel
, ext_rel
);
4072 BFD_ASSERT (ext_rel
- (Elf64_Mips_External_Rel
*) rel_hdr
->contents
4077 mips_elf64_write_rela (bfd
*abfd
, asection
*sec
,
4078 Elf_Internal_Shdr
*rela_hdr
,
4079 int *count
, void *data
)
4081 bfd_boolean
*failedp
= data
;
4082 Elf64_Mips_External_Rela
*ext_rela
;
4084 asymbol
*last_sym
= 0;
4085 int last_sym_idx
= 0;
4087 rela_hdr
->sh_size
= rela_hdr
->sh_entsize
* *count
;
4088 rela_hdr
->contents
= bfd_alloc (abfd
, rela_hdr
->sh_size
);
4089 if (rela_hdr
->contents
== NULL
)
4095 ext_rela
= (Elf64_Mips_External_Rela
*) rela_hdr
->contents
;
4096 for (idx
= 0; idx
< sec
->reloc_count
; idx
++, ext_rela
++)
4099 Elf64_Mips_Internal_Rela int_rela
;
4104 ptr
= sec
->orelocation
[idx
];
4106 /* The address of an ELF reloc is section relative for an object
4107 file, and absolute for an executable file or shared library.
4108 The address of a BFD reloc is always section relative. */
4109 if ((abfd
->flags
& (EXEC_P
| DYNAMIC
)) == 0)
4110 int_rela
.r_offset
= ptr
->address
;
4112 int_rela
.r_offset
= ptr
->address
+ sec
->vma
;
4114 sym
= *ptr
->sym_ptr_ptr
;
4115 if (sym
== last_sym
)
4117 else if (bfd_is_abs_section (sym
->section
) && sym
->value
== 0)
4122 n
= _bfd_elf_symbol_from_bfd_symbol (abfd
, &sym
);
4132 int_rela
.r_addend
= ptr
->addend
;
4133 int_rela
.r_ssym
= RSS_UNDEF
;
4135 if ((*ptr
->sym_ptr_ptr
)->the_bfd
->xvec
!= abfd
->xvec
4136 && ! _bfd_elf_validate_reloc (abfd
, ptr
))
4142 int_rela
.r_type
= ptr
->howto
->type
;
4143 int_rela
.r_type2
= (int) R_MIPS_NONE
;
4144 int_rela
.r_type3
= (int) R_MIPS_NONE
;
4146 for (i
= 0; i
< 2; i
++)
4150 if (idx
+ 1 >= sec
->reloc_count
)
4152 r
= sec
->orelocation
[idx
+ 1];
4153 if (r
->address
!= ptr
->address
4154 || ! bfd_is_abs_section ((*r
->sym_ptr_ptr
)->section
)
4155 || (*r
->sym_ptr_ptr
)->value
!= 0)
4158 /* We can merge the reloc at IDX + 1 with the reloc at IDX. */
4161 int_rela
.r_type2
= r
->howto
->type
;
4163 int_rela
.r_type3
= r
->howto
->type
;
4168 mips_elf64_swap_reloca_out (abfd
, &int_rela
, ext_rela
);
4171 BFD_ASSERT (ext_rela
- (Elf64_Mips_External_Rela
*) rela_hdr
->contents
4175 /* Set the right machine number for a MIPS ELF file. */
4178 mips_elf64_object_p (bfd
*abfd
)
4182 /* Irix 6 is broken. Object file symbol tables are not always
4183 sorted correctly such that local symbols precede global symbols,
4184 and the sh_info field in the symbol table is not always right. */
4185 if (elf64_mips_irix_compat (abfd
) != ict_none
)
4186 elf_bad_symtab (abfd
) = TRUE
;
4188 mach
= _bfd_elf_mips_mach (elf_elfheader (abfd
)->e_flags
);
4189 bfd_default_set_arch_mach (abfd
, bfd_arch_mips
, mach
);
4193 /* Depending on the target vector we generate some version of Irix
4194 executables or "normal" MIPS ELF ABI executables. */
4195 static irix_compat_t
4196 elf64_mips_irix_compat (bfd
*abfd
)
4198 if ((abfd
->xvec
== &mips_elf64_be_vec
)
4199 || (abfd
->xvec
== &mips_elf64_le_vec
))
4205 /* Support for core dump NOTE sections. */
4207 elf64_mips_grok_prstatus (bfd
*abfd
, Elf_Internal_Note
*note
)
4212 switch (note
->descsz
)
4217 case 480: /* Linux/MIPS - N64 kernel */
4219 elf_tdata (abfd
)->core
->signal
= bfd_get_16 (abfd
, note
->descdata
+ 12);
4222 elf_tdata (abfd
)->core
->lwpid
= bfd_get_32 (abfd
, note
->descdata
+ 32);
4231 /* Make a ".reg/999" section. */
4232 return _bfd_elfcore_make_pseudosection (abfd
, ".reg",
4233 size
, note
->descpos
+ offset
);
4237 elf64_mips_grok_psinfo (bfd
*abfd
, Elf_Internal_Note
*note
)
4239 switch (note
->descsz
)
4244 case 136: /* Linux/MIPS - N64 kernel elf_prpsinfo */
4245 elf_tdata (abfd
)->core
->program
4246 = _bfd_elfcore_strndup (abfd
, note
->descdata
+ 40, 16);
4247 elf_tdata (abfd
)->core
->command
4248 = _bfd_elfcore_strndup (abfd
, note
->descdata
+ 56, 80);
4251 /* Note that for some reason, a spurious space is tacked
4252 onto the end of the args in some (at least one anyway)
4253 implementations, so strip it off if it exists. */
4256 char *command
= elf_tdata (abfd
)->core
->command
;
4257 int n
= strlen (command
);
4259 if (0 < n
&& command
[n
- 1] == ' ')
4260 command
[n
- 1] = '\0';
4266 /* ECOFF swapping routines. These are used when dealing with the
4267 .mdebug section, which is in the ECOFF debugging format. */
4268 static const struct ecoff_debug_swap mips_elf64_ecoff_debug_swap
=
4270 /* Symbol table magic number. */
4272 /* Alignment of debugging information. E.g., 4. */
4274 /* Sizes of external symbolic information. */
4275 sizeof (struct hdr_ext
),
4276 sizeof (struct dnr_ext
),
4277 sizeof (struct pdr_ext
),
4278 sizeof (struct sym_ext
),
4279 sizeof (struct opt_ext
),
4280 sizeof (struct fdr_ext
),
4281 sizeof (struct rfd_ext
),
4282 sizeof (struct ext_ext
),
4283 /* Functions to swap in external symbolic data. */
4292 _bfd_ecoff_swap_tir_in
,
4293 _bfd_ecoff_swap_rndx_in
,
4294 /* Functions to swap out external symbolic data. */
4303 _bfd_ecoff_swap_tir_out
,
4304 _bfd_ecoff_swap_rndx_out
,
4305 /* Function to read in symbolic data. */
4306 _bfd_mips_elf_read_ecoff_info
4309 /* Relocations in the 64 bit MIPS ELF ABI are more complex than in
4310 standard ELF. This structure is used to redirect the relocation
4311 handling routines. */
4313 const struct elf_size_info mips_elf64_size_info
=
4315 sizeof (Elf64_External_Ehdr
),
4316 sizeof (Elf64_External_Phdr
),
4317 sizeof (Elf64_External_Shdr
),
4318 sizeof (Elf64_Mips_External_Rel
),
4319 sizeof (Elf64_Mips_External_Rela
),
4320 sizeof (Elf64_External_Sym
),
4321 sizeof (Elf64_External_Dyn
),
4322 sizeof (Elf_External_Note
),
4323 4, /* hash-table entry size */
4324 3, /* internal relocations per external relocations */
4326 3, /* log_file_align */
4329 bfd_elf64_write_out_phdrs
,
4330 bfd_elf64_write_shdrs_and_ehdr
,
4331 bfd_elf64_checksum_contents
,
4332 mips_elf64_write_relocs
,
4333 bfd_elf64_swap_symbol_in
,
4334 bfd_elf64_swap_symbol_out
,
4335 mips_elf64_slurp_reloc_table
,
4336 bfd_elf64_slurp_symbol_table
,
4337 bfd_elf64_swap_dyn_in
,
4338 bfd_elf64_swap_dyn_out
,
4339 mips_elf64_be_swap_reloc_in
,
4340 mips_elf64_be_swap_reloc_out
,
4341 mips_elf64_be_swap_reloca_in
,
4342 mips_elf64_be_swap_reloca_out
4345 #define ELF_ARCH bfd_arch_mips
4346 #define ELF_TARGET_ID MIPS_ELF_DATA
4347 #define ELF_MACHINE_CODE EM_MIPS
4349 #define elf_backend_collect TRUE
4350 #define elf_backend_type_change_ok TRUE
4351 #define elf_backend_can_gc_sections TRUE
4352 #define elf_backend_gc_mark_extra_sections \
4353 _bfd_mips_elf_gc_mark_extra_sections
4354 #define elf_info_to_howto mips_elf64_info_to_howto_rela
4355 #define elf_info_to_howto_rel mips_elf64_info_to_howto_rel
4356 #define elf_backend_object_p mips_elf64_object_p
4357 #define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing
4358 #define elf_backend_section_processing _bfd_mips_elf_section_processing
4359 #define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr
4360 #define elf_backend_fake_sections _bfd_mips_elf_fake_sections
4361 #define elf_backend_section_from_bfd_section \
4362 _bfd_mips_elf_section_from_bfd_section
4363 #define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook
4364 #define elf_backend_link_output_symbol_hook \
4365 _bfd_mips_elf_link_output_symbol_hook
4366 #define elf_backend_create_dynamic_sections \
4367 _bfd_mips_elf_create_dynamic_sections
4368 #define elf_backend_check_relocs _bfd_mips_elf_check_relocs
4369 #define elf_backend_merge_symbol_attribute \
4370 _bfd_mips_elf_merge_symbol_attribute
4371 #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag
4372 #define elf_backend_adjust_dynamic_symbol \
4373 _bfd_mips_elf_adjust_dynamic_symbol
4374 #define elf_backend_always_size_sections \
4375 _bfd_mips_elf_always_size_sections
4376 #define elf_backend_size_dynamic_sections \
4377 _bfd_mips_elf_size_dynamic_sections
4378 #define elf_backend_init_index_section _bfd_elf_init_1_index_section
4379 #define elf_backend_relocate_section _bfd_mips_elf_relocate_section
4380 #define elf_backend_finish_dynamic_symbol \
4381 _bfd_mips_elf_finish_dynamic_symbol
4382 #define elf_backend_finish_dynamic_sections \
4383 _bfd_mips_elf_finish_dynamic_sections
4384 #define elf_backend_final_write_processing \
4385 _bfd_mips_elf_final_write_processing
4386 #define elf_backend_additional_program_headers \
4387 _bfd_mips_elf_additional_program_headers
4388 #define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map
4389 #define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook
4390 #define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook
4391 #define elf_backend_copy_indirect_symbol \
4392 _bfd_mips_elf_copy_indirect_symbol
4393 #define elf_backend_ignore_discarded_relocs \
4394 _bfd_mips_elf_ignore_discarded_relocs
4395 #define elf_backend_mips_irix_compat elf64_mips_irix_compat
4396 #define elf_backend_mips_rtype_to_howto mips_elf64_rtype_to_howto
4397 #define elf_backend_ecoff_debug_swap &mips_elf64_ecoff_debug_swap
4398 #define elf_backend_size_info mips_elf64_size_info
4400 #define elf_backend_grok_prstatus elf64_mips_grok_prstatus
4401 #define elf_backend_grok_psinfo elf64_mips_grok_psinfo
4403 #define elf_backend_got_header_size (8 * MIPS_RESERVED_GOTNO)
4404 #define elf_backend_want_dynrelro 1
4406 /* MIPS ELF64 can use a mixture of REL and RELA, but some Relocations
4407 work better/work only in RELA, so we default to this. */
4408 #define elf_backend_may_use_rel_p 1
4409 #define elf_backend_may_use_rela_p 1
4410 #define elf_backend_default_use_rela_p 1
4411 #define elf_backend_rela_plts_and_copies_p 0
4412 #define elf_backend_plt_readonly 1
4413 #define elf_backend_plt_sym_val _bfd_mips_elf_plt_sym_val
4415 #define elf_backend_sign_extend_vma TRUE
4417 #define elf_backend_write_section _bfd_mips_elf_write_section
4418 #define elf_backend_sort_relocs_p _bfd_mips_elf_sort_relocs_p
4420 /* We don't set bfd_elf64_bfd_is_local_label_name because the 32-bit
4421 MIPS-specific function only applies to IRIX5, which had no 64-bit
4423 #define bfd_elf64_bfd_is_target_special_symbol \
4424 _bfd_mips_elf_is_target_special_symbol
4425 #define bfd_elf64_find_nearest_line _bfd_mips_elf_find_nearest_line
4426 #define bfd_elf64_find_inliner_info _bfd_mips_elf_find_inliner_info
4427 #define bfd_elf64_new_section_hook _bfd_mips_elf_new_section_hook
4428 #define bfd_elf64_set_section_contents _bfd_mips_elf_set_section_contents
4429 #define bfd_elf64_bfd_get_relocated_section_contents \
4430 _bfd_elf_mips_get_relocated_section_contents
4431 #define bfd_elf64_bfd_link_hash_table_create \
4432 _bfd_mips_elf_link_hash_table_create
4433 #define bfd_elf64_bfd_final_link _bfd_mips_elf_final_link
4434 #define bfd_elf64_bfd_merge_private_bfd_data \
4435 _bfd_mips_elf_merge_private_bfd_data
4436 #define bfd_elf64_bfd_set_private_flags _bfd_mips_elf_set_private_flags
4437 #define bfd_elf64_bfd_print_private_bfd_data \
4438 _bfd_mips_elf_print_private_bfd_data
4440 #define bfd_elf64_get_reloc_upper_bound mips_elf64_get_reloc_upper_bound
4441 #define bfd_elf64_get_dynamic_reloc_upper_bound mips_elf64_get_dynamic_reloc_upper_bound
4442 #define bfd_elf64_mkobject _bfd_mips_elf_mkobject
4444 /* The SGI style (n)64 NewABI. */
4445 #define TARGET_LITTLE_SYM mips_elf64_le_vec
4446 #define TARGET_LITTLE_NAME "elf64-littlemips"
4447 #define TARGET_BIG_SYM mips_elf64_be_vec
4448 #define TARGET_BIG_NAME "elf64-bigmips"
4450 #define ELF_MAXPAGESIZE 0x10000
4451 #define ELF_COMMONPAGESIZE 0x1000
4453 #include "elf64-target.h"
4455 /* The SYSV-style 'traditional' (n)64 NewABI. */
4456 #undef TARGET_LITTLE_SYM
4457 #undef TARGET_LITTLE_NAME
4458 #undef TARGET_BIG_SYM
4459 #undef TARGET_BIG_NAME
4461 #undef ELF_MAXPAGESIZE
4462 #undef ELF_COMMONPAGESIZE
4464 #define TARGET_LITTLE_SYM mips_elf64_trad_le_vec
4465 #define TARGET_LITTLE_NAME "elf64-tradlittlemips"
4466 #define TARGET_BIG_SYM mips_elf64_trad_be_vec
4467 #define TARGET_BIG_NAME "elf64-tradbigmips"
4469 #define ELF_MAXPAGESIZE 0x10000
4470 #define ELF_COMMONPAGESIZE 0x1000
4471 #define elf64_bed elf64_tradbed
4473 /* Include the target file again for this target. */
4474 #include "elf64-target.h"
4477 /* FreeBSD support. */
4479 #undef TARGET_LITTLE_SYM
4480 #undef TARGET_LITTLE_NAME
4481 #undef TARGET_BIG_SYM
4482 #undef TARGET_BIG_NAME
4484 #define TARGET_LITTLE_SYM mips_elf64_tradfbsd_le_vec
4485 #define TARGET_LITTLE_NAME "elf64-tradlittlemips-freebsd"
4486 #define TARGET_BIG_SYM mips_elf64_tradfbsd_be_vec
4487 #define TARGET_BIG_NAME "elf64-tradbigmips-freebsd"
4490 #define ELF_OSABI ELFOSABI_FREEBSD
4493 #define elf64_bed elf64_fbsd_tradbed
4495 #include "elf64-target.h"