1 /* MIPS-specific support for 64-bit ELF
2 Copyright (C) 1996-2018 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 void mips_elf64_info_to_howto_rel
84 (bfd
*, arelent
*, Elf_Internal_Rela
*);
85 static void mips_elf64_info_to_howto_rela
86 (bfd
*, arelent
*, Elf_Internal_Rela
*);
87 static long mips_elf64_get_dynamic_reloc_upper_bound
89 static bfd_boolean mips_elf64_slurp_one_reloc_table
90 (bfd
*, asection
*, Elf_Internal_Shdr
*, bfd_size_type
, arelent
*,
91 asymbol
**, bfd_boolean
);
92 static bfd_boolean mips_elf64_slurp_reloc_table
93 (bfd
*, asection
*, asymbol
**, bfd_boolean
);
94 static void mips_elf64_write_relocs
95 (bfd
*, asection
*, void *);
96 static void mips_elf64_write_rel
97 (bfd
*, asection
*, Elf_Internal_Shdr
*, int *, void *);
98 static void mips_elf64_write_rela
99 (bfd
*, asection
*, Elf_Internal_Shdr
*, int *, void *);
100 static bfd_reloc_status_type mips_elf64_gprel16_reloc
101 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
102 static bfd_reloc_status_type mips_elf64_literal_reloc
103 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
104 static bfd_reloc_status_type mips_elf64_gprel32_reloc
105 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
106 static bfd_reloc_status_type mips_elf64_shift6_reloc
107 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
108 static bfd_reloc_status_type mips16_gprel_reloc
109 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
110 static bfd_boolean mips_elf64_assign_gp
112 static bfd_reloc_status_type mips_elf64_final_gp
113 (bfd
*, asymbol
*, bfd_boolean
, char **, bfd_vma
*);
114 static bfd_boolean mips_elf64_object_p
116 static irix_compat_t elf64_mips_irix_compat
118 static bfd_boolean elf64_mips_grok_prstatus
119 (bfd
*, Elf_Internal_Note
*);
120 static bfd_boolean elf64_mips_grok_psinfo
121 (bfd
*, Elf_Internal_Note
*);
123 extern const bfd_target mips_elf64_be_vec
;
124 extern const bfd_target mips_elf64_le_vec
;
126 /* In case we're on a 32-bit machine, construct a 64-bit "-1" value
127 from smaller values. Start with zero, widen, *then* decrement. */
128 #define MINUS_ONE (((bfd_vma)0) - 1)
130 /* The number of local .got entries we reserve. */
131 #define MIPS_RESERVED_GOTNO (2)
133 /* The relocation table used for SHT_REL sections. */
135 static reloc_howto_type mips_elf64_howto_table_rel
[] =
138 HOWTO (R_MIPS_NONE
, /* type */
140 3, /* size (0 = byte, 1 = short, 2 = long) */
142 FALSE
, /* pc_relative */
144 complain_overflow_dont
, /* complain_on_overflow */
145 _bfd_mips_elf_generic_reloc
, /* special_function */
146 "R_MIPS_NONE", /* name */
147 FALSE
, /* partial_inplace */
150 FALSE
), /* pcrel_offset */
152 /* 16 bit relocation. */
153 HOWTO (R_MIPS_16
, /* type */
155 2, /* size (0 = byte, 1 = short, 2 = long) */
157 FALSE
, /* pc_relative */
159 complain_overflow_signed
, /* complain_on_overflow */
160 _bfd_mips_elf_generic_reloc
, /* special_function */
161 "R_MIPS_16", /* name */
162 TRUE
, /* partial_inplace */
163 0x0000ffff, /* src_mask */
164 0x0000ffff, /* dst_mask */
165 FALSE
), /* pcrel_offset */
167 /* 32 bit relocation. */
168 HOWTO (R_MIPS_32
, /* type */
170 2, /* size (0 = byte, 1 = short, 2 = long) */
172 FALSE
, /* pc_relative */
174 complain_overflow_dont
, /* complain_on_overflow */
175 _bfd_mips_elf_generic_reloc
, /* special_function */
176 "R_MIPS_32", /* name */
177 TRUE
, /* partial_inplace */
178 0xffffffff, /* src_mask */
179 0xffffffff, /* dst_mask */
180 FALSE
), /* pcrel_offset */
182 /* 32 bit symbol relative relocation. */
183 HOWTO (R_MIPS_REL32
, /* type */
185 2, /* size (0 = byte, 1 = short, 2 = long) */
187 FALSE
, /* pc_relative */
189 complain_overflow_dont
, /* complain_on_overflow */
190 _bfd_mips_elf_generic_reloc
, /* special_function */
191 "R_MIPS_REL32", /* name */
192 TRUE
, /* partial_inplace */
193 0xffffffff, /* src_mask */
194 0xffffffff, /* dst_mask */
195 FALSE
), /* pcrel_offset */
197 /* 26 bit jump address. */
198 HOWTO (R_MIPS_26
, /* type */
200 2, /* size (0 = byte, 1 = short, 2 = long) */
202 FALSE
, /* pc_relative */
204 complain_overflow_dont
, /* complain_on_overflow */
205 /* This needs complex overflow
206 detection, because the upper 36
207 bits must match the PC + 4. */
208 _bfd_mips_elf_generic_reloc
, /* special_function */
209 "R_MIPS_26", /* name */
210 TRUE
, /* partial_inplace */
211 0x03ffffff, /* src_mask */
212 0x03ffffff, /* dst_mask */
213 FALSE
), /* pcrel_offset */
215 /* R_MIPS_HI16 and R_MIPS_LO16 are unsupported for NewABI REL.
216 However, the native IRIX6 tools use them, so we try our best. */
218 /* High 16 bits of symbol value. */
219 HOWTO (R_MIPS_HI16
, /* type */
221 2, /* size (0 = byte, 1 = short, 2 = long) */
223 FALSE
, /* pc_relative */
225 complain_overflow_dont
, /* complain_on_overflow */
226 _bfd_mips_elf_hi16_reloc
, /* special_function */
227 "R_MIPS_HI16", /* name */
228 TRUE
, /* partial_inplace */
229 0x0000ffff, /* src_mask */
230 0x0000ffff, /* dst_mask */
231 FALSE
), /* pcrel_offset */
233 /* Low 16 bits of symbol value. */
234 HOWTO (R_MIPS_LO16
, /* type */
236 2, /* size (0 = byte, 1 = short, 2 = long) */
238 FALSE
, /* pc_relative */
240 complain_overflow_dont
, /* complain_on_overflow */
241 _bfd_mips_elf_lo16_reloc
, /* special_function */
242 "R_MIPS_LO16", /* name */
243 TRUE
, /* partial_inplace */
244 0x0000ffff, /* src_mask */
245 0x0000ffff, /* dst_mask */
246 FALSE
), /* pcrel_offset */
248 /* GP relative reference. */
249 HOWTO (R_MIPS_GPREL16
, /* type */
251 2, /* size (0 = byte, 1 = short, 2 = long) */
253 FALSE
, /* pc_relative */
255 complain_overflow_signed
, /* complain_on_overflow */
256 mips_elf64_gprel16_reloc
, /* special_function */
257 "R_MIPS_GPREL16", /* name */
258 TRUE
, /* partial_inplace */
259 0x0000ffff, /* src_mask */
260 0x0000ffff, /* dst_mask */
261 FALSE
), /* pcrel_offset */
263 /* Reference to literal section. */
264 HOWTO (R_MIPS_LITERAL
, /* type */
266 2, /* size (0 = byte, 1 = short, 2 = long) */
268 FALSE
, /* pc_relative */
270 complain_overflow_signed
, /* complain_on_overflow */
271 mips_elf64_literal_reloc
, /* special_function */
272 "R_MIPS_LITERAL", /* name */
273 TRUE
, /* partial_inplace */
274 0x0000ffff, /* src_mask */
275 0x0000ffff, /* dst_mask */
276 FALSE
), /* pcrel_offset */
278 /* Reference to global offset table. */
279 HOWTO (R_MIPS_GOT16
, /* type */
281 2, /* size (0 = byte, 1 = short, 2 = long) */
283 FALSE
, /* pc_relative */
285 complain_overflow_signed
, /* complain_on_overflow */
286 _bfd_mips_elf_got16_reloc
, /* special_function */
287 "R_MIPS_GOT16", /* name */
288 TRUE
, /* partial_inplace */
289 0x0000ffff, /* src_mask */
290 0x0000ffff, /* dst_mask */
291 FALSE
), /* pcrel_offset */
293 /* 16 bit PC relative reference. Note that the ABI document has a typo
294 and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
295 We do the right thing here. */
296 HOWTO (R_MIPS_PC16
, /* type */
298 2, /* size (0 = byte, 1 = short, 2 = long) */
300 TRUE
, /* pc_relative */
302 complain_overflow_signed
, /* complain_on_overflow */
303 _bfd_mips_elf_generic_reloc
, /* special_function */
304 "R_MIPS_PC16", /* name */
305 TRUE
, /* partial_inplace */
306 0x0000ffff, /* src_mask */
307 0x0000ffff, /* dst_mask */
308 TRUE
), /* pcrel_offset */
310 /* 16 bit call through global offset table. */
311 HOWTO (R_MIPS_CALL16
, /* type */
313 2, /* size (0 = byte, 1 = short, 2 = long) */
315 FALSE
, /* pc_relative */
317 complain_overflow_signed
, /* complain_on_overflow */
318 _bfd_mips_elf_generic_reloc
, /* special_function */
319 "R_MIPS_CALL16", /* name */
320 TRUE
, /* partial_inplace */
321 0x0000ffff, /* src_mask */
322 0x0000ffff, /* dst_mask */
323 FALSE
), /* pcrel_offset */
325 /* 32 bit GP relative reference. */
326 HOWTO (R_MIPS_GPREL32
, /* type */
328 2, /* size (0 = byte, 1 = short, 2 = long) */
330 FALSE
, /* pc_relative */
332 complain_overflow_dont
, /* complain_on_overflow */
333 mips_elf64_gprel32_reloc
, /* special_function */
334 "R_MIPS_GPREL32", /* name */
335 TRUE
, /* partial_inplace */
336 0xffffffff, /* src_mask */
337 0xffffffff, /* dst_mask */
338 FALSE
), /* pcrel_offset */
344 /* A 5 bit shift field. */
345 HOWTO (R_MIPS_SHIFT5
, /* type */
347 2, /* size (0 = byte, 1 = short, 2 = long) */
349 FALSE
, /* pc_relative */
351 complain_overflow_bitfield
, /* complain_on_overflow */
352 _bfd_mips_elf_generic_reloc
, /* special_function */
353 "R_MIPS_SHIFT5", /* name */
354 TRUE
, /* partial_inplace */
355 0x000007c0, /* src_mask */
356 0x000007c0, /* dst_mask */
357 FALSE
), /* pcrel_offset */
359 /* A 6 bit shift field. */
360 HOWTO (R_MIPS_SHIFT6
, /* type */
362 2, /* size (0 = byte, 1 = short, 2 = long) */
364 FALSE
, /* pc_relative */
366 complain_overflow_bitfield
, /* complain_on_overflow */
367 mips_elf64_shift6_reloc
, /* special_function */
368 "R_MIPS_SHIFT6", /* name */
369 TRUE
, /* partial_inplace */
370 0x000007c4, /* src_mask */
371 0x000007c4, /* dst_mask */
372 FALSE
), /* pcrel_offset */
374 /* 64 bit relocation. */
375 HOWTO (R_MIPS_64
, /* type */
377 4, /* size (0 = byte, 1 = short, 2 = long) */
379 FALSE
, /* pc_relative */
381 complain_overflow_dont
, /* complain_on_overflow */
382 _bfd_mips_elf_generic_reloc
, /* special_function */
383 "R_MIPS_64", /* name */
384 TRUE
, /* partial_inplace */
385 MINUS_ONE
, /* src_mask */
386 MINUS_ONE
, /* dst_mask */
387 FALSE
), /* pcrel_offset */
389 /* Displacement in the global offset table. */
390 HOWTO (R_MIPS_GOT_DISP
, /* type */
392 2, /* size (0 = byte, 1 = short, 2 = long) */
394 FALSE
, /* pc_relative */
396 complain_overflow_signed
, /* complain_on_overflow */
397 _bfd_mips_elf_generic_reloc
, /* special_function */
398 "R_MIPS_GOT_DISP", /* name */
399 TRUE
, /* partial_inplace */
400 0x0000ffff, /* src_mask */
401 0x0000ffff, /* dst_mask */
402 FALSE
), /* pcrel_offset */
404 /* Displacement to page pointer in the global offset table. */
405 HOWTO (R_MIPS_GOT_PAGE
, /* type */
407 2, /* size (0 = byte, 1 = short, 2 = long) */
409 FALSE
, /* pc_relative */
411 complain_overflow_signed
, /* complain_on_overflow */
412 _bfd_mips_elf_generic_reloc
, /* special_function */
413 "R_MIPS_GOT_PAGE", /* name */
414 TRUE
, /* partial_inplace */
415 0x0000ffff, /* src_mask */
416 0x0000ffff, /* dst_mask */
417 FALSE
), /* pcrel_offset */
419 /* Offset from page pointer in the global offset table. */
420 HOWTO (R_MIPS_GOT_OFST
, /* type */
422 2, /* size (0 = byte, 1 = short, 2 = long) */
424 FALSE
, /* pc_relative */
426 complain_overflow_signed
, /* complain_on_overflow */
427 _bfd_mips_elf_generic_reloc
, /* special_function */
428 "R_MIPS_GOT_OFST", /* name */
429 TRUE
, /* partial_inplace */
430 0x0000ffff, /* src_mask */
431 0x0000ffff, /* dst_mask */
432 FALSE
), /* pcrel_offset */
434 /* High 16 bits of displacement in global offset table. */
435 HOWTO (R_MIPS_GOT_HI16
, /* type */
437 2, /* size (0 = byte, 1 = short, 2 = long) */
439 FALSE
, /* pc_relative */
441 complain_overflow_dont
, /* complain_on_overflow */
442 _bfd_mips_elf_generic_reloc
, /* special_function */
443 "R_MIPS_GOT_HI16", /* name */
444 TRUE
, /* partial_inplace */
445 0x0000ffff, /* src_mask */
446 0x0000ffff, /* dst_mask */
447 FALSE
), /* pcrel_offset */
449 /* Low 16 bits of displacement in global offset table. */
450 HOWTO (R_MIPS_GOT_LO16
, /* type */
452 2, /* size (0 = byte, 1 = short, 2 = long) */
454 FALSE
, /* pc_relative */
456 complain_overflow_dont
, /* complain_on_overflow */
457 _bfd_mips_elf_generic_reloc
, /* special_function */
458 "R_MIPS_GOT_LO16", /* name */
459 TRUE
, /* partial_inplace */
460 0x0000ffff, /* src_mask */
461 0x0000ffff, /* dst_mask */
462 FALSE
), /* pcrel_offset */
464 /* 64 bit subtraction. */
465 HOWTO (R_MIPS_SUB
, /* type */
467 4, /* size (0 = byte, 1 = short, 2 = long) */
469 FALSE
, /* pc_relative */
471 complain_overflow_dont
, /* complain_on_overflow */
472 _bfd_mips_elf_generic_reloc
, /* special_function */
473 "R_MIPS_SUB", /* name */
474 TRUE
, /* partial_inplace */
475 MINUS_ONE
, /* src_mask */
476 MINUS_ONE
, /* dst_mask */
477 FALSE
), /* pcrel_offset */
479 /* Insert the addend as an instruction. */
480 /* FIXME: Not handled correctly. */
481 HOWTO (R_MIPS_INSERT_A
, /* type */
483 2, /* size (0 = byte, 1 = short, 2 = long) */
485 FALSE
, /* pc_relative */
487 complain_overflow_dont
, /* complain_on_overflow */
488 _bfd_mips_elf_generic_reloc
, /* special_function */
489 "R_MIPS_INSERT_A", /* name */
490 TRUE
, /* partial_inplace */
491 0xffffffff, /* src_mask */
492 0xffffffff, /* dst_mask */
493 FALSE
), /* pcrel_offset */
495 /* Insert the addend as an instruction, and change all relocations
496 to refer to the old instruction at the address. */
497 /* FIXME: Not handled correctly. */
498 HOWTO (R_MIPS_INSERT_B
, /* type */
500 2, /* size (0 = byte, 1 = short, 2 = long) */
502 FALSE
, /* pc_relative */
504 complain_overflow_dont
, /* complain_on_overflow */
505 _bfd_mips_elf_generic_reloc
, /* special_function */
506 "R_MIPS_INSERT_B", /* name */
507 TRUE
, /* partial_inplace */
508 0xffffffff, /* src_mask */
509 0xffffffff, /* dst_mask */
510 FALSE
), /* pcrel_offset */
512 /* Delete a 32 bit instruction. */
513 /* FIXME: Not handled correctly. */
514 HOWTO (R_MIPS_DELETE
, /* type */
516 2, /* size (0 = byte, 1 = short, 2 = long) */
518 FALSE
, /* pc_relative */
520 complain_overflow_dont
, /* complain_on_overflow */
521 _bfd_mips_elf_generic_reloc
, /* special_function */
522 "R_MIPS_DELETE", /* name */
523 TRUE
, /* partial_inplace */
524 0xffffffff, /* src_mask */
525 0xffffffff, /* dst_mask */
526 FALSE
), /* pcrel_offset */
528 /* The MIPS ELF64 ABI Draft wants us to support these for REL relocations.
530 a) It means building the addend from a R_MIPS_HIGHEST/R_MIPS_HIGHER/
531 R_MIPS_HI16/R_MIPS_LO16 sequence with varying ordering, using
533 b) No other NewABI toolchain actually emits such relocations. */
534 EMPTY_HOWTO (R_MIPS_HIGHER
),
535 EMPTY_HOWTO (R_MIPS_HIGHEST
),
537 /* High 16 bits of displacement in global offset table. */
538 HOWTO (R_MIPS_CALL_HI16
, /* type */
540 2, /* size (0 = byte, 1 = short, 2 = long) */
542 FALSE
, /* pc_relative */
544 complain_overflow_dont
, /* complain_on_overflow */
545 _bfd_mips_elf_generic_reloc
, /* special_function */
546 "R_MIPS_CALL_HI16", /* name */
547 TRUE
, /* partial_inplace */
548 0x0000ffff, /* src_mask */
549 0x0000ffff, /* dst_mask */
550 FALSE
), /* pcrel_offset */
552 /* Low 16 bits of displacement in global offset table. */
553 HOWTO (R_MIPS_CALL_LO16
, /* type */
555 2, /* size (0 = byte, 1 = short, 2 = long) */
557 FALSE
, /* pc_relative */
559 complain_overflow_dont
, /* complain_on_overflow */
560 _bfd_mips_elf_generic_reloc
, /* special_function */
561 "R_MIPS_CALL_LO16", /* name */
562 TRUE
, /* partial_inplace */
563 0x0000ffff, /* src_mask */
564 0x0000ffff, /* dst_mask */
565 FALSE
), /* pcrel_offset */
567 /* Section displacement, used by an associated event location section. */
568 HOWTO (R_MIPS_SCN_DISP
, /* type */
570 2, /* size (0 = byte, 1 = short, 2 = long) */
572 FALSE
, /* pc_relative */
574 complain_overflow_dont
, /* complain_on_overflow */
575 _bfd_mips_elf_generic_reloc
, /* special_function */
576 "R_MIPS_SCN_DISP", /* name */
577 TRUE
, /* partial_inplace */
578 0xffffffff, /* src_mask */
579 0xffffffff, /* dst_mask */
580 FALSE
), /* pcrel_offset */
582 HOWTO (R_MIPS_REL16
, /* type */
584 1, /* size (0 = byte, 1 = short, 2 = long) */
586 FALSE
, /* pc_relative */
588 complain_overflow_signed
, /* complain_on_overflow */
589 _bfd_mips_elf_generic_reloc
, /* special_function */
590 "R_MIPS_REL16", /* name */
591 TRUE
, /* partial_inplace */
592 0xffff, /* src_mask */
593 0xffff, /* dst_mask */
594 FALSE
), /* pcrel_offset */
596 /* These two are obsolete. */
597 EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE
),
598 EMPTY_HOWTO (R_MIPS_PJUMP
),
600 /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
601 It must be used for multigot GOT's (and only there). */
602 HOWTO (R_MIPS_RELGOT
, /* type */
604 2, /* size (0 = byte, 1 = short, 2 = long) */
606 FALSE
, /* pc_relative */
608 complain_overflow_dont
, /* complain_on_overflow */
609 _bfd_mips_elf_generic_reloc
, /* special_function */
610 "R_MIPS_RELGOT", /* name */
611 TRUE
, /* partial_inplace */
612 0xffffffff, /* src_mask */
613 0xffffffff, /* dst_mask */
614 FALSE
), /* pcrel_offset */
616 /* Protected jump conversion. This is an optimization hint. No
617 relocation is required for correctness. */
618 HOWTO (R_MIPS_JALR
, /* type */
620 2, /* size (0 = byte, 1 = short, 2 = long) */
622 FALSE
, /* pc_relative */
624 complain_overflow_dont
, /* complain_on_overflow */
625 _bfd_mips_elf_generic_reloc
, /* special_function */
626 "R_MIPS_JALR", /* name */
627 FALSE
, /* partial_inplace */
629 0x00000000, /* dst_mask */
630 FALSE
), /* pcrel_offset */
632 /* TLS relocations. */
633 EMPTY_HOWTO (R_MIPS_TLS_DTPMOD32
),
634 EMPTY_HOWTO (R_MIPS_TLS_DTPREL32
),
636 HOWTO (R_MIPS_TLS_DTPMOD64
, /* type */
638 4, /* size (0 = byte, 1 = short, 2 = long) */
640 FALSE
, /* pc_relative */
642 complain_overflow_dont
, /* complain_on_overflow */
643 _bfd_mips_elf_generic_reloc
, /* special_function */
644 "R_MIPS_TLS_DTPMOD64", /* name */
645 TRUE
, /* partial_inplace */
646 MINUS_ONE
, /* src_mask */
647 MINUS_ONE
, /* dst_mask */
648 FALSE
), /* pcrel_offset */
650 HOWTO (R_MIPS_TLS_DTPREL64
, /* type */
652 4, /* size (0 = byte, 1 = short, 2 = long) */
654 FALSE
, /* pc_relative */
656 complain_overflow_dont
, /* complain_on_overflow */
657 _bfd_mips_elf_generic_reloc
, /* special_function */
658 "R_MIPS_TLS_DTPREL64", /* name */
659 TRUE
, /* partial_inplace */
660 MINUS_ONE
, /* src_mask */
661 MINUS_ONE
, /* dst_mask */
662 FALSE
), /* pcrel_offset */
664 /* TLS general dynamic variable reference. */
665 HOWTO (R_MIPS_TLS_GD
, /* type */
667 2, /* size (0 = byte, 1 = short, 2 = long) */
669 FALSE
, /* pc_relative */
671 complain_overflow_signed
, /* complain_on_overflow */
672 _bfd_mips_elf_generic_reloc
, /* special_function */
673 "R_MIPS_TLS_GD", /* name */
674 TRUE
, /* partial_inplace */
675 0x0000ffff, /* src_mask */
676 0x0000ffff, /* dst_mask */
677 FALSE
), /* pcrel_offset */
679 /* TLS local dynamic variable reference. */
680 HOWTO (R_MIPS_TLS_LDM
, /* type */
682 2, /* size (0 = byte, 1 = short, 2 = long) */
684 FALSE
, /* pc_relative */
686 complain_overflow_signed
, /* complain_on_overflow */
687 _bfd_mips_elf_generic_reloc
, /* special_function */
688 "R_MIPS_TLS_LDM", /* name */
689 TRUE
, /* partial_inplace */
690 0x0000ffff, /* src_mask */
691 0x0000ffff, /* dst_mask */
692 FALSE
), /* pcrel_offset */
694 /* TLS local dynamic offset. */
695 HOWTO (R_MIPS_TLS_DTPREL_HI16
, /* type */
697 2, /* size (0 = byte, 1 = short, 2 = long) */
699 FALSE
, /* pc_relative */
701 complain_overflow_signed
, /* complain_on_overflow */
702 _bfd_mips_elf_generic_reloc
, /* special_function */
703 "R_MIPS_TLS_DTPREL_HI16", /* name */
704 TRUE
, /* partial_inplace */
705 0x0000ffff, /* src_mask */
706 0x0000ffff, /* dst_mask */
707 FALSE
), /* pcrel_offset */
709 /* TLS local dynamic offset. */
710 HOWTO (R_MIPS_TLS_DTPREL_LO16
, /* type */
712 2, /* size (0 = byte, 1 = short, 2 = long) */
714 FALSE
, /* pc_relative */
716 complain_overflow_signed
, /* complain_on_overflow */
717 _bfd_mips_elf_generic_reloc
, /* special_function */
718 "R_MIPS_TLS_DTPREL_LO16", /* name */
719 TRUE
, /* partial_inplace */
720 0x0000ffff, /* src_mask */
721 0x0000ffff, /* dst_mask */
722 FALSE
), /* pcrel_offset */
724 /* TLS thread pointer offset. */
725 HOWTO (R_MIPS_TLS_GOTTPREL
, /* type */
727 2, /* size (0 = byte, 1 = short, 2 = long) */
729 FALSE
, /* pc_relative */
731 complain_overflow_signed
, /* complain_on_overflow */
732 _bfd_mips_elf_generic_reloc
, /* special_function */
733 "R_MIPS_TLS_GOTTPREL", /* name */
734 TRUE
, /* partial_inplace */
735 0x0000ffff, /* src_mask */
736 0x0000ffff, /* dst_mask */
737 FALSE
), /* pcrel_offset */
739 /* TLS IE dynamic relocations. */
740 EMPTY_HOWTO (R_MIPS_TLS_TPREL32
),
742 HOWTO (R_MIPS_TLS_TPREL64
, /* type */
744 4, /* size (0 = byte, 1 = short, 2 = long) */
746 FALSE
, /* pc_relative */
748 complain_overflow_dont
, /* complain_on_overflow */
749 _bfd_mips_elf_generic_reloc
, /* special_function */
750 "R_MIPS_TLS_TPREL64", /* name */
751 TRUE
, /* partial_inplace */
752 MINUS_ONE
, /* src_mask */
753 MINUS_ONE
, /* dst_mask */
754 FALSE
), /* pcrel_offset */
756 /* TLS thread pointer offset. */
757 HOWTO (R_MIPS_TLS_TPREL_HI16
, /* type */
759 2, /* size (0 = byte, 1 = short, 2 = long) */
761 FALSE
, /* pc_relative */
763 complain_overflow_signed
, /* complain_on_overflow */
764 _bfd_mips_elf_generic_reloc
, /* special_function */
765 "R_MIPS_TLS_TPREL_HI16", /* name */
766 TRUE
, /* partial_inplace */
767 0x0000ffff, /* src_mask */
768 0x0000ffff, /* dst_mask */
769 FALSE
), /* pcrel_offset */
771 /* TLS thread pointer offset. */
772 HOWTO (R_MIPS_TLS_TPREL_LO16
, /* type */
774 2, /* size (0 = byte, 1 = short, 2 = long) */
776 FALSE
, /* pc_relative */
778 complain_overflow_signed
, /* complain_on_overflow */
779 _bfd_mips_elf_generic_reloc
, /* special_function */
780 "R_MIPS_TLS_TPREL_LO16", /* name */
781 TRUE
, /* partial_inplace */
782 0x0000ffff, /* src_mask */
783 0x0000ffff, /* dst_mask */
784 FALSE
), /* pcrel_offset */
786 /* 32 bit relocation with no addend. */
787 HOWTO (R_MIPS_GLOB_DAT
, /* type */
789 2, /* size (0 = byte, 1 = short, 2 = long) */
791 FALSE
, /* pc_relative */
793 complain_overflow_dont
, /* complain_on_overflow */
794 _bfd_mips_elf_generic_reloc
, /* special_function */
795 "R_MIPS_GLOB_DAT", /* name */
796 FALSE
, /* partial_inplace */
798 0xffffffff, /* dst_mask */
799 FALSE
), /* pcrel_offset */
810 HOWTO (R_MIPS_PC21_S2
, /* type */
812 2, /* size (0 = byte, 1 = short, 2 = long) */
814 TRUE
, /* pc_relative */
816 complain_overflow_signed
, /* complain_on_overflow */
817 _bfd_mips_elf_generic_reloc
, /* special_function */
818 "R_MIPS_PC21_S2", /* name */
819 TRUE
, /* partial_inplace */
820 0x001fffff, /* src_mask */
821 0x001fffff, /* dst_mask */
822 TRUE
), /* pcrel_offset */
824 HOWTO (R_MIPS_PC26_S2
, /* type */
826 2, /* size (0 = byte, 1 = short, 2 = long) */
828 TRUE
, /* pc_relative */
830 complain_overflow_signed
, /* complain_on_overflow */
831 _bfd_mips_elf_generic_reloc
, /* special_function */
832 "R_MIPS_PC26_S2", /* name */
833 TRUE
, /* partial_inplace */
834 0x03ffffff, /* src_mask */
835 0x03ffffff, /* dst_mask */
836 TRUE
), /* pcrel_offset */
838 HOWTO (R_MIPS_PC18_S3
, /* type */
840 2, /* size (0 = byte, 1 = short, 2 = long) */
842 TRUE
, /* pc_relative */
844 complain_overflow_signed
, /* complain_on_overflow */
845 _bfd_mips_elf_generic_reloc
, /* special_function */
846 "R_MIPS_PC18_S3", /* name */
847 TRUE
, /* partial_inplace */
848 0x0003ffff, /* src_mask */
849 0x0003ffff, /* dst_mask */
850 TRUE
), /* pcrel_offset */
852 HOWTO (R_MIPS_PC19_S2
, /* type */
854 2, /* size (0 = byte, 1 = short, 2 = long) */
856 TRUE
, /* pc_relative */
858 complain_overflow_signed
, /* complain_on_overflow */
859 _bfd_mips_elf_generic_reloc
, /* special_function */
860 "R_MIPS_PC19_S2", /* name */
861 TRUE
, /* partial_inplace */
862 0x0007ffff, /* src_mask */
863 0x0007ffff, /* dst_mask */
864 TRUE
), /* pcrel_offset */
866 HOWTO (R_MIPS_PCHI16
, /* type */
868 2, /* size (0 = byte, 1 = short, 2 = long) */
870 TRUE
, /* pc_relative */
872 complain_overflow_signed
, /* complain_on_overflow */
873 _bfd_mips_elf_generic_reloc
, /* special_function */
874 "R_MIPS_PCHI16", /* name */
875 TRUE
, /* partial_inplace */
876 0x0000ffff, /* src_mask */
877 0x0000ffff, /* dst_mask */
878 TRUE
), /* pcrel_offset */
880 HOWTO (R_MIPS_PCLO16
, /* type */
882 2, /* size (0 = byte, 1 = short, 2 = long) */
884 TRUE
, /* pc_relative */
886 complain_overflow_dont
, /* complain_on_overflow */
887 _bfd_mips_elf_generic_reloc
, /* special_function */
888 "R_MIPS_PCLO16", /* name */
889 TRUE
, /* partial_inplace */
890 0x0000ffff, /* src_mask */
891 0x0000ffff, /* dst_mask */
892 TRUE
), /* pcrel_offset */
896 /* The relocation table used for SHT_RELA sections. */
898 static reloc_howto_type mips_elf64_howto_table_rela
[] =
901 HOWTO (R_MIPS_NONE
, /* type */
903 3, /* size (0 = byte, 1 = short, 2 = long) */
905 FALSE
, /* pc_relative */
907 complain_overflow_dont
, /* complain_on_overflow */
908 _bfd_mips_elf_generic_reloc
, /* special_function */
909 "R_MIPS_NONE", /* name */
910 FALSE
, /* partial_inplace */
913 FALSE
), /* pcrel_offset */
915 /* 16 bit relocation. */
916 HOWTO (R_MIPS_16
, /* type */
918 2, /* size (0 = byte, 1 = short, 2 = long) */
920 FALSE
, /* pc_relative */
922 complain_overflow_signed
, /* complain_on_overflow */
923 _bfd_mips_elf_generic_reloc
, /* special_function */
924 "R_MIPS_16", /* name */
925 FALSE
, /* partial_inplace */
927 0x0000ffff, /* dst_mask */
928 FALSE
), /* pcrel_offset */
930 /* 32 bit relocation. */
931 HOWTO (R_MIPS_32
, /* type */
933 2, /* size (0 = byte, 1 = short, 2 = long) */
935 FALSE
, /* pc_relative */
937 complain_overflow_dont
, /* complain_on_overflow */
938 _bfd_mips_elf_generic_reloc
, /* special_function */
939 "R_MIPS_32", /* name */
940 FALSE
, /* partial_inplace */
942 0xffffffff, /* dst_mask */
943 FALSE
), /* pcrel_offset */
945 /* 32 bit symbol relative relocation. */
946 HOWTO (R_MIPS_REL32
, /* type */
948 2, /* size (0 = byte, 1 = short, 2 = long) */
950 FALSE
, /* pc_relative */
952 complain_overflow_dont
, /* complain_on_overflow */
953 _bfd_mips_elf_generic_reloc
, /* special_function */
954 "R_MIPS_REL32", /* name */
955 FALSE
, /* partial_inplace */
957 0xffffffff, /* dst_mask */
958 FALSE
), /* pcrel_offset */
960 /* 26 bit jump address. */
961 HOWTO (R_MIPS_26
, /* type */
963 2, /* size (0 = byte, 1 = short, 2 = long) */
965 FALSE
, /* pc_relative */
967 complain_overflow_dont
, /* complain_on_overflow */
968 /* This needs complex overflow
969 detection, because the upper 36
970 bits must match the PC + 4. */
971 _bfd_mips_elf_generic_reloc
, /* special_function */
972 "R_MIPS_26", /* name */
973 FALSE
, /* partial_inplace */
975 0x03ffffff, /* dst_mask */
976 FALSE
), /* pcrel_offset */
978 /* High 16 bits of symbol value. */
979 HOWTO (R_MIPS_HI16
, /* type */
981 2, /* size (0 = byte, 1 = short, 2 = long) */
983 FALSE
, /* pc_relative */
985 complain_overflow_dont
, /* complain_on_overflow */
986 _bfd_mips_elf_generic_reloc
, /* special_function */
987 "R_MIPS_HI16", /* name */
988 FALSE
, /* partial_inplace */
990 0x0000ffff, /* dst_mask */
991 FALSE
), /* pcrel_offset */
993 /* Low 16 bits of symbol value. */
994 HOWTO (R_MIPS_LO16
, /* type */
996 2, /* size (0 = byte, 1 = short, 2 = long) */
998 FALSE
, /* pc_relative */
1000 complain_overflow_dont
, /* complain_on_overflow */
1001 _bfd_mips_elf_generic_reloc
, /* special_function */
1002 "R_MIPS_LO16", /* name */
1003 FALSE
, /* partial_inplace */
1005 0x0000ffff, /* dst_mask */
1006 FALSE
), /* pcrel_offset */
1008 /* GP relative reference. */
1009 HOWTO (R_MIPS_GPREL16
, /* type */
1011 2, /* size (0 = byte, 1 = short, 2 = long) */
1013 FALSE
, /* pc_relative */
1015 complain_overflow_signed
, /* complain_on_overflow */
1016 mips_elf64_gprel16_reloc
, /* special_function */
1017 "R_MIPS_GPREL16", /* name */
1018 FALSE
, /* partial_inplace */
1020 0x0000ffff, /* dst_mask */
1021 FALSE
), /* pcrel_offset */
1023 /* Reference to literal section. */
1024 HOWTO (R_MIPS_LITERAL
, /* type */
1026 2, /* size (0 = byte, 1 = short, 2 = long) */
1028 FALSE
, /* pc_relative */
1030 complain_overflow_signed
, /* complain_on_overflow */
1031 mips_elf64_literal_reloc
, /* special_function */
1032 "R_MIPS_LITERAL", /* name */
1033 FALSE
, /* partial_inplace */
1035 0x0000ffff, /* dst_mask */
1036 FALSE
), /* pcrel_offset */
1038 /* Reference to global offset table. */
1039 HOWTO (R_MIPS_GOT16
, /* type */
1041 2, /* size (0 = byte, 1 = short, 2 = long) */
1043 FALSE
, /* pc_relative */
1045 complain_overflow_signed
, /* complain_on_overflow */
1046 _bfd_mips_elf_generic_reloc
, /* special_function */
1047 "R_MIPS_GOT16", /* name */
1048 FALSE
, /* partial_inplace */
1050 0x0000ffff, /* dst_mask */
1051 FALSE
), /* pcrel_offset */
1053 /* 16 bit PC relative reference. Note that the ABI document has a typo
1054 and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
1055 We do the right thing here. */
1056 HOWTO (R_MIPS_PC16
, /* type */
1058 2, /* size (0 = byte, 1 = short, 2 = long) */
1060 TRUE
, /* pc_relative */
1062 complain_overflow_signed
, /* complain_on_overflow */
1063 _bfd_mips_elf_generic_reloc
, /* special_function */
1064 "R_MIPS_PC16", /* name */
1065 FALSE
, /* partial_inplace */
1067 0x0000ffff, /* dst_mask */
1068 TRUE
), /* pcrel_offset */
1070 /* 16 bit call through global offset table. */
1071 HOWTO (R_MIPS_CALL16
, /* type */
1073 2, /* size (0 = byte, 1 = short, 2 = long) */
1075 FALSE
, /* pc_relative */
1077 complain_overflow_signed
, /* complain_on_overflow */
1078 _bfd_mips_elf_generic_reloc
, /* special_function */
1079 "R_MIPS_CALL16", /* name */
1080 FALSE
, /* partial_inplace */
1082 0x0000ffff, /* dst_mask */
1083 FALSE
), /* pcrel_offset */
1085 /* 32 bit GP relative reference. */
1086 HOWTO (R_MIPS_GPREL32
, /* type */
1088 2, /* size (0 = byte, 1 = short, 2 = long) */
1090 FALSE
, /* pc_relative */
1092 complain_overflow_dont
, /* complain_on_overflow */
1093 mips_elf64_gprel32_reloc
, /* special_function */
1094 "R_MIPS_GPREL32", /* name */
1095 FALSE
, /* partial_inplace */
1097 0xffffffff, /* dst_mask */
1098 FALSE
), /* pcrel_offset */
1104 /* A 5 bit shift field. */
1105 HOWTO (R_MIPS_SHIFT5
, /* type */
1107 2, /* size (0 = byte, 1 = short, 2 = long) */
1109 FALSE
, /* pc_relative */
1111 complain_overflow_bitfield
, /* complain_on_overflow */
1112 _bfd_mips_elf_generic_reloc
, /* special_function */
1113 "R_MIPS_SHIFT5", /* name */
1114 FALSE
, /* partial_inplace */
1116 0x000007c0, /* dst_mask */
1117 FALSE
), /* pcrel_offset */
1119 /* A 6 bit shift field. */
1120 HOWTO (R_MIPS_SHIFT6
, /* type */
1122 2, /* size (0 = byte, 1 = short, 2 = long) */
1124 FALSE
, /* pc_relative */
1126 complain_overflow_bitfield
, /* complain_on_overflow */
1127 mips_elf64_shift6_reloc
, /* special_function */
1128 "R_MIPS_SHIFT6", /* name */
1129 FALSE
, /* partial_inplace */
1131 0x000007c4, /* dst_mask */
1132 FALSE
), /* pcrel_offset */
1134 /* 64 bit relocation. */
1135 HOWTO (R_MIPS_64
, /* type */
1137 4, /* size (0 = byte, 1 = short, 2 = long) */
1139 FALSE
, /* pc_relative */
1141 complain_overflow_dont
, /* complain_on_overflow */
1142 _bfd_mips_elf_generic_reloc
, /* special_function */
1143 "R_MIPS_64", /* name */
1144 FALSE
, /* partial_inplace */
1146 MINUS_ONE
, /* dst_mask */
1147 FALSE
), /* pcrel_offset */
1149 /* Displacement in the global offset table. */
1150 HOWTO (R_MIPS_GOT_DISP
, /* type */
1152 2, /* size (0 = byte, 1 = short, 2 = long) */
1154 FALSE
, /* pc_relative */
1156 complain_overflow_signed
, /* complain_on_overflow */
1157 _bfd_mips_elf_generic_reloc
, /* special_function */
1158 "R_MIPS_GOT_DISP", /* name */
1159 FALSE
, /* partial_inplace */
1161 0x0000ffff, /* dst_mask */
1162 FALSE
), /* pcrel_offset */
1164 /* Displacement to page pointer in the global offset table. */
1165 HOWTO (R_MIPS_GOT_PAGE
, /* type */
1167 2, /* size (0 = byte, 1 = short, 2 = long) */
1169 FALSE
, /* pc_relative */
1171 complain_overflow_signed
, /* complain_on_overflow */
1172 _bfd_mips_elf_generic_reloc
, /* special_function */
1173 "R_MIPS_GOT_PAGE", /* name */
1174 FALSE
, /* partial_inplace */
1176 0x0000ffff, /* dst_mask */
1177 FALSE
), /* pcrel_offset */
1179 /* Offset from page pointer in the global offset table. */
1180 HOWTO (R_MIPS_GOT_OFST
, /* type */
1182 2, /* size (0 = byte, 1 = short, 2 = long) */
1184 FALSE
, /* pc_relative */
1186 complain_overflow_signed
, /* complain_on_overflow */
1187 _bfd_mips_elf_generic_reloc
, /* special_function */
1188 "R_MIPS_GOT_OFST", /* name */
1189 FALSE
, /* partial_inplace */
1191 0x0000ffff, /* dst_mask */
1192 FALSE
), /* pcrel_offset */
1194 /* High 16 bits of displacement in global offset table. */
1195 HOWTO (R_MIPS_GOT_HI16
, /* type */
1197 2, /* size (0 = byte, 1 = short, 2 = long) */
1199 FALSE
, /* pc_relative */
1201 complain_overflow_dont
, /* complain_on_overflow */
1202 _bfd_mips_elf_generic_reloc
, /* special_function */
1203 "R_MIPS_GOT_HI16", /* name */
1204 FALSE
, /* partial_inplace */
1206 0x0000ffff, /* dst_mask */
1207 FALSE
), /* pcrel_offset */
1209 /* Low 16 bits of displacement in global offset table. */
1210 HOWTO (R_MIPS_GOT_LO16
, /* type */
1212 2, /* size (0 = byte, 1 = short, 2 = long) */
1214 FALSE
, /* pc_relative */
1216 complain_overflow_dont
, /* complain_on_overflow */
1217 _bfd_mips_elf_generic_reloc
, /* special_function */
1218 "R_MIPS_GOT_LO16", /* name */
1219 FALSE
, /* partial_inplace */
1221 0x0000ffff, /* dst_mask */
1222 FALSE
), /* pcrel_offset */
1224 /* 64 bit subtraction. */
1225 HOWTO (R_MIPS_SUB
, /* type */
1227 4, /* size (0 = byte, 1 = short, 2 = long) */
1229 FALSE
, /* pc_relative */
1231 complain_overflow_dont
, /* complain_on_overflow */
1232 _bfd_mips_elf_generic_reloc
, /* special_function */
1233 "R_MIPS_SUB", /* name */
1234 FALSE
, /* partial_inplace */
1236 MINUS_ONE
, /* dst_mask */
1237 FALSE
), /* pcrel_offset */
1239 /* Insert the addend as an instruction. */
1240 /* FIXME: Not handled correctly. */
1241 HOWTO (R_MIPS_INSERT_A
, /* type */
1243 2, /* size (0 = byte, 1 = short, 2 = long) */
1245 FALSE
, /* pc_relative */
1247 complain_overflow_dont
, /* complain_on_overflow */
1248 _bfd_mips_elf_generic_reloc
, /* special_function */
1249 "R_MIPS_INSERT_A", /* name */
1250 FALSE
, /* partial_inplace */
1252 0xffffffff, /* dst_mask */
1253 FALSE
), /* pcrel_offset */
1255 /* Insert the addend as an instruction, and change all relocations
1256 to refer to the old instruction at the address. */
1257 /* FIXME: Not handled correctly. */
1258 HOWTO (R_MIPS_INSERT_B
, /* type */
1260 2, /* size (0 = byte, 1 = short, 2 = long) */
1262 FALSE
, /* pc_relative */
1264 complain_overflow_dont
, /* complain_on_overflow */
1265 _bfd_mips_elf_generic_reloc
, /* special_function */
1266 "R_MIPS_INSERT_B", /* name */
1267 FALSE
, /* partial_inplace */
1269 0xffffffff, /* dst_mask */
1270 FALSE
), /* pcrel_offset */
1272 /* Delete a 32 bit instruction. */
1273 /* FIXME: Not handled correctly. */
1274 HOWTO (R_MIPS_DELETE
, /* type */
1276 2, /* size (0 = byte, 1 = short, 2 = long) */
1278 FALSE
, /* pc_relative */
1280 complain_overflow_dont
, /* complain_on_overflow */
1281 _bfd_mips_elf_generic_reloc
, /* special_function */
1282 "R_MIPS_DELETE", /* name */
1283 FALSE
, /* partial_inplace */
1285 0xffffffff, /* dst_mask */
1286 FALSE
), /* pcrel_offset */
1288 /* Get the higher value of a 64 bit addend. */
1289 HOWTO (R_MIPS_HIGHER
, /* type */
1291 2, /* size (0 = byte, 1 = short, 2 = long) */
1293 FALSE
, /* pc_relative */
1295 complain_overflow_dont
, /* complain_on_overflow */
1296 _bfd_mips_elf_generic_reloc
, /* special_function */
1297 "R_MIPS_HIGHER", /* name */
1298 FALSE
, /* partial_inplace */
1300 0x0000ffff, /* dst_mask */
1301 FALSE
), /* pcrel_offset */
1303 /* Get the highest value of a 64 bit addend. */
1304 HOWTO (R_MIPS_HIGHEST
, /* type */
1306 2, /* size (0 = byte, 1 = short, 2 = long) */
1308 FALSE
, /* pc_relative */
1310 complain_overflow_dont
, /* complain_on_overflow */
1311 _bfd_mips_elf_generic_reloc
, /* special_function */
1312 "R_MIPS_HIGHEST", /* name */
1313 FALSE
, /* partial_inplace */
1315 0x0000ffff, /* dst_mask */
1316 FALSE
), /* pcrel_offset */
1318 /* High 16 bits of displacement in global offset table. */
1319 HOWTO (R_MIPS_CALL_HI16
, /* type */
1321 2, /* size (0 = byte, 1 = short, 2 = long) */
1323 FALSE
, /* pc_relative */
1325 complain_overflow_dont
, /* complain_on_overflow */
1326 _bfd_mips_elf_generic_reloc
, /* special_function */
1327 "R_MIPS_CALL_HI16", /* name */
1328 FALSE
, /* partial_inplace */
1330 0x0000ffff, /* dst_mask */
1331 FALSE
), /* pcrel_offset */
1333 /* Low 16 bits of displacement in global offset table. */
1334 HOWTO (R_MIPS_CALL_LO16
, /* type */
1336 2, /* size (0 = byte, 1 = short, 2 = long) */
1338 FALSE
, /* pc_relative */
1340 complain_overflow_dont
, /* complain_on_overflow */
1341 _bfd_mips_elf_generic_reloc
, /* special_function */
1342 "R_MIPS_CALL_LO16", /* name */
1343 FALSE
, /* partial_inplace */
1345 0x0000ffff, /* dst_mask */
1346 FALSE
), /* pcrel_offset */
1348 /* Section displacement, used by an associated event location section. */
1349 HOWTO (R_MIPS_SCN_DISP
, /* type */
1351 2, /* size (0 = byte, 1 = short, 2 = long) */
1353 FALSE
, /* pc_relative */
1355 complain_overflow_dont
, /* complain_on_overflow */
1356 _bfd_mips_elf_generic_reloc
, /* special_function */
1357 "R_MIPS_SCN_DISP", /* name */
1358 FALSE
, /* partial_inplace */
1360 0xffffffff, /* dst_mask */
1361 FALSE
), /* pcrel_offset */
1363 HOWTO (R_MIPS_REL16
, /* type */
1365 1, /* size (0 = byte, 1 = short, 2 = long) */
1367 FALSE
, /* pc_relative */
1369 complain_overflow_signed
, /* complain_on_overflow */
1370 _bfd_mips_elf_generic_reloc
, /* special_function */
1371 "R_MIPS_REL16", /* name */
1372 FALSE
, /* partial_inplace */
1374 0xffff, /* dst_mask */
1375 FALSE
), /* pcrel_offset */
1377 /* These two are obsolete. */
1378 EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE
),
1379 EMPTY_HOWTO (R_MIPS_PJUMP
),
1381 /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
1382 It must be used for multigot GOT's (and only there). */
1383 HOWTO (R_MIPS_RELGOT
, /* type */
1385 2, /* size (0 = byte, 1 = short, 2 = long) */
1387 FALSE
, /* pc_relative */
1389 complain_overflow_dont
, /* complain_on_overflow */
1390 _bfd_mips_elf_generic_reloc
, /* special_function */
1391 "R_MIPS_RELGOT", /* name */
1392 FALSE
, /* partial_inplace */
1394 0xffffffff, /* dst_mask */
1395 FALSE
), /* pcrel_offset */
1397 /* Protected jump conversion. This is an optimization hint. No
1398 relocation is required for correctness. */
1399 HOWTO (R_MIPS_JALR
, /* type */
1401 2, /* size (0 = byte, 1 = short, 2 = long) */
1403 FALSE
, /* pc_relative */
1405 complain_overflow_dont
, /* complain_on_overflow */
1406 _bfd_mips_elf_generic_reloc
, /* special_function */
1407 "R_MIPS_JALR", /* name */
1408 FALSE
, /* partial_inplace */
1410 0x00000000, /* dst_mask */
1411 FALSE
), /* pcrel_offset */
1413 /* TLS relocations. */
1414 EMPTY_HOWTO (R_MIPS_TLS_DTPMOD32
),
1415 EMPTY_HOWTO (R_MIPS_TLS_DTPREL32
),
1417 HOWTO (R_MIPS_TLS_DTPMOD64
, /* type */
1419 4, /* size (0 = byte, 1 = short, 2 = long) */
1421 FALSE
, /* pc_relative */
1423 complain_overflow_dont
, /* complain_on_overflow */
1424 _bfd_mips_elf_generic_reloc
, /* special_function */
1425 "R_MIPS_TLS_DTPMOD64", /* name */
1426 FALSE
, /* partial_inplace */
1428 MINUS_ONE
, /* dst_mask */
1429 FALSE
), /* pcrel_offset */
1431 HOWTO (R_MIPS_TLS_DTPREL64
, /* type */
1433 4, /* size (0 = byte, 1 = short, 2 = long) */
1435 FALSE
, /* pc_relative */
1437 complain_overflow_dont
, /* complain_on_overflow */
1438 _bfd_mips_elf_generic_reloc
, /* special_function */
1439 "R_MIPS_TLS_DTPREL64", /* name */
1440 FALSE
, /* partial_inplace */
1442 MINUS_ONE
, /* dst_mask */
1443 FALSE
), /* pcrel_offset */
1445 /* TLS general dynamic variable reference. */
1446 HOWTO (R_MIPS_TLS_GD
, /* type */
1448 2, /* size (0 = byte, 1 = short, 2 = long) */
1450 FALSE
, /* pc_relative */
1452 complain_overflow_signed
, /* complain_on_overflow */
1453 _bfd_mips_elf_generic_reloc
, /* special_function */
1454 "R_MIPS_TLS_GD", /* name */
1455 FALSE
, /* partial_inplace */
1457 0x0000ffff, /* dst_mask */
1458 FALSE
), /* pcrel_offset */
1460 /* TLS local dynamic variable reference. */
1461 HOWTO (R_MIPS_TLS_LDM
, /* type */
1463 2, /* size (0 = byte, 1 = short, 2 = long) */
1465 FALSE
, /* pc_relative */
1467 complain_overflow_signed
, /* complain_on_overflow */
1468 _bfd_mips_elf_generic_reloc
, /* special_function */
1469 "R_MIPS_TLS_LDM", /* name */
1470 FALSE
, /* partial_inplace */
1472 0x0000ffff, /* dst_mask */
1473 FALSE
), /* pcrel_offset */
1475 /* TLS local dynamic offset. */
1476 HOWTO (R_MIPS_TLS_DTPREL_HI16
, /* type */
1478 2, /* size (0 = byte, 1 = short, 2 = long) */
1480 FALSE
, /* pc_relative */
1482 complain_overflow_signed
, /* complain_on_overflow */
1483 _bfd_mips_elf_generic_reloc
, /* special_function */
1484 "R_MIPS_TLS_DTPREL_HI16", /* name */
1485 FALSE
, /* partial_inplace */
1487 0x0000ffff, /* dst_mask */
1488 FALSE
), /* pcrel_offset */
1490 /* TLS local dynamic offset. */
1491 HOWTO (R_MIPS_TLS_DTPREL_LO16
, /* type */
1493 2, /* size (0 = byte, 1 = short, 2 = long) */
1495 FALSE
, /* pc_relative */
1497 complain_overflow_signed
, /* complain_on_overflow */
1498 _bfd_mips_elf_generic_reloc
, /* special_function */
1499 "R_MIPS_TLS_DTPREL_LO16", /* name */
1500 FALSE
, /* partial_inplace */
1502 0x0000ffff, /* dst_mask */
1503 FALSE
), /* pcrel_offset */
1505 /* TLS thread pointer offset. */
1506 HOWTO (R_MIPS_TLS_GOTTPREL
, /* type */
1508 2, /* size (0 = byte, 1 = short, 2 = long) */
1510 FALSE
, /* pc_relative */
1512 complain_overflow_signed
, /* complain_on_overflow */
1513 _bfd_mips_elf_generic_reloc
, /* special_function */
1514 "R_MIPS_TLS_GOTTPREL", /* name */
1515 FALSE
, /* partial_inplace */
1517 0x0000ffff, /* dst_mask */
1518 FALSE
), /* pcrel_offset */
1520 /* TLS IE dynamic relocations. */
1521 EMPTY_HOWTO (R_MIPS_TLS_TPREL32
),
1523 HOWTO (R_MIPS_TLS_TPREL64
, /* type */
1525 4, /* size (0 = byte, 1 = short, 2 = long) */
1527 FALSE
, /* pc_relative */
1529 complain_overflow_dont
, /* complain_on_overflow */
1530 _bfd_mips_elf_generic_reloc
, /* special_function */
1531 "R_MIPS_TLS_TPREL64", /* name */
1532 FALSE
, /* partial_inplace */
1534 MINUS_ONE
, /* dst_mask */
1535 FALSE
), /* pcrel_offset */
1537 /* TLS thread pointer offset. */
1538 HOWTO (R_MIPS_TLS_TPREL_HI16
, /* type */
1540 2, /* size (0 = byte, 1 = short, 2 = long) */
1542 FALSE
, /* pc_relative */
1544 complain_overflow_signed
, /* complain_on_overflow */
1545 _bfd_mips_elf_generic_reloc
, /* special_function */
1546 "R_MIPS_TLS_TPREL_HI16", /* name */
1547 FALSE
, /* partial_inplace */
1549 0x0000ffff, /* dst_mask */
1550 FALSE
), /* pcrel_offset */
1552 /* TLS thread pointer offset. */
1553 HOWTO (R_MIPS_TLS_TPREL_LO16
, /* type */
1555 2, /* size (0 = byte, 1 = short, 2 = long) */
1557 FALSE
, /* pc_relative */
1559 complain_overflow_signed
, /* complain_on_overflow */
1560 _bfd_mips_elf_generic_reloc
, /* special_function */
1561 "R_MIPS_TLS_TPREL_LO16", /* name */
1562 FALSE
, /* partial_inplace */
1564 0x0000ffff, /* dst_mask */
1565 FALSE
), /* pcrel_offset */
1567 /* 32 bit relocation with no addend. */
1568 HOWTO (R_MIPS_GLOB_DAT
, /* type */
1570 2, /* size (0 = byte, 1 = short, 2 = long) */
1572 FALSE
, /* pc_relative */
1574 complain_overflow_dont
, /* complain_on_overflow */
1575 _bfd_mips_elf_generic_reloc
, /* special_function */
1576 "R_MIPS_GLOB_DAT", /* name */
1577 FALSE
, /* partial_inplace */
1579 0xffffffff, /* dst_mask */
1580 FALSE
), /* pcrel_offset */
1591 HOWTO (R_MIPS_PC21_S2
, /* type */
1593 2, /* size (0 = byte, 1 = short, 2 = long) */
1595 TRUE
, /* pc_relative */
1597 complain_overflow_signed
, /* complain_on_overflow */
1598 _bfd_mips_elf_generic_reloc
, /* special_function */
1599 "R_MIPS_PC21_S2", /* name */
1600 FALSE
, /* partial_inplace */
1602 0x001fffff, /* dst_mask */
1603 TRUE
), /* pcrel_offset */
1605 HOWTO (R_MIPS_PC26_S2
, /* type */
1607 2, /* size (0 = byte, 1 = short, 2 = long) */
1609 TRUE
, /* pc_relative */
1611 complain_overflow_signed
, /* complain_on_overflow */
1612 _bfd_mips_elf_generic_reloc
, /* special_function */
1613 "R_MIPS_PC26_S2", /* name */
1614 FALSE
, /* partial_inplace */
1616 0x03ffffff, /* dst_mask */
1617 TRUE
), /* pcrel_offset */
1619 HOWTO (R_MIPS_PC18_S3
, /* type */
1621 2, /* size (0 = byte, 1 = short, 2 = long) */
1623 TRUE
, /* pc_relative */
1625 complain_overflow_signed
, /* complain_on_overflow */
1626 _bfd_mips_elf_generic_reloc
, /* special_function */
1627 "R_MIPS_PC18_S3", /* name */
1628 FALSE
, /* partial_inplace */
1630 0x0003ffff, /* dst_mask */
1631 TRUE
), /* pcrel_offset */
1633 HOWTO (R_MIPS_PC19_S2
, /* type */
1635 2, /* size (0 = byte, 1 = short, 2 = long) */
1637 TRUE
, /* pc_relative */
1639 complain_overflow_signed
, /* complain_on_overflow */
1640 _bfd_mips_elf_generic_reloc
, /* special_function */
1641 "R_MIPS_PC19_S2", /* name */
1642 FALSE
, /* partial_inplace */
1644 0x0007ffff, /* dst_mask */
1645 TRUE
), /* pcrel_offset */
1647 HOWTO (R_MIPS_PCHI16
, /* type */
1648 16, /* rightshift */
1649 2, /* size (0 = byte, 1 = short, 2 = long) */
1651 TRUE
, /* pc_relative */
1653 complain_overflow_signed
, /* complain_on_overflow */
1654 _bfd_mips_elf_generic_reloc
, /* special_function */
1655 "R_MIPS_PCHI16", /* name */
1656 FALSE
, /* partial_inplace */
1658 0x0000ffff, /* dst_mask */
1659 TRUE
), /* pcrel_offset */
1661 HOWTO (R_MIPS_PCLO16
, /* type */
1663 2, /* size (0 = byte, 1 = short, 2 = long) */
1665 TRUE
, /* pc_relative */
1667 complain_overflow_dont
, /* complain_on_overflow */
1668 _bfd_mips_elf_generic_reloc
, /* special_function */
1669 "R_MIPS_PCLO16", /* name */
1670 FALSE
, /* partial_inplace */
1672 0x0000ffff, /* dst_mask */
1673 TRUE
), /* pcrel_offset */
1677 static reloc_howto_type mips16_elf64_howto_table_rel
[] =
1679 /* The reloc used for the mips16 jump instruction. */
1680 HOWTO (R_MIPS16_26
, /* type */
1682 2, /* size (0 = byte, 1 = short, 2 = long) */
1684 FALSE
, /* pc_relative */
1686 complain_overflow_dont
, /* complain_on_overflow */
1687 /* This needs complex overflow
1688 detection, because the upper four
1689 bits must match the PC. */
1690 _bfd_mips_elf_generic_reloc
, /* special_function */
1691 "R_MIPS16_26", /* name */
1692 TRUE
, /* partial_inplace */
1693 0x3ffffff, /* src_mask */
1694 0x3ffffff, /* dst_mask */
1695 FALSE
), /* pcrel_offset */
1697 /* The reloc used for the mips16 gprel instruction. */
1698 HOWTO (R_MIPS16_GPREL
, /* type */
1700 2, /* size (0 = byte, 1 = short, 2 = long) */
1702 FALSE
, /* pc_relative */
1704 complain_overflow_signed
, /* complain_on_overflow */
1705 mips16_gprel_reloc
, /* special_function */
1706 "R_MIPS16_GPREL", /* name */
1707 TRUE
, /* partial_inplace */
1708 0x0000ffff, /* src_mask */
1709 0x0000ffff, /* dst_mask */
1710 FALSE
), /* pcrel_offset */
1712 /* A MIPS16 reference to the global offset table. */
1713 HOWTO (R_MIPS16_GOT16
, /* type */
1715 2, /* size (0 = byte, 1 = short, 2 = long) */
1717 FALSE
, /* pc_relative */
1719 complain_overflow_dont
, /* complain_on_overflow */
1720 _bfd_mips_elf_got16_reloc
, /* special_function */
1721 "R_MIPS16_GOT16", /* name */
1722 TRUE
, /* partial_inplace */
1723 0x0000ffff, /* src_mask */
1724 0x0000ffff, /* dst_mask */
1725 FALSE
), /* pcrel_offset */
1727 /* A MIPS16 call through the global offset table. */
1728 HOWTO (R_MIPS16_CALL16
, /* type */
1730 2, /* size (0 = byte, 1 = short, 2 = long) */
1732 FALSE
, /* pc_relative */
1734 complain_overflow_dont
, /* complain_on_overflow */
1735 _bfd_mips_elf_generic_reloc
, /* special_function */
1736 "R_MIPS16_CALL16", /* name */
1737 TRUE
, /* partial_inplace */
1738 0x0000ffff, /* src_mask */
1739 0x0000ffff, /* dst_mask */
1740 FALSE
), /* pcrel_offset */
1742 /* MIPS16 high 16 bits of symbol value. */
1743 HOWTO (R_MIPS16_HI16
, /* type */
1744 16, /* rightshift */
1745 2, /* size (0 = byte, 1 = short, 2 = long) */
1747 FALSE
, /* pc_relative */
1749 complain_overflow_dont
, /* complain_on_overflow */
1750 _bfd_mips_elf_hi16_reloc
, /* special_function */
1751 "R_MIPS16_HI16", /* name */
1752 TRUE
, /* partial_inplace */
1753 0x0000ffff, /* src_mask */
1754 0x0000ffff, /* dst_mask */
1755 FALSE
), /* pcrel_offset */
1757 /* MIPS16 low 16 bits of symbol value. */
1758 HOWTO (R_MIPS16_LO16
, /* type */
1760 2, /* size (0 = byte, 1 = short, 2 = long) */
1762 FALSE
, /* pc_relative */
1764 complain_overflow_dont
, /* complain_on_overflow */
1765 _bfd_mips_elf_lo16_reloc
, /* special_function */
1766 "R_MIPS16_LO16", /* name */
1767 TRUE
, /* partial_inplace */
1768 0x0000ffff, /* src_mask */
1769 0x0000ffff, /* dst_mask */
1770 FALSE
), /* pcrel_offset */
1772 /* MIPS16 TLS general dynamic variable reference. */
1773 HOWTO (R_MIPS16_TLS_GD
, /* type */
1775 2, /* size (0 = byte, 1 = short, 2 = long) */
1777 FALSE
, /* pc_relative */
1779 complain_overflow_signed
, /* complain_on_overflow */
1780 _bfd_mips_elf_generic_reloc
, /* special_function */
1781 "R_MIPS16_TLS_GD", /* name */
1782 TRUE
, /* partial_inplace */
1783 0x0000ffff, /* src_mask */
1784 0x0000ffff, /* dst_mask */
1785 FALSE
), /* pcrel_offset */
1787 /* MIPS16 TLS local dynamic variable reference. */
1788 HOWTO (R_MIPS16_TLS_LDM
, /* type */
1790 2, /* size (0 = byte, 1 = short, 2 = long) */
1792 FALSE
, /* pc_relative */
1794 complain_overflow_signed
, /* complain_on_overflow */
1795 _bfd_mips_elf_generic_reloc
, /* special_function */
1796 "R_MIPS16_TLS_LDM", /* name */
1797 TRUE
, /* partial_inplace */
1798 0x0000ffff, /* src_mask */
1799 0x0000ffff, /* dst_mask */
1800 FALSE
), /* pcrel_offset */
1802 /* MIPS16 TLS local dynamic offset. */
1803 HOWTO (R_MIPS16_TLS_DTPREL_HI16
, /* type */
1805 2, /* size (0 = byte, 1 = short, 2 = long) */
1807 FALSE
, /* pc_relative */
1809 complain_overflow_signed
, /* complain_on_overflow */
1810 _bfd_mips_elf_generic_reloc
, /* special_function */
1811 "R_MIPS16_TLS_DTPREL_HI16", /* name */
1812 TRUE
, /* partial_inplace */
1813 0x0000ffff, /* src_mask */
1814 0x0000ffff, /* dst_mask */
1815 FALSE
), /* pcrel_offset */
1817 /* MIPS16 TLS local dynamic offset. */
1818 HOWTO (R_MIPS16_TLS_DTPREL_LO16
, /* type */
1820 2, /* size (0 = byte, 1 = short, 2 = long) */
1822 FALSE
, /* pc_relative */
1824 complain_overflow_signed
, /* complain_on_overflow */
1825 _bfd_mips_elf_generic_reloc
, /* special_function */
1826 "R_MIPS16_TLS_DTPREL_LO16", /* name */
1827 TRUE
, /* partial_inplace */
1828 0x0000ffff, /* src_mask */
1829 0x0000ffff, /* dst_mask */
1830 FALSE
), /* pcrel_offset */
1832 /* MIPS16 TLS thread pointer offset. */
1833 HOWTO (R_MIPS16_TLS_GOTTPREL
, /* type */
1835 2, /* size (0 = byte, 1 = short, 2 = long) */
1837 FALSE
, /* pc_relative */
1839 complain_overflow_signed
, /* complain_on_overflow */
1840 _bfd_mips_elf_generic_reloc
, /* special_function */
1841 "R_MIPS16_TLS_GOTTPREL", /* name */
1842 TRUE
, /* partial_inplace */
1843 0x0000ffff, /* src_mask */
1844 0x0000ffff, /* dst_mask */
1845 FALSE
), /* pcrel_offset */
1847 /* MIPS16 TLS thread pointer offset. */
1848 HOWTO (R_MIPS16_TLS_TPREL_HI16
, /* type */
1850 2, /* size (0 = byte, 1 = short, 2 = long) */
1852 FALSE
, /* pc_relative */
1854 complain_overflow_signed
, /* complain_on_overflow */
1855 _bfd_mips_elf_generic_reloc
, /* special_function */
1856 "R_MIPS16_TLS_TPREL_HI16", /* name */
1857 TRUE
, /* partial_inplace */
1858 0x0000ffff, /* src_mask */
1859 0x0000ffff, /* dst_mask */
1860 FALSE
), /* pcrel_offset */
1862 /* MIPS16 TLS thread pointer offset. */
1863 HOWTO (R_MIPS16_TLS_TPREL_LO16
, /* type */
1865 2, /* size (0 = byte, 1 = short, 2 = long) */
1867 FALSE
, /* pc_relative */
1869 complain_overflow_signed
, /* complain_on_overflow */
1870 _bfd_mips_elf_generic_reloc
, /* special_function */
1871 "R_MIPS16_TLS_TPREL_LO16", /* name */
1872 TRUE
, /* partial_inplace */
1873 0x0000ffff, /* src_mask */
1874 0x0000ffff, /* dst_mask */
1875 FALSE
), /* pcrel_offset */
1877 /* MIPS16 16-bit PC-relative branch offset. */
1878 HOWTO (R_MIPS16_PC16_S1
, /* type */
1880 2, /* size (0 = byte, 1 = short, 2 = long) */
1882 TRUE
, /* pc_relative */
1884 complain_overflow_signed
, /* complain_on_overflow */
1885 _bfd_mips_elf_generic_reloc
, /* special_function */
1886 "R_MIPS16_PC16_S1", /* name */
1887 TRUE
, /* partial_inplace */
1888 0x0000ffff, /* src_mask */
1889 0x0000ffff, /* dst_mask */
1890 TRUE
), /* pcrel_offset */
1893 static reloc_howto_type mips16_elf64_howto_table_rela
[] =
1895 /* The reloc used for the mips16 jump instruction. */
1896 HOWTO (R_MIPS16_26
, /* type */
1898 2, /* size (0 = byte, 1 = short, 2 = long) */
1900 FALSE
, /* pc_relative */
1902 complain_overflow_dont
, /* complain_on_overflow */
1903 /* This needs complex overflow
1904 detection, because the upper four
1905 bits must match the PC. */
1906 _bfd_mips_elf_generic_reloc
, /* special_function */
1907 "R_MIPS16_26", /* name */
1908 FALSE
, /* partial_inplace */
1910 0x3ffffff, /* dst_mask */
1911 FALSE
), /* pcrel_offset */
1913 /* The reloc used for the mips16 gprel instruction. */
1914 HOWTO (R_MIPS16_GPREL
, /* type */
1916 2, /* size (0 = byte, 1 = short, 2 = long) */
1918 FALSE
, /* pc_relative */
1920 complain_overflow_signed
, /* complain_on_overflow */
1921 mips16_gprel_reloc
, /* special_function */
1922 "R_MIPS16_GPREL", /* name */
1923 FALSE
, /* partial_inplace */
1925 0x0000ffff, /* dst_mask */
1926 FALSE
), /* pcrel_offset */
1928 /* A MIPS16 reference to the global offset table. */
1929 HOWTO (R_MIPS16_GOT16
, /* type */
1931 2, /* size (0 = byte, 1 = short, 2 = long) */
1933 FALSE
, /* pc_relative */
1935 complain_overflow_dont
, /* complain_on_overflow */
1936 _bfd_mips_elf_got16_reloc
, /* special_function */
1937 "R_MIPS16_GOT16", /* name */
1938 FALSE
, /* partial_inplace */
1940 0x0000ffff, /* dst_mask */
1941 FALSE
), /* pcrel_offset */
1943 /* A MIPS16 call through the global offset table. */
1944 HOWTO (R_MIPS16_CALL16
, /* type */
1946 2, /* size (0 = byte, 1 = short, 2 = long) */
1948 FALSE
, /* pc_relative */
1950 complain_overflow_dont
, /* complain_on_overflow */
1951 _bfd_mips_elf_generic_reloc
, /* special_function */
1952 "R_MIPS16_CALL16", /* name */
1953 FALSE
, /* partial_inplace */
1955 0x0000ffff, /* dst_mask */
1956 FALSE
), /* pcrel_offset */
1958 /* MIPS16 high 16 bits of symbol value. */
1959 HOWTO (R_MIPS16_HI16
, /* type */
1960 16, /* rightshift */
1961 2, /* size (0 = byte, 1 = short, 2 = long) */
1963 FALSE
, /* pc_relative */
1965 complain_overflow_dont
, /* complain_on_overflow */
1966 _bfd_mips_elf_hi16_reloc
, /* special_function */
1967 "R_MIPS16_HI16", /* name */
1968 FALSE
, /* partial_inplace */
1970 0x0000ffff, /* dst_mask */
1971 FALSE
), /* pcrel_offset */
1973 /* MIPS16 low 16 bits of symbol value. */
1974 HOWTO (R_MIPS16_LO16
, /* type */
1976 2, /* size (0 = byte, 1 = short, 2 = long) */
1978 FALSE
, /* pc_relative */
1980 complain_overflow_dont
, /* complain_on_overflow */
1981 _bfd_mips_elf_lo16_reloc
, /* special_function */
1982 "R_MIPS16_LO16", /* name */
1983 FALSE
, /* partial_inplace */
1985 0x0000ffff, /* dst_mask */
1986 FALSE
), /* pcrel_offset */
1988 /* MIPS16 TLS general dynamic variable reference. */
1989 HOWTO (R_MIPS16_TLS_GD
, /* type */
1991 2, /* size (0 = byte, 1 = short, 2 = long) */
1993 FALSE
, /* pc_relative */
1995 complain_overflow_signed
, /* complain_on_overflow */
1996 _bfd_mips_elf_generic_reloc
, /* special_function */
1997 "R_MIPS16_TLS_GD", /* name */
1998 FALSE
, /* partial_inplace */
2000 0x0000ffff, /* dst_mask */
2001 FALSE
), /* pcrel_offset */
2003 /* MIPS16 TLS local dynamic variable reference. */
2004 HOWTO (R_MIPS16_TLS_LDM
, /* type */
2006 2, /* size (0 = byte, 1 = short, 2 = long) */
2008 FALSE
, /* pc_relative */
2010 complain_overflow_signed
, /* complain_on_overflow */
2011 _bfd_mips_elf_generic_reloc
, /* special_function */
2012 "R_MIPS16_TLS_LDM", /* name */
2013 FALSE
, /* partial_inplace */
2015 0x0000ffff, /* dst_mask */
2016 FALSE
), /* pcrel_offset */
2018 /* MIPS16 TLS local dynamic offset. */
2019 HOWTO (R_MIPS16_TLS_DTPREL_HI16
, /* type */
2021 2, /* size (0 = byte, 1 = short, 2 = long) */
2023 FALSE
, /* pc_relative */
2025 complain_overflow_signed
, /* complain_on_overflow */
2026 _bfd_mips_elf_generic_reloc
, /* special_function */
2027 "R_MIPS16_TLS_DTPREL_HI16", /* name */
2028 FALSE
, /* partial_inplace */
2030 0x0000ffff, /* dst_mask */
2031 FALSE
), /* pcrel_offset */
2033 /* MIPS16 TLS local dynamic offset. */
2034 HOWTO (R_MIPS16_TLS_DTPREL_LO16
, /* type */
2036 2, /* size (0 = byte, 1 = short, 2 = long) */
2038 FALSE
, /* pc_relative */
2040 complain_overflow_signed
, /* complain_on_overflow */
2041 _bfd_mips_elf_generic_reloc
, /* special_function */
2042 "R_MIPS16_TLS_DTPREL_LO16", /* name */
2043 FALSE
, /* partial_inplace */
2045 0x0000ffff, /* dst_mask */
2046 FALSE
), /* pcrel_offset */
2048 /* MIPS16 TLS thread pointer offset. */
2049 HOWTO (R_MIPS16_TLS_GOTTPREL
, /* type */
2051 2, /* size (0 = byte, 1 = short, 2 = long) */
2053 FALSE
, /* pc_relative */
2055 complain_overflow_signed
, /* complain_on_overflow */
2056 _bfd_mips_elf_generic_reloc
, /* special_function */
2057 "R_MIPS16_TLS_GOTTPREL", /* name */
2058 FALSE
, /* partial_inplace */
2060 0x0000ffff, /* dst_mask */
2061 FALSE
), /* pcrel_offset */
2063 /* MIPS16 TLS thread pointer offset. */
2064 HOWTO (R_MIPS16_TLS_TPREL_HI16
, /* type */
2066 2, /* size (0 = byte, 1 = short, 2 = long) */
2068 FALSE
, /* pc_relative */
2070 complain_overflow_signed
, /* complain_on_overflow */
2071 _bfd_mips_elf_generic_reloc
, /* special_function */
2072 "R_MIPS16_TLS_TPREL_HI16", /* name */
2073 FALSE
, /* partial_inplace */
2075 0x0000ffff, /* dst_mask */
2076 FALSE
), /* pcrel_offset */
2078 /* MIPS16 TLS thread pointer offset. */
2079 HOWTO (R_MIPS16_TLS_TPREL_LO16
, /* type */
2081 2, /* size (0 = byte, 1 = short, 2 = long) */
2083 FALSE
, /* pc_relative */
2085 complain_overflow_signed
, /* complain_on_overflow */
2086 _bfd_mips_elf_generic_reloc
, /* special_function */
2087 "R_MIPS16_TLS_TPREL_LO16", /* name */
2088 FALSE
, /* partial_inplace */
2090 0x0000ffff, /* dst_mask */
2091 FALSE
), /* pcrel_offset */
2093 /* MIPS16 16-bit PC-relative branch offset. */
2094 HOWTO (R_MIPS16_PC16_S1
, /* type */
2096 2, /* size (0 = byte, 1 = short, 2 = long) */
2098 TRUE
, /* pc_relative */
2100 complain_overflow_signed
, /* complain_on_overflow */
2101 _bfd_mips_elf_generic_reloc
, /* special_function */
2102 "R_MIPS16_PC16_S1", /* name */
2103 FALSE
, /* partial_inplace */
2105 0x0000ffff, /* dst_mask */
2106 TRUE
), /* pcrel_offset */
2109 static reloc_howto_type micromips_elf64_howto_table_rel
[] =
2115 /* 26 bit jump address. */
2116 HOWTO (R_MICROMIPS_26_S1
, /* type */
2118 2, /* size (0 = byte, 1 = short, 2 = long) */
2120 FALSE
, /* pc_relative */
2122 complain_overflow_dont
, /* complain_on_overflow */
2123 /* This needs complex overflow
2124 detection, because the upper four
2125 bits must match the PC. */
2126 _bfd_mips_elf_generic_reloc
, /* special_function */
2127 "R_MICROMIPS_26_S1", /* name */
2128 TRUE
, /* partial_inplace */
2129 0x3ffffff, /* src_mask */
2130 0x3ffffff, /* dst_mask */
2131 FALSE
), /* pcrel_offset */
2133 /* High 16 bits of symbol value. */
2134 HOWTO (R_MICROMIPS_HI16
, /* type */
2135 16, /* rightshift */
2136 2, /* size (0 = byte, 1 = short, 2 = long) */
2138 FALSE
, /* pc_relative */
2140 complain_overflow_dont
, /* complain_on_overflow */
2141 _bfd_mips_elf_hi16_reloc
, /* special_function */
2142 "R_MICROMIPS_HI16", /* name */
2143 TRUE
, /* partial_inplace */
2144 0x0000ffff, /* src_mask */
2145 0x0000ffff, /* dst_mask */
2146 FALSE
), /* pcrel_offset */
2148 /* Low 16 bits of symbol value. */
2149 HOWTO (R_MICROMIPS_LO16
, /* type */
2151 2, /* size (0 = byte, 1 = short, 2 = long) */
2153 FALSE
, /* pc_relative */
2155 complain_overflow_dont
, /* complain_on_overflow */
2156 _bfd_mips_elf_lo16_reloc
, /* special_function */
2157 "R_MICROMIPS_LO16", /* name */
2158 TRUE
, /* partial_inplace */
2159 0x0000ffff, /* src_mask */
2160 0x0000ffff, /* dst_mask */
2161 FALSE
), /* pcrel_offset */
2163 /* GP relative reference. */
2164 HOWTO (R_MICROMIPS_GPREL16
, /* type */
2166 2, /* size (0 = byte, 1 = short, 2 = long) */
2168 FALSE
, /* pc_relative */
2170 complain_overflow_signed
, /* complain_on_overflow */
2171 _bfd_mips_elf32_gprel16_reloc
, /* special_function */
2172 "R_MICROMIPS_GPREL16", /* name */
2173 TRUE
, /* partial_inplace */
2174 0x0000ffff, /* src_mask */
2175 0x0000ffff, /* dst_mask */
2176 FALSE
), /* pcrel_offset */
2178 /* Reference to literal section. */
2179 HOWTO (R_MICROMIPS_LITERAL
, /* type */
2181 2, /* size (0 = byte, 1 = short, 2 = long) */
2183 FALSE
, /* pc_relative */
2185 complain_overflow_signed
, /* complain_on_overflow */
2186 _bfd_mips_elf32_gprel16_reloc
, /* special_function */
2187 "R_MICROMIPS_LITERAL", /* name */
2188 TRUE
, /* partial_inplace */
2189 0x0000ffff, /* src_mask */
2190 0x0000ffff, /* dst_mask */
2191 FALSE
), /* pcrel_offset */
2193 /* Reference to global offset table. */
2194 HOWTO (R_MICROMIPS_GOT16
, /* type */
2196 2, /* size (0 = byte, 1 = short, 2 = long) */
2198 FALSE
, /* pc_relative */
2200 complain_overflow_signed
, /* complain_on_overflow */
2201 _bfd_mips_elf_got16_reloc
, /* special_function */
2202 "R_MICROMIPS_GOT16", /* name */
2203 TRUE
, /* partial_inplace */
2204 0x0000ffff, /* src_mask */
2205 0x0000ffff, /* dst_mask */
2206 FALSE
), /* pcrel_offset */
2208 /* This is for microMIPS branches. */
2209 HOWTO (R_MICROMIPS_PC7_S1
, /* type */
2211 1, /* size (0 = byte, 1 = short, 2 = long) */
2213 TRUE
, /* pc_relative */
2215 complain_overflow_signed
, /* complain_on_overflow */
2216 _bfd_mips_elf_generic_reloc
, /* special_function */
2217 "R_MICROMIPS_PC7_S1", /* name */
2218 TRUE
, /* partial_inplace */
2219 0x0000007f, /* src_mask */
2220 0x0000007f, /* dst_mask */
2221 TRUE
), /* pcrel_offset */
2223 HOWTO (R_MICROMIPS_PC10_S1
, /* type */
2225 1, /* size (0 = byte, 1 = short, 2 = long) */
2227 TRUE
, /* pc_relative */
2229 complain_overflow_signed
, /* complain_on_overflow */
2230 _bfd_mips_elf_generic_reloc
, /* special_function */
2231 "R_MICROMIPS_PC10_S1", /* name */
2232 TRUE
, /* partial_inplace */
2233 0x000003ff, /* src_mask */
2234 0x000003ff, /* dst_mask */
2235 TRUE
), /* pcrel_offset */
2237 HOWTO (R_MICROMIPS_PC16_S1
, /* type */
2239 2, /* size (0 = byte, 1 = short, 2 = long) */
2241 TRUE
, /* pc_relative */
2243 complain_overflow_signed
, /* complain_on_overflow */
2244 _bfd_mips_elf_generic_reloc
, /* special_function */
2245 "R_MICROMIPS_PC16_S1", /* name */
2246 TRUE
, /* partial_inplace */
2247 0x0000ffff, /* src_mask */
2248 0x0000ffff, /* dst_mask */
2249 TRUE
), /* pcrel_offset */
2251 /* 16 bit call through global offset table. */
2252 HOWTO (R_MICROMIPS_CALL16
, /* type */
2254 2, /* size (0 = byte, 1 = short, 2 = long) */
2256 FALSE
, /* pc_relative */
2258 complain_overflow_signed
, /* complain_on_overflow */
2259 _bfd_mips_elf_generic_reloc
, /* special_function */
2260 "R_MICROMIPS_CALL16", /* name */
2261 TRUE
, /* partial_inplace */
2262 0x0000ffff, /* src_mask */
2263 0x0000ffff, /* dst_mask */
2264 FALSE
), /* pcrel_offset */
2269 /* Displacement in the global offset table. */
2270 HOWTO (R_MICROMIPS_GOT_DISP
, /* type */
2272 2, /* size (0 = byte, 1 = short, 2 = long) */
2274 FALSE
, /* pc_relative */
2276 complain_overflow_signed
, /* complain_on_overflow */
2277 _bfd_mips_elf_generic_reloc
, /* special_function */
2278 "R_MICROMIPS_GOT_DISP",/* name */
2279 TRUE
, /* partial_inplace */
2280 0x0000ffff, /* src_mask */
2281 0x0000ffff, /* dst_mask */
2282 FALSE
), /* pcrel_offset */
2284 /* Displacement to page pointer in the global offset table. */
2285 HOWTO (R_MICROMIPS_GOT_PAGE
, /* type */
2287 2, /* size (0 = byte, 1 = short, 2 = long) */
2289 FALSE
, /* pc_relative */
2291 complain_overflow_signed
, /* complain_on_overflow */
2292 _bfd_mips_elf_generic_reloc
, /* special_function */
2293 "R_MICROMIPS_GOT_PAGE",/* name */
2294 TRUE
, /* partial_inplace */
2295 0x0000ffff, /* src_mask */
2296 0x0000ffff, /* dst_mask */
2297 FALSE
), /* pcrel_offset */
2299 /* Offset from page pointer in the global offset table. */
2300 HOWTO (R_MICROMIPS_GOT_OFST
, /* type */
2302 2, /* size (0 = byte, 1 = short, 2 = long) */
2304 FALSE
, /* pc_relative */
2306 complain_overflow_signed
, /* complain_on_overflow */
2307 _bfd_mips_elf_generic_reloc
, /* special_function */
2308 "R_MICROMIPS_GOT_OFST",/* name */
2309 TRUE
, /* partial_inplace */
2310 0x0000ffff, /* src_mask */
2311 0x0000ffff, /* dst_mask */
2312 FALSE
), /* pcrel_offset */
2314 /* High 16 bits of displacement in global offset table. */
2315 HOWTO (R_MICROMIPS_GOT_HI16
, /* type */
2317 2, /* size (0 = byte, 1 = short, 2 = long) */
2319 FALSE
, /* pc_relative */
2321 complain_overflow_dont
, /* complain_on_overflow */
2322 _bfd_mips_elf_generic_reloc
, /* special_function */
2323 "R_MICROMIPS_GOT_HI16",/* name */
2324 TRUE
, /* partial_inplace */
2325 0x0000ffff, /* src_mask */
2326 0x0000ffff, /* dst_mask */
2327 FALSE
), /* pcrel_offset */
2329 /* Low 16 bits of displacement in global offset table. */
2330 HOWTO (R_MICROMIPS_GOT_LO16
, /* type */
2332 2, /* size (0 = byte, 1 = short, 2 = long) */
2334 FALSE
, /* pc_relative */
2336 complain_overflow_dont
, /* complain_on_overflow */
2337 _bfd_mips_elf_generic_reloc
, /* special_function */
2338 "R_MICROMIPS_GOT_LO16",/* name */
2339 TRUE
, /* partial_inplace */
2340 0x0000ffff, /* src_mask */
2341 0x0000ffff, /* dst_mask */
2342 FALSE
), /* pcrel_offset */
2344 /* 64 bit subtraction. Used in the N32 ABI. */
2345 HOWTO (R_MICROMIPS_SUB
, /* type */
2347 4, /* size (0 = byte, 1 = short, 2 = long) */
2349 FALSE
, /* pc_relative */
2351 complain_overflow_dont
, /* complain_on_overflow */
2352 _bfd_mips_elf_generic_reloc
, /* special_function */
2353 "R_MICROMIPS_SUB", /* name */
2354 TRUE
, /* partial_inplace */
2355 MINUS_ONE
, /* src_mask */
2356 MINUS_ONE
, /* dst_mask */
2357 FALSE
), /* pcrel_offset */
2359 /* We don't support these for REL relocations, because it means building
2360 the addend from a R_MICROMIPS_HIGHEST/R_MICROMIPS_HIGHER/
2361 R_MICROMIPS_HI16/R_MICROMIPS_LO16 sequence with varying ordering,
2362 using fallable heuristics. */
2363 EMPTY_HOWTO (R_MICROMIPS_HIGHER
),
2364 EMPTY_HOWTO (R_MICROMIPS_HIGHEST
),
2366 /* High 16 bits of displacement in global offset table. */
2367 HOWTO (R_MICROMIPS_CALL_HI16
, /* type */
2369 2, /* size (0 = byte, 1 = short, 2 = long) */
2371 FALSE
, /* pc_relative */
2373 complain_overflow_dont
, /* complain_on_overflow */
2374 _bfd_mips_elf_generic_reloc
, /* special_function */
2375 "R_MICROMIPS_CALL_HI16",/* name */
2376 TRUE
, /* partial_inplace */
2377 0x0000ffff, /* src_mask */
2378 0x0000ffff, /* dst_mask */
2379 FALSE
), /* pcrel_offset */
2381 /* Low 16 bits of displacement in global offset table. */
2382 HOWTO (R_MICROMIPS_CALL_LO16
, /* type */
2384 2, /* size (0 = byte, 1 = short, 2 = long) */
2386 FALSE
, /* pc_relative */
2388 complain_overflow_dont
, /* complain_on_overflow */
2389 _bfd_mips_elf_generic_reloc
, /* special_function */
2390 "R_MICROMIPS_CALL_LO16",/* name */
2391 TRUE
, /* partial_inplace */
2392 0x0000ffff, /* src_mask */
2393 0x0000ffff, /* dst_mask */
2394 FALSE
), /* pcrel_offset */
2396 /* Section displacement. */
2397 HOWTO (R_MICROMIPS_SCN_DISP
, /* type */
2399 2, /* size (0 = byte, 1 = short, 2 = long) */
2401 FALSE
, /* pc_relative */
2403 complain_overflow_dont
, /* complain_on_overflow */
2404 _bfd_mips_elf_generic_reloc
, /* special_function */
2405 "R_MICROMIPS_SCN_DISP", /* name */
2406 TRUE
, /* partial_inplace */
2407 0xffffffff, /* src_mask */
2408 0xffffffff, /* dst_mask */
2409 FALSE
), /* pcrel_offset */
2411 /* Protected jump conversion. This is an optimization hint. No
2412 relocation is required for correctness. */
2413 HOWTO (R_MICROMIPS_JALR
, /* type */
2415 2, /* size (0 = byte, 1 = short, 2 = long) */
2417 FALSE
, /* pc_relative */
2419 complain_overflow_dont
, /* complain_on_overflow */
2420 _bfd_mips_elf_generic_reloc
, /* special_function */
2421 "R_MICROMIPS_JALR", /* name */
2422 FALSE
, /* partial_inplace */
2424 0x00000000, /* dst_mask */
2425 FALSE
), /* pcrel_offset */
2428 static reloc_howto_type micromips_elf64_howto_table_rela
[] =
2434 /* 26 bit jump address. */
2435 HOWTO (R_MICROMIPS_26_S1
, /* type */
2437 2, /* size (0 = byte, 1 = short, 2 = long) */
2439 FALSE
, /* pc_relative */
2441 complain_overflow_dont
, /* complain_on_overflow */
2442 /* This needs complex overflow
2443 detection, because the upper four
2444 bits must match the PC. */
2445 _bfd_mips_elf_generic_reloc
, /* special_function */
2446 "R_MICROMIPS_26_S1", /* name */
2447 FALSE
, /* partial_inplace */
2449 0x3ffffff, /* dst_mask */
2450 FALSE
), /* pcrel_offset */
2452 /* High 16 bits of symbol value. */
2453 HOWTO (R_MICROMIPS_HI16
, /* type */
2454 16, /* rightshift */
2455 2, /* size (0 = byte, 1 = short, 2 = long) */
2457 FALSE
, /* pc_relative */
2459 complain_overflow_dont
, /* complain_on_overflow */
2460 _bfd_mips_elf_hi16_reloc
, /* special_function */
2461 "R_MICROMIPS_HI16", /* name */
2462 FALSE
, /* partial_inplace */
2464 0x0000ffff, /* dst_mask */
2465 FALSE
), /* pcrel_offset */
2467 /* Low 16 bits of symbol value. */
2468 HOWTO (R_MICROMIPS_LO16
, /* type */
2470 2, /* size (0 = byte, 1 = short, 2 = long) */
2472 FALSE
, /* pc_relative */
2474 complain_overflow_dont
, /* complain_on_overflow */
2475 _bfd_mips_elf_lo16_reloc
, /* special_function */
2476 "R_MICROMIPS_LO16", /* name */
2477 FALSE
, /* partial_inplace */
2479 0x0000ffff, /* dst_mask */
2480 FALSE
), /* pcrel_offset */
2482 /* GP relative reference. */
2483 HOWTO (R_MICROMIPS_GPREL16
, /* type */
2485 2, /* size (0 = byte, 1 = short, 2 = long) */
2487 FALSE
, /* pc_relative */
2489 complain_overflow_signed
, /* complain_on_overflow */
2490 _bfd_mips_elf32_gprel16_reloc
, /* special_function */
2491 "R_MICROMIPS_GPREL16", /* name */
2492 FALSE
, /* partial_inplace */
2494 0x0000ffff, /* dst_mask */
2495 FALSE
), /* pcrel_offset */
2497 /* Reference to literal section. */
2498 HOWTO (R_MICROMIPS_LITERAL
, /* type */
2500 2, /* size (0 = byte, 1 = short, 2 = long) */
2502 FALSE
, /* pc_relative */
2504 complain_overflow_signed
, /* complain_on_overflow */
2505 _bfd_mips_elf32_gprel16_reloc
, /* special_function */
2506 "R_MICROMIPS_LITERAL", /* name */
2507 FALSE
, /* partial_inplace */
2509 0x0000ffff, /* dst_mask */
2510 FALSE
), /* pcrel_offset */
2512 /* Reference to global offset table. */
2513 HOWTO (R_MICROMIPS_GOT16
, /* type */
2515 2, /* size (0 = byte, 1 = short, 2 = long) */
2517 FALSE
, /* pc_relative */
2519 complain_overflow_signed
, /* complain_on_overflow */
2520 _bfd_mips_elf_got16_reloc
, /* special_function */
2521 "R_MICROMIPS_GOT16", /* name */
2522 FALSE
, /* partial_inplace */
2524 0x0000ffff, /* dst_mask */
2525 FALSE
), /* pcrel_offset */
2527 /* This is for microMIPS branches. */
2528 HOWTO (R_MICROMIPS_PC7_S1
, /* type */
2530 1, /* size (0 = byte, 1 = short, 2 = long) */
2532 TRUE
, /* pc_relative */
2534 complain_overflow_signed
, /* complain_on_overflow */
2535 _bfd_mips_elf_generic_reloc
, /* special_function */
2536 "R_MICROMIPS_PC7_S1", /* name */
2537 FALSE
, /* partial_inplace */
2539 0x0000007f, /* dst_mask */
2540 TRUE
), /* pcrel_offset */
2542 HOWTO (R_MICROMIPS_PC10_S1
, /* type */
2544 1, /* size (0 = byte, 1 = short, 2 = long) */
2546 TRUE
, /* pc_relative */
2548 complain_overflow_signed
, /* complain_on_overflow */
2549 _bfd_mips_elf_generic_reloc
, /* special_function */
2550 "R_MICROMIPS_PC10_S1", /* name */
2551 FALSE
, /* partial_inplace */
2553 0x000003ff, /* dst_mask */
2554 TRUE
), /* pcrel_offset */
2556 HOWTO (R_MICROMIPS_PC16_S1
, /* type */
2558 2, /* size (0 = byte, 1 = short, 2 = long) */
2560 TRUE
, /* pc_relative */
2562 complain_overflow_signed
, /* complain_on_overflow */
2563 _bfd_mips_elf_generic_reloc
, /* special_function */
2564 "R_MICROMIPS_PC16_S1", /* name */
2565 FALSE
, /* partial_inplace */
2567 0x0000ffff, /* dst_mask */
2568 TRUE
), /* pcrel_offset */
2570 /* 16 bit call through global offset table. */
2571 HOWTO (R_MICROMIPS_CALL16
, /* type */
2573 2, /* size (0 = byte, 1 = short, 2 = long) */
2575 FALSE
, /* pc_relative */
2577 complain_overflow_signed
, /* complain_on_overflow */
2578 _bfd_mips_elf_generic_reloc
, /* special_function */
2579 "R_MICROMIPS_CALL16", /* name */
2580 FALSE
, /* partial_inplace */
2582 0x0000ffff, /* dst_mask */
2583 FALSE
), /* pcrel_offset */
2588 /* Displacement in the global offset table. */
2589 HOWTO (R_MICROMIPS_GOT_DISP
, /* type */
2591 2, /* size (0 = byte, 1 = short, 2 = long) */
2593 FALSE
, /* pc_relative */
2595 complain_overflow_signed
, /* complain_on_overflow */
2596 _bfd_mips_elf_generic_reloc
, /* special_function */
2597 "R_MICROMIPS_GOT_DISP",/* name */
2598 FALSE
, /* partial_inplace */
2600 0x0000ffff, /* dst_mask */
2601 FALSE
), /* pcrel_offset */
2603 /* Displacement to page pointer in the global offset table. */
2604 HOWTO (R_MICROMIPS_GOT_PAGE
, /* type */
2606 2, /* size (0 = byte, 1 = short, 2 = long) */
2608 FALSE
, /* pc_relative */
2610 complain_overflow_signed
, /* complain_on_overflow */
2611 _bfd_mips_elf_generic_reloc
, /* special_function */
2612 "R_MICROMIPS_GOT_PAGE",/* name */
2613 FALSE
, /* partial_inplace */
2615 0x0000ffff, /* dst_mask */
2616 FALSE
), /* pcrel_offset */
2618 /* Offset from page pointer in the global offset table. */
2619 HOWTO (R_MICROMIPS_GOT_OFST
, /* type */
2621 2, /* size (0 = byte, 1 = short, 2 = long) */
2623 FALSE
, /* pc_relative */
2625 complain_overflow_signed
, /* complain_on_overflow */
2626 _bfd_mips_elf_generic_reloc
, /* special_function */
2627 "R_MICROMIPS_GOT_OFST",/* name */
2628 FALSE
, /* partial_inplace */
2630 0x0000ffff, /* dst_mask */
2631 FALSE
), /* pcrel_offset */
2633 /* High 16 bits of displacement in global offset table. */
2634 HOWTO (R_MICROMIPS_GOT_HI16
, /* type */
2636 2, /* size (0 = byte, 1 = short, 2 = long) */
2638 FALSE
, /* pc_relative */
2640 complain_overflow_dont
, /* complain_on_overflow */
2641 _bfd_mips_elf_generic_reloc
, /* special_function */
2642 "R_MICROMIPS_GOT_HI16",/* name */
2643 FALSE
, /* partial_inplace */
2645 0x0000ffff, /* dst_mask */
2646 FALSE
), /* pcrel_offset */
2648 /* Low 16 bits of displacement in global offset table. */
2649 HOWTO (R_MICROMIPS_GOT_LO16
, /* type */
2651 2, /* size (0 = byte, 1 = short, 2 = long) */
2653 FALSE
, /* pc_relative */
2655 complain_overflow_dont
, /* complain_on_overflow */
2656 _bfd_mips_elf_generic_reloc
, /* special_function */
2657 "R_MICROMIPS_GOT_LO16",/* name */
2658 FALSE
, /* partial_inplace */
2660 0x0000ffff, /* dst_mask */
2661 FALSE
), /* pcrel_offset */
2663 /* 64 bit subtraction. Used in the N32 ABI. */
2664 HOWTO (R_MICROMIPS_SUB
, /* type */
2666 4, /* size (0 = byte, 1 = short, 2 = long) */
2668 FALSE
, /* pc_relative */
2670 complain_overflow_dont
, /* complain_on_overflow */
2671 _bfd_mips_elf_generic_reloc
, /* special_function */
2672 "R_MICROMIPS_SUB", /* name */
2673 FALSE
, /* partial_inplace */
2675 MINUS_ONE
, /* dst_mask */
2676 FALSE
), /* pcrel_offset */
2678 /* Get the higher value of a 64 bit addend. */
2679 HOWTO (R_MICROMIPS_HIGHER
, /* type */
2681 2, /* size (0 = byte, 1 = short, 2 = long) */
2683 FALSE
, /* pc_relative */
2685 complain_overflow_dont
, /* complain_on_overflow */
2686 _bfd_mips_elf_generic_reloc
, /* special_function */
2687 "R_MICROMIPS_HIGHER", /* name */
2688 FALSE
, /* partial_inplace */
2690 0x0000ffff, /* dst_mask */
2691 FALSE
), /* pcrel_offset */
2693 /* Get the highest value of a 64 bit addend. */
2694 HOWTO (R_MICROMIPS_HIGHEST
, /* type */
2696 2, /* size (0 = byte, 1 = short, 2 = long) */
2698 FALSE
, /* pc_relative */
2700 complain_overflow_dont
, /* complain_on_overflow */
2701 _bfd_mips_elf_generic_reloc
, /* special_function */
2702 "R_MICROMIPS_HIGHEST", /* name */
2703 FALSE
, /* partial_inplace */
2705 0x0000ffff, /* dst_mask */
2706 FALSE
), /* pcrel_offset */
2708 /* High 16 bits of displacement in global offset table. */
2709 HOWTO (R_MICROMIPS_CALL_HI16
, /* type */
2711 2, /* size (0 = byte, 1 = short, 2 = long) */
2713 FALSE
, /* pc_relative */
2715 complain_overflow_dont
, /* complain_on_overflow */
2716 _bfd_mips_elf_generic_reloc
, /* special_function */
2717 "R_MICROMIPS_CALL_HI16",/* name */
2718 FALSE
, /* partial_inplace */
2720 0x0000ffff, /* dst_mask */
2721 FALSE
), /* pcrel_offset */
2723 /* Low 16 bits of displacement in global offset table. */
2724 HOWTO (R_MICROMIPS_CALL_LO16
, /* type */
2726 2, /* size (0 = byte, 1 = short, 2 = long) */
2728 FALSE
, /* pc_relative */
2730 complain_overflow_dont
, /* complain_on_overflow */
2731 _bfd_mips_elf_generic_reloc
, /* special_function */
2732 "R_MICROMIPS_CALL_LO16",/* name */
2733 FALSE
, /* partial_inplace */
2735 0x0000ffff, /* dst_mask */
2736 FALSE
), /* pcrel_offset */
2738 /* Section displacement. */
2739 HOWTO (R_MICROMIPS_SCN_DISP
, /* type */
2741 2, /* size (0 = byte, 1 = short, 2 = long) */
2743 FALSE
, /* pc_relative */
2745 complain_overflow_dont
, /* complain_on_overflow */
2746 _bfd_mips_elf_generic_reloc
, /* special_function */
2747 "R_MICROMIPS_SCN_DISP", /* name */
2748 FALSE
, /* partial_inplace */
2750 0xffffffff, /* dst_mask */
2751 FALSE
), /* pcrel_offset */
2753 /* Protected jump conversion. This is an optimization hint. No
2754 relocation is required for correctness. */
2755 HOWTO (R_MICROMIPS_JALR
, /* type */
2757 2, /* size (0 = byte, 1 = short, 2 = long) */
2759 FALSE
, /* pc_relative */
2761 complain_overflow_dont
, /* complain_on_overflow */
2762 _bfd_mips_elf_generic_reloc
, /* special_function */
2763 "R_MICROMIPS_JALR", /* name */
2764 FALSE
, /* partial_inplace */
2766 0x00000000, /* dst_mask */
2767 FALSE
), /* pcrel_offset */
2770 /* GNU extension to record C++ vtable hierarchy */
2771 static reloc_howto_type elf_mips_gnu_vtinherit_howto
=
2772 HOWTO (R_MIPS_GNU_VTINHERIT
, /* type */
2774 2, /* size (0 = byte, 1 = short, 2 = long) */
2776 FALSE
, /* pc_relative */
2778 complain_overflow_dont
, /* complain_on_overflow */
2779 NULL
, /* special_function */
2780 "R_MIPS_GNU_VTINHERIT", /* name */
2781 FALSE
, /* partial_inplace */
2784 FALSE
); /* pcrel_offset */
2786 /* GNU extension to record C++ vtable member usage */
2787 static reloc_howto_type elf_mips_gnu_vtentry_howto
=
2788 HOWTO (R_MIPS_GNU_VTENTRY
, /* type */
2790 2, /* size (0 = byte, 1 = short, 2 = long) */
2792 FALSE
, /* pc_relative */
2794 complain_overflow_dont
, /* complain_on_overflow */
2795 _bfd_elf_rel_vtable_reloc_fn
, /* special_function */
2796 "R_MIPS_GNU_VTENTRY", /* name */
2797 FALSE
, /* partial_inplace */
2800 FALSE
); /* pcrel_offset */
2802 /* 16 bit offset for pc-relative branches. */
2803 static reloc_howto_type elf_mips_gnu_rel16_s2
=
2804 HOWTO (R_MIPS_GNU_REL16_S2
, /* type */
2806 2, /* size (0 = byte, 1 = short, 2 = long) */
2808 TRUE
, /* pc_relative */
2810 complain_overflow_signed
, /* complain_on_overflow */
2811 _bfd_mips_elf_generic_reloc
, /* special_function */
2812 "R_MIPS_GNU_REL16_S2", /* name */
2813 TRUE
, /* partial_inplace */
2814 0x0000ffff, /* src_mask */
2815 0x0000ffff, /* dst_mask */
2816 TRUE
); /* pcrel_offset */
2818 /* 16 bit offset for pc-relative branches. */
2819 static reloc_howto_type elf_mips_gnu_rela16_s2
=
2820 HOWTO (R_MIPS_GNU_REL16_S2
, /* type */
2822 2, /* size (0 = byte, 1 = short, 2 = long) */
2824 TRUE
, /* pc_relative */
2826 complain_overflow_signed
, /* complain_on_overflow */
2827 _bfd_mips_elf_generic_reloc
, /* special_function */
2828 "R_MIPS_GNU_REL16_S2", /* name */
2829 FALSE
, /* partial_inplace */
2831 0x0000ffff, /* dst_mask */
2832 TRUE
); /* pcrel_offset */
2834 /* 32 bit pc-relative. Used for compact EH tables. */
2835 static reloc_howto_type elf_mips_gnu_pcrel32
=
2836 HOWTO (R_MIPS_PC32
, /* type */
2838 2, /* size (0 = byte, 1 = short, 2 = long) */
2840 TRUE
, /* pc_relative */
2842 complain_overflow_signed
, /* complain_on_overflow */
2843 _bfd_mips_elf_generic_reloc
, /* special_function */
2844 "R_MIPS_PC32", /* name */
2845 TRUE
, /* partial_inplace */
2846 0xffffffff, /* src_mask */
2847 0xffffffff, /* dst_mask */
2848 TRUE
); /* pcrel_offset */
2851 /* Originally a VxWorks extension, but now used for other systems too. */
2852 static reloc_howto_type elf_mips_copy_howto
=
2853 HOWTO (R_MIPS_COPY
, /* type */
2855 0, /* this one is variable size */
2857 FALSE
, /* pc_relative */
2859 complain_overflow_bitfield
, /* complain_on_overflow */
2860 _bfd_mips_elf_generic_reloc
, /* special_function */
2861 "R_MIPS_COPY", /* name */
2862 FALSE
, /* partial_inplace */
2865 FALSE
); /* pcrel_offset */
2867 /* Originally a VxWorks extension, but now used for other systems too. */
2868 static reloc_howto_type elf_mips_jump_slot_howto
=
2869 HOWTO (R_MIPS_JUMP_SLOT
, /* type */
2871 4, /* size (0 = byte, 1 = short, 2 = long) */
2873 FALSE
, /* pc_relative */
2875 complain_overflow_bitfield
, /* complain_on_overflow */
2876 _bfd_mips_elf_generic_reloc
, /* special_function */
2877 "R_MIPS_JUMP_SLOT", /* name */
2878 FALSE
, /* partial_inplace */
2881 FALSE
); /* pcrel_offset */
2883 /* Used in EH tables. */
2884 static reloc_howto_type elf_mips_eh_howto
=
2885 HOWTO (R_MIPS_EH
, /* type */
2887 2, /* size (0 = byte, 1 = short, 2 = long) */
2889 FALSE
, /* pc_relative */
2891 complain_overflow_signed
, /* complain_on_overflow */
2892 _bfd_mips_elf_generic_reloc
, /* special_function */
2893 "R_MIPS_EH", /* name */
2894 TRUE
, /* partial_inplace */
2895 0xffffffff, /* src_mask */
2896 0xffffffff, /* dst_mask */
2897 FALSE
); /* pcrel_offset */
2900 /* Swap in a MIPS 64-bit Rel reloc. */
2903 mips_elf64_swap_reloc_in (bfd
*abfd
, const Elf64_Mips_External_Rel
*src
,
2904 Elf64_Mips_Internal_Rela
*dst
)
2906 dst
->r_offset
= H_GET_64 (abfd
, src
->r_offset
);
2907 dst
->r_sym
= H_GET_32 (abfd
, src
->r_sym
);
2908 dst
->r_ssym
= H_GET_8 (abfd
, src
->r_ssym
);
2909 dst
->r_type3
= H_GET_8 (abfd
, src
->r_type3
);
2910 dst
->r_type2
= H_GET_8 (abfd
, src
->r_type2
);
2911 dst
->r_type
= H_GET_8 (abfd
, src
->r_type
);
2915 /* Swap in a MIPS 64-bit Rela reloc. */
2918 mips_elf64_swap_reloca_in (bfd
*abfd
, const Elf64_Mips_External_Rela
*src
,
2919 Elf64_Mips_Internal_Rela
*dst
)
2921 dst
->r_offset
= H_GET_64 (abfd
, src
->r_offset
);
2922 dst
->r_sym
= H_GET_32 (abfd
, src
->r_sym
);
2923 dst
->r_ssym
= H_GET_8 (abfd
, src
->r_ssym
);
2924 dst
->r_type3
= H_GET_8 (abfd
, src
->r_type3
);
2925 dst
->r_type2
= H_GET_8 (abfd
, src
->r_type2
);
2926 dst
->r_type
= H_GET_8 (abfd
, src
->r_type
);
2927 dst
->r_addend
= H_GET_S64 (abfd
, src
->r_addend
);
2930 /* Swap out a MIPS 64-bit Rel reloc. */
2933 mips_elf64_swap_reloc_out (bfd
*abfd
, const Elf64_Mips_Internal_Rela
*src
,
2934 Elf64_Mips_External_Rel
*dst
)
2936 H_PUT_64 (abfd
, src
->r_offset
, dst
->r_offset
);
2937 H_PUT_32 (abfd
, src
->r_sym
, dst
->r_sym
);
2938 H_PUT_8 (abfd
, src
->r_ssym
, dst
->r_ssym
);
2939 H_PUT_8 (abfd
, src
->r_type3
, dst
->r_type3
);
2940 H_PUT_8 (abfd
, src
->r_type2
, dst
->r_type2
);
2941 H_PUT_8 (abfd
, src
->r_type
, dst
->r_type
);
2944 /* Swap out a MIPS 64-bit Rela reloc. */
2947 mips_elf64_swap_reloca_out (bfd
*abfd
, const Elf64_Mips_Internal_Rela
*src
,
2948 Elf64_Mips_External_Rela
*dst
)
2950 H_PUT_64 (abfd
, src
->r_offset
, dst
->r_offset
);
2951 H_PUT_32 (abfd
, src
->r_sym
, dst
->r_sym
);
2952 H_PUT_8 (abfd
, src
->r_ssym
, dst
->r_ssym
);
2953 H_PUT_8 (abfd
, src
->r_type3
, dst
->r_type3
);
2954 H_PUT_8 (abfd
, src
->r_type2
, dst
->r_type2
);
2955 H_PUT_8 (abfd
, src
->r_type
, dst
->r_type
);
2956 H_PUT_S64 (abfd
, src
->r_addend
, dst
->r_addend
);
2959 /* Swap in a MIPS 64-bit Rel reloc. */
2962 mips_elf64_be_swap_reloc_in (bfd
*abfd
, const bfd_byte
*src
,
2963 Elf_Internal_Rela
*dst
)
2965 Elf64_Mips_Internal_Rela mirel
;
2967 mips_elf64_swap_reloc_in (abfd
,
2968 (const Elf64_Mips_External_Rel
*) src
,
2971 dst
[0].r_offset
= mirel
.r_offset
;
2972 dst
[0].r_info
= ELF64_R_INFO (mirel
.r_sym
, mirel
.r_type
);
2973 dst
[0].r_addend
= 0;
2974 dst
[1].r_offset
= mirel
.r_offset
;
2975 dst
[1].r_info
= ELF64_R_INFO (mirel
.r_ssym
, mirel
.r_type2
);
2976 dst
[1].r_addend
= 0;
2977 dst
[2].r_offset
= mirel
.r_offset
;
2978 dst
[2].r_info
= ELF64_R_INFO (STN_UNDEF
, mirel
.r_type3
);
2979 dst
[2].r_addend
= 0;
2982 /* Swap in a MIPS 64-bit Rela reloc. */
2985 mips_elf64_be_swap_reloca_in (bfd
*abfd
, const bfd_byte
*src
,
2986 Elf_Internal_Rela
*dst
)
2988 Elf64_Mips_Internal_Rela mirela
;
2990 mips_elf64_swap_reloca_in (abfd
,
2991 (const Elf64_Mips_External_Rela
*) src
,
2994 dst
[0].r_offset
= mirela
.r_offset
;
2995 dst
[0].r_info
= ELF64_R_INFO (mirela
.r_sym
, mirela
.r_type
);
2996 dst
[0].r_addend
= mirela
.r_addend
;
2997 dst
[1].r_offset
= mirela
.r_offset
;
2998 dst
[1].r_info
= ELF64_R_INFO (mirela
.r_ssym
, mirela
.r_type2
);
2999 dst
[1].r_addend
= 0;
3000 dst
[2].r_offset
= mirela
.r_offset
;
3001 dst
[2].r_info
= ELF64_R_INFO (STN_UNDEF
, mirela
.r_type3
);
3002 dst
[2].r_addend
= 0;
3005 /* Swap out a MIPS 64-bit Rel reloc. */
3008 mips_elf64_be_swap_reloc_out (bfd
*abfd
, const Elf_Internal_Rela
*src
,
3011 Elf64_Mips_Internal_Rela mirel
;
3013 mirel
.r_offset
= src
[0].r_offset
;
3014 BFD_ASSERT(src
[0].r_offset
== src
[1].r_offset
);
3015 BFD_ASSERT(src
[0].r_offset
== src
[2].r_offset
);
3017 mirel
.r_type
= ELF64_MIPS_R_TYPE (src
[0].r_info
);
3018 mirel
.r_sym
= ELF64_R_SYM (src
[0].r_info
);
3019 mirel
.r_type2
= ELF64_MIPS_R_TYPE (src
[1].r_info
);
3020 mirel
.r_ssym
= ELF64_MIPS_R_SSYM (src
[1].r_info
);
3021 mirel
.r_type3
= ELF64_MIPS_R_TYPE (src
[2].r_info
);
3023 mips_elf64_swap_reloc_out (abfd
, &mirel
,
3024 (Elf64_Mips_External_Rel
*) dst
);
3027 /* Swap out a MIPS 64-bit Rela reloc. */
3030 mips_elf64_be_swap_reloca_out (bfd
*abfd
, const Elf_Internal_Rela
*src
,
3033 Elf64_Mips_Internal_Rela mirela
;
3035 mirela
.r_offset
= src
[0].r_offset
;
3036 BFD_ASSERT(src
[0].r_offset
== src
[1].r_offset
);
3037 BFD_ASSERT(src
[0].r_offset
== src
[2].r_offset
);
3039 mirela
.r_type
= ELF64_MIPS_R_TYPE (src
[0].r_info
);
3040 mirela
.r_sym
= ELF64_R_SYM (src
[0].r_info
);
3041 mirela
.r_addend
= src
[0].r_addend
;
3042 BFD_ASSERT(src
[1].r_addend
== 0);
3043 BFD_ASSERT(src
[2].r_addend
== 0);
3045 mirela
.r_type2
= ELF64_MIPS_R_TYPE (src
[1].r_info
);
3046 mirela
.r_ssym
= ELF64_MIPS_R_SSYM (src
[1].r_info
);
3047 mirela
.r_type3
= ELF64_MIPS_R_TYPE (src
[2].r_info
);
3049 mips_elf64_swap_reloca_out (abfd
, &mirela
,
3050 (Elf64_Mips_External_Rela
*) dst
);
3053 /* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a
3054 dangerous relocation. */
3057 mips_elf64_assign_gp (bfd
*output_bfd
, bfd_vma
*pgp
)
3063 /* If we've already figured out what GP will be, just return it. */
3064 *pgp
= _bfd_get_gp_value (output_bfd
);
3068 count
= bfd_get_symcount (output_bfd
);
3069 sym
= bfd_get_outsymbols (output_bfd
);
3071 /* The linker script will have created a symbol named `_gp' with the
3072 appropriate value. */
3077 for (i
= 0; i
< count
; i
++, sym
++)
3079 register const char *name
;
3081 name
= bfd_asymbol_name (*sym
);
3082 if (*name
== '_' && strcmp (name
, "_gp") == 0)
3084 *pgp
= bfd_asymbol_value (*sym
);
3085 _bfd_set_gp_value (output_bfd
, *pgp
);
3093 /* Only get the error once. */
3095 _bfd_set_gp_value (output_bfd
, *pgp
);
3102 /* We have to figure out the gp value, so that we can adjust the
3103 symbol value correctly. We look up the symbol _gp in the output
3104 BFD. If we can't find it, we're stuck. We cache it in the ELF
3105 target data. We don't need to adjust the symbol value for an
3106 external symbol if we are producing relocatable output. */
3108 static bfd_reloc_status_type
3109 mips_elf64_final_gp (bfd
*output_bfd
, asymbol
*symbol
, bfd_boolean relocatable
,
3110 char **error_message
, bfd_vma
*pgp
)
3112 if (bfd_is_und_section (symbol
->section
)
3116 return bfd_reloc_undefined
;
3119 *pgp
= _bfd_get_gp_value (output_bfd
);
3122 || (symbol
->flags
& BSF_SECTION_SYM
) != 0))
3126 /* Make up a value. */
3127 *pgp
= symbol
->section
->output_section
->vma
/*+ 0x4000*/;
3128 _bfd_set_gp_value (output_bfd
, *pgp
);
3130 else if (!mips_elf64_assign_gp (output_bfd
, pgp
))
3133 (char *) _("GP relative relocation when _gp not defined");
3134 return bfd_reloc_dangerous
;
3138 return bfd_reloc_ok
;
3141 /* Do a R_MIPS_GPREL16 relocation. This is a 16 bit value which must
3142 become the offset from the gp register. */
3144 static bfd_reloc_status_type
3145 mips_elf64_gprel16_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
3146 void *data
, asection
*input_section
, bfd
*output_bfd
,
3147 char **error_message
)
3149 bfd_boolean relocatable
;
3150 bfd_reloc_status_type ret
;
3153 /* If we're relocating, and this is an external symbol, we don't want
3154 to change anything. */
3155 if (output_bfd
!= NULL
3156 && (symbol
->flags
& BSF_SECTION_SYM
) == 0
3157 && (symbol
->flags
& BSF_LOCAL
) != 0)
3159 reloc_entry
->address
+= input_section
->output_offset
;
3160 return bfd_reloc_ok
;
3163 if (output_bfd
!= NULL
)
3167 relocatable
= FALSE
;
3168 output_bfd
= symbol
->section
->output_section
->owner
;
3171 ret
= mips_elf64_final_gp (output_bfd
, symbol
, relocatable
, error_message
,
3173 if (ret
!= bfd_reloc_ok
)
3176 return _bfd_mips_elf_gprel16_with_gp (abfd
, symbol
, reloc_entry
,
3177 input_section
, relocatable
,
3181 /* Do a R_MIPS_LITERAL relocation. */
3183 static bfd_reloc_status_type
3184 mips_elf64_literal_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
3185 void *data
, asection
*input_section
, bfd
*output_bfd
,
3186 char **error_message
)
3188 bfd_boolean relocatable
;
3189 bfd_reloc_status_type ret
;
3192 /* R_MIPS_LITERAL relocations are defined for local symbols only. */
3193 if (output_bfd
!= NULL
3194 && (symbol
->flags
& BSF_SECTION_SYM
) == 0
3195 && (symbol
->flags
& BSF_LOCAL
) != 0)
3197 *error_message
= (char *)
3198 _("literal relocation occurs for an external symbol");
3199 return bfd_reloc_outofrange
;
3202 /* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */
3203 if (output_bfd
!= NULL
)
3207 relocatable
= FALSE
;
3208 output_bfd
= symbol
->section
->output_section
->owner
;
3211 ret
= mips_elf64_final_gp (output_bfd
, symbol
, relocatable
, error_message
,
3213 if (ret
!= bfd_reloc_ok
)
3216 return _bfd_mips_elf_gprel16_with_gp (abfd
, symbol
, reloc_entry
,
3217 input_section
, relocatable
,
3221 /* Do a R_MIPS_GPREL32 relocation. This is a 32 bit value which must
3222 become the offset from the gp register. */
3224 static bfd_reloc_status_type
3225 mips_elf64_gprel32_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
3226 void *data
, asection
*input_section
, bfd
*output_bfd
,
3227 char **error_message
)
3229 bfd_boolean relocatable
;
3230 bfd_reloc_status_type ret
;
3235 /* R_MIPS_GPREL32 relocations are defined for local symbols only. */
3236 if (output_bfd
!= NULL
3237 && (symbol
->flags
& BSF_SECTION_SYM
) == 0
3238 && (symbol
->flags
& BSF_LOCAL
) != 0)
3240 *error_message
= (char *)
3241 _("32bits gp relative relocation occurs for an external symbol");
3242 return bfd_reloc_outofrange
;
3245 if (output_bfd
!= NULL
)
3249 relocatable
= FALSE
;
3250 output_bfd
= symbol
->section
->output_section
->owner
;
3253 ret
= mips_elf64_final_gp (output_bfd
, symbol
, relocatable
,
3254 error_message
, &gp
);
3255 if (ret
!= bfd_reloc_ok
)
3258 if (bfd_is_com_section (symbol
->section
))
3261 relocation
= symbol
->value
;
3263 relocation
+= symbol
->section
->output_section
->vma
;
3264 relocation
+= symbol
->section
->output_offset
;
3266 if (reloc_entry
->address
> bfd_get_section_limit (abfd
, input_section
))
3267 return bfd_reloc_outofrange
;
3269 /* Set val to the offset into the section or symbol. */
3270 val
= reloc_entry
->addend
;
3272 if (reloc_entry
->howto
->partial_inplace
)
3273 val
+= bfd_get_32 (abfd
, (bfd_byte
*) data
+ reloc_entry
->address
);
3275 /* Adjust val for the final section location and GP value. If we
3276 are producing relocatable output, we don't want to do this for
3277 an external symbol. */
3279 || (symbol
->flags
& BSF_SECTION_SYM
) != 0)
3280 val
+= relocation
- gp
;
3282 if (reloc_entry
->howto
->partial_inplace
)
3283 bfd_put_32 (abfd
, val
, (bfd_byte
*) data
+ reloc_entry
->address
);
3285 reloc_entry
->addend
= val
;
3288 reloc_entry
->address
+= input_section
->output_offset
;
3290 return bfd_reloc_ok
;
3293 /* Do a R_MIPS_SHIFT6 relocation. The MSB of the shift is stored at bit 2,
3294 the rest is at bits 6-10. The bitpos already got right by the howto. */
3296 static bfd_reloc_status_type
3297 mips_elf64_shift6_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
3298 void *data
, asection
*input_section
, bfd
*output_bfd
,
3299 char **error_message
)
3301 if (reloc_entry
->howto
->partial_inplace
)
3303 reloc_entry
->addend
= ((reloc_entry
->addend
& 0x00007c0)
3304 | (reloc_entry
->addend
& 0x00000800) >> 9);
3307 return _bfd_mips_elf_generic_reloc (abfd
, reloc_entry
, symbol
, data
,
3308 input_section
, output_bfd
,
3312 /* Handle a mips16 GP relative reloc. */
3314 static bfd_reloc_status_type
3315 mips16_gprel_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
3316 void *data
, asection
*input_section
, bfd
*output_bfd
,
3317 char **error_message
)
3319 bfd_boolean relocatable
;
3320 bfd_reloc_status_type ret
;
3324 /* If we're relocating, and this is an external symbol, we don't want
3325 to change anything. */
3326 if (output_bfd
!= NULL
3327 && (symbol
->flags
& BSF_SECTION_SYM
) == 0
3328 && (symbol
->flags
& BSF_LOCAL
) != 0)
3330 reloc_entry
->address
+= input_section
->output_offset
;
3331 return bfd_reloc_ok
;
3334 if (output_bfd
!= NULL
)
3338 relocatable
= FALSE
;
3339 output_bfd
= symbol
->section
->output_section
->owner
;
3342 ret
= mips_elf64_final_gp (output_bfd
, symbol
, relocatable
, error_message
,
3344 if (ret
!= bfd_reloc_ok
)
3347 location
= (bfd_byte
*) data
+ reloc_entry
->address
;
3348 _bfd_mips_elf_reloc_unshuffle (abfd
, reloc_entry
->howto
->type
, FALSE
,
3350 ret
= _bfd_mips_elf_gprel16_with_gp (abfd
, symbol
, reloc_entry
,
3351 input_section
, relocatable
,
3353 _bfd_mips_elf_reloc_shuffle (abfd
, reloc_entry
->howto
->type
, !relocatable
,
3359 /* A mapping from BFD reloc types to MIPS ELF reloc types. */
3361 struct elf_reloc_map
{
3362 bfd_reloc_code_real_type bfd_val
;
3363 enum elf_mips_reloc_type elf_val
;
3366 static const struct elf_reloc_map mips_reloc_map
[] =
3368 { BFD_RELOC_NONE
, R_MIPS_NONE
},
3369 { BFD_RELOC_16
, R_MIPS_16
},
3370 { BFD_RELOC_32
, R_MIPS_32
},
3371 /* There is no BFD reloc for R_MIPS_REL32. */
3372 { BFD_RELOC_64
, R_MIPS_64
},
3373 { BFD_RELOC_CTOR
, R_MIPS_64
},
3374 { BFD_RELOC_16_PCREL_S2
, R_MIPS_PC16
},
3375 { BFD_RELOC_HI16_S
, R_MIPS_HI16
},
3376 { BFD_RELOC_LO16
, R_MIPS_LO16
},
3377 { BFD_RELOC_GPREL16
, R_MIPS_GPREL16
},
3378 { BFD_RELOC_GPREL32
, R_MIPS_GPREL32
},
3379 { BFD_RELOC_MIPS_JMP
, R_MIPS_26
},
3380 { BFD_RELOC_MIPS_LITERAL
, R_MIPS_LITERAL
},
3381 { BFD_RELOC_MIPS_GOT16
, R_MIPS_GOT16
},
3382 { BFD_RELOC_MIPS_CALL16
, R_MIPS_CALL16
},
3383 { BFD_RELOC_MIPS_SHIFT5
, R_MIPS_SHIFT5
},
3384 { BFD_RELOC_MIPS_SHIFT6
, R_MIPS_SHIFT6
},
3385 { BFD_RELOC_MIPS_GOT_DISP
, R_MIPS_GOT_DISP
},
3386 { BFD_RELOC_MIPS_GOT_PAGE
, R_MIPS_GOT_PAGE
},
3387 { BFD_RELOC_MIPS_GOT_OFST
, R_MIPS_GOT_OFST
},
3388 { BFD_RELOC_MIPS_GOT_HI16
, R_MIPS_GOT_HI16
},
3389 { BFD_RELOC_MIPS_GOT_LO16
, R_MIPS_GOT_LO16
},
3390 { BFD_RELOC_MIPS_SUB
, R_MIPS_SUB
},
3391 { BFD_RELOC_MIPS_INSERT_A
, R_MIPS_INSERT_A
},
3392 { BFD_RELOC_MIPS_INSERT_B
, R_MIPS_INSERT_B
},
3393 { BFD_RELOC_MIPS_DELETE
, R_MIPS_DELETE
},
3394 { BFD_RELOC_MIPS_HIGHEST
, R_MIPS_HIGHEST
},
3395 { BFD_RELOC_MIPS_HIGHER
, R_MIPS_HIGHER
},
3396 { BFD_RELOC_MIPS_CALL_HI16
, R_MIPS_CALL_HI16
},
3397 { BFD_RELOC_MIPS_CALL_LO16
, R_MIPS_CALL_LO16
},
3398 { BFD_RELOC_MIPS_SCN_DISP
, R_MIPS_SCN_DISP
},
3399 { BFD_RELOC_MIPS_REL16
, R_MIPS_REL16
},
3400 /* Use of R_MIPS_ADD_IMMEDIATE and R_MIPS_PJUMP is deprecated. */
3401 { BFD_RELOC_MIPS_RELGOT
, R_MIPS_RELGOT
},
3402 { BFD_RELOC_MIPS_JALR
, R_MIPS_JALR
},
3403 { BFD_RELOC_MIPS_TLS_DTPMOD32
, R_MIPS_TLS_DTPMOD32
},
3404 { BFD_RELOC_MIPS_TLS_DTPREL32
, R_MIPS_TLS_DTPREL32
},
3405 { BFD_RELOC_MIPS_TLS_DTPMOD64
, R_MIPS_TLS_DTPMOD64
},
3406 { BFD_RELOC_MIPS_TLS_DTPREL64
, R_MIPS_TLS_DTPREL64
},
3407 { BFD_RELOC_MIPS_TLS_GD
, R_MIPS_TLS_GD
},
3408 { BFD_RELOC_MIPS_TLS_LDM
, R_MIPS_TLS_LDM
},
3409 { BFD_RELOC_MIPS_TLS_DTPREL_HI16
, R_MIPS_TLS_DTPREL_HI16
},
3410 { BFD_RELOC_MIPS_TLS_DTPREL_LO16
, R_MIPS_TLS_DTPREL_LO16
},
3411 { BFD_RELOC_MIPS_TLS_GOTTPREL
, R_MIPS_TLS_GOTTPREL
},
3412 { BFD_RELOC_MIPS_TLS_TPREL32
, R_MIPS_TLS_TPREL32
},
3413 { BFD_RELOC_MIPS_TLS_TPREL64
, R_MIPS_TLS_TPREL64
},
3414 { BFD_RELOC_MIPS_TLS_TPREL_HI16
, R_MIPS_TLS_TPREL_HI16
},
3415 { BFD_RELOC_MIPS_TLS_TPREL_LO16
, R_MIPS_TLS_TPREL_LO16
},
3416 { BFD_RELOC_MIPS_21_PCREL_S2
, R_MIPS_PC21_S2
},
3417 { BFD_RELOC_MIPS_26_PCREL_S2
, R_MIPS_PC26_S2
},
3418 { BFD_RELOC_MIPS_18_PCREL_S3
, R_MIPS_PC18_S3
},
3419 { BFD_RELOC_MIPS_19_PCREL_S2
, R_MIPS_PC19_S2
},
3420 { BFD_RELOC_HI16_S_PCREL
, R_MIPS_PCHI16
},
3421 { BFD_RELOC_LO16_PCREL
, R_MIPS_PCLO16
}
3424 static const struct elf_reloc_map mips16_reloc_map
[] =
3426 { BFD_RELOC_MIPS16_JMP
, R_MIPS16_26
- R_MIPS16_min
},
3427 { BFD_RELOC_MIPS16_GPREL
, R_MIPS16_GPREL
- R_MIPS16_min
},
3428 { BFD_RELOC_MIPS16_GOT16
, R_MIPS16_GOT16
- R_MIPS16_min
},
3429 { BFD_RELOC_MIPS16_CALL16
, R_MIPS16_CALL16
- R_MIPS16_min
},
3430 { BFD_RELOC_MIPS16_HI16_S
, R_MIPS16_HI16
- R_MIPS16_min
},
3431 { BFD_RELOC_MIPS16_LO16
, R_MIPS16_LO16
- R_MIPS16_min
},
3432 { BFD_RELOC_MIPS16_TLS_GD
, R_MIPS16_TLS_GD
- R_MIPS16_min
},
3433 { BFD_RELOC_MIPS16_TLS_LDM
, R_MIPS16_TLS_LDM
- R_MIPS16_min
},
3434 { BFD_RELOC_MIPS16_TLS_DTPREL_HI16
,
3435 R_MIPS16_TLS_DTPREL_HI16
- R_MIPS16_min
},
3436 { BFD_RELOC_MIPS16_TLS_DTPREL_LO16
,
3437 R_MIPS16_TLS_DTPREL_LO16
- R_MIPS16_min
},
3438 { BFD_RELOC_MIPS16_TLS_GOTTPREL
, R_MIPS16_TLS_GOTTPREL
- R_MIPS16_min
},
3439 { BFD_RELOC_MIPS16_TLS_TPREL_HI16
, R_MIPS16_TLS_TPREL_HI16
- R_MIPS16_min
},
3440 { BFD_RELOC_MIPS16_TLS_TPREL_LO16
, R_MIPS16_TLS_TPREL_LO16
- R_MIPS16_min
},
3441 { BFD_RELOC_MIPS16_16_PCREL_S1
, R_MIPS16_PC16_S1
- R_MIPS16_min
}
3444 static const struct elf_reloc_map micromips_reloc_map
[] =
3446 { BFD_RELOC_MICROMIPS_JMP
, R_MICROMIPS_26_S1
- R_MICROMIPS_min
},
3447 { BFD_RELOC_MICROMIPS_HI16_S
, R_MICROMIPS_HI16
- R_MICROMIPS_min
},
3448 { BFD_RELOC_MICROMIPS_LO16
, R_MICROMIPS_LO16
- R_MICROMIPS_min
},
3449 { BFD_RELOC_MICROMIPS_GPREL16
, R_MICROMIPS_GPREL16
- R_MICROMIPS_min
},
3450 { BFD_RELOC_MICROMIPS_LITERAL
, R_MICROMIPS_LITERAL
- R_MICROMIPS_min
},
3451 { BFD_RELOC_MICROMIPS_GOT16
, R_MICROMIPS_GOT16
- R_MICROMIPS_min
},
3452 { BFD_RELOC_MICROMIPS_7_PCREL_S1
, R_MICROMIPS_PC7_S1
- R_MICROMIPS_min
},
3453 { BFD_RELOC_MICROMIPS_10_PCREL_S1
, R_MICROMIPS_PC10_S1
- R_MICROMIPS_min
},
3454 { BFD_RELOC_MICROMIPS_16_PCREL_S1
, R_MICROMIPS_PC16_S1
- R_MICROMIPS_min
},
3455 { BFD_RELOC_MICROMIPS_CALL16
, R_MICROMIPS_CALL16
- R_MICROMIPS_min
},
3456 { BFD_RELOC_MICROMIPS_GOT_DISP
, R_MICROMIPS_GOT_DISP
- R_MICROMIPS_min
},
3457 { BFD_RELOC_MICROMIPS_GOT_PAGE
, R_MICROMIPS_GOT_PAGE
- R_MICROMIPS_min
},
3458 { BFD_RELOC_MICROMIPS_GOT_OFST
, R_MICROMIPS_GOT_OFST
- R_MICROMIPS_min
},
3459 { BFD_RELOC_MICROMIPS_GOT_HI16
, R_MICROMIPS_GOT_HI16
- R_MICROMIPS_min
},
3460 { BFD_RELOC_MICROMIPS_GOT_LO16
, R_MICROMIPS_GOT_LO16
- R_MICROMIPS_min
},
3461 { BFD_RELOC_MICROMIPS_SUB
, R_MICROMIPS_SUB
- R_MICROMIPS_min
},
3462 { BFD_RELOC_MICROMIPS_HIGHER
, R_MICROMIPS_HIGHER
- R_MICROMIPS_min
},
3463 { BFD_RELOC_MICROMIPS_HIGHEST
, R_MICROMIPS_HIGHEST
- R_MICROMIPS_min
},
3464 { BFD_RELOC_MICROMIPS_CALL_HI16
, R_MICROMIPS_CALL_HI16
- R_MICROMIPS_min
},
3465 { BFD_RELOC_MICROMIPS_CALL_LO16
, R_MICROMIPS_CALL_LO16
- R_MICROMIPS_min
},
3466 { BFD_RELOC_MICROMIPS_SCN_DISP
, R_MICROMIPS_SCN_DISP
- R_MICROMIPS_min
},
3467 { BFD_RELOC_MICROMIPS_JALR
, R_MICROMIPS_JALR
- R_MICROMIPS_min
},
3469 /* Given a BFD reloc type, return a howto structure. */
3471 static reloc_howto_type
*
3472 bfd_elf64_bfd_reloc_type_lookup (bfd
*abfd ATTRIBUTE_UNUSED
,
3473 bfd_reloc_code_real_type code
)
3476 /* FIXME: We default to RELA here instead of choosing the right
3477 relocation variant. */
3478 reloc_howto_type
*howto_table
= mips_elf64_howto_table_rela
;
3479 reloc_howto_type
*howto16_table
= mips16_elf64_howto_table_rela
;
3480 reloc_howto_type
*howto_micromips_table
= micromips_elf64_howto_table_rela
;
3482 for (i
= 0; i
< sizeof (mips_reloc_map
) / sizeof (struct elf_reloc_map
);
3485 if (mips_reloc_map
[i
].bfd_val
== code
)
3486 return &howto_table
[(int) mips_reloc_map
[i
].elf_val
];
3489 for (i
= 0; i
< sizeof (mips16_reloc_map
) / sizeof (struct elf_reloc_map
);
3492 if (mips16_reloc_map
[i
].bfd_val
== code
)
3493 return &howto16_table
[(int) mips16_reloc_map
[i
].elf_val
];
3496 for (i
= 0; i
< sizeof (micromips_reloc_map
) / sizeof (struct elf_reloc_map
);
3499 if (micromips_reloc_map
[i
].bfd_val
== code
)
3500 return &howto_micromips_table
[(int) micromips_reloc_map
[i
].elf_val
];
3505 case BFD_RELOC_VTABLE_INHERIT
:
3506 return &elf_mips_gnu_vtinherit_howto
;
3507 case BFD_RELOC_VTABLE_ENTRY
:
3508 return &elf_mips_gnu_vtentry_howto
;
3509 case BFD_RELOC_32_PCREL
:
3510 return &elf_mips_gnu_pcrel32
;
3511 case BFD_RELOC_MIPS_EH
:
3512 return &elf_mips_eh_howto
;
3513 case BFD_RELOC_MIPS_COPY
:
3514 return &elf_mips_copy_howto
;
3515 case BFD_RELOC_MIPS_JUMP_SLOT
:
3516 return &elf_mips_jump_slot_howto
;
3518 bfd_set_error (bfd_error_bad_value
);
3523 static reloc_howto_type
*
3524 bfd_elf64_bfd_reloc_name_lookup (bfd
*abfd ATTRIBUTE_UNUSED
,
3530 i
< (sizeof (mips_elf64_howto_table_rela
)
3531 / sizeof (mips_elf64_howto_table_rela
[0])); i
++)
3532 if (mips_elf64_howto_table_rela
[i
].name
!= NULL
3533 && strcasecmp (mips_elf64_howto_table_rela
[i
].name
, r_name
) == 0)
3534 return &mips_elf64_howto_table_rela
[i
];
3537 i
< (sizeof (mips16_elf64_howto_table_rela
)
3538 / sizeof (mips16_elf64_howto_table_rela
[0]));
3540 if (mips16_elf64_howto_table_rela
[i
].name
!= NULL
3541 && strcasecmp (mips16_elf64_howto_table_rela
[i
].name
, r_name
) == 0)
3542 return &mips16_elf64_howto_table_rela
[i
];
3545 i
< (sizeof (micromips_elf64_howto_table_rela
)
3546 / sizeof (micromips_elf64_howto_table_rela
[0]));
3548 if (micromips_elf64_howto_table_rela
[i
].name
!= NULL
3549 && strcasecmp (micromips_elf64_howto_table_rela
[i
].name
, r_name
) == 0)
3550 return µmips_elf64_howto_table_rela
[i
];
3552 if (strcasecmp (elf_mips_gnu_vtinherit_howto
.name
, r_name
) == 0)
3553 return &elf_mips_gnu_vtinherit_howto
;
3554 if (strcasecmp (elf_mips_gnu_vtentry_howto
.name
, r_name
) == 0)
3555 return &elf_mips_gnu_vtentry_howto
;
3556 if (strcasecmp (elf_mips_gnu_rel16_s2
.name
, r_name
) == 0)
3557 return &elf_mips_gnu_rel16_s2
;
3558 if (strcasecmp (elf_mips_gnu_rela16_s2
.name
, r_name
) == 0)
3559 return &elf_mips_gnu_rela16_s2
;
3560 if (strcasecmp (elf_mips_gnu_pcrel32
.name
, r_name
) == 0)
3561 return &elf_mips_gnu_pcrel32
;
3562 if (strcasecmp (elf_mips_eh_howto
.name
, r_name
) == 0)
3563 return &elf_mips_eh_howto
;
3564 if (strcasecmp (elf_mips_copy_howto
.name
, r_name
) == 0)
3565 return &elf_mips_copy_howto
;
3566 if (strcasecmp (elf_mips_jump_slot_howto
.name
, r_name
) == 0)
3567 return &elf_mips_jump_slot_howto
;
3572 /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
3574 static reloc_howto_type
*
3575 mips_elf64_rtype_to_howto (bfd
*abfd
, unsigned int r_type
, bfd_boolean rela_p
)
3579 case R_MIPS_GNU_VTINHERIT
:
3580 return &elf_mips_gnu_vtinherit_howto
;
3581 case R_MIPS_GNU_VTENTRY
:
3582 return &elf_mips_gnu_vtentry_howto
;
3583 case R_MIPS_GNU_REL16_S2
:
3585 return &elf_mips_gnu_rela16_s2
;
3587 return &elf_mips_gnu_rel16_s2
;
3589 return &elf_mips_gnu_pcrel32
;
3591 return &elf_mips_eh_howto
;
3593 return &elf_mips_copy_howto
;
3594 case R_MIPS_JUMP_SLOT
:
3595 return &elf_mips_jump_slot_howto
;
3597 if (r_type
>= R_MICROMIPS_min
&& r_type
< R_MICROMIPS_max
)
3600 return µmips_elf64_howto_table_rela
[r_type
- R_MICROMIPS_min
];
3602 return µmips_elf64_howto_table_rel
[r_type
- R_MICROMIPS_min
];
3604 if (r_type
>= R_MIPS16_min
&& r_type
< R_MIPS16_max
)
3607 return &mips16_elf64_howto_table_rela
[r_type
- R_MIPS16_min
];
3609 return &mips16_elf64_howto_table_rel
[r_type
- R_MIPS16_min
];
3611 if (r_type
>= R_MIPS_max
)
3613 _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
3615 bfd_set_error (bfd_error_bad_value
);
3616 r_type
= R_MIPS_NONE
;
3619 return &mips_elf64_howto_table_rela
[r_type
];
3621 return &mips_elf64_howto_table_rel
[r_type
];
3626 /* Prevent relocation handling by bfd for MIPS ELF64. */
3629 mips_elf64_info_to_howto_rel (bfd
*abfd ATTRIBUTE_UNUSED
,
3630 arelent
*cache_ptr ATTRIBUTE_UNUSED
,
3631 Elf_Internal_Rela
*dst ATTRIBUTE_UNUSED
)
3637 mips_elf64_info_to_howto_rela (bfd
*abfd ATTRIBUTE_UNUSED
,
3638 arelent
*cache_ptr ATTRIBUTE_UNUSED
,
3639 Elf_Internal_Rela
*dst ATTRIBUTE_UNUSED
)
3644 /* Since each entry in an SHT_REL or SHT_RELA section can represent up
3645 to three relocs, we must tell the user to allocate more space. */
3648 mips_elf64_get_dynamic_reloc_upper_bound (bfd
*abfd
)
3650 return _bfd_elf_get_dynamic_reloc_upper_bound (abfd
) * 3;
3653 /* Read the relocations from one reloc section. This is mostly copied
3654 from elfcode.h, except for the changes to expand one external
3655 relocation to 3 internal ones. To reduce processing effort we
3656 could discard those R_MIPS_NONE relocations that occupy the second
3657 and the third entry of a triplet, as `mips_elf64_write_rel' and
3658 `mips_elf64_write_rela' recreate them in output automagically,
3659 however that would also remove them from `objdump -r' output,
3660 breaking a long-established tradition and likely confusing people. */
3663 mips_elf64_slurp_one_reloc_table (bfd
*abfd
, asection
*asect
,
3664 Elf_Internal_Shdr
*rel_hdr
,
3665 bfd_size_type reloc_count
,
3666 arelent
*relents
, asymbol
**symbols
,
3667 bfd_boolean dynamic
)
3670 bfd_byte
*native_relocs
;
3676 allocated
= bfd_malloc (rel_hdr
->sh_size
);
3677 if (allocated
== NULL
)
3680 if (bfd_seek (abfd
, rel_hdr
->sh_offset
, SEEK_SET
) != 0
3681 || (bfd_bread (allocated
, rel_hdr
->sh_size
, abfd
)
3682 != rel_hdr
->sh_size
))
3685 native_relocs
= allocated
;
3687 entsize
= rel_hdr
->sh_entsize
;
3688 BFD_ASSERT (entsize
== sizeof (Elf64_Mips_External_Rel
)
3689 || entsize
== sizeof (Elf64_Mips_External_Rela
));
3691 if (entsize
== sizeof (Elf64_Mips_External_Rel
))
3696 for (i
= 0, relent
= relents
;
3698 i
++, native_relocs
+= entsize
)
3700 Elf64_Mips_Internal_Rela rela
;
3701 bfd_boolean used_sym
, used_ssym
;
3704 if (entsize
== sizeof (Elf64_Mips_External_Rela
))
3705 mips_elf64_swap_reloca_in (abfd
,
3706 (Elf64_Mips_External_Rela
*) native_relocs
,
3709 mips_elf64_swap_reloc_in (abfd
,
3710 (Elf64_Mips_External_Rel
*) native_relocs
,
3713 /* Each entry represents exactly three actual relocations. */
3717 for (ir
= 0; ir
< 3; ir
++)
3719 enum elf_mips_reloc_type type
;
3726 type
= (enum elf_mips_reloc_type
) rela
.r_type
;
3729 type
= (enum elf_mips_reloc_type
) rela
.r_type2
;
3732 type
= (enum elf_mips_reloc_type
) rela
.r_type3
;
3736 /* Some types require symbols, whereas some do not. */
3740 case R_MIPS_LITERAL
:
3741 case R_MIPS_INSERT_A
:
3742 case R_MIPS_INSERT_B
:
3744 relent
->sym_ptr_ptr
= bfd_abs_section_ptr
->symbol_ptr_ptr
;
3750 if (rela
.r_sym
== STN_UNDEF
)
3751 relent
->sym_ptr_ptr
= bfd_abs_section_ptr
->symbol_ptr_ptr
;
3756 ps
= symbols
+ rela
.r_sym
- 1;
3758 if ((s
->flags
& BSF_SECTION_SYM
) == 0)
3759 relent
->sym_ptr_ptr
= ps
;
3761 relent
->sym_ptr_ptr
= s
->section
->symbol_ptr_ptr
;
3766 else if (! used_ssym
)
3768 switch (rela
.r_ssym
)
3771 relent
->sym_ptr_ptr
=
3772 bfd_abs_section_ptr
->symbol_ptr_ptr
;
3778 /* FIXME: I think these need to be handled using
3779 special howto structures. */
3791 relent
->sym_ptr_ptr
= bfd_abs_section_ptr
->symbol_ptr_ptr
;
3796 /* The address of an ELF reloc is section relative for an
3797 object file, and absolute for an executable file or
3798 shared library. The address of a BFD reloc is always
3799 section relative. */
3800 if ((abfd
->flags
& (EXEC_P
| DYNAMIC
)) == 0 || dynamic
)
3801 relent
->address
= rela
.r_offset
;
3803 relent
->address
= rela
.r_offset
- asect
->vma
;
3805 relent
->addend
= rela
.r_addend
;
3807 relent
->howto
= mips_elf64_rtype_to_howto (abfd
, type
, rela_p
);
3813 if (allocated
!= NULL
)
3819 if (allocated
!= NULL
)
3824 /* Read the relocations. On Irix 6, there can be two reloc sections
3825 associated with a single data section. This is copied from
3826 elfcode.h as well, with changes as small as accounting for 3
3827 internal relocs per external reloc. */
3830 mips_elf64_slurp_reloc_table (bfd
*abfd
, asection
*asect
,
3831 asymbol
**symbols
, bfd_boolean dynamic
)
3833 struct bfd_elf_section_data
* const d
= elf_section_data (asect
);
3834 Elf_Internal_Shdr
*rel_hdr
;
3835 Elf_Internal_Shdr
*rel_hdr2
;
3836 bfd_size_type reloc_count
;
3837 bfd_size_type reloc_count2
;
3841 if (asect
->relocation
!= NULL
)
3846 if ((asect
->flags
& SEC_RELOC
) == 0
3847 || asect
->reloc_count
== 0)
3850 rel_hdr
= d
->rel
.hdr
;
3851 reloc_count
= rel_hdr
? NUM_SHDR_ENTRIES (rel_hdr
) : 0;
3852 rel_hdr2
= d
->rela
.hdr
;
3853 reloc_count2
= (rel_hdr2
? NUM_SHDR_ENTRIES (rel_hdr2
) : 0);
3855 BFD_ASSERT (asect
->reloc_count
== 3 * (reloc_count
+ reloc_count2
));
3856 BFD_ASSERT ((rel_hdr
&& asect
->rel_filepos
== rel_hdr
->sh_offset
)
3857 || (rel_hdr2
&& asect
->rel_filepos
== rel_hdr2
->sh_offset
));
3862 /* Note that ASECT->RELOC_COUNT tends not to be accurate in this
3863 case because relocations against this section may use the
3864 dynamic symbol table, and in that case bfd_section_from_shdr
3865 in elf.c does not update the RELOC_COUNT. */
3866 if (asect
->size
== 0)
3869 rel_hdr
= &d
->this_hdr
;
3870 reloc_count
= NUM_SHDR_ENTRIES (rel_hdr
);
3875 /* Allocate space for 3 arelent structures for each Rel structure. */
3876 amt
= (reloc_count
+ reloc_count2
) * 3 * sizeof (arelent
);
3877 relents
= bfd_alloc (abfd
, amt
);
3878 if (relents
== NULL
)
3882 && ! mips_elf64_slurp_one_reloc_table (abfd
, asect
,
3883 rel_hdr
, reloc_count
,
3887 if (rel_hdr2
!= NULL
3888 && ! mips_elf64_slurp_one_reloc_table (abfd
, asect
,
3889 rel_hdr2
, reloc_count2
,
3890 relents
+ reloc_count
* 3,
3894 asect
->relocation
= relents
;
3898 /* Write out the relocations. */
3901 mips_elf64_write_relocs (bfd
*abfd
, asection
*sec
, void *data
)
3903 bfd_boolean
*failedp
= data
;
3905 Elf_Internal_Shdr
*rel_hdr
;
3908 /* If we have already failed, don't do anything. */
3912 if ((sec
->flags
& SEC_RELOC
) == 0)
3915 /* The linker backend writes the relocs out itself, and sets the
3916 reloc_count field to zero to inhibit writing them here. Also,
3917 sometimes the SEC_RELOC flag gets set even when there aren't any
3919 if (sec
->reloc_count
== 0)
3922 /* We can combine up to three relocs that refer to the same address
3923 if the latter relocs have no associated symbol. */
3925 for (idx
= 0; idx
< sec
->reloc_count
; idx
++)
3932 addr
= sec
->orelocation
[idx
]->address
;
3933 for (i
= 0; i
< 2; i
++)
3937 if (idx
+ 1 >= sec
->reloc_count
)
3939 r
= sec
->orelocation
[idx
+ 1];
3940 if (r
->address
!= addr
3941 || ! bfd_is_abs_section ((*r
->sym_ptr_ptr
)->section
)
3942 || (*r
->sym_ptr_ptr
)->value
!= 0)
3945 /* We can merge the reloc at IDX + 1 with the reloc at IDX. */
3951 rel_hdr
= _bfd_elf_single_rel_hdr (sec
);
3953 /* Do the actual relocation. */
3955 if (rel_hdr
->sh_entsize
== sizeof(Elf64_Mips_External_Rel
))
3956 mips_elf64_write_rel (abfd
, sec
, rel_hdr
, &count
, data
);
3957 else if (rel_hdr
->sh_entsize
== sizeof(Elf64_Mips_External_Rela
))
3958 mips_elf64_write_rela (abfd
, sec
, rel_hdr
, &count
, data
);
3964 mips_elf64_write_rel (bfd
*abfd
, asection
*sec
,
3965 Elf_Internal_Shdr
*rel_hdr
,
3966 int *count
, void *data
)
3968 bfd_boolean
*failedp
= data
;
3969 Elf64_Mips_External_Rel
*ext_rel
;
3971 asymbol
*last_sym
= 0;
3972 int last_sym_idx
= 0;
3974 rel_hdr
->sh_size
= rel_hdr
->sh_entsize
* *count
;
3975 rel_hdr
->contents
= bfd_alloc (abfd
, rel_hdr
->sh_size
);
3976 if (rel_hdr
->contents
== NULL
)
3982 ext_rel
= (Elf64_Mips_External_Rel
*) rel_hdr
->contents
;
3983 for (idx
= 0; idx
< sec
->reloc_count
; idx
++, ext_rel
++)
3986 Elf64_Mips_Internal_Rela int_rel
;
3991 ptr
= sec
->orelocation
[idx
];
3993 /* The address of an ELF reloc is section relative for an object
3994 file, and absolute for an executable file or shared library.
3995 The address of a BFD reloc is always section relative. */
3996 if ((abfd
->flags
& (EXEC_P
| DYNAMIC
)) == 0)
3997 int_rel
.r_offset
= ptr
->address
;
3999 int_rel
.r_offset
= ptr
->address
+ sec
->vma
;
4001 sym
= *ptr
->sym_ptr_ptr
;
4002 if (sym
== last_sym
)
4004 else if (bfd_is_abs_section (sym
->section
) && sym
->value
== 0)
4009 n
= _bfd_elf_symbol_from_bfd_symbol (abfd
, &sym
);
4019 int_rel
.r_ssym
= RSS_UNDEF
;
4021 if ((*ptr
->sym_ptr_ptr
)->the_bfd
->xvec
!= abfd
->xvec
4022 && ! _bfd_elf_validate_reloc (abfd
, ptr
))
4028 int_rel
.r_type
= ptr
->howto
->type
;
4029 int_rel
.r_type2
= (int) R_MIPS_NONE
;
4030 int_rel
.r_type3
= (int) R_MIPS_NONE
;
4032 for (i
= 0; i
< 2; i
++)
4036 if (idx
+ 1 >= sec
->reloc_count
)
4038 r
= sec
->orelocation
[idx
+ 1];
4039 if (r
->address
!= ptr
->address
4040 || ! bfd_is_abs_section ((*r
->sym_ptr_ptr
)->section
)
4041 || (*r
->sym_ptr_ptr
)->value
!= 0)
4044 /* We can merge the reloc at IDX + 1 with the reloc at IDX. */
4047 int_rel
.r_type2
= r
->howto
->type
;
4049 int_rel
.r_type3
= r
->howto
->type
;
4054 mips_elf64_swap_reloc_out (abfd
, &int_rel
, ext_rel
);
4057 BFD_ASSERT (ext_rel
- (Elf64_Mips_External_Rel
*) rel_hdr
->contents
4062 mips_elf64_write_rela (bfd
*abfd
, asection
*sec
,
4063 Elf_Internal_Shdr
*rela_hdr
,
4064 int *count
, void *data
)
4066 bfd_boolean
*failedp
= data
;
4067 Elf64_Mips_External_Rela
*ext_rela
;
4069 asymbol
*last_sym
= 0;
4070 int last_sym_idx
= 0;
4072 rela_hdr
->sh_size
= rela_hdr
->sh_entsize
* *count
;
4073 rela_hdr
->contents
= bfd_alloc (abfd
, rela_hdr
->sh_size
);
4074 if (rela_hdr
->contents
== NULL
)
4080 ext_rela
= (Elf64_Mips_External_Rela
*) rela_hdr
->contents
;
4081 for (idx
= 0; idx
< sec
->reloc_count
; idx
++, ext_rela
++)
4084 Elf64_Mips_Internal_Rela int_rela
;
4089 ptr
= sec
->orelocation
[idx
];
4091 /* The address of an ELF reloc is section relative for an object
4092 file, and absolute for an executable file or shared library.
4093 The address of a BFD reloc is always section relative. */
4094 if ((abfd
->flags
& (EXEC_P
| DYNAMIC
)) == 0)
4095 int_rela
.r_offset
= ptr
->address
;
4097 int_rela
.r_offset
= ptr
->address
+ sec
->vma
;
4099 sym
= *ptr
->sym_ptr_ptr
;
4100 if (sym
== last_sym
)
4102 else if (bfd_is_abs_section (sym
->section
) && sym
->value
== 0)
4107 n
= _bfd_elf_symbol_from_bfd_symbol (abfd
, &sym
);
4117 int_rela
.r_addend
= ptr
->addend
;
4118 int_rela
.r_ssym
= RSS_UNDEF
;
4120 if ((*ptr
->sym_ptr_ptr
)->the_bfd
->xvec
!= abfd
->xvec
4121 && ! _bfd_elf_validate_reloc (abfd
, ptr
))
4127 int_rela
.r_type
= ptr
->howto
->type
;
4128 int_rela
.r_type2
= (int) R_MIPS_NONE
;
4129 int_rela
.r_type3
= (int) R_MIPS_NONE
;
4131 for (i
= 0; i
< 2; i
++)
4135 if (idx
+ 1 >= sec
->reloc_count
)
4137 r
= sec
->orelocation
[idx
+ 1];
4138 if (r
->address
!= ptr
->address
4139 || ! bfd_is_abs_section ((*r
->sym_ptr_ptr
)->section
)
4140 || (*r
->sym_ptr_ptr
)->value
!= 0)
4143 /* We can merge the reloc at IDX + 1 with the reloc at IDX. */
4146 int_rela
.r_type2
= r
->howto
->type
;
4148 int_rela
.r_type3
= r
->howto
->type
;
4153 mips_elf64_swap_reloca_out (abfd
, &int_rela
, ext_rela
);
4156 BFD_ASSERT (ext_rela
- (Elf64_Mips_External_Rela
*) rela_hdr
->contents
4160 /* Set the right machine number for a MIPS ELF file. */
4163 mips_elf64_object_p (bfd
*abfd
)
4167 /* Irix 6 is broken. Object file symbol tables are not always
4168 sorted correctly such that local symbols precede global symbols,
4169 and the sh_info field in the symbol table is not always right. */
4170 if (elf64_mips_irix_compat (abfd
) != ict_none
)
4171 elf_bad_symtab (abfd
) = TRUE
;
4173 mach
= _bfd_elf_mips_mach (elf_elfheader (abfd
)->e_flags
);
4174 bfd_default_set_arch_mach (abfd
, bfd_arch_mips
, mach
);
4178 /* Depending on the target vector we generate some version of Irix
4179 executables or "normal" MIPS ELF ABI executables. */
4180 static irix_compat_t
4181 elf64_mips_irix_compat (bfd
*abfd
)
4183 if ((abfd
->xvec
== &mips_elf64_be_vec
)
4184 || (abfd
->xvec
== &mips_elf64_le_vec
))
4190 /* Support for core dump NOTE sections. */
4192 elf64_mips_grok_prstatus (bfd
*abfd
, Elf_Internal_Note
*note
)
4197 switch (note
->descsz
)
4202 case 480: /* Linux/MIPS - N64 kernel */
4204 elf_tdata (abfd
)->core
->signal
= bfd_get_16 (abfd
, note
->descdata
+ 12);
4207 elf_tdata (abfd
)->core
->lwpid
= bfd_get_32 (abfd
, note
->descdata
+ 32);
4216 /* Make a ".reg/999" section. */
4217 return _bfd_elfcore_make_pseudosection (abfd
, ".reg",
4218 size
, note
->descpos
+ offset
);
4222 elf64_mips_grok_psinfo (bfd
*abfd
, Elf_Internal_Note
*note
)
4224 switch (note
->descsz
)
4229 case 136: /* Linux/MIPS - N64 kernel elf_prpsinfo */
4230 elf_tdata (abfd
)->core
->pid
4231 = bfd_get_32 (abfd
, note
->descdata
+ 24);
4232 elf_tdata (abfd
)->core
->program
4233 = _bfd_elfcore_strndup (abfd
, note
->descdata
+ 40, 16);
4234 elf_tdata (abfd
)->core
->command
4235 = _bfd_elfcore_strndup (abfd
, note
->descdata
+ 56, 80);
4238 /* Note that for some reason, a spurious space is tacked
4239 onto the end of the args in some (at least one anyway)
4240 implementations, so strip it off if it exists. */
4243 char *command
= elf_tdata (abfd
)->core
->command
;
4244 int n
= strlen (command
);
4246 if (0 < n
&& command
[n
- 1] == ' ')
4247 command
[n
- 1] = '\0';
4253 /* Write Linux core PRSTATUS note into core file. */
4256 elf64_mips_write_core_note (bfd
*abfd
, char *buf
, int *bufsiz
, int note_type
,
4276 va_start (ap
, note_type
);
4277 memset (data
, 0, 112);
4278 pid
= va_arg (ap
, long);
4279 bfd_put_32 (abfd
, pid
, data
+ 32);
4280 cursig
= va_arg (ap
, int);
4281 bfd_put_16 (abfd
, cursig
, data
+ 12);
4282 greg
= va_arg (ap
, const void *);
4283 memcpy (data
+ 112, greg
, 360);
4284 memset (data
+ 472, 0, 8);
4286 return elfcore_write_note (abfd
, buf
, bufsiz
,
4287 "CORE", note_type
, data
, sizeof (data
));
4292 /* ECOFF swapping routines. These are used when dealing with the
4293 .mdebug section, which is in the ECOFF debugging format. */
4294 static const struct ecoff_debug_swap mips_elf64_ecoff_debug_swap
=
4296 /* Symbol table magic number. */
4298 /* Alignment of debugging information. E.g., 4. */
4300 /* Sizes of external symbolic information. */
4301 sizeof (struct hdr_ext
),
4302 sizeof (struct dnr_ext
),
4303 sizeof (struct pdr_ext
),
4304 sizeof (struct sym_ext
),
4305 sizeof (struct opt_ext
),
4306 sizeof (struct fdr_ext
),
4307 sizeof (struct rfd_ext
),
4308 sizeof (struct ext_ext
),
4309 /* Functions to swap in external symbolic data. */
4318 _bfd_ecoff_swap_tir_in
,
4319 _bfd_ecoff_swap_rndx_in
,
4320 /* Functions to swap out external symbolic data. */
4329 _bfd_ecoff_swap_tir_out
,
4330 _bfd_ecoff_swap_rndx_out
,
4331 /* Function to read in symbolic data. */
4332 _bfd_mips_elf_read_ecoff_info
4335 /* Relocations in the 64 bit MIPS ELF ABI are more complex than in
4336 standard ELF. This structure is used to redirect the relocation
4337 handling routines. */
4339 const struct elf_size_info mips_elf64_size_info
=
4341 sizeof (Elf64_External_Ehdr
),
4342 sizeof (Elf64_External_Phdr
),
4343 sizeof (Elf64_External_Shdr
),
4344 sizeof (Elf64_Mips_External_Rel
),
4345 sizeof (Elf64_Mips_External_Rela
),
4346 sizeof (Elf64_External_Sym
),
4347 sizeof (Elf64_External_Dyn
),
4348 sizeof (Elf_External_Note
),
4349 4, /* hash-table entry size */
4350 3, /* internal relocations per external relocations */
4352 3, /* log_file_align */
4355 bfd_elf64_write_out_phdrs
,
4356 bfd_elf64_write_shdrs_and_ehdr
,
4357 bfd_elf64_checksum_contents
,
4358 mips_elf64_write_relocs
,
4359 bfd_elf64_swap_symbol_in
,
4360 bfd_elf64_swap_symbol_out
,
4361 mips_elf64_slurp_reloc_table
,
4362 bfd_elf64_slurp_symbol_table
,
4363 bfd_elf64_swap_dyn_in
,
4364 bfd_elf64_swap_dyn_out
,
4365 mips_elf64_be_swap_reloc_in
,
4366 mips_elf64_be_swap_reloc_out
,
4367 mips_elf64_be_swap_reloca_in
,
4368 mips_elf64_be_swap_reloca_out
4371 #define ELF_ARCH bfd_arch_mips
4372 #define ELF_TARGET_ID MIPS_ELF_DATA
4373 #define ELF_MACHINE_CODE EM_MIPS
4375 #define elf_backend_collect TRUE
4376 #define elf_backend_type_change_ok TRUE
4377 #define elf_backend_can_gc_sections TRUE
4378 #define elf_backend_gc_mark_extra_sections \
4379 _bfd_mips_elf_gc_mark_extra_sections
4380 #define elf_info_to_howto mips_elf64_info_to_howto_rela
4381 #define elf_info_to_howto_rel mips_elf64_info_to_howto_rel
4382 #define elf_backend_object_p mips_elf64_object_p
4383 #define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing
4384 #define elf_backend_section_processing _bfd_mips_elf_section_processing
4385 #define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr
4386 #define elf_backend_fake_sections _bfd_mips_elf_fake_sections
4387 #define elf_backend_section_from_bfd_section \
4388 _bfd_mips_elf_section_from_bfd_section
4389 #define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook
4390 #define elf_backend_link_output_symbol_hook \
4391 _bfd_mips_elf_link_output_symbol_hook
4392 #define elf_backend_create_dynamic_sections \
4393 _bfd_mips_elf_create_dynamic_sections
4394 #define elf_backend_check_relocs _bfd_mips_elf_check_relocs
4395 #define elf_backend_merge_symbol_attribute \
4396 _bfd_mips_elf_merge_symbol_attribute
4397 #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag
4398 #define elf_backend_adjust_dynamic_symbol \
4399 _bfd_mips_elf_adjust_dynamic_symbol
4400 #define elf_backend_always_size_sections \
4401 _bfd_mips_elf_always_size_sections
4402 #define elf_backend_size_dynamic_sections \
4403 _bfd_mips_elf_size_dynamic_sections
4404 #define elf_backend_init_index_section _bfd_elf_init_1_index_section
4405 #define elf_backend_relocate_section _bfd_mips_elf_relocate_section
4406 #define elf_backend_finish_dynamic_symbol \
4407 _bfd_mips_elf_finish_dynamic_symbol
4408 #define elf_backend_finish_dynamic_sections \
4409 _bfd_mips_elf_finish_dynamic_sections
4410 #define elf_backend_final_write_processing \
4411 _bfd_mips_elf_final_write_processing
4412 #define elf_backend_additional_program_headers \
4413 _bfd_mips_elf_additional_program_headers
4414 #define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map
4415 #define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook
4416 #define elf_backend_copy_indirect_symbol \
4417 _bfd_mips_elf_copy_indirect_symbol
4418 #define elf_backend_ignore_discarded_relocs \
4419 _bfd_mips_elf_ignore_discarded_relocs
4420 #define elf_backend_mips_irix_compat elf64_mips_irix_compat
4421 #define elf_backend_mips_rtype_to_howto mips_elf64_rtype_to_howto
4422 #define elf_backend_ecoff_debug_swap &mips_elf64_ecoff_debug_swap
4423 #define elf_backend_size_info mips_elf64_size_info
4425 #define elf_backend_grok_prstatus elf64_mips_grok_prstatus
4426 #define elf_backend_grok_psinfo elf64_mips_grok_psinfo
4428 #define elf_backend_got_header_size (8 * MIPS_RESERVED_GOTNO)
4429 #define elf_backend_want_dynrelro 1
4431 /* MIPS ELF64 can use a mixture of REL and RELA, but some Relocations
4432 work better/work only in RELA, so we default to this. */
4433 #define elf_backend_may_use_rel_p 1
4434 #define elf_backend_may_use_rela_p 1
4435 #define elf_backend_default_use_rela_p 1
4436 #define elf_backend_rela_plts_and_copies_p 0
4437 #define elf_backend_plt_readonly 1
4438 #define elf_backend_plt_sym_val _bfd_mips_elf_plt_sym_val
4440 #define elf_backend_sign_extend_vma TRUE
4442 #define elf_backend_write_section _bfd_mips_elf_write_section
4443 #define elf_backend_sort_relocs_p _bfd_mips_elf_sort_relocs_p
4445 /* We don't set bfd_elf64_bfd_is_local_label_name because the 32-bit
4446 MIPS-specific function only applies to IRIX5, which had no 64-bit
4448 #define bfd_elf64_bfd_is_target_special_symbol \
4449 _bfd_mips_elf_is_target_special_symbol
4450 #define bfd_elf64_find_nearest_line _bfd_mips_elf_find_nearest_line
4451 #define bfd_elf64_find_inliner_info _bfd_mips_elf_find_inliner_info
4452 #define bfd_elf64_new_section_hook _bfd_mips_elf_new_section_hook
4453 #define bfd_elf64_set_section_contents _bfd_mips_elf_set_section_contents
4454 #define bfd_elf64_bfd_get_relocated_section_contents \
4455 _bfd_elf_mips_get_relocated_section_contents
4456 #define bfd_elf64_bfd_link_hash_table_create \
4457 _bfd_mips_elf_link_hash_table_create
4458 #define bfd_elf64_bfd_final_link _bfd_mips_elf_final_link
4459 #define bfd_elf64_bfd_merge_private_bfd_data \
4460 _bfd_mips_elf_merge_private_bfd_data
4461 #define bfd_elf64_bfd_set_private_flags _bfd_mips_elf_set_private_flags
4462 #define bfd_elf64_bfd_print_private_bfd_data \
4463 _bfd_mips_elf_print_private_bfd_data
4465 #define bfd_elf64_get_dynamic_reloc_upper_bound mips_elf64_get_dynamic_reloc_upper_bound
4466 #define bfd_elf64_mkobject _bfd_mips_elf_mkobject
4468 /* The SGI style (n)64 NewABI. */
4469 #define TARGET_LITTLE_SYM mips_elf64_le_vec
4470 #define TARGET_LITTLE_NAME "elf64-littlemips"
4471 #define TARGET_BIG_SYM mips_elf64_be_vec
4472 #define TARGET_BIG_NAME "elf64-bigmips"
4474 #define ELF_MAXPAGESIZE 0x10000
4475 #define ELF_COMMONPAGESIZE 0x1000
4477 #include "elf64-target.h"
4479 /* The SYSV-style 'traditional' (n)64 NewABI. */
4480 #undef TARGET_LITTLE_SYM
4481 #undef TARGET_LITTLE_NAME
4482 #undef TARGET_BIG_SYM
4483 #undef TARGET_BIG_NAME
4485 #undef ELF_MAXPAGESIZE
4486 #undef ELF_COMMONPAGESIZE
4488 #define TARGET_LITTLE_SYM mips_elf64_trad_le_vec
4489 #define TARGET_LITTLE_NAME "elf64-tradlittlemips"
4490 #define TARGET_BIG_SYM mips_elf64_trad_be_vec
4491 #define TARGET_BIG_NAME "elf64-tradbigmips"
4493 #define ELF_MAXPAGESIZE 0x10000
4494 #define ELF_COMMONPAGESIZE 0x1000
4495 #define elf64_bed elf64_tradbed
4497 #undef elf_backend_write_core_note
4498 #define elf_backend_write_core_note elf64_mips_write_core_note
4500 /* Include the target file again for this target. */
4501 #include "elf64-target.h"
4504 /* FreeBSD support. */
4506 #undef TARGET_LITTLE_SYM
4507 #undef TARGET_LITTLE_NAME
4508 #undef TARGET_BIG_SYM
4509 #undef TARGET_BIG_NAME
4511 #define TARGET_LITTLE_SYM mips_elf64_tradfbsd_le_vec
4512 #define TARGET_LITTLE_NAME "elf64-tradlittlemips-freebsd"
4513 #define TARGET_BIG_SYM mips_elf64_tradfbsd_be_vec
4514 #define TARGET_BIG_NAME "elf64-tradbigmips-freebsd"
4517 #define ELF_OSABI ELFOSABI_FREEBSD
4520 #define elf64_bed elf64_fbsd_tradbed
4522 #undef elf64_mips_write_core_note
4524 #include "elf64-target.h"