1 /* MIPS-specific support for 64-bit ELF
2 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
3 2007 Free Software Foundation, Inc.
4 Ian Lance Taylor, Cygnus Support
5 Linker support added by Mark Mitchell, CodeSourcery, LLC.
6 <mark@codesourcery.com>
8 This file is part of BFD, the Binary File Descriptor library.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
23 MA 02110-1301, USA. */
26 /* This file supports the 64-bit MIPS ELF ABI.
28 The MIPS 64-bit ELF ABI uses an unusual reloc format. This file
29 overrides the usual ELF reloc handling, and handles reading and
30 writing the relocations here. */
32 /* TODO: Many things are unsupported, even if there is some code for it
33 . (which was mostly stolen from elf32-mips.c and slightly adapted).
35 . - Relocation handling for REL relocs is wrong in many cases and
37 . - Relocation handling for RELA relocs related to GOT support are
38 . also likely to be wrong.
39 . - Support for MIPS16 is untested.
40 . - Combined relocs with RSS_* entries are unsupported.
41 . - The whole GOT handling for NewABI is missing, some parts of
42 . the OldABI version is still lying around and should be removed.
52 #include "elfxx-mips.h"
55 /* Get the ECOFF swapping routines. The 64-bit ABI is not supposed to
56 use ECOFF. However, we support it anyhow for an easier changeover. */
58 #include "coff/symconst.h"
59 #include "coff/internal.h"
60 #include "coff/ecoff.h"
61 /* The 64 bit versions of the mdebug data structures are in alpha.h. */
62 #include "coff/alpha.h"
63 #define ECOFF_SIGNED_64
64 #include "ecoffswap.h"
66 static void mips_elf64_swap_reloc_in
67 (bfd
*, const Elf64_Mips_External_Rel
*, Elf64_Mips_Internal_Rela
*);
68 static void mips_elf64_swap_reloca_in
69 (bfd
*, const Elf64_Mips_External_Rela
*, Elf64_Mips_Internal_Rela
*);
70 static void mips_elf64_swap_reloc_out
71 (bfd
*, const Elf64_Mips_Internal_Rela
*, Elf64_Mips_External_Rel
*);
72 static void mips_elf64_swap_reloca_out
73 (bfd
*, const Elf64_Mips_Internal_Rela
*, Elf64_Mips_External_Rela
*);
74 static void mips_elf64_be_swap_reloc_in
75 (bfd
*, const bfd_byte
*, Elf_Internal_Rela
*);
76 static void mips_elf64_be_swap_reloc_out
77 (bfd
*, const Elf_Internal_Rela
*, bfd_byte
*);
78 static void mips_elf64_be_swap_reloca_in
79 (bfd
*, const bfd_byte
*, Elf_Internal_Rela
*);
80 static void mips_elf64_be_swap_reloca_out
81 (bfd
*, const Elf_Internal_Rela
*, bfd_byte
*);
82 static reloc_howto_type
*bfd_elf64_bfd_reloc_type_lookup
83 (bfd
*, bfd_reloc_code_real_type
);
84 static reloc_howto_type
*mips_elf64_rtype_to_howto
85 (unsigned int, bfd_boolean
);
86 static void mips_elf64_info_to_howto_rel
87 (bfd
*, arelent
*, Elf_Internal_Rela
*);
88 static void mips_elf64_info_to_howto_rela
89 (bfd
*, arelent
*, Elf_Internal_Rela
*);
90 static long mips_elf64_get_reloc_upper_bound
92 static long mips_elf64_canonicalize_reloc
93 (bfd
*, asection
*, arelent
**, asymbol
**);
94 static long mips_elf64_get_dynamic_reloc_upper_bound
96 static long mips_elf64_canonicalize_dynamic_reloc
97 (bfd
*, arelent
**, asymbol
**);
98 static bfd_boolean mips_elf64_slurp_one_reloc_table
99 (bfd
*, asection
*, Elf_Internal_Shdr
*, bfd_size_type
, arelent
*,
100 asymbol
**, bfd_boolean
);
101 static bfd_boolean mips_elf64_slurp_reloc_table
102 (bfd
*, asection
*, asymbol
**, bfd_boolean
);
103 static void mips_elf64_write_relocs
104 (bfd
*, asection
*, void *);
105 static void mips_elf64_write_rel
106 (bfd
*, asection
*, Elf_Internal_Shdr
*, int *, void *);
107 static void mips_elf64_write_rela
108 (bfd
*, asection
*, Elf_Internal_Shdr
*, int *, void *);
109 static bfd_reloc_status_type mips_elf64_gprel16_reloc
110 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
111 static bfd_reloc_status_type mips_elf64_literal_reloc
112 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
113 static bfd_reloc_status_type mips_elf64_gprel32_reloc
114 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
115 static bfd_reloc_status_type mips_elf64_shift6_reloc
116 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
117 static bfd_reloc_status_type mips16_gprel_reloc
118 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
119 static bfd_boolean mips_elf64_assign_gp
121 static bfd_reloc_status_type mips_elf64_final_gp
122 (bfd
*, asymbol
*, bfd_boolean
, char **, bfd_vma
*);
123 static bfd_boolean mips_elf64_object_p
125 static irix_compat_t elf64_mips_irix_compat
127 static bfd_boolean elf64_mips_grok_prstatus
128 (bfd
*, Elf_Internal_Note
*);
129 static bfd_boolean elf64_mips_grok_psinfo
130 (bfd
*, Elf_Internal_Note
*);
132 extern const bfd_target bfd_elf64_bigmips_vec
;
133 extern const bfd_target bfd_elf64_littlemips_vec
;
135 /* In case we're on a 32-bit machine, construct a 64-bit "-1" value
136 from smaller values. Start with zero, widen, *then* decrement. */
137 #define MINUS_ONE (((bfd_vma)0) - 1)
139 /* The number of local .got entries we reserve. */
140 #define MIPS_RESERVED_GOTNO (2)
142 /* The relocation table used for SHT_REL sections. */
144 static reloc_howto_type mips_elf64_howto_table_rel
[] =
147 HOWTO (R_MIPS_NONE
, /* type */
149 0, /* size (0 = byte, 1 = short, 2 = long) */
151 FALSE
, /* pc_relative */
153 complain_overflow_dont
, /* complain_on_overflow */
154 _bfd_mips_elf_generic_reloc
, /* special_function */
155 "R_MIPS_NONE", /* name */
156 FALSE
, /* partial_inplace */
159 FALSE
), /* pcrel_offset */
161 /* 16 bit relocation. */
162 HOWTO (R_MIPS_16
, /* type */
164 2, /* size (0 = byte, 1 = short, 2 = long) */
166 FALSE
, /* pc_relative */
168 complain_overflow_signed
, /* complain_on_overflow */
169 _bfd_mips_elf_generic_reloc
, /* special_function */
170 "R_MIPS_16", /* name */
171 TRUE
, /* partial_inplace */
172 0x0000ffff, /* src_mask */
173 0x0000ffff, /* dst_mask */
174 FALSE
), /* pcrel_offset */
176 /* 32 bit relocation. */
177 HOWTO (R_MIPS_32
, /* type */
179 2, /* size (0 = byte, 1 = short, 2 = long) */
181 FALSE
, /* pc_relative */
183 complain_overflow_dont
, /* complain_on_overflow */
184 _bfd_mips_elf_generic_reloc
, /* special_function */
185 "R_MIPS_32", /* name */
186 TRUE
, /* partial_inplace */
187 0xffffffff, /* src_mask */
188 0xffffffff, /* dst_mask */
189 FALSE
), /* pcrel_offset */
191 /* 32 bit symbol relative relocation. */
192 HOWTO (R_MIPS_REL32
, /* type */
194 2, /* size (0 = byte, 1 = short, 2 = long) */
196 FALSE
, /* pc_relative */
198 complain_overflow_dont
, /* complain_on_overflow */
199 _bfd_mips_elf_generic_reloc
, /* special_function */
200 "R_MIPS_REL32", /* name */
201 TRUE
, /* partial_inplace */
202 0xffffffff, /* src_mask */
203 0xffffffff, /* dst_mask */
204 FALSE
), /* pcrel_offset */
206 /* 26 bit jump address. */
207 HOWTO (R_MIPS_26
, /* type */
209 2, /* size (0 = byte, 1 = short, 2 = long) */
211 FALSE
, /* pc_relative */
213 complain_overflow_dont
, /* complain_on_overflow */
214 /* This needs complex overflow
215 detection, because the upper 36
216 bits must match the PC + 4. */
217 _bfd_mips_elf_generic_reloc
, /* special_function */
218 "R_MIPS_26", /* name */
219 TRUE
, /* partial_inplace */
220 0x03ffffff, /* src_mask */
221 0x03ffffff, /* dst_mask */
222 FALSE
), /* pcrel_offset */
224 /* R_MIPS_HI16 and R_MIPS_LO16 are unsupported for NewABI REL.
225 However, the native IRIX6 tools use them, so we try our best. */
227 /* High 16 bits of symbol value. */
228 HOWTO (R_MIPS_HI16
, /* type */
230 2, /* size (0 = byte, 1 = short, 2 = long) */
232 FALSE
, /* pc_relative */
234 complain_overflow_dont
, /* complain_on_overflow */
235 _bfd_mips_elf_hi16_reloc
, /* special_function */
236 "R_MIPS_HI16", /* name */
237 TRUE
, /* partial_inplace */
238 0x0000ffff, /* src_mask */
239 0x0000ffff, /* dst_mask */
240 FALSE
), /* pcrel_offset */
242 /* Low 16 bits of symbol value. */
243 HOWTO (R_MIPS_LO16
, /* type */
245 2, /* size (0 = byte, 1 = short, 2 = long) */
247 FALSE
, /* pc_relative */
249 complain_overflow_dont
, /* complain_on_overflow */
250 _bfd_mips_elf_lo16_reloc
, /* special_function */
251 "R_MIPS_LO16", /* name */
252 TRUE
, /* partial_inplace */
253 0x0000ffff, /* src_mask */
254 0x0000ffff, /* dst_mask */
255 FALSE
), /* pcrel_offset */
257 /* GP relative reference. */
258 HOWTO (R_MIPS_GPREL16
, /* type */
260 2, /* size (0 = byte, 1 = short, 2 = long) */
262 FALSE
, /* pc_relative */
264 complain_overflow_signed
, /* complain_on_overflow */
265 mips_elf64_gprel16_reloc
, /* special_function */
266 "R_MIPS_GPREL16", /* name */
267 TRUE
, /* partial_inplace */
268 0x0000ffff, /* src_mask */
269 0x0000ffff, /* dst_mask */
270 FALSE
), /* pcrel_offset */
272 /* Reference to literal section. */
273 HOWTO (R_MIPS_LITERAL
, /* type */
275 2, /* size (0 = byte, 1 = short, 2 = long) */
277 FALSE
, /* pc_relative */
279 complain_overflow_signed
, /* complain_on_overflow */
280 mips_elf64_literal_reloc
, /* special_function */
281 "R_MIPS_LITERAL", /* name */
282 TRUE
, /* partial_inplace */
283 0x0000ffff, /* src_mask */
284 0x0000ffff, /* dst_mask */
285 FALSE
), /* pcrel_offset */
287 /* Reference to global offset table. */
288 HOWTO (R_MIPS_GOT16
, /* type */
290 2, /* size (0 = byte, 1 = short, 2 = long) */
292 FALSE
, /* pc_relative */
294 complain_overflow_signed
, /* complain_on_overflow */
295 _bfd_mips_elf_got16_reloc
, /* special_function */
296 "R_MIPS_GOT16", /* name */
297 TRUE
, /* partial_inplace */
298 0x0000ffff, /* src_mask */
299 0x0000ffff, /* dst_mask */
300 FALSE
), /* pcrel_offset */
302 /* 16 bit PC relative reference. Note that the ABI document has a typo
303 and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
304 We do the right thing here. */
305 HOWTO (R_MIPS_PC16
, /* type */
307 2, /* size (0 = byte, 1 = short, 2 = long) */
309 TRUE
, /* pc_relative */
311 complain_overflow_signed
, /* complain_on_overflow */
312 _bfd_mips_elf_generic_reloc
, /* special_function */
313 "R_MIPS_PC16", /* name */
314 TRUE
, /* partial_inplace */
315 0x0000ffff, /* src_mask */
316 0x0000ffff, /* dst_mask */
317 TRUE
), /* pcrel_offset */
319 /* 16 bit call through global offset table. */
320 HOWTO (R_MIPS_CALL16
, /* type */
322 2, /* size (0 = byte, 1 = short, 2 = long) */
324 FALSE
, /* pc_relative */
326 complain_overflow_signed
, /* complain_on_overflow */
327 _bfd_mips_elf_generic_reloc
, /* special_function */
328 "R_MIPS_CALL16", /* name */
329 TRUE
, /* partial_inplace */
330 0x0000ffff, /* src_mask */
331 0x0000ffff, /* dst_mask */
332 FALSE
), /* pcrel_offset */
334 /* 32 bit GP relative reference. */
335 HOWTO (R_MIPS_GPREL32
, /* type */
337 2, /* size (0 = byte, 1 = short, 2 = long) */
339 FALSE
, /* pc_relative */
341 complain_overflow_dont
, /* complain_on_overflow */
342 mips_elf64_gprel32_reloc
, /* special_function */
343 "R_MIPS_GPREL32", /* name */
344 TRUE
, /* partial_inplace */
345 0xffffffff, /* src_mask */
346 0xffffffff, /* dst_mask */
347 FALSE
), /* pcrel_offset */
353 /* A 5 bit shift field. */
354 HOWTO (R_MIPS_SHIFT5
, /* type */
356 2, /* size (0 = byte, 1 = short, 2 = long) */
358 FALSE
, /* pc_relative */
360 complain_overflow_bitfield
, /* complain_on_overflow */
361 _bfd_mips_elf_generic_reloc
, /* special_function */
362 "R_MIPS_SHIFT5", /* name */
363 TRUE
, /* partial_inplace */
364 0x000007c0, /* src_mask */
365 0x000007c0, /* dst_mask */
366 FALSE
), /* pcrel_offset */
368 /* A 6 bit shift field. */
369 HOWTO (R_MIPS_SHIFT6
, /* type */
371 2, /* size (0 = byte, 1 = short, 2 = long) */
373 FALSE
, /* pc_relative */
375 complain_overflow_bitfield
, /* complain_on_overflow */
376 mips_elf64_shift6_reloc
, /* special_function */
377 "R_MIPS_SHIFT6", /* name */
378 TRUE
, /* partial_inplace */
379 0x000007c4, /* src_mask */
380 0x000007c4, /* dst_mask */
381 FALSE
), /* pcrel_offset */
383 /* 64 bit relocation. */
384 HOWTO (R_MIPS_64
, /* type */
386 4, /* size (0 = byte, 1 = short, 2 = long) */
388 FALSE
, /* pc_relative */
390 complain_overflow_dont
, /* complain_on_overflow */
391 _bfd_mips_elf_generic_reloc
, /* special_function */
392 "R_MIPS_64", /* name */
393 TRUE
, /* partial_inplace */
394 MINUS_ONE
, /* src_mask */
395 MINUS_ONE
, /* dst_mask */
396 FALSE
), /* pcrel_offset */
398 /* Displacement in the global offset table. */
399 HOWTO (R_MIPS_GOT_DISP
, /* type */
401 2, /* size (0 = byte, 1 = short, 2 = long) */
403 FALSE
, /* pc_relative */
405 complain_overflow_signed
, /* complain_on_overflow */
406 _bfd_mips_elf_generic_reloc
, /* special_function */
407 "R_MIPS_GOT_DISP", /* name */
408 TRUE
, /* partial_inplace */
409 0x0000ffff, /* src_mask */
410 0x0000ffff, /* dst_mask */
411 FALSE
), /* pcrel_offset */
413 /* Displacement to page pointer in the global offset table. */
414 HOWTO (R_MIPS_GOT_PAGE
, /* type */
416 2, /* size (0 = byte, 1 = short, 2 = long) */
418 FALSE
, /* pc_relative */
420 complain_overflow_signed
, /* complain_on_overflow */
421 _bfd_mips_elf_generic_reloc
, /* special_function */
422 "R_MIPS_GOT_PAGE", /* name */
423 TRUE
, /* partial_inplace */
424 0x0000ffff, /* src_mask */
425 0x0000ffff, /* dst_mask */
426 FALSE
), /* pcrel_offset */
428 /* Offset from page pointer in the global offset table. */
429 HOWTO (R_MIPS_GOT_OFST
, /* type */
431 2, /* size (0 = byte, 1 = short, 2 = long) */
433 FALSE
, /* pc_relative */
435 complain_overflow_signed
, /* complain_on_overflow */
436 _bfd_mips_elf_generic_reloc
, /* special_function */
437 "R_MIPS_GOT_OFST", /* name */
438 TRUE
, /* partial_inplace */
439 0x0000ffff, /* src_mask */
440 0x0000ffff, /* dst_mask */
441 FALSE
), /* pcrel_offset */
443 /* High 16 bits of displacement in global offset table. */
444 HOWTO (R_MIPS_GOT_HI16
, /* type */
446 2, /* size (0 = byte, 1 = short, 2 = long) */
448 FALSE
, /* pc_relative */
450 complain_overflow_dont
, /* complain_on_overflow */
451 _bfd_mips_elf_generic_reloc
, /* special_function */
452 "R_MIPS_GOT_HI16", /* name */
453 TRUE
, /* partial_inplace */
454 0x0000ffff, /* src_mask */
455 0x0000ffff, /* dst_mask */
456 FALSE
), /* pcrel_offset */
458 /* Low 16 bits of displacement in global offset table. */
459 HOWTO (R_MIPS_GOT_LO16
, /* type */
461 2, /* size (0 = byte, 1 = short, 2 = long) */
463 FALSE
, /* pc_relative */
465 complain_overflow_dont
, /* complain_on_overflow */
466 _bfd_mips_elf_generic_reloc
, /* special_function */
467 "R_MIPS_GOT_LO16", /* name */
468 TRUE
, /* partial_inplace */
469 0x0000ffff, /* src_mask */
470 0x0000ffff, /* dst_mask */
471 FALSE
), /* pcrel_offset */
473 /* 64 bit subtraction. */
474 HOWTO (R_MIPS_SUB
, /* type */
476 4, /* size (0 = byte, 1 = short, 2 = long) */
478 FALSE
, /* pc_relative */
480 complain_overflow_dont
, /* complain_on_overflow */
481 _bfd_mips_elf_generic_reloc
, /* special_function */
482 "R_MIPS_SUB", /* name */
483 TRUE
, /* partial_inplace */
484 MINUS_ONE
, /* src_mask */
485 MINUS_ONE
, /* dst_mask */
486 FALSE
), /* pcrel_offset */
488 /* Insert the addend as an instruction. */
489 /* FIXME: Not handled correctly. */
490 HOWTO (R_MIPS_INSERT_A
, /* type */
492 2, /* size (0 = byte, 1 = short, 2 = long) */
494 FALSE
, /* pc_relative */
496 complain_overflow_dont
, /* complain_on_overflow */
497 _bfd_mips_elf_generic_reloc
, /* special_function */
498 "R_MIPS_INSERT_A", /* name */
499 TRUE
, /* partial_inplace */
500 0xffffffff, /* src_mask */
501 0xffffffff, /* dst_mask */
502 FALSE
), /* pcrel_offset */
504 /* Insert the addend as an instruction, and change all relocations
505 to refer to the old instruction at the address. */
506 /* FIXME: Not handled correctly. */
507 HOWTO (R_MIPS_INSERT_B
, /* type */
509 2, /* size (0 = byte, 1 = short, 2 = long) */
511 FALSE
, /* pc_relative */
513 complain_overflow_dont
, /* complain_on_overflow */
514 _bfd_mips_elf_generic_reloc
, /* special_function */
515 "R_MIPS_INSERT_B", /* name */
516 TRUE
, /* partial_inplace */
517 0xffffffff, /* src_mask */
518 0xffffffff, /* dst_mask */
519 FALSE
), /* pcrel_offset */
521 /* Delete a 32 bit instruction. */
522 /* FIXME: Not handled correctly. */
523 HOWTO (R_MIPS_DELETE
, /* type */
525 2, /* size (0 = byte, 1 = short, 2 = long) */
527 FALSE
, /* pc_relative */
529 complain_overflow_dont
, /* complain_on_overflow */
530 _bfd_mips_elf_generic_reloc
, /* special_function */
531 "R_MIPS_DELETE", /* name */
532 TRUE
, /* partial_inplace */
533 0xffffffff, /* src_mask */
534 0xffffffff, /* dst_mask */
535 FALSE
), /* pcrel_offset */
537 /* The MIPS ELF64 ABI Draft wants us to support these for REL relocations.
539 a) It means building the addend from a R_MIPS_HIGHEST/R_MIPS_HIGHER/
540 R_MIPS_HI16/R_MIPS_LO16 sequence with varying ordering, using
542 b) No other NewABI toolchain actually emits such relocations. */
543 EMPTY_HOWTO (R_MIPS_HIGHER
),
544 EMPTY_HOWTO (R_MIPS_HIGHEST
),
546 /* High 16 bits of displacement in global offset table. */
547 HOWTO (R_MIPS_CALL_HI16
, /* type */
549 2, /* size (0 = byte, 1 = short, 2 = long) */
551 FALSE
, /* pc_relative */
553 complain_overflow_dont
, /* complain_on_overflow */
554 _bfd_mips_elf_generic_reloc
, /* special_function */
555 "R_MIPS_CALL_HI16", /* name */
556 TRUE
, /* partial_inplace */
557 0x0000ffff, /* src_mask */
558 0x0000ffff, /* dst_mask */
559 FALSE
), /* pcrel_offset */
561 /* Low 16 bits of displacement in global offset table. */
562 HOWTO (R_MIPS_CALL_LO16
, /* type */
564 2, /* size (0 = byte, 1 = short, 2 = long) */
566 FALSE
, /* pc_relative */
568 complain_overflow_dont
, /* complain_on_overflow */
569 _bfd_mips_elf_generic_reloc
, /* special_function */
570 "R_MIPS_CALL_LO16", /* name */
571 TRUE
, /* partial_inplace */
572 0x0000ffff, /* src_mask */
573 0x0000ffff, /* dst_mask */
574 FALSE
), /* pcrel_offset */
576 /* Section displacement, used by an associated event location section. */
577 HOWTO (R_MIPS_SCN_DISP
, /* type */
579 2, /* size (0 = byte, 1 = short, 2 = long) */
581 FALSE
, /* pc_relative */
583 complain_overflow_dont
, /* complain_on_overflow */
584 _bfd_mips_elf_generic_reloc
, /* special_function */
585 "R_MIPS_SCN_DISP", /* name */
586 TRUE
, /* partial_inplace */
587 0xffffffff, /* src_mask */
588 0xffffffff, /* dst_mask */
589 FALSE
), /* pcrel_offset */
591 HOWTO (R_MIPS_REL16
, /* type */
593 1, /* size (0 = byte, 1 = short, 2 = long) */
595 FALSE
, /* pc_relative */
597 complain_overflow_signed
, /* complain_on_overflow */
598 _bfd_mips_elf_generic_reloc
, /* special_function */
599 "R_MIPS_REL16", /* name */
600 TRUE
, /* partial_inplace */
601 0xffff, /* src_mask */
602 0xffff, /* dst_mask */
603 FALSE
), /* pcrel_offset */
605 /* These two are obsolete. */
606 EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE
),
607 EMPTY_HOWTO (R_MIPS_PJUMP
),
609 /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
610 It must be used for multigot GOT's (and only there). */
611 HOWTO (R_MIPS_RELGOT
, /* type */
613 2, /* size (0 = byte, 1 = short, 2 = long) */
615 FALSE
, /* pc_relative */
617 complain_overflow_dont
, /* complain_on_overflow */
618 _bfd_mips_elf_generic_reloc
, /* special_function */
619 "R_MIPS_RELGOT", /* name */
620 TRUE
, /* partial_inplace */
621 0xffffffff, /* src_mask */
622 0xffffffff, /* dst_mask */
623 FALSE
), /* pcrel_offset */
625 /* Protected jump conversion. This is an optimization hint. No
626 relocation is required for correctness. */
627 HOWTO (R_MIPS_JALR
, /* type */
629 2, /* size (0 = byte, 1 = short, 2 = long) */
631 FALSE
, /* pc_relative */
633 complain_overflow_dont
, /* complain_on_overflow */
634 _bfd_mips_elf_generic_reloc
, /* special_function */
635 "R_MIPS_JALR", /* name */
636 FALSE
, /* partial_inplace */
638 0x00000000, /* dst_mask */
639 FALSE
), /* pcrel_offset */
641 /* TLS relocations. */
642 EMPTY_HOWTO (R_MIPS_TLS_DTPMOD32
),
643 EMPTY_HOWTO (R_MIPS_TLS_DTPREL32
),
645 HOWTO (R_MIPS_TLS_DTPMOD64
, /* type */
647 4, /* size (0 = byte, 1 = short, 2 = long) */
649 FALSE
, /* pc_relative */
651 complain_overflow_dont
, /* complain_on_overflow */
652 _bfd_mips_elf_generic_reloc
, /* special_function */
653 "R_MIPS_TLS_DTPMOD64", /* name */
654 TRUE
, /* partial_inplace */
655 MINUS_ONE
, /* src_mask */
656 MINUS_ONE
, /* dst_mask */
657 FALSE
), /* pcrel_offset */
659 HOWTO (R_MIPS_TLS_DTPREL64
, /* type */
661 4, /* size (0 = byte, 1 = short, 2 = long) */
663 FALSE
, /* pc_relative */
665 complain_overflow_dont
, /* complain_on_overflow */
666 _bfd_mips_elf_generic_reloc
, /* special_function */
667 "R_MIPS_TLS_DTPREL64", /* name */
668 TRUE
, /* partial_inplace */
669 MINUS_ONE
, /* src_mask */
670 MINUS_ONE
, /* dst_mask */
671 FALSE
), /* pcrel_offset */
673 /* TLS general dynamic variable reference. */
674 HOWTO (R_MIPS_TLS_GD
, /* type */
676 2, /* size (0 = byte, 1 = short, 2 = long) */
678 FALSE
, /* pc_relative */
680 complain_overflow_signed
, /* complain_on_overflow */
681 _bfd_mips_elf_generic_reloc
, /* special_function */
682 "R_MIPS_TLS_GD", /* name */
683 TRUE
, /* partial_inplace */
684 0x0000ffff, /* src_mask */
685 0x0000ffff, /* dst_mask */
686 FALSE
), /* pcrel_offset */
688 /* TLS local dynamic variable reference. */
689 HOWTO (R_MIPS_TLS_LDM
, /* type */
691 2, /* size (0 = byte, 1 = short, 2 = long) */
693 FALSE
, /* pc_relative */
695 complain_overflow_signed
, /* complain_on_overflow */
696 _bfd_mips_elf_generic_reloc
, /* special_function */
697 "R_MIPS_TLS_LDM", /* name */
698 TRUE
, /* partial_inplace */
699 0x0000ffff, /* src_mask */
700 0x0000ffff, /* dst_mask */
701 FALSE
), /* pcrel_offset */
703 /* TLS local dynamic offset. */
704 HOWTO (R_MIPS_TLS_DTPREL_HI16
, /* type */
706 2, /* size (0 = byte, 1 = short, 2 = long) */
708 FALSE
, /* pc_relative */
710 complain_overflow_signed
, /* complain_on_overflow */
711 _bfd_mips_elf_generic_reloc
, /* special_function */
712 "R_MIPS_TLS_DTPREL_HI16", /* name */
713 TRUE
, /* partial_inplace */
714 0x0000ffff, /* src_mask */
715 0x0000ffff, /* dst_mask */
716 FALSE
), /* pcrel_offset */
718 /* TLS local dynamic offset. */
719 HOWTO (R_MIPS_TLS_DTPREL_LO16
, /* type */
721 2, /* size (0 = byte, 1 = short, 2 = long) */
723 FALSE
, /* pc_relative */
725 complain_overflow_signed
, /* complain_on_overflow */
726 _bfd_mips_elf_generic_reloc
, /* special_function */
727 "R_MIPS_TLS_DTPREL_LO16", /* name */
728 TRUE
, /* partial_inplace */
729 0x0000ffff, /* src_mask */
730 0x0000ffff, /* dst_mask */
731 FALSE
), /* pcrel_offset */
733 /* TLS thread pointer offset. */
734 HOWTO (R_MIPS_TLS_GOTTPREL
, /* type */
736 2, /* size (0 = byte, 1 = short, 2 = long) */
738 FALSE
, /* pc_relative */
740 complain_overflow_signed
, /* complain_on_overflow */
741 _bfd_mips_elf_generic_reloc
, /* special_function */
742 "R_MIPS_TLS_GOTTPREL", /* name */
743 TRUE
, /* partial_inplace */
744 0x0000ffff, /* src_mask */
745 0x0000ffff, /* dst_mask */
746 FALSE
), /* pcrel_offset */
748 /* TLS IE dynamic relocations. */
749 EMPTY_HOWTO (R_MIPS_TLS_TPREL32
),
751 HOWTO (R_MIPS_TLS_TPREL64
, /* type */
753 4, /* size (0 = byte, 1 = short, 2 = long) */
755 FALSE
, /* pc_relative */
757 complain_overflow_dont
, /* complain_on_overflow */
758 _bfd_mips_elf_generic_reloc
, /* special_function */
759 "R_MIPS_TLS_TPREL64", /* name */
760 TRUE
, /* partial_inplace */
761 MINUS_ONE
, /* src_mask */
762 MINUS_ONE
, /* dst_mask */
763 FALSE
), /* pcrel_offset */
765 /* TLS thread pointer offset. */
766 HOWTO (R_MIPS_TLS_TPREL_HI16
, /* type */
768 2, /* size (0 = byte, 1 = short, 2 = long) */
770 FALSE
, /* pc_relative */
772 complain_overflow_signed
, /* complain_on_overflow */
773 _bfd_mips_elf_generic_reloc
, /* special_function */
774 "R_MIPS_TLS_TPREL_HI16", /* name */
775 TRUE
, /* partial_inplace */
776 0x0000ffff, /* src_mask */
777 0x0000ffff, /* dst_mask */
778 FALSE
), /* pcrel_offset */
780 /* TLS thread pointer offset. */
781 HOWTO (R_MIPS_TLS_TPREL_LO16
, /* type */
783 2, /* size (0 = byte, 1 = short, 2 = long) */
785 FALSE
, /* pc_relative */
787 complain_overflow_signed
, /* complain_on_overflow */
788 _bfd_mips_elf_generic_reloc
, /* special_function */
789 "R_MIPS_TLS_TPREL_LO16", /* name */
790 TRUE
, /* partial_inplace */
791 0x0000ffff, /* src_mask */
792 0x0000ffff, /* dst_mask */
793 FALSE
), /* pcrel_offset */
795 /* 32 bit relocation with no addend. */
796 HOWTO (R_MIPS_GLOB_DAT
, /* type */
798 2, /* size (0 = byte, 1 = short, 2 = long) */
800 FALSE
, /* pc_relative */
802 complain_overflow_dont
, /* complain_on_overflow */
803 _bfd_mips_elf_generic_reloc
, /* special_function */
804 "R_MIPS_GLOB_DAT", /* name */
805 FALSE
, /* partial_inplace */
807 0xffffffff, /* dst_mask */
808 FALSE
), /* pcrel_offset */
811 /* The relocation table used for SHT_RELA sections. */
813 static reloc_howto_type mips_elf64_howto_table_rela
[] =
816 HOWTO (R_MIPS_NONE
, /* type */
818 0, /* size (0 = byte, 1 = short, 2 = long) */
820 FALSE
, /* pc_relative */
822 complain_overflow_dont
, /* complain_on_overflow */
823 _bfd_mips_elf_generic_reloc
, /* special_function */
824 "R_MIPS_NONE", /* name */
825 FALSE
, /* partial_inplace */
828 FALSE
), /* pcrel_offset */
830 /* 16 bit relocation. */
831 HOWTO (R_MIPS_16
, /* type */
833 2, /* size (0 = byte, 1 = short, 2 = long) */
835 FALSE
, /* pc_relative */
837 complain_overflow_signed
, /* complain_on_overflow */
838 _bfd_mips_elf_generic_reloc
, /* special_function */
839 "R_MIPS_16", /* name */
840 FALSE
, /* partial_inplace */
842 0x0000ffff, /* dst_mask */
843 FALSE
), /* pcrel_offset */
845 /* 32 bit relocation. */
846 HOWTO (R_MIPS_32
, /* type */
848 2, /* size (0 = byte, 1 = short, 2 = long) */
850 FALSE
, /* pc_relative */
852 complain_overflow_dont
, /* complain_on_overflow */
853 _bfd_mips_elf_generic_reloc
, /* special_function */
854 "R_MIPS_32", /* name */
855 FALSE
, /* partial_inplace */
857 0xffffffff, /* dst_mask */
858 FALSE
), /* pcrel_offset */
860 /* 32 bit symbol relative relocation. */
861 HOWTO (R_MIPS_REL32
, /* type */
863 2, /* size (0 = byte, 1 = short, 2 = long) */
865 FALSE
, /* pc_relative */
867 complain_overflow_dont
, /* complain_on_overflow */
868 _bfd_mips_elf_generic_reloc
, /* special_function */
869 "R_MIPS_REL32", /* name */
870 FALSE
, /* partial_inplace */
872 0xffffffff, /* dst_mask */
873 FALSE
), /* pcrel_offset */
875 /* 26 bit jump address. */
876 HOWTO (R_MIPS_26
, /* type */
878 2, /* size (0 = byte, 1 = short, 2 = long) */
880 FALSE
, /* pc_relative */
882 complain_overflow_dont
, /* complain_on_overflow */
883 /* This needs complex overflow
884 detection, because the upper 36
885 bits must match the PC + 4. */
886 _bfd_mips_elf_generic_reloc
, /* special_function */
887 "R_MIPS_26", /* name */
888 FALSE
, /* partial_inplace */
890 0x03ffffff, /* dst_mask */
891 FALSE
), /* pcrel_offset */
893 /* High 16 bits of symbol value. */
894 HOWTO (R_MIPS_HI16
, /* type */
896 2, /* size (0 = byte, 1 = short, 2 = long) */
898 FALSE
, /* pc_relative */
900 complain_overflow_dont
, /* complain_on_overflow */
901 _bfd_mips_elf_generic_reloc
, /* special_function */
902 "R_MIPS_HI16", /* name */
903 FALSE
, /* partial_inplace */
905 0x0000ffff, /* dst_mask */
906 FALSE
), /* pcrel_offset */
908 /* Low 16 bits of symbol value. */
909 HOWTO (R_MIPS_LO16
, /* type */
911 2, /* size (0 = byte, 1 = short, 2 = long) */
913 FALSE
, /* pc_relative */
915 complain_overflow_dont
, /* complain_on_overflow */
916 _bfd_mips_elf_generic_reloc
, /* special_function */
917 "R_MIPS_LO16", /* name */
918 FALSE
, /* partial_inplace */
920 0x0000ffff, /* dst_mask */
921 FALSE
), /* pcrel_offset */
923 /* GP relative reference. */
924 HOWTO (R_MIPS_GPREL16
, /* type */
926 2, /* size (0 = byte, 1 = short, 2 = long) */
928 FALSE
, /* pc_relative */
930 complain_overflow_signed
, /* complain_on_overflow */
931 mips_elf64_gprel16_reloc
, /* special_function */
932 "R_MIPS_GPREL16", /* name */
933 FALSE
, /* partial_inplace */
935 0x0000ffff, /* dst_mask */
936 FALSE
), /* pcrel_offset */
938 /* Reference to literal section. */
939 HOWTO (R_MIPS_LITERAL
, /* type */
941 2, /* size (0 = byte, 1 = short, 2 = long) */
943 FALSE
, /* pc_relative */
945 complain_overflow_signed
, /* complain_on_overflow */
946 mips_elf64_literal_reloc
, /* special_function */
947 "R_MIPS_LITERAL", /* name */
948 FALSE
, /* partial_inplace */
950 0x0000ffff, /* dst_mask */
951 FALSE
), /* pcrel_offset */
953 /* Reference to global offset table. */
954 HOWTO (R_MIPS_GOT16
, /* type */
956 2, /* size (0 = byte, 1 = short, 2 = long) */
958 FALSE
, /* pc_relative */
960 complain_overflow_signed
, /* complain_on_overflow */
961 _bfd_mips_elf_generic_reloc
, /* special_function */
962 "R_MIPS_GOT16", /* name */
963 FALSE
, /* partial_inplace */
965 0x0000ffff, /* dst_mask */
966 FALSE
), /* pcrel_offset */
968 /* 16 bit PC relative reference. Note that the ABI document has a typo
969 and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
970 We do the right thing here. */
971 HOWTO (R_MIPS_PC16
, /* type */
973 2, /* size (0 = byte, 1 = short, 2 = long) */
975 TRUE
, /* pc_relative */
977 complain_overflow_signed
, /* complain_on_overflow */
978 _bfd_mips_elf_generic_reloc
, /* special_function */
979 "R_MIPS_PC16", /* name */
980 FALSE
, /* partial_inplace */
982 0x0000ffff, /* dst_mask */
983 TRUE
), /* pcrel_offset */
985 /* 16 bit call through global offset table. */
986 HOWTO (R_MIPS_CALL16
, /* type */
988 2, /* size (0 = byte, 1 = short, 2 = long) */
990 FALSE
, /* pc_relative */
992 complain_overflow_signed
, /* complain_on_overflow */
993 _bfd_mips_elf_generic_reloc
, /* special_function */
994 "R_MIPS_CALL16", /* name */
995 FALSE
, /* partial_inplace */
997 0x0000ffff, /* dst_mask */
998 FALSE
), /* pcrel_offset */
1000 /* 32 bit GP relative reference. */
1001 HOWTO (R_MIPS_GPREL32
, /* type */
1003 2, /* size (0 = byte, 1 = short, 2 = long) */
1005 FALSE
, /* pc_relative */
1007 complain_overflow_dont
, /* complain_on_overflow */
1008 mips_elf64_gprel32_reloc
, /* special_function */
1009 "R_MIPS_GPREL32", /* name */
1010 FALSE
, /* partial_inplace */
1012 0xffffffff, /* dst_mask */
1013 FALSE
), /* pcrel_offset */
1019 /* A 5 bit shift field. */
1020 HOWTO (R_MIPS_SHIFT5
, /* type */
1022 2, /* size (0 = byte, 1 = short, 2 = long) */
1024 FALSE
, /* pc_relative */
1026 complain_overflow_bitfield
, /* complain_on_overflow */
1027 _bfd_mips_elf_generic_reloc
, /* special_function */
1028 "R_MIPS_SHIFT5", /* name */
1029 FALSE
, /* partial_inplace */
1031 0x000007c0, /* dst_mask */
1032 FALSE
), /* pcrel_offset */
1034 /* A 6 bit shift field. */
1035 HOWTO (R_MIPS_SHIFT6
, /* type */
1037 2, /* size (0 = byte, 1 = short, 2 = long) */
1039 FALSE
, /* pc_relative */
1041 complain_overflow_bitfield
, /* complain_on_overflow */
1042 mips_elf64_shift6_reloc
, /* special_function */
1043 "R_MIPS_SHIFT6", /* name */
1044 FALSE
, /* partial_inplace */
1046 0x000007c4, /* dst_mask */
1047 FALSE
), /* pcrel_offset */
1049 /* 64 bit relocation. */
1050 HOWTO (R_MIPS_64
, /* type */
1052 4, /* size (0 = byte, 1 = short, 2 = long) */
1054 FALSE
, /* pc_relative */
1056 complain_overflow_dont
, /* complain_on_overflow */
1057 _bfd_mips_elf_generic_reloc
, /* special_function */
1058 "R_MIPS_64", /* name */
1059 FALSE
, /* partial_inplace */
1061 MINUS_ONE
, /* dst_mask */
1062 FALSE
), /* pcrel_offset */
1064 /* Displacement in the global offset table. */
1065 HOWTO (R_MIPS_GOT_DISP
, /* type */
1067 2, /* size (0 = byte, 1 = short, 2 = long) */
1069 FALSE
, /* pc_relative */
1071 complain_overflow_signed
, /* complain_on_overflow */
1072 _bfd_mips_elf_generic_reloc
, /* special_function */
1073 "R_MIPS_GOT_DISP", /* name */
1074 FALSE
, /* partial_inplace */
1076 0x0000ffff, /* dst_mask */
1077 FALSE
), /* pcrel_offset */
1079 /* Displacement to page pointer in the global offset table. */
1080 HOWTO (R_MIPS_GOT_PAGE
, /* type */
1082 2, /* size (0 = byte, 1 = short, 2 = long) */
1084 FALSE
, /* pc_relative */
1086 complain_overflow_signed
, /* complain_on_overflow */
1087 _bfd_mips_elf_generic_reloc
, /* special_function */
1088 "R_MIPS_GOT_PAGE", /* name */
1089 FALSE
, /* partial_inplace */
1091 0x0000ffff, /* dst_mask */
1092 FALSE
), /* pcrel_offset */
1094 /* Offset from page pointer in the global offset table. */
1095 HOWTO (R_MIPS_GOT_OFST
, /* type */
1097 2, /* size (0 = byte, 1 = short, 2 = long) */
1099 FALSE
, /* pc_relative */
1101 complain_overflow_signed
, /* complain_on_overflow */
1102 _bfd_mips_elf_generic_reloc
, /* special_function */
1103 "R_MIPS_GOT_OFST", /* name */
1104 FALSE
, /* partial_inplace */
1106 0x0000ffff, /* dst_mask */
1107 FALSE
), /* pcrel_offset */
1109 /* High 16 bits of displacement in global offset table. */
1110 HOWTO (R_MIPS_GOT_HI16
, /* type */
1112 2, /* size (0 = byte, 1 = short, 2 = long) */
1114 FALSE
, /* pc_relative */
1116 complain_overflow_dont
, /* complain_on_overflow */
1117 _bfd_mips_elf_generic_reloc
, /* special_function */
1118 "R_MIPS_GOT_HI16", /* name */
1119 FALSE
, /* partial_inplace */
1121 0x0000ffff, /* dst_mask */
1122 FALSE
), /* pcrel_offset */
1124 /* Low 16 bits of displacement in global offset table. */
1125 HOWTO (R_MIPS_GOT_LO16
, /* type */
1127 2, /* size (0 = byte, 1 = short, 2 = long) */
1129 FALSE
, /* pc_relative */
1131 complain_overflow_dont
, /* complain_on_overflow */
1132 _bfd_mips_elf_generic_reloc
, /* special_function */
1133 "R_MIPS_GOT_LO16", /* name */
1134 FALSE
, /* partial_inplace */
1136 0x0000ffff, /* dst_mask */
1137 FALSE
), /* pcrel_offset */
1139 /* 64 bit subtraction. */
1140 HOWTO (R_MIPS_SUB
, /* type */
1142 4, /* size (0 = byte, 1 = short, 2 = long) */
1144 FALSE
, /* pc_relative */
1146 complain_overflow_dont
, /* complain_on_overflow */
1147 _bfd_mips_elf_generic_reloc
, /* special_function */
1148 "R_MIPS_SUB", /* name */
1149 FALSE
, /* partial_inplace */
1151 MINUS_ONE
, /* dst_mask */
1152 FALSE
), /* pcrel_offset */
1154 /* Insert the addend as an instruction. */
1155 /* FIXME: Not handled correctly. */
1156 HOWTO (R_MIPS_INSERT_A
, /* type */
1158 2, /* size (0 = byte, 1 = short, 2 = long) */
1160 FALSE
, /* pc_relative */
1162 complain_overflow_dont
, /* complain_on_overflow */
1163 _bfd_mips_elf_generic_reloc
, /* special_function */
1164 "R_MIPS_INSERT_A", /* name */
1165 FALSE
, /* partial_inplace */
1167 0xffffffff, /* dst_mask */
1168 FALSE
), /* pcrel_offset */
1170 /* Insert the addend as an instruction, and change all relocations
1171 to refer to the old instruction at the address. */
1172 /* FIXME: Not handled correctly. */
1173 HOWTO (R_MIPS_INSERT_B
, /* type */
1175 2, /* size (0 = byte, 1 = short, 2 = long) */
1177 FALSE
, /* pc_relative */
1179 complain_overflow_dont
, /* complain_on_overflow */
1180 _bfd_mips_elf_generic_reloc
, /* special_function */
1181 "R_MIPS_INSERT_B", /* name */
1182 FALSE
, /* partial_inplace */
1184 0xffffffff, /* dst_mask */
1185 FALSE
), /* pcrel_offset */
1187 /* Delete a 32 bit instruction. */
1188 /* FIXME: Not handled correctly. */
1189 HOWTO (R_MIPS_DELETE
, /* type */
1191 2, /* size (0 = byte, 1 = short, 2 = long) */
1193 FALSE
, /* pc_relative */
1195 complain_overflow_dont
, /* complain_on_overflow */
1196 _bfd_mips_elf_generic_reloc
, /* special_function */
1197 "R_MIPS_DELETE", /* name */
1198 FALSE
, /* partial_inplace */
1200 0xffffffff, /* dst_mask */
1201 FALSE
), /* pcrel_offset */
1203 /* Get the higher value of a 64 bit addend. */
1204 HOWTO (R_MIPS_HIGHER
, /* type */
1206 2, /* size (0 = byte, 1 = short, 2 = long) */
1208 FALSE
, /* pc_relative */
1210 complain_overflow_dont
, /* complain_on_overflow */
1211 _bfd_mips_elf_generic_reloc
, /* special_function */
1212 "R_MIPS_HIGHER", /* name */
1213 FALSE
, /* partial_inplace */
1215 0x0000ffff, /* dst_mask */
1216 FALSE
), /* pcrel_offset */
1218 /* Get the highest value of a 64 bit addend. */
1219 HOWTO (R_MIPS_HIGHEST
, /* type */
1221 2, /* size (0 = byte, 1 = short, 2 = long) */
1223 FALSE
, /* pc_relative */
1225 complain_overflow_dont
, /* complain_on_overflow */
1226 _bfd_mips_elf_generic_reloc
, /* special_function */
1227 "R_MIPS_HIGHEST", /* name */
1228 FALSE
, /* partial_inplace */
1230 0x0000ffff, /* dst_mask */
1231 FALSE
), /* pcrel_offset */
1233 /* High 16 bits of displacement in global offset table. */
1234 HOWTO (R_MIPS_CALL_HI16
, /* type */
1236 2, /* size (0 = byte, 1 = short, 2 = long) */
1238 FALSE
, /* pc_relative */
1240 complain_overflow_dont
, /* complain_on_overflow */
1241 _bfd_mips_elf_generic_reloc
, /* special_function */
1242 "R_MIPS_CALL_HI16", /* name */
1243 FALSE
, /* partial_inplace */
1245 0x0000ffff, /* dst_mask */
1246 FALSE
), /* pcrel_offset */
1248 /* Low 16 bits of displacement in global offset table. */
1249 HOWTO (R_MIPS_CALL_LO16
, /* type */
1251 2, /* size (0 = byte, 1 = short, 2 = long) */
1253 FALSE
, /* pc_relative */
1255 complain_overflow_dont
, /* complain_on_overflow */
1256 _bfd_mips_elf_generic_reloc
, /* special_function */
1257 "R_MIPS_CALL_LO16", /* name */
1258 FALSE
, /* partial_inplace */
1260 0x0000ffff, /* dst_mask */
1261 FALSE
), /* pcrel_offset */
1263 /* Section displacement, used by an associated event location section. */
1264 HOWTO (R_MIPS_SCN_DISP
, /* type */
1266 2, /* size (0 = byte, 1 = short, 2 = long) */
1268 FALSE
, /* pc_relative */
1270 complain_overflow_dont
, /* complain_on_overflow */
1271 _bfd_mips_elf_generic_reloc
, /* special_function */
1272 "R_MIPS_SCN_DISP", /* name */
1273 FALSE
, /* partial_inplace */
1275 0xffffffff, /* dst_mask */
1276 FALSE
), /* pcrel_offset */
1278 HOWTO (R_MIPS_REL16
, /* type */
1280 1, /* size (0 = byte, 1 = short, 2 = long) */
1282 FALSE
, /* pc_relative */
1284 complain_overflow_signed
, /* complain_on_overflow */
1285 _bfd_mips_elf_generic_reloc
, /* special_function */
1286 "R_MIPS_REL16", /* name */
1287 FALSE
, /* partial_inplace */
1289 0xffff, /* dst_mask */
1290 FALSE
), /* pcrel_offset */
1292 /* These two are obsolete. */
1293 EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE
),
1294 EMPTY_HOWTO (R_MIPS_PJUMP
),
1296 /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
1297 It must be used for multigot GOT's (and only there). */
1298 HOWTO (R_MIPS_RELGOT
, /* type */
1300 2, /* size (0 = byte, 1 = short, 2 = long) */
1302 FALSE
, /* pc_relative */
1304 complain_overflow_dont
, /* complain_on_overflow */
1305 _bfd_mips_elf_generic_reloc
, /* special_function */
1306 "R_MIPS_RELGOT", /* name */
1307 FALSE
, /* partial_inplace */
1309 0xffffffff, /* dst_mask */
1310 FALSE
), /* pcrel_offset */
1312 /* Protected jump conversion. This is an optimization hint. No
1313 relocation is required for correctness. */
1314 HOWTO (R_MIPS_JALR
, /* type */
1316 2, /* size (0 = byte, 1 = short, 2 = long) */
1318 FALSE
, /* pc_relative */
1320 complain_overflow_dont
, /* complain_on_overflow */
1321 _bfd_mips_elf_generic_reloc
, /* special_function */
1322 "R_MIPS_JALR", /* name */
1323 FALSE
, /* partial_inplace */
1325 0x00000000, /* dst_mask */
1326 FALSE
), /* pcrel_offset */
1328 /* TLS relocations. */
1329 EMPTY_HOWTO (R_MIPS_TLS_DTPMOD32
),
1330 EMPTY_HOWTO (R_MIPS_TLS_DTPREL32
),
1331 EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64
),
1333 HOWTO (R_MIPS_TLS_DTPREL64
, /* type */
1335 4, /* size (0 = byte, 1 = short, 2 = long) */
1337 FALSE
, /* pc_relative */
1339 complain_overflow_dont
, /* complain_on_overflow */
1340 _bfd_mips_elf_generic_reloc
, /* special_function */
1341 "R_MIPS_TLS_DTPREL64", /* name */
1342 TRUE
, /* partial_inplace */
1343 MINUS_ONE
, /* src_mask */
1344 MINUS_ONE
, /* dst_mask */
1345 FALSE
), /* pcrel_offset */
1347 /* TLS general dynamic variable reference. */
1348 HOWTO (R_MIPS_TLS_GD
, /* type */
1350 2, /* size (0 = byte, 1 = short, 2 = long) */
1352 FALSE
, /* pc_relative */
1354 complain_overflow_signed
, /* complain_on_overflow */
1355 _bfd_mips_elf_generic_reloc
, /* special_function */
1356 "R_MIPS_TLS_GD", /* name */
1357 TRUE
, /* partial_inplace */
1358 0x0000ffff, /* src_mask */
1359 0x0000ffff, /* dst_mask */
1360 FALSE
), /* pcrel_offset */
1362 /* TLS local dynamic variable reference. */
1363 HOWTO (R_MIPS_TLS_LDM
, /* type */
1365 2, /* 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_TLS_LDM", /* name */
1372 TRUE
, /* partial_inplace */
1373 0x0000ffff, /* src_mask */
1374 0x0000ffff, /* dst_mask */
1375 FALSE
), /* pcrel_offset */
1377 /* TLS local dynamic offset. */
1378 HOWTO (R_MIPS_TLS_DTPREL_HI16
, /* type */
1380 2, /* size (0 = byte, 1 = short, 2 = long) */
1382 FALSE
, /* pc_relative */
1384 complain_overflow_signed
, /* complain_on_overflow */
1385 _bfd_mips_elf_generic_reloc
, /* special_function */
1386 "R_MIPS_TLS_DTPREL_HI16", /* name */
1387 TRUE
, /* partial_inplace */
1388 0x0000ffff, /* src_mask */
1389 0x0000ffff, /* dst_mask */
1390 FALSE
), /* pcrel_offset */
1392 /* TLS local dynamic offset. */
1393 HOWTO (R_MIPS_TLS_DTPREL_LO16
, /* type */
1395 2, /* size (0 = byte, 1 = short, 2 = long) */
1397 FALSE
, /* pc_relative */
1399 complain_overflow_signed
, /* complain_on_overflow */
1400 _bfd_mips_elf_generic_reloc
, /* special_function */
1401 "R_MIPS_TLS_DTPREL_LO16", /* name */
1402 TRUE
, /* partial_inplace */
1403 0x0000ffff, /* src_mask */
1404 0x0000ffff, /* dst_mask */
1405 FALSE
), /* pcrel_offset */
1407 /* TLS thread pointer offset. */
1408 HOWTO (R_MIPS_TLS_GOTTPREL
, /* type */
1410 2, /* size (0 = byte, 1 = short, 2 = long) */
1412 FALSE
, /* pc_relative */
1414 complain_overflow_signed
, /* complain_on_overflow */
1415 _bfd_mips_elf_generic_reloc
, /* special_function */
1416 "R_MIPS_TLS_GOTTPREL", /* name */
1417 TRUE
, /* partial_inplace */
1418 0x0000ffff, /* src_mask */
1419 0x0000ffff, /* dst_mask */
1420 FALSE
), /* pcrel_offset */
1422 EMPTY_HOWTO (R_MIPS_TLS_TPREL32
),
1423 EMPTY_HOWTO (R_MIPS_TLS_TPREL64
),
1425 /* TLS thread pointer offset. */
1426 HOWTO (R_MIPS_TLS_TPREL_HI16
, /* type */
1428 2, /* size (0 = byte, 1 = short, 2 = long) */
1430 FALSE
, /* pc_relative */
1432 complain_overflow_signed
, /* complain_on_overflow */
1433 _bfd_mips_elf_generic_reloc
, /* special_function */
1434 "R_MIPS_TLS_TPREL_HI16", /* name */
1435 TRUE
, /* partial_inplace */
1436 0x0000ffff, /* src_mask */
1437 0x0000ffff, /* dst_mask */
1438 FALSE
), /* pcrel_offset */
1440 /* TLS thread pointer offset. */
1441 HOWTO (R_MIPS_TLS_TPREL_LO16
, /* type */
1443 2, /* size (0 = byte, 1 = short, 2 = long) */
1445 FALSE
, /* pc_relative */
1447 complain_overflow_signed
, /* complain_on_overflow */
1448 _bfd_mips_elf_generic_reloc
, /* special_function */
1449 "R_MIPS_TLS_TPREL_LO16", /* name */
1450 TRUE
, /* partial_inplace */
1451 0x0000ffff, /* src_mask */
1452 0x0000ffff, /* dst_mask */
1453 FALSE
), /* pcrel_offset */
1455 /* 32 bit relocation with no addend. */
1456 HOWTO (R_MIPS_GLOB_DAT
, /* type */
1458 2, /* size (0 = byte, 1 = short, 2 = long) */
1460 FALSE
, /* pc_relative */
1462 complain_overflow_dont
, /* complain_on_overflow */
1463 _bfd_mips_elf_generic_reloc
, /* special_function */
1464 "R_MIPS_GLOB_DAT", /* name */
1465 FALSE
, /* partial_inplace */
1467 0xffffffff, /* dst_mask */
1468 FALSE
), /* pcrel_offset */
1471 static reloc_howto_type mips16_elf64_howto_table_rel
[] =
1473 /* The reloc used for the mips16 jump instruction. */
1474 HOWTO (R_MIPS16_26
, /* type */
1476 2, /* size (0 = byte, 1 = short, 2 = long) */
1478 FALSE
, /* pc_relative */
1480 complain_overflow_dont
, /* complain_on_overflow */
1481 /* This needs complex overflow
1482 detection, because the upper four
1483 bits must match the PC. */
1484 _bfd_mips_elf_generic_reloc
, /* special_function */
1485 "R_MIPS16_26", /* name */
1486 TRUE
, /* partial_inplace */
1487 0x3ffffff, /* src_mask */
1488 0x3ffffff, /* dst_mask */
1489 FALSE
), /* pcrel_offset */
1491 /* The reloc used for the mips16 gprel instruction. */
1492 HOWTO (R_MIPS16_GPREL
, /* type */
1494 2, /* size (0 = byte, 1 = short, 2 = long) */
1496 FALSE
, /* pc_relative */
1498 complain_overflow_signed
, /* complain_on_overflow */
1499 mips16_gprel_reloc
, /* special_function */
1500 "R_MIPS16_GPREL", /* name */
1501 TRUE
, /* partial_inplace */
1502 0x0000ffff, /* src_mask */
1503 0x0000ffff, /* dst_mask */
1504 FALSE
), /* pcrel_offset */
1506 /* A MIPS16 reference to the global offset table. */
1507 HOWTO (R_MIPS16_GOT16
, /* type */
1509 2, /* size (0 = byte, 1 = short, 2 = long) */
1511 FALSE
, /* pc_relative */
1513 complain_overflow_dont
, /* complain_on_overflow */
1514 _bfd_mips_elf_got16_reloc
, /* special_function */
1515 "R_MIPS16_GOT16", /* name */
1516 TRUE
, /* partial_inplace */
1517 0x0000ffff, /* src_mask */
1518 0x0000ffff, /* dst_mask */
1519 FALSE
), /* pcrel_offset */
1521 /* A MIPS16 call through the global offset table. */
1522 HOWTO (R_MIPS16_CALL16
, /* type */
1524 2, /* size (0 = byte, 1 = short, 2 = long) */
1526 FALSE
, /* pc_relative */
1528 complain_overflow_dont
, /* complain_on_overflow */
1529 _bfd_mips_elf_generic_reloc
, /* special_function */
1530 "R_MIPS16_CALL16", /* name */
1531 TRUE
, /* partial_inplace */
1532 0x0000ffff, /* src_mask */
1533 0x0000ffff, /* dst_mask */
1534 FALSE
), /* pcrel_offset */
1536 /* MIPS16 high 16 bits of symbol value. */
1537 HOWTO (R_MIPS16_HI16
, /* type */
1538 16, /* rightshift */
1539 2, /* size (0 = byte, 1 = short, 2 = long) */
1541 FALSE
, /* pc_relative */
1543 complain_overflow_dont
, /* complain_on_overflow */
1544 _bfd_mips_elf_hi16_reloc
, /* special_function */
1545 "R_MIPS16_HI16", /* name */
1546 TRUE
, /* partial_inplace */
1547 0x0000ffff, /* src_mask */
1548 0x0000ffff, /* dst_mask */
1549 FALSE
), /* pcrel_offset */
1551 /* MIPS16 low 16 bits of symbol value. */
1552 HOWTO (R_MIPS16_LO16
, /* type */
1554 2, /* size (0 = byte, 1 = short, 2 = long) */
1556 FALSE
, /* pc_relative */
1558 complain_overflow_dont
, /* complain_on_overflow */
1559 _bfd_mips_elf_lo16_reloc
, /* special_function */
1560 "R_MIPS16_LO16", /* name */
1561 TRUE
, /* partial_inplace */
1562 0x0000ffff, /* src_mask */
1563 0x0000ffff, /* dst_mask */
1564 FALSE
), /* pcrel_offset */
1567 static reloc_howto_type mips16_elf64_howto_table_rela
[] =
1569 /* The reloc used for the mips16 jump instruction. */
1570 HOWTO (R_MIPS16_26
, /* type */
1572 2, /* size (0 = byte, 1 = short, 2 = long) */
1574 FALSE
, /* pc_relative */
1576 complain_overflow_dont
, /* complain_on_overflow */
1577 /* This needs complex overflow
1578 detection, because the upper four
1579 bits must match the PC. */
1580 _bfd_mips_elf_generic_reloc
, /* special_function */
1581 "R_MIPS16_26", /* name */
1582 FALSE
, /* partial_inplace */
1583 0x3ffffff, /* src_mask */
1584 0x3ffffff, /* dst_mask */
1585 FALSE
), /* pcrel_offset */
1587 /* The reloc used for the mips16 gprel instruction. */
1588 HOWTO (R_MIPS16_GPREL
, /* type */
1590 2, /* size (0 = byte, 1 = short, 2 = long) */
1592 FALSE
, /* pc_relative */
1594 complain_overflow_signed
, /* complain_on_overflow */
1595 mips16_gprel_reloc
, /* special_function */
1596 "R_MIPS16_GPREL", /* name */
1597 FALSE
, /* partial_inplace */
1598 0x0000ffff, /* src_mask */
1599 0x0000ffff, /* dst_mask */
1600 FALSE
), /* pcrel_offset */
1602 /* A MIPS16 reference to the global offset table. */
1603 HOWTO (R_MIPS16_GOT16
, /* type */
1605 2, /* size (0 = byte, 1 = short, 2 = long) */
1607 FALSE
, /* pc_relative */
1609 complain_overflow_dont
, /* complain_on_overflow */
1610 _bfd_mips_elf_got16_reloc
, /* special_function */
1611 "R_MIPS16_GOT16", /* name */
1612 FALSE
, /* partial_inplace */
1613 0x0000ffff, /* src_mask */
1614 0x0000ffff, /* dst_mask */
1615 FALSE
), /* pcrel_offset */
1617 /* A MIPS16 call through the global offset table. */
1618 HOWTO (R_MIPS16_CALL16
, /* type */
1620 2, /* size (0 = byte, 1 = short, 2 = long) */
1622 FALSE
, /* pc_relative */
1624 complain_overflow_dont
, /* complain_on_overflow */
1625 _bfd_mips_elf_generic_reloc
, /* special_function */
1626 "R_MIPS16_CALL16", /* name */
1627 FALSE
, /* partial_inplace */
1628 0x0000ffff, /* src_mask */
1629 0x0000ffff, /* dst_mask */
1630 FALSE
), /* pcrel_offset */
1632 /* MIPS16 high 16 bits of symbol value. */
1633 HOWTO (R_MIPS16_HI16
, /* type */
1634 16, /* rightshift */
1635 2, /* size (0 = byte, 1 = short, 2 = long) */
1637 FALSE
, /* pc_relative */
1639 complain_overflow_dont
, /* complain_on_overflow */
1640 _bfd_mips_elf_hi16_reloc
, /* special_function */
1641 "R_MIPS16_HI16", /* name */
1642 FALSE
, /* partial_inplace */
1643 0x0000ffff, /* src_mask */
1644 0x0000ffff, /* dst_mask */
1645 FALSE
), /* pcrel_offset */
1647 /* MIPS16 low 16 bits of symbol value. */
1648 HOWTO (R_MIPS16_LO16
, /* type */
1650 2, /* size (0 = byte, 1 = short, 2 = long) */
1652 FALSE
, /* pc_relative */
1654 complain_overflow_dont
, /* complain_on_overflow */
1655 _bfd_mips_elf_lo16_reloc
, /* special_function */
1656 "R_MIPS16_LO16", /* name */
1657 FALSE
, /* partial_inplace */
1658 0x0000ffff, /* src_mask */
1659 0x0000ffff, /* dst_mask */
1660 FALSE
), /* pcrel_offset */
1663 /* GNU extension to record C++ vtable hierarchy */
1664 static reloc_howto_type elf_mips_gnu_vtinherit_howto
=
1665 HOWTO (R_MIPS_GNU_VTINHERIT
, /* type */
1667 2, /* size (0 = byte, 1 = short, 2 = long) */
1669 FALSE
, /* pc_relative */
1671 complain_overflow_dont
, /* complain_on_overflow */
1672 NULL
, /* special_function */
1673 "R_MIPS_GNU_VTINHERIT", /* name */
1674 FALSE
, /* partial_inplace */
1677 FALSE
); /* pcrel_offset */
1679 /* GNU extension to record C++ vtable member usage */
1680 static reloc_howto_type elf_mips_gnu_vtentry_howto
=
1681 HOWTO (R_MIPS_GNU_VTENTRY
, /* type */
1683 2, /* size (0 = byte, 1 = short, 2 = long) */
1685 FALSE
, /* pc_relative */
1687 complain_overflow_dont
, /* complain_on_overflow */
1688 _bfd_elf_rel_vtable_reloc_fn
, /* special_function */
1689 "R_MIPS_GNU_VTENTRY", /* name */
1690 FALSE
, /* partial_inplace */
1693 FALSE
); /* pcrel_offset */
1695 /* 16 bit offset for pc-relative branches. */
1696 static reloc_howto_type elf_mips_gnu_rel16_s2
=
1697 HOWTO (R_MIPS_GNU_REL16_S2
, /* type */
1699 2, /* size (0 = byte, 1 = short, 2 = long) */
1701 TRUE
, /* pc_relative */
1703 complain_overflow_signed
, /* complain_on_overflow */
1704 _bfd_mips_elf_generic_reloc
, /* special_function */
1705 "R_MIPS_GNU_REL16_S2", /* name */
1706 TRUE
, /* partial_inplace */
1707 0x0000ffff, /* src_mask */
1708 0x0000ffff, /* dst_mask */
1709 TRUE
); /* pcrel_offset */
1711 /* 16 bit offset for pc-relative branches. */
1712 static reloc_howto_type elf_mips_gnu_rela16_s2
=
1713 HOWTO (R_MIPS_GNU_REL16_S2
, /* type */
1715 2, /* size (0 = byte, 1 = short, 2 = long) */
1717 TRUE
, /* pc_relative */
1719 complain_overflow_signed
, /* complain_on_overflow */
1720 _bfd_mips_elf_generic_reloc
, /* special_function */
1721 "R_MIPS_GNU_REL16_S2", /* name */
1722 FALSE
, /* partial_inplace */
1724 0x0000ffff, /* dst_mask */
1725 TRUE
); /* pcrel_offset */
1727 /* Swap in a MIPS 64-bit Rel reloc. */
1730 mips_elf64_swap_reloc_in (bfd
*abfd
, const Elf64_Mips_External_Rel
*src
,
1731 Elf64_Mips_Internal_Rela
*dst
)
1733 dst
->r_offset
= H_GET_64 (abfd
, src
->r_offset
);
1734 dst
->r_sym
= H_GET_32 (abfd
, src
->r_sym
);
1735 dst
->r_ssym
= H_GET_8 (abfd
, src
->r_ssym
);
1736 dst
->r_type3
= H_GET_8 (abfd
, src
->r_type3
);
1737 dst
->r_type2
= H_GET_8 (abfd
, src
->r_type2
);
1738 dst
->r_type
= H_GET_8 (abfd
, src
->r_type
);
1742 /* Swap in a MIPS 64-bit Rela reloc. */
1745 mips_elf64_swap_reloca_in (bfd
*abfd
, const Elf64_Mips_External_Rela
*src
,
1746 Elf64_Mips_Internal_Rela
*dst
)
1748 dst
->r_offset
= H_GET_64 (abfd
, src
->r_offset
);
1749 dst
->r_sym
= H_GET_32 (abfd
, src
->r_sym
);
1750 dst
->r_ssym
= H_GET_8 (abfd
, src
->r_ssym
);
1751 dst
->r_type3
= H_GET_8 (abfd
, src
->r_type3
);
1752 dst
->r_type2
= H_GET_8 (abfd
, src
->r_type2
);
1753 dst
->r_type
= H_GET_8 (abfd
, src
->r_type
);
1754 dst
->r_addend
= H_GET_S64 (abfd
, src
->r_addend
);
1757 /* Swap out a MIPS 64-bit Rel reloc. */
1760 mips_elf64_swap_reloc_out (bfd
*abfd
, const Elf64_Mips_Internal_Rela
*src
,
1761 Elf64_Mips_External_Rel
*dst
)
1763 H_PUT_64 (abfd
, src
->r_offset
, dst
->r_offset
);
1764 H_PUT_32 (abfd
, src
->r_sym
, dst
->r_sym
);
1765 H_PUT_8 (abfd
, src
->r_ssym
, dst
->r_ssym
);
1766 H_PUT_8 (abfd
, src
->r_type3
, dst
->r_type3
);
1767 H_PUT_8 (abfd
, src
->r_type2
, dst
->r_type2
);
1768 H_PUT_8 (abfd
, src
->r_type
, dst
->r_type
);
1771 /* Swap out a MIPS 64-bit Rela reloc. */
1774 mips_elf64_swap_reloca_out (bfd
*abfd
, const Elf64_Mips_Internal_Rela
*src
,
1775 Elf64_Mips_External_Rela
*dst
)
1777 H_PUT_64 (abfd
, src
->r_offset
, dst
->r_offset
);
1778 H_PUT_32 (abfd
, src
->r_sym
, dst
->r_sym
);
1779 H_PUT_8 (abfd
, src
->r_ssym
, dst
->r_ssym
);
1780 H_PUT_8 (abfd
, src
->r_type3
, dst
->r_type3
);
1781 H_PUT_8 (abfd
, src
->r_type2
, dst
->r_type2
);
1782 H_PUT_8 (abfd
, src
->r_type
, dst
->r_type
);
1783 H_PUT_S64 (abfd
, src
->r_addend
, dst
->r_addend
);
1786 /* Swap in a MIPS 64-bit Rel reloc. */
1789 mips_elf64_be_swap_reloc_in (bfd
*abfd
, const bfd_byte
*src
,
1790 Elf_Internal_Rela
*dst
)
1792 Elf64_Mips_Internal_Rela mirel
;
1794 mips_elf64_swap_reloc_in (abfd
,
1795 (const Elf64_Mips_External_Rel
*) src
,
1798 dst
[0].r_offset
= mirel
.r_offset
;
1799 dst
[0].r_info
= ELF64_R_INFO (mirel
.r_sym
, mirel
.r_type
);
1800 dst
[0].r_addend
= 0;
1801 dst
[1].r_offset
= mirel
.r_offset
;
1802 dst
[1].r_info
= ELF64_R_INFO (mirel
.r_ssym
, mirel
.r_type2
);
1803 dst
[1].r_addend
= 0;
1804 dst
[2].r_offset
= mirel
.r_offset
;
1805 dst
[2].r_info
= ELF64_R_INFO (STN_UNDEF
, mirel
.r_type3
);
1806 dst
[2].r_addend
= 0;
1809 /* Swap in a MIPS 64-bit Rela reloc. */
1812 mips_elf64_be_swap_reloca_in (bfd
*abfd
, const bfd_byte
*src
,
1813 Elf_Internal_Rela
*dst
)
1815 Elf64_Mips_Internal_Rela mirela
;
1817 mips_elf64_swap_reloca_in (abfd
,
1818 (const Elf64_Mips_External_Rela
*) src
,
1821 dst
[0].r_offset
= mirela
.r_offset
;
1822 dst
[0].r_info
= ELF64_R_INFO (mirela
.r_sym
, mirela
.r_type
);
1823 dst
[0].r_addend
= mirela
.r_addend
;
1824 dst
[1].r_offset
= mirela
.r_offset
;
1825 dst
[1].r_info
= ELF64_R_INFO (mirela
.r_ssym
, mirela
.r_type2
);
1826 dst
[1].r_addend
= 0;
1827 dst
[2].r_offset
= mirela
.r_offset
;
1828 dst
[2].r_info
= ELF64_R_INFO (STN_UNDEF
, mirela
.r_type3
);
1829 dst
[2].r_addend
= 0;
1832 /* Swap out a MIPS 64-bit Rel reloc. */
1835 mips_elf64_be_swap_reloc_out (bfd
*abfd
, const Elf_Internal_Rela
*src
,
1838 Elf64_Mips_Internal_Rela mirel
;
1840 mirel
.r_offset
= src
[0].r_offset
;
1841 BFD_ASSERT(src
[0].r_offset
== src
[1].r_offset
);
1843 mirel
.r_type
= ELF64_MIPS_R_TYPE (src
[0].r_info
);
1844 mirel
.r_sym
= ELF64_R_SYM (src
[0].r_info
);
1845 mirel
.r_type2
= ELF64_MIPS_R_TYPE (src
[1].r_info
);
1846 mirel
.r_ssym
= ELF64_MIPS_R_SSYM (src
[1].r_info
);
1847 mirel
.r_type3
= ELF64_MIPS_R_TYPE (src
[2].r_info
);
1849 mips_elf64_swap_reloc_out (abfd
, &mirel
,
1850 (Elf64_Mips_External_Rel
*) dst
);
1853 /* Swap out a MIPS 64-bit Rela reloc. */
1856 mips_elf64_be_swap_reloca_out (bfd
*abfd
, const Elf_Internal_Rela
*src
,
1859 Elf64_Mips_Internal_Rela mirela
;
1861 mirela
.r_offset
= src
[0].r_offset
;
1862 BFD_ASSERT(src
[0].r_offset
== src
[1].r_offset
);
1863 BFD_ASSERT(src
[0].r_offset
== src
[2].r_offset
);
1865 mirela
.r_type
= ELF64_MIPS_R_TYPE (src
[0].r_info
);
1866 mirela
.r_sym
= ELF64_R_SYM (src
[0].r_info
);
1867 mirela
.r_addend
= src
[0].r_addend
;
1868 BFD_ASSERT(src
[1].r_addend
== 0);
1869 BFD_ASSERT(src
[2].r_addend
== 0);
1871 mirela
.r_type2
= ELF64_MIPS_R_TYPE (src
[1].r_info
);
1872 mirela
.r_ssym
= ELF64_MIPS_R_SSYM (src
[1].r_info
);
1873 mirela
.r_type3
= ELF64_MIPS_R_TYPE (src
[2].r_info
);
1875 mips_elf64_swap_reloca_out (abfd
, &mirela
,
1876 (Elf64_Mips_External_Rela
*) dst
);
1879 /* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a
1880 dangerous relocation. */
1883 mips_elf64_assign_gp (bfd
*output_bfd
, bfd_vma
*pgp
)
1889 /* If we've already figured out what GP will be, just return it. */
1890 *pgp
= _bfd_get_gp_value (output_bfd
);
1894 count
= bfd_get_symcount (output_bfd
);
1895 sym
= bfd_get_outsymbols (output_bfd
);
1897 /* The linker script will have created a symbol named `_gp' with the
1898 appropriate value. */
1903 for (i
= 0; i
< count
; i
++, sym
++)
1905 register const char *name
;
1907 name
= bfd_asymbol_name (*sym
);
1908 if (*name
== '_' && strcmp (name
, "_gp") == 0)
1910 *pgp
= bfd_asymbol_value (*sym
);
1911 _bfd_set_gp_value (output_bfd
, *pgp
);
1919 /* Only get the error once. */
1921 _bfd_set_gp_value (output_bfd
, *pgp
);
1928 /* We have to figure out the gp value, so that we can adjust the
1929 symbol value correctly. We look up the symbol _gp in the output
1930 BFD. If we can't find it, we're stuck. We cache it in the ELF
1931 target data. We don't need to adjust the symbol value for an
1932 external symbol if we are producing relocatable output. */
1934 static bfd_reloc_status_type
1935 mips_elf64_final_gp (bfd
*output_bfd
, asymbol
*symbol
, bfd_boolean relocatable
,
1936 char **error_message
, bfd_vma
*pgp
)
1938 if (bfd_is_und_section (symbol
->section
)
1942 return bfd_reloc_undefined
;
1945 *pgp
= _bfd_get_gp_value (output_bfd
);
1948 || (symbol
->flags
& BSF_SECTION_SYM
) != 0))
1952 /* Make up a value. */
1953 *pgp
= symbol
->section
->output_section
->vma
/*+ 0x4000*/;
1954 _bfd_set_gp_value (output_bfd
, *pgp
);
1956 else if (!mips_elf64_assign_gp (output_bfd
, pgp
))
1959 (char *) _("GP relative relocation when _gp not defined");
1960 return bfd_reloc_dangerous
;
1964 return bfd_reloc_ok
;
1967 /* Do a R_MIPS_GPREL16 relocation. This is a 16 bit value which must
1968 become the offset from the gp register. */
1970 static bfd_reloc_status_type
1971 mips_elf64_gprel16_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
1972 void *data
, asection
*input_section
, bfd
*output_bfd
,
1973 char **error_message
)
1975 bfd_boolean relocatable
;
1976 bfd_reloc_status_type ret
;
1979 /* If we're relocating, and this is an external symbol, we don't want
1980 to change anything. */
1981 if (output_bfd
!= NULL
1982 && (symbol
->flags
& BSF_SECTION_SYM
) == 0
1983 && (symbol
->flags
& BSF_LOCAL
) != 0)
1985 reloc_entry
->address
+= input_section
->output_offset
;
1986 return bfd_reloc_ok
;
1989 if (output_bfd
!= NULL
)
1993 relocatable
= FALSE
;
1994 output_bfd
= symbol
->section
->output_section
->owner
;
1997 ret
= mips_elf64_final_gp (output_bfd
, symbol
, relocatable
, error_message
,
1999 if (ret
!= bfd_reloc_ok
)
2002 return _bfd_mips_elf_gprel16_with_gp (abfd
, symbol
, reloc_entry
,
2003 input_section
, relocatable
,
2007 /* Do a R_MIPS_LITERAL relocation. */
2009 static bfd_reloc_status_type
2010 mips_elf64_literal_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
2011 void *data
, asection
*input_section
, bfd
*output_bfd
,
2012 char **error_message
)
2014 bfd_boolean relocatable
;
2015 bfd_reloc_status_type ret
;
2018 /* R_MIPS_LITERAL relocations are defined for local symbols only. */
2019 if (output_bfd
!= NULL
2020 && (symbol
->flags
& BSF_SECTION_SYM
) == 0
2021 && (symbol
->flags
& BSF_LOCAL
) != 0)
2023 *error_message
= (char *)
2024 _("literal relocation occurs for an external symbol");
2025 return bfd_reloc_outofrange
;
2028 /* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */
2029 if (output_bfd
!= NULL
)
2033 relocatable
= FALSE
;
2034 output_bfd
= symbol
->section
->output_section
->owner
;
2037 ret
= mips_elf64_final_gp (output_bfd
, symbol
, relocatable
, error_message
,
2039 if (ret
!= bfd_reloc_ok
)
2042 return _bfd_mips_elf_gprel16_with_gp (abfd
, symbol
, reloc_entry
,
2043 input_section
, relocatable
,
2047 /* Do a R_MIPS_GPREL32 relocation. This is a 32 bit value which must
2048 become the offset from the gp register. */
2050 static bfd_reloc_status_type
2051 mips_elf64_gprel32_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
2052 void *data
, asection
*input_section
, bfd
*output_bfd
,
2053 char **error_message
)
2055 bfd_boolean relocatable
;
2056 bfd_reloc_status_type ret
;
2061 /* R_MIPS_GPREL32 relocations are defined for local symbols only. */
2062 if (output_bfd
!= NULL
2063 && (symbol
->flags
& BSF_SECTION_SYM
) == 0
2064 && (symbol
->flags
& BSF_LOCAL
) != 0)
2066 *error_message
= (char *)
2067 _("32bits gp relative relocation occurs for an external symbol");
2068 return bfd_reloc_outofrange
;
2071 if (output_bfd
!= NULL
)
2075 relocatable
= FALSE
;
2076 output_bfd
= symbol
->section
->output_section
->owner
;
2079 ret
= mips_elf64_final_gp (output_bfd
, symbol
, relocatable
,
2080 error_message
, &gp
);
2081 if (ret
!= bfd_reloc_ok
)
2084 if (bfd_is_com_section (symbol
->section
))
2087 relocation
= symbol
->value
;
2089 relocation
+= symbol
->section
->output_section
->vma
;
2090 relocation
+= symbol
->section
->output_offset
;
2092 if (reloc_entry
->address
> bfd_get_section_limit (abfd
, input_section
))
2093 return bfd_reloc_outofrange
;
2095 /* Set val to the offset into the section or symbol. */
2096 val
= reloc_entry
->addend
;
2098 if (reloc_entry
->howto
->partial_inplace
)
2099 val
+= bfd_get_32 (abfd
, (bfd_byte
*) data
+ reloc_entry
->address
);
2101 /* Adjust val for the final section location and GP value. If we
2102 are producing relocatable output, we don't want to do this for
2103 an external symbol. */
2105 || (symbol
->flags
& BSF_SECTION_SYM
) != 0)
2106 val
+= relocation
- gp
;
2108 if (reloc_entry
->howto
->partial_inplace
)
2109 bfd_put_32 (abfd
, val
, (bfd_byte
*) data
+ reloc_entry
->address
);
2111 reloc_entry
->addend
= val
;
2114 reloc_entry
->address
+= input_section
->output_offset
;
2116 return bfd_reloc_ok
;
2119 /* Do a R_MIPS_SHIFT6 relocation. The MSB of the shift is stored at bit 2,
2120 the rest is at bits 6-10. The bitpos already got right by the howto. */
2122 static bfd_reloc_status_type
2123 mips_elf64_shift6_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
2124 void *data
, asection
*input_section
, bfd
*output_bfd
,
2125 char **error_message
)
2127 if (reloc_entry
->howto
->partial_inplace
)
2129 reloc_entry
->addend
= ((reloc_entry
->addend
& 0x00007c0)
2130 | (reloc_entry
->addend
& 0x00000800) >> 9);
2133 return _bfd_mips_elf_generic_reloc (abfd
, reloc_entry
, symbol
, data
,
2134 input_section
, output_bfd
,
2138 /* Handle a mips16 GP relative reloc. */
2140 static bfd_reloc_status_type
2141 mips16_gprel_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
2142 void *data
, asection
*input_section
, bfd
*output_bfd
,
2143 char **error_message
)
2145 bfd_boolean relocatable
;
2146 bfd_reloc_status_type ret
;
2150 /* If we're relocating, and this is an external symbol, we don't want
2151 to change anything. */
2152 if (output_bfd
!= NULL
2153 && (symbol
->flags
& BSF_SECTION_SYM
) == 0
2154 && (symbol
->flags
& BSF_LOCAL
) != 0)
2156 reloc_entry
->address
+= input_section
->output_offset
;
2157 return bfd_reloc_ok
;
2160 if (output_bfd
!= NULL
)
2164 relocatable
= FALSE
;
2165 output_bfd
= symbol
->section
->output_section
->owner
;
2168 ret
= mips_elf64_final_gp (output_bfd
, symbol
, relocatable
, error_message
,
2170 if (ret
!= bfd_reloc_ok
)
2173 location
= (bfd_byte
*) data
+ reloc_entry
->address
;
2174 _bfd_mips16_elf_reloc_unshuffle (abfd
, reloc_entry
->howto
->type
, FALSE
,
2176 ret
= _bfd_mips_elf_gprel16_with_gp (abfd
, symbol
, reloc_entry
,
2177 input_section
, relocatable
,
2179 _bfd_mips16_elf_reloc_shuffle (abfd
, reloc_entry
->howto
->type
, !relocatable
,
2185 /* A mapping from BFD reloc types to MIPS ELF reloc types. */
2187 struct elf_reloc_map
{
2188 bfd_reloc_code_real_type bfd_val
;
2189 enum elf_mips_reloc_type elf_val
;
2192 static const struct elf_reloc_map mips_reloc_map
[] =
2194 { BFD_RELOC_NONE
, R_MIPS_NONE
},
2195 { BFD_RELOC_16
, R_MIPS_16
},
2196 { BFD_RELOC_32
, R_MIPS_32
},
2197 /* There is no BFD reloc for R_MIPS_REL32. */
2198 { BFD_RELOC_64
, R_MIPS_64
},
2199 { BFD_RELOC_CTOR
, R_MIPS_64
},
2200 { BFD_RELOC_16_PCREL_S2
, R_MIPS_PC16
},
2201 { BFD_RELOC_HI16_S
, R_MIPS_HI16
},
2202 { BFD_RELOC_LO16
, R_MIPS_LO16
},
2203 { BFD_RELOC_GPREL16
, R_MIPS_GPREL16
},
2204 { BFD_RELOC_GPREL32
, R_MIPS_GPREL32
},
2205 { BFD_RELOC_MIPS_JMP
, R_MIPS_26
},
2206 { BFD_RELOC_MIPS_LITERAL
, R_MIPS_LITERAL
},
2207 { BFD_RELOC_MIPS_GOT16
, R_MIPS_GOT16
},
2208 { BFD_RELOC_MIPS_CALL16
, R_MIPS_CALL16
},
2209 { BFD_RELOC_MIPS_SHIFT5
, R_MIPS_SHIFT5
},
2210 { BFD_RELOC_MIPS_SHIFT6
, R_MIPS_SHIFT6
},
2211 { BFD_RELOC_MIPS_GOT_DISP
, R_MIPS_GOT_DISP
},
2212 { BFD_RELOC_MIPS_GOT_PAGE
, R_MIPS_GOT_PAGE
},
2213 { BFD_RELOC_MIPS_GOT_OFST
, R_MIPS_GOT_OFST
},
2214 { BFD_RELOC_MIPS_GOT_HI16
, R_MIPS_GOT_HI16
},
2215 { BFD_RELOC_MIPS_GOT_LO16
, R_MIPS_GOT_LO16
},
2216 { BFD_RELOC_MIPS_SUB
, R_MIPS_SUB
},
2217 { BFD_RELOC_MIPS_INSERT_A
, R_MIPS_INSERT_A
},
2218 { BFD_RELOC_MIPS_INSERT_B
, R_MIPS_INSERT_B
},
2219 { BFD_RELOC_MIPS_DELETE
, R_MIPS_DELETE
},
2220 { BFD_RELOC_MIPS_HIGHEST
, R_MIPS_HIGHEST
},
2221 { BFD_RELOC_MIPS_HIGHER
, R_MIPS_HIGHER
},
2222 { BFD_RELOC_MIPS_CALL_HI16
, R_MIPS_CALL_HI16
},
2223 { BFD_RELOC_MIPS_CALL_LO16
, R_MIPS_CALL_LO16
},
2224 { BFD_RELOC_MIPS_SCN_DISP
, R_MIPS_SCN_DISP
},
2225 { BFD_RELOC_MIPS_REL16
, R_MIPS_REL16
},
2226 /* Use of R_MIPS_ADD_IMMEDIATE and R_MIPS_PJUMP is deprecated. */
2227 { BFD_RELOC_MIPS_RELGOT
, R_MIPS_RELGOT
},
2228 { BFD_RELOC_MIPS_JALR
, R_MIPS_JALR
},
2229 { BFD_RELOC_MIPS_TLS_DTPMOD32
, R_MIPS_TLS_DTPMOD32
},
2230 { BFD_RELOC_MIPS_TLS_DTPREL32
, R_MIPS_TLS_DTPREL32
},
2231 { BFD_RELOC_MIPS_TLS_DTPMOD64
, R_MIPS_TLS_DTPMOD64
},
2232 { BFD_RELOC_MIPS_TLS_DTPREL64
, R_MIPS_TLS_DTPREL64
},
2233 { BFD_RELOC_MIPS_TLS_GD
, R_MIPS_TLS_GD
},
2234 { BFD_RELOC_MIPS_TLS_LDM
, R_MIPS_TLS_LDM
},
2235 { BFD_RELOC_MIPS_TLS_DTPREL_HI16
, R_MIPS_TLS_DTPREL_HI16
},
2236 { BFD_RELOC_MIPS_TLS_DTPREL_LO16
, R_MIPS_TLS_DTPREL_LO16
},
2237 { BFD_RELOC_MIPS_TLS_GOTTPREL
, R_MIPS_TLS_GOTTPREL
},
2238 { BFD_RELOC_MIPS_TLS_TPREL32
, R_MIPS_TLS_TPREL32
},
2239 { BFD_RELOC_MIPS_TLS_TPREL64
, R_MIPS_TLS_TPREL64
},
2240 { BFD_RELOC_MIPS_TLS_TPREL_HI16
, R_MIPS_TLS_TPREL_HI16
},
2241 { BFD_RELOC_MIPS_TLS_TPREL_LO16
, R_MIPS_TLS_TPREL_LO16
}
2244 static const struct elf_reloc_map mips16_reloc_map
[] =
2246 { BFD_RELOC_MIPS16_JMP
, R_MIPS16_26
- R_MIPS16_min
},
2247 { BFD_RELOC_MIPS16_GPREL
, R_MIPS16_GPREL
- R_MIPS16_min
},
2248 { BFD_RELOC_MIPS16_GOT16
, R_MIPS16_GOT16
- R_MIPS16_min
},
2249 { BFD_RELOC_MIPS16_CALL16
, R_MIPS16_CALL16
- R_MIPS16_min
},
2250 { BFD_RELOC_MIPS16_HI16_S
, R_MIPS16_HI16
- R_MIPS16_min
},
2251 { BFD_RELOC_MIPS16_LO16
, R_MIPS16_LO16
- R_MIPS16_min
},
2254 /* Given a BFD reloc type, return a howto structure. */
2256 static reloc_howto_type
*
2257 bfd_elf64_bfd_reloc_type_lookup (bfd
*abfd ATTRIBUTE_UNUSED
,
2258 bfd_reloc_code_real_type code
)
2261 /* FIXME: We default to RELA here instead of choosing the right
2262 relocation variant. */
2263 reloc_howto_type
*howto_table
= mips_elf64_howto_table_rela
;
2264 reloc_howto_type
*howto16_table
= mips16_elf64_howto_table_rela
;
2266 for (i
= 0; i
< sizeof (mips_reloc_map
) / sizeof (struct elf_reloc_map
);
2269 if (mips_reloc_map
[i
].bfd_val
== code
)
2270 return &howto_table
[(int) mips_reloc_map
[i
].elf_val
];
2273 for (i
= 0; i
< sizeof (mips16_reloc_map
) / sizeof (struct elf_reloc_map
);
2276 if (mips16_reloc_map
[i
].bfd_val
== code
)
2277 return &howto16_table
[(int) mips16_reloc_map
[i
].elf_val
];
2282 case BFD_RELOC_VTABLE_INHERIT
:
2283 return &elf_mips_gnu_vtinherit_howto
;
2284 case BFD_RELOC_VTABLE_ENTRY
:
2285 return &elf_mips_gnu_vtentry_howto
;
2287 bfd_set_error (bfd_error_bad_value
);
2292 static reloc_howto_type
*
2293 bfd_elf64_bfd_reloc_name_lookup (bfd
*abfd ATTRIBUTE_UNUSED
,
2299 i
< (sizeof (mips_elf64_howto_table_rela
)
2300 / sizeof (mips_elf64_howto_table_rela
[0])); i
++)
2301 if (mips_elf64_howto_table_rela
[i
].name
!= NULL
2302 && strcasecmp (mips_elf64_howto_table_rela
[i
].name
, r_name
) == 0)
2303 return &mips_elf64_howto_table_rela
[i
];
2306 i
< (sizeof (mips16_elf64_howto_table_rela
)
2307 / sizeof (mips16_elf64_howto_table_rela
[0]));
2309 if (mips16_elf64_howto_table_rela
[i
].name
!= NULL
2310 && strcasecmp (mips16_elf64_howto_table_rela
[i
].name
, r_name
) == 0)
2311 return &mips16_elf64_howto_table_rela
[i
];
2313 if (strcasecmp (elf_mips_gnu_vtinherit_howto
.name
, r_name
) == 0)
2314 return &elf_mips_gnu_vtinherit_howto
;
2315 if (strcasecmp (elf_mips_gnu_vtentry_howto
.name
, r_name
) == 0)
2316 return &elf_mips_gnu_vtentry_howto
;
2317 if (strcasecmp (elf_mips_gnu_rel16_s2
.name
, r_name
) == 0)
2318 return &elf_mips_gnu_rel16_s2
;
2319 if (strcasecmp (elf_mips_gnu_rela16_s2
.name
, r_name
) == 0)
2320 return &elf_mips_gnu_rela16_s2
;
2325 /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
2327 static reloc_howto_type
*
2328 mips_elf64_rtype_to_howto (unsigned int r_type
, bfd_boolean rela_p
)
2332 case R_MIPS_GNU_VTINHERIT
:
2333 return &elf_mips_gnu_vtinherit_howto
;
2334 case R_MIPS_GNU_VTENTRY
:
2335 return &elf_mips_gnu_vtentry_howto
;
2336 case R_MIPS_GNU_REL16_S2
:
2338 return &elf_mips_gnu_rela16_s2
;
2340 return &elf_mips_gnu_rel16_s2
;
2342 if (r_type
>= R_MIPS16_min
&& r_type
< R_MIPS16_max
)
2345 return &mips16_elf64_howto_table_rela
[r_type
- R_MIPS16_min
];
2347 return &mips16_elf64_howto_table_rel
[r_type
- R_MIPS16_min
];
2349 BFD_ASSERT (r_type
< (unsigned int) R_MIPS_max
);
2351 return &mips_elf64_howto_table_rela
[r_type
];
2353 return &mips_elf64_howto_table_rel
[r_type
];
2358 /* Prevent relocation handling by bfd for MIPS ELF64. */
2361 mips_elf64_info_to_howto_rel (bfd
*abfd ATTRIBUTE_UNUSED
,
2362 arelent
*cache_ptr ATTRIBUTE_UNUSED
,
2363 Elf_Internal_Rela
*dst ATTRIBUTE_UNUSED
)
2369 mips_elf64_info_to_howto_rela (bfd
*abfd ATTRIBUTE_UNUSED
,
2370 arelent
*cache_ptr ATTRIBUTE_UNUSED
,
2371 Elf_Internal_Rela
*dst ATTRIBUTE_UNUSED
)
2376 /* Since each entry in an SHT_REL or SHT_RELA section can represent up
2377 to three relocs, we must tell the user to allocate more space. */
2380 mips_elf64_get_reloc_upper_bound (bfd
*abfd ATTRIBUTE_UNUSED
, asection
*sec
)
2382 return (sec
->reloc_count
* 3 + 1) * sizeof (arelent
*);
2386 mips_elf64_get_dynamic_reloc_upper_bound (bfd
*abfd
)
2388 return _bfd_elf_get_dynamic_reloc_upper_bound (abfd
) * 3;
2391 /* We must also copy more relocations than the corresponding functions
2392 in elf.c would, so the two following functions are slightly
2393 modified from elf.c, that multiply the external relocation count by
2394 3 to obtain the internal relocation count. */
2397 mips_elf64_canonicalize_reloc (bfd
*abfd
, sec_ptr section
,
2398 arelent
**relptr
, asymbol
**symbols
)
2402 const struct elf_backend_data
*bed
= get_elf_backend_data (abfd
);
2404 if (! bed
->s
->slurp_reloc_table (abfd
, section
, symbols
, FALSE
))
2407 tblptr
= section
->relocation
;
2408 for (i
= 0; i
< section
->reloc_count
* 3; i
++)
2409 *relptr
++ = tblptr
++;
2413 return section
->reloc_count
* 3;
2417 mips_elf64_canonicalize_dynamic_reloc (bfd
*abfd
, arelent
**storage
,
2420 bfd_boolean (*slurp_relocs
) (bfd
*, asection
*, asymbol
**, bfd_boolean
);
2424 if (elf_dynsymtab (abfd
) == 0)
2426 bfd_set_error (bfd_error_invalid_operation
);
2430 slurp_relocs
= get_elf_backend_data (abfd
)->s
->slurp_reloc_table
;
2432 for (s
= abfd
->sections
; s
!= NULL
; s
= s
->next
)
2434 if (elf_section_data (s
)->this_hdr
.sh_link
== elf_dynsymtab (abfd
)
2435 && (elf_section_data (s
)->this_hdr
.sh_type
== SHT_REL
2436 || elf_section_data (s
)->this_hdr
.sh_type
== SHT_RELA
))
2441 if (! (*slurp_relocs
) (abfd
, s
, syms
, TRUE
))
2443 count
= s
->size
/ elf_section_data (s
)->this_hdr
.sh_entsize
* 3;
2445 for (i
= 0; i
< count
; i
++)
2456 /* Read the relocations from one reloc section. This is mostly copied
2457 from elfcode.h, except for the changes to expand one external
2458 relocation to 3 internal ones. We must unfortunately set
2459 reloc_count to the number of external relocations, because a lot of
2460 generic code seems to depend on this. */
2463 mips_elf64_slurp_one_reloc_table (bfd
*abfd
, asection
*asect
,
2464 Elf_Internal_Shdr
*rel_hdr
,
2465 bfd_size_type reloc_count
,
2466 arelent
*relents
, asymbol
**symbols
,
2467 bfd_boolean dynamic
)
2470 bfd_byte
*native_relocs
;
2476 allocated
= bfd_malloc (rel_hdr
->sh_size
);
2477 if (allocated
== NULL
)
2480 if (bfd_seek (abfd
, rel_hdr
->sh_offset
, SEEK_SET
) != 0
2481 || (bfd_bread (allocated
, rel_hdr
->sh_size
, abfd
)
2482 != rel_hdr
->sh_size
))
2485 native_relocs
= allocated
;
2487 entsize
= rel_hdr
->sh_entsize
;
2488 BFD_ASSERT (entsize
== sizeof (Elf64_Mips_External_Rel
)
2489 || entsize
== sizeof (Elf64_Mips_External_Rela
));
2491 if (entsize
== sizeof (Elf64_Mips_External_Rel
))
2496 for (i
= 0, relent
= relents
;
2498 i
++, native_relocs
+= entsize
)
2500 Elf64_Mips_Internal_Rela rela
;
2501 bfd_boolean used_sym
, used_ssym
;
2504 if (entsize
== sizeof (Elf64_Mips_External_Rela
))
2505 mips_elf64_swap_reloca_in (abfd
,
2506 (Elf64_Mips_External_Rela
*) native_relocs
,
2509 mips_elf64_swap_reloc_in (abfd
,
2510 (Elf64_Mips_External_Rel
*) native_relocs
,
2513 /* Each entry represents exactly three actual relocations. */
2517 for (ir
= 0; ir
< 3; ir
++)
2519 enum elf_mips_reloc_type type
;
2526 type
= (enum elf_mips_reloc_type
) rela
.r_type
;
2529 type
= (enum elf_mips_reloc_type
) rela
.r_type2
;
2532 type
= (enum elf_mips_reloc_type
) rela
.r_type3
;
2536 /* Some types require symbols, whereas some do not. */
2540 case R_MIPS_LITERAL
:
2541 case R_MIPS_INSERT_A
:
2542 case R_MIPS_INSERT_B
:
2544 relent
->sym_ptr_ptr
= bfd_abs_section_ptr
->symbol_ptr_ptr
;
2550 if (rela
.r_sym
== 0)
2551 relent
->sym_ptr_ptr
= bfd_abs_section_ptr
->symbol_ptr_ptr
;
2556 ps
= symbols
+ rela
.r_sym
- 1;
2558 if ((s
->flags
& BSF_SECTION_SYM
) == 0)
2559 relent
->sym_ptr_ptr
= ps
;
2561 relent
->sym_ptr_ptr
= s
->section
->symbol_ptr_ptr
;
2566 else if (! used_ssym
)
2568 switch (rela
.r_ssym
)
2571 relent
->sym_ptr_ptr
=
2572 bfd_abs_section_ptr
->symbol_ptr_ptr
;
2578 /* FIXME: I think these need to be handled using
2579 special howto structures. */
2591 relent
->sym_ptr_ptr
= bfd_abs_section_ptr
->symbol_ptr_ptr
;
2596 /* The address of an ELF reloc is section relative for an
2597 object file, and absolute for an executable file or
2598 shared library. The address of a BFD reloc is always
2599 section relative. */
2600 if ((abfd
->flags
& (EXEC_P
| DYNAMIC
)) == 0 || dynamic
)
2601 relent
->address
= rela
.r_offset
;
2603 relent
->address
= rela
.r_offset
- asect
->vma
;
2605 relent
->addend
= rela
.r_addend
;
2607 relent
->howto
= mips_elf64_rtype_to_howto (type
, rela_p
);
2613 asect
->reloc_count
+= (relent
- relents
) / 3;
2615 if (allocated
!= NULL
)
2621 if (allocated
!= NULL
)
2626 /* Read the relocations. On Irix 6, there can be two reloc sections
2627 associated with a single data section. This is copied from
2628 elfcode.h as well, with changes as small as accounting for 3
2629 internal relocs per external reloc and resetting reloc_count to
2630 zero before processing the relocs of a section. */
2633 mips_elf64_slurp_reloc_table (bfd
*abfd
, asection
*asect
,
2634 asymbol
**symbols
, bfd_boolean dynamic
)
2636 struct bfd_elf_section_data
* const d
= elf_section_data (asect
);
2637 Elf_Internal_Shdr
*rel_hdr
;
2638 Elf_Internal_Shdr
*rel_hdr2
;
2639 bfd_size_type reloc_count
;
2640 bfd_size_type reloc_count2
;
2644 if (asect
->relocation
!= NULL
)
2649 if ((asect
->flags
& SEC_RELOC
) == 0
2650 || asect
->reloc_count
== 0)
2653 rel_hdr
= &d
->rel_hdr
;
2654 reloc_count
= NUM_SHDR_ENTRIES (rel_hdr
);
2655 rel_hdr2
= d
->rel_hdr2
;
2656 reloc_count2
= (rel_hdr2
? NUM_SHDR_ENTRIES (rel_hdr2
) : 0);
2658 BFD_ASSERT (asect
->reloc_count
== reloc_count
+ reloc_count2
);
2659 BFD_ASSERT (asect
->rel_filepos
== rel_hdr
->sh_offset
2660 || (rel_hdr2
&& asect
->rel_filepos
== rel_hdr2
->sh_offset
));
2665 /* Note that ASECT->RELOC_COUNT tends not to be accurate in this
2666 case because relocations against this section may use the
2667 dynamic symbol table, and in that case bfd_section_from_shdr
2668 in elf.c does not update the RELOC_COUNT. */
2669 if (asect
->size
== 0)
2672 rel_hdr
= &d
->this_hdr
;
2673 reloc_count
= NUM_SHDR_ENTRIES (rel_hdr
);
2678 /* Allocate space for 3 arelent structures for each Rel structure. */
2679 amt
= (reloc_count
+ reloc_count2
) * 3 * sizeof (arelent
);
2680 relents
= bfd_alloc (abfd
, amt
);
2681 if (relents
== NULL
)
2684 /* The slurp_one_reloc_table routine increments reloc_count. */
2685 asect
->reloc_count
= 0;
2687 if (! mips_elf64_slurp_one_reloc_table (abfd
, asect
,
2688 rel_hdr
, reloc_count
,
2692 if (d
->rel_hdr2
!= NULL
)
2694 if (! mips_elf64_slurp_one_reloc_table (abfd
, asect
,
2695 rel_hdr2
, reloc_count2
,
2696 relents
+ reloc_count
* 3,
2701 asect
->relocation
= relents
;
2705 /* Write out the relocations. */
2708 mips_elf64_write_relocs (bfd
*abfd
, asection
*sec
, void *data
)
2710 bfd_boolean
*failedp
= data
;
2712 Elf_Internal_Shdr
*rel_hdr
;
2715 /* If we have already failed, don't do anything. */
2719 if ((sec
->flags
& SEC_RELOC
) == 0)
2722 /* The linker backend writes the relocs out itself, and sets the
2723 reloc_count field to zero to inhibit writing them here. Also,
2724 sometimes the SEC_RELOC flag gets set even when there aren't any
2726 if (sec
->reloc_count
== 0)
2729 /* We can combine up to three relocs that refer to the same address
2730 if the latter relocs have no associated symbol. */
2732 for (idx
= 0; idx
< sec
->reloc_count
; idx
++)
2739 addr
= sec
->orelocation
[idx
]->address
;
2740 for (i
= 0; i
< 2; i
++)
2744 if (idx
+ 1 >= sec
->reloc_count
)
2746 r
= sec
->orelocation
[idx
+ 1];
2747 if (r
->address
!= addr
2748 || ! bfd_is_abs_section ((*r
->sym_ptr_ptr
)->section
)
2749 || (*r
->sym_ptr_ptr
)->value
!= 0)
2752 /* We can merge the reloc at IDX + 1 with the reloc at IDX. */
2758 rel_hdr
= &elf_section_data (sec
)->rel_hdr
;
2760 /* Do the actual relocation. */
2762 if (rel_hdr
->sh_entsize
== sizeof(Elf64_Mips_External_Rel
))
2763 mips_elf64_write_rel (abfd
, sec
, rel_hdr
, &count
, data
);
2764 else if (rel_hdr
->sh_entsize
== sizeof(Elf64_Mips_External_Rela
))
2765 mips_elf64_write_rela (abfd
, sec
, rel_hdr
, &count
, data
);
2771 mips_elf64_write_rel (bfd
*abfd
, asection
*sec
,
2772 Elf_Internal_Shdr
*rel_hdr
,
2773 int *count
, void *data
)
2775 bfd_boolean
*failedp
= data
;
2776 Elf64_Mips_External_Rel
*ext_rel
;
2778 asymbol
*last_sym
= 0;
2779 int last_sym_idx
= 0;
2781 rel_hdr
->sh_size
= rel_hdr
->sh_entsize
* *count
;
2782 rel_hdr
->contents
= bfd_alloc (abfd
, rel_hdr
->sh_size
);
2783 if (rel_hdr
->contents
== NULL
)
2789 ext_rel
= (Elf64_Mips_External_Rel
*) rel_hdr
->contents
;
2790 for (idx
= 0; idx
< sec
->reloc_count
; idx
++, ext_rel
++)
2793 Elf64_Mips_Internal_Rela int_rel
;
2798 ptr
= sec
->orelocation
[idx
];
2800 /* The address of an ELF reloc is section relative for an object
2801 file, and absolute for an executable file or shared library.
2802 The address of a BFD reloc is always section relative. */
2803 if ((abfd
->flags
& (EXEC_P
| DYNAMIC
)) == 0)
2804 int_rel
.r_offset
= ptr
->address
;
2806 int_rel
.r_offset
= ptr
->address
+ sec
->vma
;
2808 sym
= *ptr
->sym_ptr_ptr
;
2809 if (sym
== last_sym
)
2811 else if (bfd_is_abs_section (sym
->section
) && sym
->value
== 0)
2816 n
= _bfd_elf_symbol_from_bfd_symbol (abfd
, &sym
);
2826 int_rel
.r_ssym
= RSS_UNDEF
;
2828 if ((*ptr
->sym_ptr_ptr
)->the_bfd
->xvec
!= abfd
->xvec
2829 && ! _bfd_elf_validate_reloc (abfd
, ptr
))
2835 int_rel
.r_type
= ptr
->howto
->type
;
2836 int_rel
.r_type2
= (int) R_MIPS_NONE
;
2837 int_rel
.r_type3
= (int) R_MIPS_NONE
;
2839 for (i
= 0; i
< 2; i
++)
2843 if (idx
+ 1 >= sec
->reloc_count
)
2845 r
= sec
->orelocation
[idx
+ 1];
2846 if (r
->address
!= ptr
->address
2847 || ! bfd_is_abs_section ((*r
->sym_ptr_ptr
)->section
)
2848 || (*r
->sym_ptr_ptr
)->value
!= 0)
2851 /* We can merge the reloc at IDX + 1 with the reloc at IDX. */
2854 int_rel
.r_type2
= r
->howto
->type
;
2856 int_rel
.r_type3
= r
->howto
->type
;
2861 mips_elf64_swap_reloc_out (abfd
, &int_rel
, ext_rel
);
2864 BFD_ASSERT (ext_rel
- (Elf64_Mips_External_Rel
*) rel_hdr
->contents
2869 mips_elf64_write_rela (bfd
*abfd
, asection
*sec
,
2870 Elf_Internal_Shdr
*rela_hdr
,
2871 int *count
, void *data
)
2873 bfd_boolean
*failedp
= data
;
2874 Elf64_Mips_External_Rela
*ext_rela
;
2876 asymbol
*last_sym
= 0;
2877 int last_sym_idx
= 0;
2879 rela_hdr
->sh_size
= rela_hdr
->sh_entsize
* *count
;
2880 rela_hdr
->contents
= bfd_alloc (abfd
, rela_hdr
->sh_size
);
2881 if (rela_hdr
->contents
== NULL
)
2887 ext_rela
= (Elf64_Mips_External_Rela
*) rela_hdr
->contents
;
2888 for (idx
= 0; idx
< sec
->reloc_count
; idx
++, ext_rela
++)
2891 Elf64_Mips_Internal_Rela int_rela
;
2896 ptr
= sec
->orelocation
[idx
];
2898 /* The address of an ELF reloc is section relative for an object
2899 file, and absolute for an executable file or shared library.
2900 The address of a BFD reloc is always section relative. */
2901 if ((abfd
->flags
& (EXEC_P
| DYNAMIC
)) == 0)
2902 int_rela
.r_offset
= ptr
->address
;
2904 int_rela
.r_offset
= ptr
->address
+ sec
->vma
;
2906 sym
= *ptr
->sym_ptr_ptr
;
2907 if (sym
== last_sym
)
2909 else if (bfd_is_abs_section (sym
->section
) && sym
->value
== 0)
2914 n
= _bfd_elf_symbol_from_bfd_symbol (abfd
, &sym
);
2924 int_rela
.r_addend
= ptr
->addend
;
2925 int_rela
.r_ssym
= RSS_UNDEF
;
2927 if ((*ptr
->sym_ptr_ptr
)->the_bfd
->xvec
!= abfd
->xvec
2928 && ! _bfd_elf_validate_reloc (abfd
, ptr
))
2934 int_rela
.r_type
= ptr
->howto
->type
;
2935 int_rela
.r_type2
= (int) R_MIPS_NONE
;
2936 int_rela
.r_type3
= (int) R_MIPS_NONE
;
2938 for (i
= 0; i
< 2; i
++)
2942 if (idx
+ 1 >= sec
->reloc_count
)
2944 r
= sec
->orelocation
[idx
+ 1];
2945 if (r
->address
!= ptr
->address
2946 || ! bfd_is_abs_section ((*r
->sym_ptr_ptr
)->section
)
2947 || (*r
->sym_ptr_ptr
)->value
!= 0)
2950 /* We can merge the reloc at IDX + 1 with the reloc at IDX. */
2953 int_rela
.r_type2
= r
->howto
->type
;
2955 int_rela
.r_type3
= r
->howto
->type
;
2960 mips_elf64_swap_reloca_out (abfd
, &int_rela
, ext_rela
);
2963 BFD_ASSERT (ext_rela
- (Elf64_Mips_External_Rela
*) rela_hdr
->contents
2967 /* Set the right machine number for a MIPS ELF file. */
2970 mips_elf64_object_p (bfd
*abfd
)
2974 /* Irix 6 is broken. Object file symbol tables are not always
2975 sorted correctly such that local symbols precede global symbols,
2976 and the sh_info field in the symbol table is not always right. */
2977 if (elf64_mips_irix_compat (abfd
) != ict_none
)
2978 elf_bad_symtab (abfd
) = TRUE
;
2980 mach
= _bfd_elf_mips_mach (elf_elfheader (abfd
)->e_flags
);
2981 bfd_default_set_arch_mach (abfd
, bfd_arch_mips
, mach
);
2985 /* Depending on the target vector we generate some version of Irix
2986 executables or "normal" MIPS ELF ABI executables. */
2987 static irix_compat_t
2988 elf64_mips_irix_compat (bfd
*abfd
)
2990 if ((abfd
->xvec
== &bfd_elf64_bigmips_vec
)
2991 || (abfd
->xvec
== &bfd_elf64_littlemips_vec
))
2997 /* Support for core dump NOTE sections. */
2999 elf64_mips_grok_prstatus (bfd
*abfd
, Elf_Internal_Note
*note
)
3004 switch (note
->descsz
)
3009 case 480: /* Linux/MIPS - N64 kernel */
3011 elf_tdata (abfd
)->core_signal
= bfd_get_16 (abfd
, note
->descdata
+ 12);
3014 elf_tdata (abfd
)->core_pid
= bfd_get_32 (abfd
, note
->descdata
+ 32);
3023 /* Make a ".reg/999" section. */
3024 return _bfd_elfcore_make_pseudosection (abfd
, ".reg",
3025 size
, note
->descpos
+ offset
);
3029 elf64_mips_grok_psinfo (bfd
*abfd
, Elf_Internal_Note
*note
)
3031 switch (note
->descsz
)
3036 case 136: /* Linux/MIPS - N64 kernel elf_prpsinfo */
3037 elf_tdata (abfd
)->core_program
3038 = _bfd_elfcore_strndup (abfd
, note
->descdata
+ 40, 16);
3039 elf_tdata (abfd
)->core_command
3040 = _bfd_elfcore_strndup (abfd
, note
->descdata
+ 56, 80);
3043 /* Note that for some reason, a spurious space is tacked
3044 onto the end of the args in some (at least one anyway)
3045 implementations, so strip it off if it exists. */
3048 char *command
= elf_tdata (abfd
)->core_command
;
3049 int n
= strlen (command
);
3051 if (0 < n
&& command
[n
- 1] == ' ')
3052 command
[n
- 1] = '\0';
3058 /* ECOFF swapping routines. These are used when dealing with the
3059 .mdebug section, which is in the ECOFF debugging format. */
3060 static const struct ecoff_debug_swap mips_elf64_ecoff_debug_swap
=
3062 /* Symbol table magic number. */
3064 /* Alignment of debugging information. E.g., 4. */
3066 /* Sizes of external symbolic information. */
3067 sizeof (struct hdr_ext
),
3068 sizeof (struct dnr_ext
),
3069 sizeof (struct pdr_ext
),
3070 sizeof (struct sym_ext
),
3071 sizeof (struct opt_ext
),
3072 sizeof (struct fdr_ext
),
3073 sizeof (struct rfd_ext
),
3074 sizeof (struct ext_ext
),
3075 /* Functions to swap in external symbolic data. */
3084 _bfd_ecoff_swap_tir_in
,
3085 _bfd_ecoff_swap_rndx_in
,
3086 /* Functions to swap out external symbolic data. */
3095 _bfd_ecoff_swap_tir_out
,
3096 _bfd_ecoff_swap_rndx_out
,
3097 /* Function to read in symbolic data. */
3098 _bfd_mips_elf_read_ecoff_info
3101 /* Relocations in the 64 bit MIPS ELF ABI are more complex than in
3102 standard ELF. This structure is used to redirect the relocation
3103 handling routines. */
3105 const struct elf_size_info mips_elf64_size_info
=
3107 sizeof (Elf64_External_Ehdr
),
3108 sizeof (Elf64_External_Phdr
),
3109 sizeof (Elf64_External_Shdr
),
3110 sizeof (Elf64_Mips_External_Rel
),
3111 sizeof (Elf64_Mips_External_Rela
),
3112 sizeof (Elf64_External_Sym
),
3113 sizeof (Elf64_External_Dyn
),
3114 sizeof (Elf_External_Note
),
3115 4, /* hash-table entry size */
3116 3, /* internal relocations per external relocations */
3118 3, /* log_file_align */
3121 bfd_elf64_write_out_phdrs
,
3122 bfd_elf64_write_shdrs_and_ehdr
,
3123 bfd_elf64_checksum_contents
,
3124 mips_elf64_write_relocs
,
3125 bfd_elf64_swap_symbol_in
,
3126 bfd_elf64_swap_symbol_out
,
3127 mips_elf64_slurp_reloc_table
,
3128 bfd_elf64_slurp_symbol_table
,
3129 bfd_elf64_swap_dyn_in
,
3130 bfd_elf64_swap_dyn_out
,
3131 mips_elf64_be_swap_reloc_in
,
3132 mips_elf64_be_swap_reloc_out
,
3133 mips_elf64_be_swap_reloca_in
,
3134 mips_elf64_be_swap_reloca_out
3137 #define ELF_ARCH bfd_arch_mips
3138 #define ELF_MACHINE_CODE EM_MIPS
3140 #define elf_backend_collect TRUE
3141 #define elf_backend_type_change_ok TRUE
3142 #define elf_backend_can_gc_sections TRUE
3143 #define elf_info_to_howto mips_elf64_info_to_howto_rela
3144 #define elf_info_to_howto_rel mips_elf64_info_to_howto_rel
3145 #define elf_backend_object_p mips_elf64_object_p
3146 #define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing
3147 #define elf_backend_section_processing _bfd_mips_elf_section_processing
3148 #define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr
3149 #define elf_backend_fake_sections _bfd_mips_elf_fake_sections
3150 #define elf_backend_section_from_bfd_section \
3151 _bfd_mips_elf_section_from_bfd_section
3152 #define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook
3153 #define elf_backend_link_output_symbol_hook \
3154 _bfd_mips_elf_link_output_symbol_hook
3155 #define elf_backend_create_dynamic_sections \
3156 _bfd_mips_elf_create_dynamic_sections
3157 #define elf_backend_check_relocs _bfd_mips_elf_check_relocs
3158 #define elf_backend_merge_symbol_attribute \
3159 _bfd_mips_elf_merge_symbol_attribute
3160 #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag
3161 #define elf_backend_adjust_dynamic_symbol \
3162 _bfd_mips_elf_adjust_dynamic_symbol
3163 #define elf_backend_always_size_sections \
3164 _bfd_mips_elf_always_size_sections
3165 #define elf_backend_size_dynamic_sections \
3166 _bfd_mips_elf_size_dynamic_sections
3167 #define elf_backend_init_index_section _bfd_elf_init_1_index_section
3168 #define elf_backend_relocate_section _bfd_mips_elf_relocate_section
3169 #define elf_backend_finish_dynamic_symbol \
3170 _bfd_mips_elf_finish_dynamic_symbol
3171 #define elf_backend_finish_dynamic_sections \
3172 _bfd_mips_elf_finish_dynamic_sections
3173 #define elf_backend_final_write_processing \
3174 _bfd_mips_elf_final_write_processing
3175 #define elf_backend_additional_program_headers \
3176 _bfd_mips_elf_additional_program_headers
3177 #define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map
3178 #define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook
3179 #define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook
3180 #define elf_backend_copy_indirect_symbol \
3181 _bfd_mips_elf_copy_indirect_symbol
3182 #define elf_backend_ignore_discarded_relocs \
3183 _bfd_mips_elf_ignore_discarded_relocs
3184 #define elf_backend_mips_irix_compat elf64_mips_irix_compat
3185 #define elf_backend_mips_rtype_to_howto mips_elf64_rtype_to_howto
3186 #define elf_backend_ecoff_debug_swap &mips_elf64_ecoff_debug_swap
3187 #define elf_backend_size_info mips_elf64_size_info
3189 #define elf_backend_grok_prstatus elf64_mips_grok_prstatus
3190 #define elf_backend_grok_psinfo elf64_mips_grok_psinfo
3192 #define elf_backend_got_header_size (4 * MIPS_RESERVED_GOTNO)
3194 /* MIPS ELF64 can use a mixture of REL and RELA, but some Relocations
3195 work better/work only in RELA, so we default to this. */
3196 #define elf_backend_may_use_rel_p 1
3197 #define elf_backend_may_use_rela_p 1
3198 #define elf_backend_default_use_rela_p 1
3200 #define elf_backend_sign_extend_vma TRUE
3202 #define elf_backend_write_section _bfd_mips_elf_write_section
3204 /* We don't set bfd_elf64_bfd_is_local_label_name because the 32-bit
3205 MIPS-specific function only applies to IRIX5, which had no 64-bit
3207 #define bfd_elf64_find_nearest_line _bfd_mips_elf_find_nearest_line
3208 #define bfd_elf64_find_inliner_info _bfd_mips_elf_find_inliner_info
3209 #define bfd_elf64_new_section_hook _bfd_mips_elf_new_section_hook
3210 #define bfd_elf64_set_section_contents _bfd_mips_elf_set_section_contents
3211 #define bfd_elf64_bfd_get_relocated_section_contents \
3212 _bfd_elf_mips_get_relocated_section_contents
3213 #define bfd_elf64_bfd_link_hash_table_create \
3214 _bfd_mips_elf_link_hash_table_create
3215 #define bfd_elf64_bfd_final_link _bfd_mips_elf_final_link
3216 #define bfd_elf64_bfd_merge_private_bfd_data \
3217 _bfd_mips_elf_merge_private_bfd_data
3218 #define bfd_elf64_bfd_set_private_flags _bfd_mips_elf_set_private_flags
3219 #define bfd_elf64_bfd_print_private_bfd_data \
3220 _bfd_mips_elf_print_private_bfd_data
3222 #define bfd_elf64_get_reloc_upper_bound mips_elf64_get_reloc_upper_bound
3223 #define bfd_elf64_canonicalize_reloc mips_elf64_canonicalize_reloc
3224 #define bfd_elf64_get_dynamic_reloc_upper_bound mips_elf64_get_dynamic_reloc_upper_bound
3225 #define bfd_elf64_canonicalize_dynamic_reloc mips_elf64_canonicalize_dynamic_reloc
3226 #define bfd_elf64_bfd_relax_section _bfd_mips_relax_section
3228 /* MIPS ELF64 archive functions. */
3229 #define bfd_elf64_archive_functions
3230 extern bfd_boolean bfd_elf64_archive_slurp_armap
3232 extern bfd_boolean bfd_elf64_archive_write_armap
3233 (bfd
*, unsigned int, struct orl
*, unsigned int, int);
3234 #define bfd_elf64_archive_slurp_extended_name_table \
3235 _bfd_archive_coff_slurp_extended_name_table
3236 #define bfd_elf64_archive_construct_extended_name_table \
3237 _bfd_archive_coff_construct_extended_name_table
3238 #define bfd_elf64_archive_truncate_arname \
3239 _bfd_archive_coff_truncate_arname
3240 #define bfd_elf64_archive_read_ar_hdr _bfd_archive_coff_read_ar_hdr
3241 #define bfd_elf64_archive_openr_next_archived_file \
3242 _bfd_archive_coff_openr_next_archived_file
3243 #define bfd_elf64_archive_get_elt_at_index \
3244 _bfd_archive_coff_get_elt_at_index
3245 #define bfd_elf64_archive_generic_stat_arch_elt \
3246 _bfd_archive_coff_generic_stat_arch_elt
3247 #define bfd_elf64_archive_update_armap_timestamp \
3248 _bfd_archive_coff_update_armap_timestamp
3250 /* The SGI style (n)64 NewABI. */
3251 #define TARGET_LITTLE_SYM bfd_elf64_littlemips_vec
3252 #define TARGET_LITTLE_NAME "elf64-littlemips"
3253 #define TARGET_BIG_SYM bfd_elf64_bigmips_vec
3254 #define TARGET_BIG_NAME "elf64-bigmips"
3256 #define ELF_MAXPAGESIZE 0x10000
3257 #define ELF_COMMONPAGESIZE 0x1000
3259 #include "elf64-target.h"
3261 /* The SYSV-style 'traditional' (n)64 NewABI. */
3262 #undef TARGET_LITTLE_SYM
3263 #undef TARGET_LITTLE_NAME
3264 #undef TARGET_BIG_SYM
3265 #undef TARGET_BIG_NAME
3267 #undef ELF_MAXPAGESIZE
3268 #undef ELF_COMMONPAGESIZE
3270 #define TARGET_LITTLE_SYM bfd_elf64_tradlittlemips_vec
3271 #define TARGET_LITTLE_NAME "elf64-tradlittlemips"
3272 #define TARGET_BIG_SYM bfd_elf64_tradbigmips_vec
3273 #define TARGET_BIG_NAME "elf64-tradbigmips"
3275 #define ELF_MAXPAGESIZE 0x10000
3276 #define ELF_COMMONPAGESIZE 0x1000
3277 #define elf64_bed elf64_tradbed
3279 /* Include the target file again for this target. */
3280 #include "elf64-target.h"