1 /* MIPS-specific support for 64-bit ELF
2 Copyright 1996, 1997, 1998, 1999, 2000, 2001
3 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
24 /* This file supports the 64-bit MIPS ELF ABI.
26 The MIPS 64-bit ELF ABI uses an unusual reloc format. This file
27 overrides the usual ELF reloc handling, and handles reading and
28 writing the relocations here.
30 The MIPS 64-bit ELF ABI also uses an unusual archive map format. */
41 /* Get the ECOFF swapping routines. The 64-bit ABI is not supposed to
42 use ECOFF. However, we support it anyhow for an easier changeover. */
44 #include "coff/symconst.h"
45 #include "coff/internal.h"
46 #include "coff/ecoff.h"
47 /* The 64 bit versions of the mdebug data structures are in alpha.h. */
48 #include "coff/alpha.h"
49 #define ECOFF_SIGNED_64
50 #include "ecoffswap.h"
52 static void mips_elf64_swap_reloc_in
53 PARAMS ((bfd
*, const Elf64_Mips_External_Rel
*,
54 Elf64_Mips_Internal_Rel
*));
55 static void mips_elf64_swap_reloca_in
56 PARAMS ((bfd
*, const Elf64_Mips_External_Rela
*,
57 Elf64_Mips_Internal_Rela
*));
58 static void mips_elf64_swap_reloc_out
59 PARAMS ((bfd
*, const Elf64_Mips_Internal_Rel
*,
60 Elf64_Mips_External_Rel
*));
61 static void mips_elf64_swap_reloca_out
62 PARAMS ((bfd
*, const Elf64_Mips_Internal_Rela
*,
63 Elf64_Mips_External_Rela
*));
64 static void mips_elf64_be_swap_reloc_in
65 PARAMS ((bfd
*, const bfd_byte
*, Elf_Internal_Rel
*));
66 static void mips_elf64_be_swap_reloc_out
67 PARAMS ((bfd
*, const Elf_Internal_Rel
*, bfd_byte
*));
68 static void mips_elf64_be_swap_reloca_in
69 PARAMS ((bfd
*, const bfd_byte
*, Elf_Internal_Rela
*));
70 static void mips_elf64_be_swap_reloca_out
71 PARAMS ((bfd
*, const Elf_Internal_Rela
*, bfd_byte
*));
72 static reloc_howto_type
*mips_elf64_reloc_type_lookup
73 PARAMS ((bfd
*, bfd_reloc_code_real_type
));
74 static long mips_elf64_get_reloc_upper_bound
PARAMS ((bfd
*, asection
*));
75 static boolean mips_elf64_slurp_one_reloc_table
76 PARAMS ((bfd
*, asection
*, asymbol
**, const Elf_Internal_Shdr
*));
77 static boolean mips_elf64_slurp_reloc_table
78 PARAMS ((bfd
*, asection
*, asymbol
**, boolean
));
79 static void mips_elf64_write_relocs
PARAMS ((bfd
*, asection
*, PTR
));
80 static boolean mips_elf64_slurp_armap
PARAMS ((bfd
*));
81 static boolean mips_elf64_write_armap
82 PARAMS ((bfd
*, unsigned int, struct orl
*, unsigned int, int));
84 /* In case we're on a 32-bit machine, construct a 64-bit "-1" value
85 from smaller values. Start with zero, widen, *then* decrement. */
86 #define MINUS_ONE (((bfd_vma)0) - 1)
88 /* The number of local .got entries we reserve. */
89 #define MIPS_RESERVED_GOTNO (2)
91 /* The relocation table used for SHT_REL sections. */
93 #define UNUSED_RELOC(num) { num, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
95 static reloc_howto_type mips_elf64_howto_table_rel
[] =
98 HOWTO (R_MIPS_NONE
, /* type */
100 0, /* size (0 = byte, 1 = short, 2 = long) */
102 false, /* pc_relative */
104 complain_overflow_dont
, /* complain_on_overflow */
105 bfd_elf_generic_reloc
, /* special_function */
106 "R_MIPS_NONE", /* name */
107 false, /* partial_inplace */
110 false), /* pcrel_offset */
112 /* 16 bit relocation. */
113 HOWTO (R_MIPS_16
, /* type */
115 1, /* size (0 = byte, 1 = short, 2 = long) */
117 false, /* pc_relative */
119 complain_overflow_bitfield
, /* complain_on_overflow */
120 bfd_elf_generic_reloc
, /* special_function */
121 "R_MIPS_16", /* name */
122 true, /* partial_inplace */
123 0xffff, /* src_mask */
124 0xffff, /* dst_mask */
125 false), /* pcrel_offset */
127 /* 32 bit relocation. */
128 HOWTO (R_MIPS_32
, /* type */
130 2, /* size (0 = byte, 1 = short, 2 = long) */
132 false, /* pc_relative */
134 complain_overflow_bitfield
, /* complain_on_overflow */
135 bfd_elf_generic_reloc
, /* special_function */
136 "R_MIPS_32", /* name */
137 true, /* partial_inplace */
138 0xffffffff, /* src_mask */
139 0xffffffff, /* dst_mask */
140 false), /* pcrel_offset */
142 /* 32 bit symbol relative relocation. */
143 HOWTO (R_MIPS_REL32
, /* type */
145 2, /* size (0 = byte, 1 = short, 2 = long) */
147 false, /* pc_relative */
149 complain_overflow_bitfield
, /* complain_on_overflow */
150 bfd_elf_generic_reloc
, /* special_function */
151 "R_MIPS_REL32", /* name */
152 true, /* partial_inplace */
153 0xffffffff, /* src_mask */
154 0xffffffff, /* dst_mask */
155 false), /* pcrel_offset */
157 /* 26 bit branch address. */
158 HOWTO (R_MIPS_26
, /* type */
160 2, /* size (0 = byte, 1 = short, 2 = long) */
162 false, /* pc_relative */
164 complain_overflow_dont
, /* complain_on_overflow */
165 /* This needs complex overflow
166 detection, because the upper four
167 bits must match the PC + 4. */
168 bfd_elf_generic_reloc
, /* special_function */
169 "R_MIPS_26", /* name */
170 true, /* partial_inplace */
171 0x3ffffff, /* src_mask */
172 0x3ffffff, /* dst_mask */
173 false), /* pcrel_offset */
175 /* High 16 bits of symbol value. */
176 HOWTO (R_MIPS_HI16
, /* type */
178 2, /* size (0 = byte, 1 = short, 2 = long) */
180 false, /* pc_relative */
182 complain_overflow_dont
, /* complain_on_overflow */
183 _bfd_mips_elf_hi16_reloc
, /* special_function */
184 "R_MIPS_HI16", /* name */
185 true, /* partial_inplace */
186 0xffff, /* src_mask */
187 0xffff, /* dst_mask */
188 false), /* pcrel_offset */
190 /* Low 16 bits of symbol value. */
191 HOWTO (R_MIPS_LO16
, /* type */
193 2, /* size (0 = byte, 1 = short, 2 = long) */
195 false, /* pc_relative */
197 complain_overflow_dont
, /* complain_on_overflow */
198 _bfd_mips_elf_lo16_reloc
, /* special_function */
199 "R_MIPS_LO16", /* name */
200 true, /* partial_inplace */
201 0xffff, /* src_mask */
202 0xffff, /* dst_mask */
203 false), /* pcrel_offset */
205 /* GP relative reference. */
206 HOWTO (R_MIPS_GPREL16
, /* type */
208 2, /* size (0 = byte, 1 = short, 2 = long) */
210 false, /* pc_relative */
212 complain_overflow_signed
, /* complain_on_overflow */
213 _bfd_mips_elf_gprel16_reloc
, /* special_function */
214 "R_MIPS_GPREL16", /* name */
215 true, /* partial_inplace */
216 0xffff, /* src_mask */
217 0xffff, /* dst_mask */
218 false), /* pcrel_offset */
220 /* Reference to literal section. */
221 HOWTO (R_MIPS_LITERAL
, /* type */
223 2, /* size (0 = byte, 1 = short, 2 = long) */
225 false, /* pc_relative */
227 complain_overflow_signed
, /* complain_on_overflow */
228 _bfd_mips_elf_gprel16_reloc
, /* special_function */
229 "R_MIPS_LITERAL", /* name */
230 true, /* partial_inplace */
231 0xffff, /* src_mask */
232 0xffff, /* dst_mask */
233 false), /* pcrel_offset */
235 /* Reference to global offset table. */
236 HOWTO (R_MIPS_GOT16
, /* type */
238 2, /* size (0 = byte, 1 = short, 2 = long) */
240 false, /* pc_relative */
242 complain_overflow_signed
, /* complain_on_overflow */
243 _bfd_mips_elf_got16_reloc
, /* special_function */
244 "R_MIPS_GOT16", /* name */
245 false, /* partial_inplace */
247 0xffff, /* dst_mask */
248 false), /* pcrel_offset */
250 /* 16 bit PC relative reference. */
251 HOWTO (R_MIPS_PC16
, /* type */
253 2, /* size (0 = byte, 1 = short, 2 = long) */
255 true, /* pc_relative */
257 complain_overflow_signed
, /* complain_on_overflow */
258 bfd_elf_generic_reloc
, /* special_function */
259 "R_MIPS_PC16", /* name */
260 true, /* partial_inplace */
261 0xffff, /* src_mask */
262 0xffff, /* dst_mask */
263 false), /* pcrel_offset */
265 /* 16 bit call through global offset table. */
266 /* FIXME: This is not handled correctly. */
267 HOWTO (R_MIPS_CALL16
, /* type */
269 2, /* size (0 = byte, 1 = short, 2 = long) */
271 false, /* pc_relative */
273 complain_overflow_signed
, /* complain_on_overflow */
274 bfd_elf_generic_reloc
, /* special_function */
275 "R_MIPS_CALL16", /* name */
276 false, /* partial_inplace */
278 0xffff, /* dst_mask */
279 false), /* pcrel_offset */
281 /* 32 bit GP relative reference. */
282 HOWTO (R_MIPS_GPREL32
, /* type */
284 2, /* size (0 = byte, 1 = short, 2 = long) */
286 false, /* pc_relative */
288 complain_overflow_bitfield
, /* complain_on_overflow */
289 _bfd_mips_elf_gprel32_reloc
, /* special_function */
290 "R_MIPS_GPREL32", /* name */
291 true, /* partial_inplace */
292 0xffffffff, /* src_mask */
293 0xffffffff, /* dst_mask */
294 false), /* pcrel_offset */
300 /* A 5 bit shift field. */
301 HOWTO (R_MIPS_SHIFT5
, /* type */
303 2, /* size (0 = byte, 1 = short, 2 = long) */
305 false, /* pc_relative */
307 complain_overflow_bitfield
, /* complain_on_overflow */
308 bfd_elf_generic_reloc
, /* special_function */
309 "R_MIPS_SHIFT5", /* name */
310 true, /* partial_inplace */
311 0x000007c0, /* src_mask */
312 0x000007c0, /* dst_mask */
313 false), /* pcrel_offset */
315 /* A 6 bit shift field. */
316 /* FIXME: This is not handled correctly; a special function is
317 needed to put the most significant bit in the right place. */
318 HOWTO (R_MIPS_SHIFT6
, /* type */
320 2, /* size (0 = byte, 1 = short, 2 = long) */
322 false, /* pc_relative */
324 complain_overflow_bitfield
, /* complain_on_overflow */
325 bfd_elf_generic_reloc
, /* special_function */
326 "R_MIPS_SHIFT6", /* name */
327 true, /* partial_inplace */
328 0x000007c4, /* src_mask */
329 0x000007c4, /* dst_mask */
330 false), /* pcrel_offset */
332 /* 64 bit relocation. */
333 HOWTO (R_MIPS_64
, /* type */
335 4, /* size (0 = byte, 1 = short, 2 = long) */
337 false, /* pc_relative */
339 complain_overflow_bitfield
, /* complain_on_overflow */
340 bfd_elf_generic_reloc
, /* special_function */
341 "R_MIPS_64", /* name */
342 true, /* partial_inplace */
343 MINUS_ONE
, /* src_mask */
344 MINUS_ONE
, /* dst_mask */
345 false), /* pcrel_offset */
347 /* Displacement in the global offset table. */
348 /* FIXME: Not handled correctly. */
349 HOWTO (R_MIPS_GOT_DISP
, /* type */
351 2, /* size (0 = byte, 1 = short, 2 = long) */
353 false, /* pc_relative */
355 complain_overflow_bitfield
, /* complain_on_overflow */
356 bfd_elf_generic_reloc
, /* special_function */
357 "R_MIPS_GOT_DISP", /* name */
358 true, /* partial_inplace */
359 0x0000ffff, /* src_mask */
360 0x0000ffff, /* dst_mask */
361 false), /* pcrel_offset */
363 /* Displacement to page pointer in the global offset table. */
364 /* FIXME: Not handled correctly. */
365 HOWTO (R_MIPS_GOT_PAGE
, /* type */
367 2, /* size (0 = byte, 1 = short, 2 = long) */
369 false, /* pc_relative */
371 complain_overflow_bitfield
, /* complain_on_overflow */
372 bfd_elf_generic_reloc
, /* special_function */
373 "R_MIPS_GOT_PAGE", /* name */
374 true, /* partial_inplace */
375 0x0000ffff, /* src_mask */
376 0x0000ffff, /* dst_mask */
377 false), /* pcrel_offset */
379 /* Offset from page pointer in the global offset table. */
380 /* FIXME: Not handled correctly. */
381 HOWTO (R_MIPS_GOT_OFST
, /* type */
383 2, /* size (0 = byte, 1 = short, 2 = long) */
385 false, /* pc_relative */
387 complain_overflow_bitfield
, /* complain_on_overflow */
388 bfd_elf_generic_reloc
, /* special_function */
389 "R_MIPS_GOT_OFST", /* name */
390 true, /* partial_inplace */
391 0x0000ffff, /* src_mask */
392 0x0000ffff, /* dst_mask */
393 false), /* pcrel_offset */
395 /* High 16 bits of displacement in global offset table. */
396 /* FIXME: Not handled correctly. */
397 HOWTO (R_MIPS_GOT_HI16
, /* type */
399 2, /* size (0 = byte, 1 = short, 2 = long) */
401 false, /* pc_relative */
403 complain_overflow_dont
, /* complain_on_overflow */
404 bfd_elf_generic_reloc
, /* special_function */
405 "R_MIPS_GOT_HI16", /* name */
406 true, /* partial_inplace */
407 0x0000ffff, /* src_mask */
408 0x0000ffff, /* dst_mask */
409 false), /* pcrel_offset */
411 /* Low 16 bits of displacement in global offset table. */
412 /* FIXME: Not handled correctly. */
413 HOWTO (R_MIPS_GOT_LO16
, /* type */
415 2, /* size (0 = byte, 1 = short, 2 = long) */
417 false, /* pc_relative */
419 complain_overflow_dont
, /* complain_on_overflow */
420 bfd_elf_generic_reloc
, /* special_function */
421 "R_MIPS_GOT_LO16", /* name */
422 true, /* partial_inplace */
423 0x0000ffff, /* src_mask */
424 0x0000ffff, /* dst_mask */
425 false), /* pcrel_offset */
427 /* 64 bit substraction. */
428 /* FIXME: Not handled correctly. */
429 HOWTO (R_MIPS_SUB
, /* type */
431 4, /* size (0 = byte, 1 = short, 2 = long) */
433 false, /* pc_relative */
435 complain_overflow_bitfield
, /* complain_on_overflow */
436 bfd_elf_generic_reloc
, /* special_function */
437 "R_MIPS_SUB", /* name */
438 true, /* partial_inplace */
439 MINUS_ONE
, /* src_mask */
440 MINUS_ONE
, /* dst_mask */
441 false), /* pcrel_offset */
443 /* Insert the addend as an instruction. */
444 /* FIXME: Not handled correctly. */
445 HOWTO (R_MIPS_INSERT_A
, /* type */
447 0, /* size (0 = byte, 1 = short, 2 = long) */
449 false, /* pc_relative */
451 complain_overflow_dont
, /* complain_on_overflow */
452 bfd_elf_generic_reloc
, /* special_function */
453 "R_MIPS_INSERT_A", /* name */
454 false, /* partial_inplace */
457 false), /* pcrel_offset */
459 /* Insert the addend as an instruction, and change all relocations
460 to refer to the old instruction at the address. */
461 /* FIXME: Not handled correctly. */
462 HOWTO (R_MIPS_INSERT_B
, /* type */
464 0, /* size (0 = byte, 1 = short, 2 = long) */
466 false, /* pc_relative */
468 complain_overflow_dont
, /* complain_on_overflow */
469 bfd_elf_generic_reloc
, /* special_function */
470 "R_MIPS_INSERT_B", /* name */
471 false, /* partial_inplace */
474 false), /* pcrel_offset */
476 /* Delete a 32 bit instruction. */
477 /* FIXME: Not handled correctly. */
478 HOWTO (R_MIPS_DELETE
, /* type */
480 0, /* size (0 = byte, 1 = short, 2 = long) */
482 false, /* pc_relative */
484 complain_overflow_dont
, /* complain_on_overflow */
485 bfd_elf_generic_reloc
, /* special_function */
486 "R_MIPS_DELETE", /* name */
487 false, /* partial_inplace */
490 false), /* pcrel_offset */
492 /* Get the higher value of a 64 bit addend. */
493 /* FIXME: Not handled correctly. */
494 HOWTO (R_MIPS_HIGHER
, /* type */
496 2, /* size (0 = byte, 1 = short, 2 = long) */
498 false, /* pc_relative */
500 complain_overflow_dont
, /* complain_on_overflow */
501 bfd_elf_generic_reloc
, /* special_function */
502 "R_MIPS_HIGHER", /* name */
503 true, /* partial_inplace */
504 0xffff, /* src_mask */
505 0xffff, /* dst_mask */
506 false), /* pcrel_offset */
508 /* Get the highest value of a 64 bit addend. */
509 /* FIXME: Not handled correctly. */
510 HOWTO (R_MIPS_HIGHEST
, /* type */
512 2, /* size (0 = byte, 1 = short, 2 = long) */
514 false, /* pc_relative */
516 complain_overflow_dont
, /* complain_on_overflow */
517 bfd_elf_generic_reloc
, /* special_function */
518 "R_MIPS_HIGHEST", /* name */
519 true, /* partial_inplace */
520 0xffff, /* src_mask */
521 0xffff, /* dst_mask */
522 false), /* pcrel_offset */
524 /* High 16 bits of displacement in global offset table. */
525 /* FIXME: Not handled correctly. */
526 HOWTO (R_MIPS_CALL_HI16
, /* type */
528 2, /* size (0 = byte, 1 = short, 2 = long) */
530 false, /* pc_relative */
532 complain_overflow_dont
, /* complain_on_overflow */
533 bfd_elf_generic_reloc
, /* special_function */
534 "R_MIPS_CALL_HI16", /* name */
535 true, /* partial_inplace */
536 0x0000ffff, /* src_mask */
537 0x0000ffff, /* dst_mask */
538 false), /* pcrel_offset */
540 /* Low 16 bits of displacement in global offset table. */
541 /* FIXME: Not handled correctly. */
542 HOWTO (R_MIPS_CALL_LO16
, /* type */
544 2, /* size (0 = byte, 1 = short, 2 = long) */
546 false, /* pc_relative */
548 complain_overflow_dont
, /* complain_on_overflow */
549 bfd_elf_generic_reloc
, /* special_function */
550 "R_MIPS_CALL_LO16", /* name */
551 true, /* partial_inplace */
552 0x0000ffff, /* src_mask */
553 0x0000ffff, /* dst_mask */
554 false), /* pcrel_offset */
556 /* I'm not sure what the remaining relocs are, but they are defined
559 HOWTO (R_MIPS_SCN_DISP
, /* type */
561 0, /* size (0 = byte, 1 = short, 2 = long) */
563 false, /* pc_relative */
565 complain_overflow_dont
, /* complain_on_overflow */
566 bfd_elf_generic_reloc
, /* special_function */
567 "R_MIPS_SCN_DISP", /* name */
568 false, /* partial_inplace */
571 false), /* pcrel_offset */
573 HOWTO (R_MIPS_REL16
, /* type */
575 0, /* size (0 = byte, 1 = short, 2 = long) */
577 false, /* pc_relative */
579 complain_overflow_dont
, /* complain_on_overflow */
580 bfd_elf_generic_reloc
, /* special_function */
581 "R_MIPS_REL16", /* name */
582 false, /* partial_inplace */
585 false), /* pcrel_offset */
587 HOWTO (R_MIPS_ADD_IMMEDIATE
, /* type */
589 0, /* size (0 = byte, 1 = short, 2 = long) */
591 false, /* pc_relative */
593 complain_overflow_dont
, /* complain_on_overflow */
594 bfd_elf_generic_reloc
, /* special_function */
595 "R_MIPS_ADD_IMMEDIATE", /* name */
596 false, /* partial_inplace */
599 false), /* pcrel_offset */
601 HOWTO (R_MIPS_PJUMP
, /* type */
603 0, /* size (0 = byte, 1 = short, 2 = long) */
605 false, /* pc_relative */
607 complain_overflow_dont
, /* complain_on_overflow */
608 bfd_elf_generic_reloc
, /* special_function */
609 "R_MIPS_PJUMP", /* name */
610 false, /* partial_inplace */
613 false), /* pcrel_offset */
615 HOWTO (R_MIPS_RELGOT
, /* type */
617 0, /* size (0 = byte, 1 = short, 2 = long) */
619 false, /* pc_relative */
621 complain_overflow_dont
, /* complain_on_overflow */
622 bfd_elf_generic_reloc
, /* special_function */
623 "R_MIPS_RELGOT", /* name */
624 false, /* partial_inplace */
627 false), /* pcrel_offset */
629 /* Protected jump conversion. This is an optimization hint. No
630 relocation is required for correctness. */
631 HOWTO (R_MIPS_JALR
, /* type */
633 0, /* size (0 = byte, 1 = short, 2 = long) */
635 false, /* pc_relative */
637 complain_overflow_dont
, /* complain_on_overflow */
638 bfd_elf_generic_reloc
, /* special_function */
639 "R_MIPS_JALR", /* name */
640 false, /* partial_inplace */
641 0x00000000, /* src_mask */
642 0x00000000, /* dst_mask */
643 false), /* pcrel_offset */
646 /* The relocation table used for SHT_RELA sections. */
648 static reloc_howto_type mips_elf64_howto_table_rela
[] =
651 HOWTO (R_MIPS_NONE
, /* type */
653 0, /* size (0 = byte, 1 = short, 2 = long) */
655 false, /* pc_relative */
657 complain_overflow_dont
, /* complain_on_overflow */
658 bfd_elf_generic_reloc
, /* special_function */
659 "R_MIPS_NONE", /* name */
660 false, /* partial_inplace */
663 false), /* pcrel_offset */
665 /* 16 bit relocation. */
666 HOWTO (R_MIPS_16
, /* type */
668 1, /* size (0 = byte, 1 = short, 2 = long) */
670 false, /* pc_relative */
672 complain_overflow_bitfield
, /* complain_on_overflow */
673 bfd_elf_generic_reloc
, /* special_function */
674 "R_MIPS_16", /* name */
675 true, /* partial_inplace */
677 0xffff, /* dst_mask */
678 false), /* pcrel_offset */
680 /* 32 bit relocation. */
681 HOWTO (R_MIPS_32
, /* type */
683 2, /* size (0 = byte, 1 = short, 2 = long) */
685 false, /* pc_relative */
687 complain_overflow_bitfield
, /* complain_on_overflow */
688 bfd_elf_generic_reloc
, /* special_function */
689 "R_MIPS_32", /* name */
690 true, /* partial_inplace */
692 0xffffffff, /* dst_mask */
693 false), /* pcrel_offset */
695 /* 32 bit symbol relative relocation. */
696 HOWTO (R_MIPS_REL32
, /* type */
698 2, /* size (0 = byte, 1 = short, 2 = long) */
700 false, /* pc_relative */
702 complain_overflow_bitfield
, /* complain_on_overflow */
703 bfd_elf_generic_reloc
, /* special_function */
704 "R_MIPS_REL32", /* name */
705 true, /* partial_inplace */
707 0xffffffff, /* dst_mask */
708 false), /* pcrel_offset */
710 /* 26 bit branch address. */
711 HOWTO (R_MIPS_26
, /* type */
713 2, /* size (0 = byte, 1 = short, 2 = long) */
715 false, /* pc_relative */
717 complain_overflow_dont
, /* complain_on_overflow */
718 /* This needs complex overflow
719 detection, because the upper four
720 bits must match the PC + 4. */
721 bfd_elf_generic_reloc
, /* special_function */
722 "R_MIPS_26", /* name */
723 true, /* partial_inplace */
725 0x3ffffff, /* dst_mask */
726 false), /* pcrel_offset */
728 /* High 16 bits of symbol value. */
729 HOWTO (R_MIPS_HI16
, /* type */
731 2, /* size (0 = byte, 1 = short, 2 = long) */
733 false, /* pc_relative */
735 complain_overflow_dont
, /* complain_on_overflow */
736 bfd_elf_generic_reloc
, /* special_function */
737 "R_MIPS_HI16", /* name */
738 true, /* partial_inplace */
740 0xffff, /* dst_mask */
741 false), /* pcrel_offset */
743 /* Low 16 bits of symbol value. */
744 HOWTO (R_MIPS_LO16
, /* type */
746 2, /* size (0 = byte, 1 = short, 2 = long) */
748 false, /* pc_relative */
750 complain_overflow_dont
, /* complain_on_overflow */
751 bfd_elf_generic_reloc
, /* special_function */
752 "R_MIPS_LO16", /* name */
753 true, /* partial_inplace */
755 0xffff, /* dst_mask */
756 false), /* pcrel_offset */
758 /* GP relative reference. */
759 HOWTO (R_MIPS_GPREL16
, /* type */
761 2, /* size (0 = byte, 1 = short, 2 = long) */
763 false, /* pc_relative */
765 complain_overflow_signed
, /* complain_on_overflow */
766 _bfd_mips_elf_gprel16_reloc
, /* special_function */
767 "R_MIPS_GPREL16", /* name */
768 true, /* partial_inplace */
770 0xffff, /* dst_mask */
771 false), /* pcrel_offset */
773 /* Reference to literal section. */
774 HOWTO (R_MIPS_LITERAL
, /* type */
776 2, /* size (0 = byte, 1 = short, 2 = long) */
778 false, /* pc_relative */
780 complain_overflow_signed
, /* complain_on_overflow */
781 _bfd_mips_elf_gprel16_reloc
, /* special_function */
782 "R_MIPS_LITERAL", /* name */
783 true, /* partial_inplace */
785 0xffff, /* dst_mask */
786 false), /* pcrel_offset */
788 /* Reference to global offset table. */
789 /* FIXME: This is not handled correctly. */
790 HOWTO (R_MIPS_GOT16
, /* type */
792 2, /* size (0 = byte, 1 = short, 2 = long) */
794 false, /* pc_relative */
796 complain_overflow_signed
, /* complain_on_overflow */
797 bfd_elf_generic_reloc
, /* special_function */
798 "R_MIPS_GOT16", /* name */
799 false, /* partial_inplace */
801 0xffff, /* dst_mask */
802 false), /* pcrel_offset */
804 /* 16 bit PC relative reference. */
805 HOWTO (R_MIPS_PC16
, /* type */
807 2, /* size (0 = byte, 1 = short, 2 = long) */
809 true, /* pc_relative */
811 complain_overflow_signed
, /* complain_on_overflow */
812 bfd_elf_generic_reloc
, /* special_function */
813 "R_MIPS_PC16", /* name */
814 true, /* partial_inplace */
816 0xffff, /* dst_mask */
817 false), /* pcrel_offset */
819 /* 16 bit call through global offset table. */
820 /* FIXME: This is not handled correctly. */
821 HOWTO (R_MIPS_CALL16
, /* type */
823 2, /* size (0 = byte, 1 = short, 2 = long) */
825 false, /* pc_relative */
827 complain_overflow_signed
, /* complain_on_overflow */
828 bfd_elf_generic_reloc
, /* special_function */
829 "R_MIPS_CALL16", /* name */
830 false, /* partial_inplace */
832 0xffff, /* dst_mask */
833 false), /* pcrel_offset */
835 /* 32 bit GP relative reference. */
836 HOWTO (R_MIPS_GPREL32
, /* type */
838 2, /* size (0 = byte, 1 = short, 2 = long) */
840 false, /* pc_relative */
842 complain_overflow_bitfield
, /* complain_on_overflow */
843 _bfd_mips_elf_gprel32_reloc
, /* special_function */
844 "R_MIPS_GPREL32", /* name */
845 true, /* partial_inplace */
847 0xffffffff, /* dst_mask */
848 false), /* pcrel_offset */
854 /* A 5 bit shift field. */
855 HOWTO (R_MIPS_SHIFT5
, /* type */
857 2, /* size (0 = byte, 1 = short, 2 = long) */
859 false, /* pc_relative */
861 complain_overflow_bitfield
, /* complain_on_overflow */
862 bfd_elf_generic_reloc
, /* special_function */
863 "R_MIPS_SHIFT5", /* name */
864 true, /* partial_inplace */
866 0x000007c0, /* dst_mask */
867 false), /* pcrel_offset */
869 /* A 6 bit shift field. */
870 /* FIXME: This is not handled correctly; a special function is
871 needed to put the most significant bit in the right place. */
872 HOWTO (R_MIPS_SHIFT6
, /* type */
874 2, /* size (0 = byte, 1 = short, 2 = long) */
876 false, /* pc_relative */
878 complain_overflow_bitfield
, /* complain_on_overflow */
879 bfd_elf_generic_reloc
, /* special_function */
880 "R_MIPS_SHIFT6", /* name */
881 true, /* partial_inplace */
883 0x000007c4, /* dst_mask */
884 false), /* pcrel_offset */
886 /* 64 bit relocation. */
887 HOWTO (R_MIPS_64
, /* type */
889 4, /* size (0 = byte, 1 = short, 2 = long) */
891 false, /* pc_relative */
893 complain_overflow_bitfield
, /* complain_on_overflow */
894 bfd_elf_generic_reloc
, /* special_function */
895 "R_MIPS_64", /* name */
896 true, /* partial_inplace */
898 MINUS_ONE
, /* dst_mask */
899 false), /* pcrel_offset */
901 /* Displacement in the global offset table. */
902 /* FIXME: Not handled correctly. */
903 HOWTO (R_MIPS_GOT_DISP
, /* type */
905 2, /* size (0 = byte, 1 = short, 2 = long) */
907 false, /* pc_relative */
909 complain_overflow_bitfield
, /* complain_on_overflow */
910 bfd_elf_generic_reloc
, /* special_function */
911 "R_MIPS_GOT_DISP", /* name */
912 true, /* partial_inplace */
914 0x0000ffff, /* dst_mask */
915 false), /* pcrel_offset */
917 /* Displacement to page pointer in the global offset table. */
918 /* FIXME: Not handled correctly. */
919 HOWTO (R_MIPS_GOT_PAGE
, /* type */
921 2, /* size (0 = byte, 1 = short, 2 = long) */
923 false, /* pc_relative */
925 complain_overflow_bitfield
, /* complain_on_overflow */
926 bfd_elf_generic_reloc
, /* special_function */
927 "R_MIPS_GOT_PAGE", /* name */
928 true, /* partial_inplace */
930 0x0000ffff, /* dst_mask */
931 false), /* pcrel_offset */
933 /* Offset from page pointer in the global offset table. */
934 /* FIXME: Not handled correctly. */
935 HOWTO (R_MIPS_GOT_OFST
, /* type */
937 2, /* size (0 = byte, 1 = short, 2 = long) */
939 false, /* pc_relative */
941 complain_overflow_bitfield
, /* complain_on_overflow */
942 bfd_elf_generic_reloc
, /* special_function */
943 "R_MIPS_GOT_OFST", /* name */
944 true, /* partial_inplace */
946 0x0000ffff, /* dst_mask */
947 false), /* pcrel_offset */
949 /* High 16 bits of displacement in global offset table. */
950 /* FIXME: Not handled correctly. */
951 HOWTO (R_MIPS_GOT_HI16
, /* type */
953 2, /* size (0 = byte, 1 = short, 2 = long) */
955 false, /* pc_relative */
957 complain_overflow_dont
, /* complain_on_overflow */
958 bfd_elf_generic_reloc
, /* special_function */
959 "R_MIPS_GOT_HI16", /* name */
960 true, /* partial_inplace */
962 0x0000ffff, /* dst_mask */
963 false), /* pcrel_offset */
965 /* Low 16 bits of displacement in global offset table. */
966 /* FIXME: Not handled correctly. */
967 HOWTO (R_MIPS_GOT_LO16
, /* type */
969 2, /* size (0 = byte, 1 = short, 2 = long) */
971 false, /* pc_relative */
973 complain_overflow_dont
, /* complain_on_overflow */
974 bfd_elf_generic_reloc
, /* special_function */
975 "R_MIPS_GOT_LO16", /* name */
976 true, /* partial_inplace */
978 0x0000ffff, /* dst_mask */
979 false), /* pcrel_offset */
981 /* 64 bit substraction. */
982 /* FIXME: Not handled correctly. */
983 HOWTO (R_MIPS_SUB
, /* type */
985 4, /* size (0 = byte, 1 = short, 2 = long) */
987 false, /* pc_relative */
989 complain_overflow_bitfield
, /* complain_on_overflow */
990 bfd_elf_generic_reloc
, /* special_function */
991 "R_MIPS_SUB", /* name */
992 true, /* partial_inplace */
994 MINUS_ONE
, /* dst_mask */
995 false), /* pcrel_offset */
997 /* Insert the addend as an instruction. */
998 /* FIXME: Not handled correctly. */
999 HOWTO (R_MIPS_INSERT_A
, /* type */
1001 0, /* size (0 = byte, 1 = short, 2 = long) */
1003 false, /* pc_relative */
1005 complain_overflow_dont
, /* complain_on_overflow */
1006 bfd_elf_generic_reloc
, /* special_function */
1007 "R_MIPS_INSERT_A", /* name */
1008 false, /* partial_inplace */
1011 false), /* pcrel_offset */
1013 /* Insert the addend as an instruction, and change all relocations
1014 to refer to the old instruction at the address. */
1015 /* FIXME: Not handled correctly. */
1016 HOWTO (R_MIPS_INSERT_B
, /* type */
1018 0, /* size (0 = byte, 1 = short, 2 = long) */
1020 false, /* pc_relative */
1022 complain_overflow_dont
, /* complain_on_overflow */
1023 bfd_elf_generic_reloc
, /* special_function */
1024 "R_MIPS_INSERT_B", /* name */
1025 false, /* partial_inplace */
1028 false), /* pcrel_offset */
1030 /* Delete a 32 bit instruction. */
1031 /* FIXME: Not handled correctly. */
1032 HOWTO (R_MIPS_DELETE
, /* type */
1034 0, /* size (0 = byte, 1 = short, 2 = long) */
1036 false, /* pc_relative */
1038 complain_overflow_dont
, /* complain_on_overflow */
1039 bfd_elf_generic_reloc
, /* special_function */
1040 "R_MIPS_DELETE", /* name */
1041 false, /* partial_inplace */
1044 false), /* pcrel_offset */
1046 /* Get the higher value of a 64 bit addend. */
1047 /* FIXME: Not handled correctly. */
1048 HOWTO (R_MIPS_HIGHER
, /* type */
1050 2, /* size (0 = byte, 1 = short, 2 = long) */
1052 false, /* pc_relative */
1054 complain_overflow_dont
, /* complain_on_overflow */
1055 bfd_elf_generic_reloc
, /* special_function */
1056 "R_MIPS_HIGHER", /* name */
1057 true, /* partial_inplace */
1059 0xffff, /* dst_mask */
1060 false), /* pcrel_offset */
1062 /* Get the highest value of a 64 bit addend. */
1063 /* FIXME: Not handled correctly. */
1064 HOWTO (R_MIPS_HIGHEST
, /* type */
1066 2, /* size (0 = byte, 1 = short, 2 = long) */
1068 false, /* pc_relative */
1070 complain_overflow_dont
, /* complain_on_overflow */
1071 bfd_elf_generic_reloc
, /* special_function */
1072 "R_MIPS_HIGHEST", /* name */
1073 true, /* partial_inplace */
1075 0xffff, /* dst_mask */
1076 false), /* pcrel_offset */
1078 /* High 16 bits of displacement in global offset table. */
1079 /* FIXME: Not handled correctly. */
1080 HOWTO (R_MIPS_CALL_HI16
, /* type */
1082 2, /* size (0 = byte, 1 = short, 2 = long) */
1084 false, /* pc_relative */
1086 complain_overflow_dont
, /* complain_on_overflow */
1087 bfd_elf_generic_reloc
, /* special_function */
1088 "R_MIPS_CALL_HI16", /* name */
1089 true, /* partial_inplace */
1091 0x0000ffff, /* dst_mask */
1092 false), /* pcrel_offset */
1094 /* Low 16 bits of displacement in global offset table. */
1095 /* FIXME: Not handled correctly. */
1096 HOWTO (R_MIPS_CALL_LO16
, /* type */
1098 2, /* size (0 = byte, 1 = short, 2 = long) */
1100 false, /* pc_relative */
1102 complain_overflow_dont
, /* complain_on_overflow */
1103 bfd_elf_generic_reloc
, /* special_function */
1104 "R_MIPS_CALL_LO16", /* name */
1105 true, /* partial_inplace */
1107 0x0000ffff, /* dst_mask */
1108 false), /* pcrel_offset */
1110 /* I'm not sure what the remaining relocs are, but they are defined
1113 HOWTO (R_MIPS_SCN_DISP
, /* type */
1115 0, /* size (0 = byte, 1 = short, 2 = long) */
1117 false, /* pc_relative */
1119 complain_overflow_dont
, /* complain_on_overflow */
1120 bfd_elf_generic_reloc
, /* special_function */
1121 "R_MIPS_SCN_DISP", /* name */
1122 false, /* partial_inplace */
1125 false), /* pcrel_offset */
1127 HOWTO (R_MIPS_REL16
, /* type */
1129 0, /* size (0 = byte, 1 = short, 2 = long) */
1131 false, /* pc_relative */
1133 complain_overflow_dont
, /* complain_on_overflow */
1134 bfd_elf_generic_reloc
, /* special_function */
1135 "R_MIPS_REL16", /* name */
1136 false, /* partial_inplace */
1139 false), /* pcrel_offset */
1141 HOWTO (R_MIPS_ADD_IMMEDIATE
, /* type */
1143 0, /* size (0 = byte, 1 = short, 2 = long) */
1145 false, /* pc_relative */
1147 complain_overflow_dont
, /* complain_on_overflow */
1148 bfd_elf_generic_reloc
, /* special_function */
1149 "R_MIPS_ADD_IMMEDIATE", /* name */
1150 false, /* partial_inplace */
1153 false), /* pcrel_offset */
1155 HOWTO (R_MIPS_PJUMP
, /* type */
1157 0, /* size (0 = byte, 1 = short, 2 = long) */
1159 false, /* pc_relative */
1161 complain_overflow_dont
, /* complain_on_overflow */
1162 bfd_elf_generic_reloc
, /* special_function */
1163 "R_MIPS_PJUMP", /* name */
1164 false, /* partial_inplace */
1167 false), /* pcrel_offset */
1169 HOWTO (R_MIPS_RELGOT
, /* type */
1171 0, /* size (0 = byte, 1 = short, 2 = long) */
1173 false, /* pc_relative */
1175 complain_overflow_dont
, /* complain_on_overflow */
1176 bfd_elf_generic_reloc
, /* special_function */
1177 "R_MIPS_RELGOT", /* name */
1178 false, /* partial_inplace */
1181 false), /* pcrel_offset */
1183 /* Protected jump conversion. This is an optimization hint. No
1184 relocation is required for correctness. */
1185 HOWTO (R_MIPS_JALR
, /* type */
1187 0, /* size (0 = byte, 1 = short, 2 = long) */
1189 false, /* pc_relative */
1191 complain_overflow_dont
, /* complain_on_overflow */
1192 bfd_elf_generic_reloc
, /* special_function */
1193 "R_MIPS_JALR", /* name */
1194 false, /* partial_inplace */
1195 0x00000000, /* src_mask */
1196 0x00000000, /* dst_mask */
1197 false), /* pcrel_offset */
1200 /* Swap in a MIPS 64-bit Rel reloc. */
1203 mips_elf64_swap_reloc_in (abfd
, src
, dst
)
1205 const Elf64_Mips_External_Rel
*src
;
1206 Elf64_Mips_Internal_Rel
*dst
;
1208 dst
->r_offset
= bfd_h_get_64 (abfd
, (bfd_byte
*) src
->r_offset
);
1209 dst
->r_sym
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
->r_sym
);
1210 dst
->r_ssym
= bfd_h_get_8 (abfd
, (bfd_byte
*) src
->r_ssym
);
1211 dst
->r_type3
= bfd_h_get_8 (abfd
, (bfd_byte
*) src
->r_type3
);
1212 dst
->r_type2
= bfd_h_get_8 (abfd
, (bfd_byte
*) src
->r_type2
);
1213 dst
->r_type
= bfd_h_get_8 (abfd
, (bfd_byte
*) src
->r_type
);
1216 /* Swap in a MIPS 64-bit Rela reloc. */
1219 mips_elf64_swap_reloca_in (abfd
, src
, dst
)
1221 const Elf64_Mips_External_Rela
*src
;
1222 Elf64_Mips_Internal_Rela
*dst
;
1224 dst
->r_offset
= bfd_h_get_64 (abfd
, (bfd_byte
*) src
->r_offset
);
1225 dst
->r_sym
= bfd_h_get_32 (abfd
, (bfd_byte
*) src
->r_sym
);
1226 dst
->r_ssym
= bfd_h_get_8 (abfd
, (bfd_byte
*) src
->r_ssym
);
1227 dst
->r_type3
= bfd_h_get_8 (abfd
, (bfd_byte
*) src
->r_type3
);
1228 dst
->r_type2
= bfd_h_get_8 (abfd
, (bfd_byte
*) src
->r_type2
);
1229 dst
->r_type
= bfd_h_get_8 (abfd
, (bfd_byte
*) src
->r_type
);
1230 dst
->r_addend
= bfd_h_get_signed_64 (abfd
, (bfd_byte
*) src
->r_addend
);
1233 /* Swap out a MIPS 64-bit Rel reloc. */
1236 mips_elf64_swap_reloc_out (abfd
, src
, dst
)
1238 const Elf64_Mips_Internal_Rel
*src
;
1239 Elf64_Mips_External_Rel
*dst
;
1241 bfd_h_put_64 (abfd
, src
->r_offset
, (bfd_byte
*) dst
->r_offset
);
1242 bfd_h_put_32 (abfd
, src
->r_sym
, (bfd_byte
*) dst
->r_sym
);
1243 bfd_h_put_8 (abfd
, src
->r_ssym
, (bfd_byte
*) dst
->r_ssym
);
1244 bfd_h_put_8 (abfd
, src
->r_type3
, (bfd_byte
*) dst
->r_type3
);
1245 bfd_h_put_8 (abfd
, src
->r_type2
, (bfd_byte
*) dst
->r_type2
);
1246 bfd_h_put_8 (abfd
, src
->r_type
, (bfd_byte
*) dst
->r_type
);
1249 /* Swap out a MIPS 64-bit Rela reloc. */
1252 mips_elf64_swap_reloca_out (abfd
, src
, dst
)
1254 const Elf64_Mips_Internal_Rela
*src
;
1255 Elf64_Mips_External_Rela
*dst
;
1257 bfd_h_put_64 (abfd
, src
->r_offset
, (bfd_byte
*) dst
->r_offset
);
1258 bfd_h_put_32 (abfd
, src
->r_sym
, (bfd_byte
*) dst
->r_sym
);
1259 bfd_h_put_8 (abfd
, src
->r_ssym
, (bfd_byte
*) dst
->r_ssym
);
1260 bfd_h_put_8 (abfd
, src
->r_type3
, (bfd_byte
*) dst
->r_type3
);
1261 bfd_h_put_8 (abfd
, src
->r_type2
, (bfd_byte
*) dst
->r_type2
);
1262 bfd_h_put_8 (abfd
, src
->r_type
, (bfd_byte
*) dst
->r_type
);
1263 bfd_h_put_64 (abfd
, src
->r_addend
, (bfd_byte
*) dst
->r_addend
);
1266 /* Swap in a MIPS 64-bit Rel reloc. */
1269 mips_elf64_be_swap_reloc_in (abfd
, src
, dst
)
1271 const bfd_byte
*src
;
1272 Elf_Internal_Rel
*dst
;
1274 Elf64_Mips_Internal_Rel mirel
;
1276 mips_elf64_swap_reloc_in (abfd
,
1277 (const Elf64_Mips_External_Rel
*) src
,
1280 dst
[0].r_offset
= mirel
.r_offset
;
1281 dst
[0].r_info
= ELF32_R_INFO (mirel
.r_sym
, mirel
.r_type
);
1282 dst
[1].r_offset
= mirel
.r_offset
;
1283 dst
[1].r_info
= ELF32_R_INFO (mirel
.r_ssym
, mirel
.r_type2
);
1284 dst
[2].r_offset
= mirel
.r_offset
;
1285 dst
[2].r_info
= ELF32_R_INFO (STN_UNDEF
, mirel
.r_type3
);
1288 /* Swap in a MIPS 64-bit Rela reloc. */
1291 mips_elf64_be_swap_reloca_in (abfd
, src
, dst
)
1293 const bfd_byte
*src
;
1294 Elf_Internal_Rela
*dst
;
1296 Elf64_Mips_Internal_Rela mirela
;
1298 mips_elf64_swap_reloca_in (abfd
,
1299 (const Elf64_Mips_External_Rela
*) src
,
1302 dst
[0].r_offset
= mirela
.r_offset
;
1303 dst
[0].r_info
= ELF32_R_INFO (mirela
.r_sym
, mirela
.r_type
);
1304 dst
[0].r_addend
= mirela
.r_addend
;
1305 dst
[1].r_offset
= mirela
.r_offset
;
1306 dst
[1].r_info
= ELF32_R_INFO (mirela
.r_ssym
, mirela
.r_type2
);
1307 dst
[1].r_addend
= 0;
1308 dst
[2].r_offset
= mirela
.r_offset
;
1309 dst
[2].r_info
= ELF32_R_INFO (STN_UNDEF
, mirela
.r_type3
);
1310 dst
[2].r_addend
= 0;
1313 /* Swap out a MIPS 64-bit Rel reloc. */
1316 mips_elf64_be_swap_reloc_out (abfd
, src
, dst
)
1318 const Elf_Internal_Rel
*src
;
1321 Elf64_Mips_Internal_Rel mirel
;
1323 mirel
.r_offset
= src
->r_offset
;
1324 mirel
.r_type
= ELF32_R_TYPE (src
->r_info
);
1325 mirel
.r_sym
= ELF32_R_SYM (src
->r_info
);
1326 mirel
.r_type2
= R_MIPS_NONE
;
1327 mirel
.r_ssym
= STN_UNDEF
;
1328 mirel
.r_type3
= R_MIPS_NONE
;
1330 mips_elf64_swap_reloc_out (abfd
, &mirel
,
1331 (Elf64_Mips_External_Rel
*) dst
);
1334 /* Swap out a MIPS 64-bit Rela reloc. */
1337 mips_elf64_be_swap_reloca_out (abfd
, src
, dst
)
1339 const Elf_Internal_Rela
*src
;
1342 Elf64_Mips_Internal_Rela mirela
;
1344 mirela
.r_offset
= src
->r_offset
;
1345 mirela
.r_type
= ELF32_R_TYPE (src
->r_info
);
1346 mirela
.r_addend
= src
->r_addend
;
1347 mirela
.r_sym
= ELF32_R_SYM (src
->r_info
);
1348 mirela
.r_type2
= R_MIPS_NONE
;
1349 mirela
.r_ssym
= STN_UNDEF
;
1350 mirela
.r_type3
= R_MIPS_NONE
;
1352 mips_elf64_swap_reloca_out (abfd
, &mirela
,
1353 (Elf64_Mips_External_Rela
*) dst
);
1356 /* A mapping from BFD reloc types to MIPS ELF reloc types. */
1358 struct elf_reloc_map
1360 bfd_reloc_code_real_type bfd_reloc_val
;
1361 enum elf_mips_reloc_type elf_reloc_val
;
1364 static CONST
struct elf_reloc_map mips_reloc_map
[] =
1366 { BFD_RELOC_NONE
, R_MIPS_NONE
, },
1367 { BFD_RELOC_16
, R_MIPS_16
},
1368 { BFD_RELOC_32
, R_MIPS_32
},
1369 { BFD_RELOC_64
, R_MIPS_64
},
1370 { BFD_RELOC_CTOR
, R_MIPS_64
},
1371 { BFD_RELOC_32_PCREL
, R_MIPS_REL32
},
1372 { BFD_RELOC_MIPS_JMP
, R_MIPS_26
},
1373 { BFD_RELOC_HI16_S
, R_MIPS_HI16
},
1374 { BFD_RELOC_LO16
, R_MIPS_LO16
},
1375 { BFD_RELOC_MIPS_GPREL
, R_MIPS_GPREL16
},
1376 { BFD_RELOC_MIPS_LITERAL
, R_MIPS_LITERAL
},
1377 { BFD_RELOC_MIPS_GOT16
, R_MIPS_GOT16
},
1378 { BFD_RELOC_16_PCREL
, R_MIPS_PC16
},
1379 { BFD_RELOC_MIPS_CALL16
, R_MIPS_CALL16
},
1380 { BFD_RELOC_MIPS_GPREL32
, R_MIPS_GPREL32
},
1381 { BFD_RELOC_MIPS_GOT_HI16
, R_MIPS_GOT_HI16
},
1382 { BFD_RELOC_MIPS_GOT_LO16
, R_MIPS_GOT_LO16
},
1383 { BFD_RELOC_MIPS_CALL_HI16
, R_MIPS_CALL_HI16
},
1384 { BFD_RELOC_MIPS_CALL_LO16
, R_MIPS_CALL_LO16
},
1385 { BFD_RELOC_MIPS_SUB
, R_MIPS_SUB
},
1386 { BFD_RELOC_MIPS_GOT_PAGE
, R_MIPS_GOT_PAGE
},
1387 { BFD_RELOC_MIPS_GOT_OFST
, R_MIPS_GOT_OFST
},
1388 { BFD_RELOC_MIPS_GOT_DISP
, R_MIPS_GOT_DISP
}
1391 /* Given a BFD reloc type, return a howto structure. */
1393 static reloc_howto_type
*
1394 mips_elf64_reloc_type_lookup (abfd
, code
)
1395 bfd
*abfd ATTRIBUTE_UNUSED
;
1396 bfd_reloc_code_real_type code
;
1400 for (i
= 0; i
< sizeof (mips_reloc_map
) / sizeof (struct elf_reloc_map
); i
++)
1402 if (mips_reloc_map
[i
].bfd_reloc_val
== code
)
1406 v
= (int) mips_reloc_map
[i
].elf_reloc_val
;
1407 return &mips_elf64_howto_table_rel
[v
];
1414 /* Since each entry in an SHT_REL or SHT_RELA section can represent up
1415 to three relocs, we must tell the user to allocate more space. */
1418 mips_elf64_get_reloc_upper_bound (abfd
, sec
)
1419 bfd
*abfd ATTRIBUTE_UNUSED
;
1422 return (sec
->reloc_count
* 3 + 1) * sizeof (arelent
*);
1425 /* Read the relocations from one reloc section. */
1428 mips_elf64_slurp_one_reloc_table (abfd
, asect
, symbols
, rel_hdr
)
1432 const Elf_Internal_Shdr
*rel_hdr
;
1434 PTR allocated
= NULL
;
1435 bfd_byte
*native_relocs
;
1441 reloc_howto_type
*howto_table
;
1443 allocated
= (PTR
) bfd_malloc (rel_hdr
->sh_size
);
1444 if (allocated
== NULL
)
1447 if (bfd_seek (abfd
, rel_hdr
->sh_offset
, SEEK_SET
) != 0
1448 || (bfd_read (allocated
, 1, rel_hdr
->sh_size
, abfd
) != rel_hdr
->sh_size
))
1451 native_relocs
= (bfd_byte
*) allocated
;
1453 relents
= asect
->relocation
+ asect
->reloc_count
;
1455 entsize
= rel_hdr
->sh_entsize
;
1456 BFD_ASSERT (entsize
== sizeof (Elf64_Mips_External_Rel
)
1457 || entsize
== sizeof (Elf64_Mips_External_Rela
));
1459 count
= rel_hdr
->sh_size
/ entsize
;
1461 if (entsize
== sizeof (Elf64_Mips_External_Rel
))
1462 howto_table
= mips_elf64_howto_table_rel
;
1464 howto_table
= mips_elf64_howto_table_rela
;
1467 for (i
= 0; i
< count
; i
++, native_relocs
+= entsize
)
1469 Elf64_Mips_Internal_Rela rela
;
1470 boolean used_sym
, used_ssym
;
1473 if (entsize
== sizeof (Elf64_Mips_External_Rela
))
1474 mips_elf64_swap_reloca_in (abfd
,
1475 (Elf64_Mips_External_Rela
*) native_relocs
,
1479 Elf64_Mips_Internal_Rel rel
;
1481 mips_elf64_swap_reloc_in (abfd
,
1482 (Elf64_Mips_External_Rel
*) native_relocs
,
1484 rela
.r_offset
= rel
.r_offset
;
1485 rela
.r_sym
= rel
.r_sym
;
1486 rela
.r_ssym
= rel
.r_ssym
;
1487 rela
.r_type3
= rel
.r_type3
;
1488 rela
.r_type2
= rel
.r_type2
;
1489 rela
.r_type
= rel
.r_type
;
1493 /* Each entry represents up to three actual relocations. */
1497 for (ir
= 0; ir
< 3; ir
++)
1499 enum elf_mips_reloc_type type
;
1506 type
= (enum elf_mips_reloc_type
) rela
.r_type
;
1509 type
= (enum elf_mips_reloc_type
) rela
.r_type2
;
1512 type
= (enum elf_mips_reloc_type
) rela
.r_type3
;
1516 if (type
== R_MIPS_NONE
)
1518 /* There are no more relocations in this entry. If this
1519 is the first entry, we need to generate a dummy
1520 relocation so that the generic linker knows that
1521 there has been a break in the sequence of relocations
1522 applying to a particular address. */
1525 relent
->sym_ptr_ptr
= bfd_abs_section_ptr
->symbol_ptr_ptr
;
1526 if ((abfd
->flags
& (EXEC_P
| DYNAMIC
)) == 0)
1527 relent
->address
= rela
.r_offset
;
1529 relent
->address
= rela
.r_offset
- asect
->vma
;
1531 relent
->howto
= &howto_table
[(int) R_MIPS_NONE
];
1537 /* Some types require symbols, whereas some do not. */
1541 case R_MIPS_LITERAL
:
1542 case R_MIPS_INSERT_A
:
1543 case R_MIPS_INSERT_B
:
1545 relent
->sym_ptr_ptr
= bfd_abs_section_ptr
->symbol_ptr_ptr
;
1551 if (rela
.r_sym
== 0)
1552 relent
->sym_ptr_ptr
= bfd_abs_section_ptr
->symbol_ptr_ptr
;
1557 ps
= symbols
+ rela
.r_sym
- 1;
1559 if ((s
->flags
& BSF_SECTION_SYM
) == 0)
1560 relent
->sym_ptr_ptr
= ps
;
1562 relent
->sym_ptr_ptr
= s
->section
->symbol_ptr_ptr
;
1567 else if (! used_ssym
)
1569 switch (rela
.r_ssym
)
1572 relent
->sym_ptr_ptr
=
1573 bfd_abs_section_ptr
->symbol_ptr_ptr
;
1579 /* FIXME: I think these need to be handled using
1580 special howto structures. */
1592 relent
->sym_ptr_ptr
= bfd_abs_section_ptr
->symbol_ptr_ptr
;
1597 /* The address of an ELF reloc is section relative for an
1598 object file, and absolute for an executable file or
1599 shared library. The address of a BFD reloc is always
1600 section relative. */
1601 if ((abfd
->flags
& (EXEC_P
| DYNAMIC
)) == 0)
1602 relent
->address
= rela
.r_offset
;
1604 relent
->address
= rela
.r_offset
- asect
->vma
;
1606 relent
->addend
= rela
.r_addend
;
1608 relent
->howto
= &howto_table
[(int) type
];
1614 asect
->reloc_count
+= relent
- relents
;
1616 if (allocated
!= NULL
)
1622 if (allocated
!= NULL
)
1627 /* Read the relocations. On Irix 6, there can be two reloc sections
1628 associated with a single data section. */
1631 mips_elf64_slurp_reloc_table (abfd
, asect
, symbols
, dynamic
)
1637 struct bfd_elf_section_data
* const d
= elf_section_data (asect
);
1641 bfd_set_error (bfd_error_invalid_operation
);
1645 if (asect
->relocation
!= NULL
1646 || (asect
->flags
& SEC_RELOC
) == 0
1647 || asect
->reloc_count
== 0)
1650 /* Allocate space for 3 arelent structures for each Rel structure. */
1651 asect
->relocation
= ((arelent
*)
1653 asect
->reloc_count
* 3 * sizeof (arelent
)));
1654 if (asect
->relocation
== NULL
)
1657 /* The slurp_one_reloc_table routine increments reloc_count. */
1658 asect
->reloc_count
= 0;
1660 if (! mips_elf64_slurp_one_reloc_table (abfd
, asect
, symbols
, &d
->rel_hdr
))
1662 if (d
->rel_hdr2
!= NULL
)
1664 if (! mips_elf64_slurp_one_reloc_table (abfd
, asect
, symbols
,
1672 /* Write out the relocations. */
1675 mips_elf64_write_relocs (abfd
, sec
, data
)
1680 boolean
*failedp
= (boolean
*) data
;
1682 Elf_Internal_Shdr
*rela_hdr
;
1683 Elf64_Mips_External_Rela
*ext_rela
;
1685 asymbol
*last_sym
= 0;
1686 int last_sym_idx
= 0;
1688 /* If we have already failed, don't do anything. */
1692 if ((sec
->flags
& SEC_RELOC
) == 0)
1695 /* The linker backend writes the relocs out itself, and sets the
1696 reloc_count field to zero to inhibit writing them here. Also,
1697 sometimes the SEC_RELOC flag gets set even when there aren't any
1699 if (sec
->reloc_count
== 0)
1702 /* We can combine up to three relocs that refer to the same address
1703 if the latter relocs have no associated symbol. */
1705 for (idx
= 0; idx
< sec
->reloc_count
; idx
++)
1712 addr
= sec
->orelocation
[idx
]->address
;
1713 for (i
= 0; i
< 2; i
++)
1717 if (idx
+ 1 >= sec
->reloc_count
)
1719 r
= sec
->orelocation
[idx
+ 1];
1720 if (r
->address
!= addr
1721 || ! bfd_is_abs_section ((*r
->sym_ptr_ptr
)->section
)
1722 || (*r
->sym_ptr_ptr
)->value
!= 0)
1725 /* We can merge the reloc at IDX + 1 with the reloc at IDX. */
1731 rela_hdr
= &elf_section_data (sec
)->rel_hdr
;
1733 rela_hdr
->sh_size
= rela_hdr
->sh_entsize
* count
;
1734 rela_hdr
->contents
= (PTR
) bfd_alloc (abfd
, rela_hdr
->sh_size
);
1735 if (rela_hdr
->contents
== NULL
)
1741 ext_rela
= (Elf64_Mips_External_Rela
*) rela_hdr
->contents
;
1742 for (idx
= 0; idx
< sec
->reloc_count
; idx
++, ext_rela
++)
1745 Elf64_Mips_Internal_Rela int_rela
;
1750 ptr
= sec
->orelocation
[idx
];
1752 /* The address of an ELF reloc is section relative for an object
1753 file, and absolute for an executable file or shared library.
1754 The address of a BFD reloc is always section relative. */
1755 if ((abfd
->flags
& (EXEC_P
| DYNAMIC
)) == 0)
1756 int_rela
.r_offset
= ptr
->address
;
1758 int_rela
.r_offset
= ptr
->address
+ sec
->vma
;
1760 sym
= *ptr
->sym_ptr_ptr
;
1761 if (sym
== last_sym
)
1766 n
= _bfd_elf_symbol_from_bfd_symbol (abfd
, &sym
);
1777 int_rela
.r_addend
= ptr
->addend
;
1779 int_rela
.r_ssym
= RSS_UNDEF
;
1781 if ((*ptr
->sym_ptr_ptr
)->the_bfd
->xvec
!= abfd
->xvec
1782 && ! _bfd_elf_validate_reloc (abfd
, ptr
))
1788 int_rela
.r_type
= ptr
->howto
->type
;
1789 int_rela
.r_type2
= (int) R_MIPS_NONE
;
1790 int_rela
.r_type3
= (int) R_MIPS_NONE
;
1792 for (i
= 0; i
< 2; i
++)
1796 if (idx
+ 1 >= sec
->reloc_count
)
1798 r
= sec
->orelocation
[idx
+ 1];
1799 if (r
->address
!= ptr
->address
1800 || ! bfd_is_abs_section ((*r
->sym_ptr_ptr
)->section
)
1801 || (*r
->sym_ptr_ptr
)->value
!= 0)
1804 /* We can merge the reloc at IDX + 1 with the reloc at IDX. */
1807 int_rela
.r_type2
= r
->howto
->type
;
1809 int_rela
.r_type3
= r
->howto
->type
;
1814 mips_elf64_swap_reloca_out (abfd
, &int_rela
, ext_rela
);
1817 BFD_ASSERT (ext_rela
- (Elf64_Mips_External_Rela
*) rela_hdr
->contents
1821 /* Irix 6 defines a brand new archive map format, so that they can
1822 have archives more than 4 GB in size. */
1824 /* Read an Irix 6 armap. */
1827 mips_elf64_slurp_armap (abfd
)
1830 struct artdata
*ardata
= bfd_ardata (abfd
);
1833 bfd_size_type i
, parsed_size
, nsymz
, stringsize
, carsym_size
, ptrsize
;
1834 struct areltdata
*mapdata
;
1835 bfd_byte int_buf
[8];
1837 bfd_byte
*raw_armap
= NULL
;
1840 ardata
->symdefs
= NULL
;
1842 /* Get the name of the first element. */
1843 arhdrpos
= bfd_tell (abfd
);
1844 i
= bfd_read ((PTR
) nextname
, 1, 16, abfd
);
1850 if (bfd_seek (abfd
, (file_ptr
) - 16, SEEK_CUR
) != 0)
1853 /* Archives with traditional armaps are still permitted. */
1854 if (strncmp (nextname
, "/ ", 16) == 0)
1855 return bfd_slurp_armap (abfd
);
1857 if (strncmp (nextname
, "/SYM64/ ", 16) != 0)
1859 bfd_has_map (abfd
) = false;
1863 mapdata
= (struct areltdata
*) _bfd_read_ar_hdr (abfd
);
1864 if (mapdata
== NULL
)
1866 parsed_size
= mapdata
->parsed_size
;
1867 bfd_release (abfd
, (PTR
) mapdata
);
1869 if (bfd_read (int_buf
, 1, 8, abfd
) != 8)
1871 if (bfd_get_error () != bfd_error_system_call
)
1872 bfd_set_error (bfd_error_malformed_archive
);
1876 nsymz
= bfd_getb64 (int_buf
);
1877 stringsize
= parsed_size
- 8 * nsymz
- 8;
1879 carsym_size
= nsymz
* sizeof (carsym
);
1880 ptrsize
= 8 * nsymz
;
1882 ardata
->symdefs
= (carsym
*) bfd_zalloc (abfd
, carsym_size
+ stringsize
+ 1);
1883 if (ardata
->symdefs
== NULL
)
1885 carsyms
= ardata
->symdefs
;
1886 stringbase
= ((char *) ardata
->symdefs
) + carsym_size
;
1888 raw_armap
= (bfd_byte
*) bfd_alloc (abfd
, ptrsize
);
1889 if (raw_armap
== NULL
)
1892 if (bfd_read (raw_armap
, 1, ptrsize
, abfd
) != ptrsize
1893 || bfd_read (stringbase
, 1, stringsize
, abfd
) != stringsize
)
1895 if (bfd_get_error () != bfd_error_system_call
)
1896 bfd_set_error (bfd_error_malformed_archive
);
1900 for (i
= 0; i
< nsymz
; i
++)
1902 carsyms
->file_offset
= bfd_getb64 (raw_armap
+ i
* 8);
1903 carsyms
->name
= stringbase
;
1904 stringbase
+= strlen (stringbase
) + 1;
1909 ardata
->symdef_count
= nsymz
;
1910 ardata
->first_file_filepos
= arhdrpos
+ sizeof (struct ar_hdr
) + parsed_size
;
1912 bfd_has_map (abfd
) = true;
1913 bfd_release (abfd
, raw_armap
);
1918 if (raw_armap
!= NULL
)
1919 bfd_release (abfd
, raw_armap
);
1920 if (ardata
->symdefs
!= NULL
)
1921 bfd_release (abfd
, ardata
->symdefs
);
1925 /* Write out an Irix 6 armap. The Irix 6 tools are supposed to be
1926 able to handle ordinary ELF armaps, but at least on Irix 6.2 the
1930 mips_elf64_write_armap (arch
, elength
, map
, symbol_count
, stridx
)
1932 unsigned int elength
;
1934 unsigned int symbol_count
;
1937 unsigned int ranlibsize
= (symbol_count
* 8) + 8;
1938 unsigned int stringsize
= stridx
;
1939 unsigned int mapsize
= stringsize
+ ranlibsize
;
1940 file_ptr archive_member_file_ptr
;
1941 bfd
*current
= arch
->archive_head
;
1948 padding
= BFD_ALIGN (mapsize
, 8) - mapsize
;
1951 /* work out where the first object file will go in the archive */
1952 archive_member_file_ptr
= (mapsize
1954 + sizeof (struct ar_hdr
)
1957 memset ((char *) (&hdr
), 0, sizeof (struct ar_hdr
));
1958 strcpy (hdr
.ar_name
, "/SYM64/");
1959 sprintf (hdr
.ar_size
, "%-10d", (int) mapsize
);
1960 sprintf (hdr
.ar_date
, "%ld", (long) time (NULL
));
1961 /* This, at least, is what Intel coff sets the values to.: */
1962 sprintf ((hdr
.ar_uid
), "%d", 0);
1963 sprintf ((hdr
.ar_gid
), "%d", 0);
1964 sprintf ((hdr
.ar_mode
), "%-7o", (unsigned) 0);
1965 strncpy (hdr
.ar_fmag
, ARFMAG
, 2);
1967 for (i
= 0; i
< sizeof (struct ar_hdr
); i
++)
1968 if (((char *) (&hdr
))[i
] == '\0')
1969 (((char *) (&hdr
))[i
]) = ' ';
1971 /* Write the ar header for this item and the number of symbols */
1973 if (bfd_write ((PTR
) &hdr
, 1, sizeof (struct ar_hdr
), arch
)
1974 != sizeof (struct ar_hdr
))
1977 bfd_putb64 (symbol_count
, buf
);
1978 if (bfd_write (buf
, 1, 8, arch
) != 8)
1981 /* Two passes, first write the file offsets for each symbol -
1982 remembering that each offset is on a two byte boundary. */
1984 /* Write out the file offset for the file associated with each
1985 symbol, and remember to keep the offsets padded out. */
1987 current
= arch
->archive_head
;
1989 while (current
!= (bfd
*) NULL
&& count
< symbol_count
)
1991 /* For each symbol which is used defined in this object, write out
1992 the object file's address in the archive */
1994 while (((bfd
*) (map
[count
]).pos
) == current
)
1996 bfd_putb64 (archive_member_file_ptr
, buf
);
1997 if (bfd_write (buf
, 1, 8, arch
) != 8)
2001 /* Add size of this archive entry */
2002 archive_member_file_ptr
+= (arelt_size (current
)
2003 + sizeof (struct ar_hdr
));
2004 /* remember about the even alignment */
2005 archive_member_file_ptr
+= archive_member_file_ptr
% 2;
2006 current
= current
->next
;
2009 /* now write the strings themselves */
2010 for (count
= 0; count
< symbol_count
; count
++)
2012 size_t len
= strlen (*map
[count
].name
) + 1;
2014 if (bfd_write (*map
[count
].name
, 1, len
, arch
) != len
)
2018 /* The spec says that this should be padded to an 8 byte boundary.
2019 However, the Irix 6.2 tools do not appear to do this. */
2020 while (padding
!= 0)
2022 if (bfd_write ("", 1, 1, arch
) != 1)
2030 /* ECOFF swapping routines. These are used when dealing with the
2031 .mdebug section, which is in the ECOFF debugging format. */
2032 static const struct ecoff_debug_swap mips_elf64_ecoff_debug_swap
=
2034 /* Symbol table magic number. */
2036 /* Alignment of debugging information. E.g., 4. */
2038 /* Sizes of external symbolic information. */
2039 sizeof (struct hdr_ext
),
2040 sizeof (struct dnr_ext
),
2041 sizeof (struct pdr_ext
),
2042 sizeof (struct sym_ext
),
2043 sizeof (struct opt_ext
),
2044 sizeof (struct fdr_ext
),
2045 sizeof (struct rfd_ext
),
2046 sizeof (struct ext_ext
),
2047 /* Functions to swap in external symbolic data. */
2056 _bfd_ecoff_swap_tir_in
,
2057 _bfd_ecoff_swap_rndx_in
,
2058 /* Functions to swap out external symbolic data. */
2067 _bfd_ecoff_swap_tir_out
,
2068 _bfd_ecoff_swap_rndx_out
,
2069 /* Function to read in symbolic data. */
2070 _bfd_mips_elf_read_ecoff_info
2073 /* Relocations in the 64 bit MIPS ELF ABI are more complex than in
2074 standard ELF. This structure is used to redirect the relocation
2075 handling routines. */
2077 const struct elf_size_info mips_elf64_size_info
=
2079 sizeof (Elf64_External_Ehdr
),
2080 sizeof (Elf64_External_Phdr
),
2081 sizeof (Elf64_External_Shdr
),
2082 sizeof (Elf64_Mips_External_Rel
),
2083 sizeof (Elf64_Mips_External_Rela
),
2084 sizeof (Elf64_External_Sym
),
2085 sizeof (Elf64_External_Dyn
),
2086 sizeof (Elf_External_Note
),
2087 4, /* hash-table entry size */
2088 3, /* internal relocations per external relocations */
2093 bfd_elf64_write_out_phdrs
,
2094 bfd_elf64_write_shdrs_and_ehdr
,
2095 mips_elf64_write_relocs
,
2096 bfd_elf64_swap_symbol_out
,
2097 mips_elf64_slurp_reloc_table
,
2098 bfd_elf64_slurp_symbol_table
,
2099 bfd_elf64_swap_dyn_in
,
2100 bfd_elf64_swap_dyn_out
,
2101 mips_elf64_be_swap_reloc_in
,
2102 mips_elf64_be_swap_reloc_out
,
2103 mips_elf64_be_swap_reloca_in
,
2104 mips_elf64_be_swap_reloca_out
2107 #define TARGET_LITTLE_SYM bfd_elf64_littlemips_vec
2108 #define TARGET_LITTLE_NAME "elf64-littlemips"
2109 #define TARGET_BIG_SYM bfd_elf64_bigmips_vec
2110 #define TARGET_BIG_NAME "elf64-bigmips"
2111 #define ELF_ARCH bfd_arch_mips
2112 #define ELF_MACHINE_CODE EM_MIPS
2114 #define ELF_MAXPAGESIZE 0x1000
2116 #define elf_backend_collect true
2117 #define elf_backend_type_change_ok true
2118 #define elf_backend_can_gc_sections true
2119 #define elf_backend_size_info mips_elf64_size_info
2120 #define elf_backend_object_p _bfd_mips_elf_object_p
2121 #define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr
2122 #define elf_backend_fake_sections _bfd_mips_elf_fake_sections
2123 #define elf_backend_section_from_bfd_section \
2124 _bfd_mips_elf_section_from_bfd_section
2125 #define elf_backend_section_processing _bfd_mips_elf_section_processing
2126 #define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing
2127 #define elf_backend_additional_program_headers \
2128 _bfd_mips_elf_additional_program_headers
2129 #define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map
2130 #define elf_backend_final_write_processing \
2131 _bfd_mips_elf_final_write_processing
2132 #define elf_backend_ecoff_debug_swap &mips_elf64_ecoff_debug_swap
2133 #define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook
2134 #define elf_backend_create_dynamic_sections \
2135 _bfd_mips_elf_create_dynamic_sections
2136 #define elf_backend_check_relocs _bfd_mips_elf_check_relocs
2137 #define elf_backend_adjust_dynamic_symbol \
2138 _bfd_mips_elf_adjust_dynamic_symbol
2139 #define elf_backend_always_size_sections \
2140 _bfd_mips_elf_always_size_sections
2141 #define elf_backend_size_dynamic_sections \
2142 _bfd_mips_elf_size_dynamic_sections
2143 #define elf_backend_relocate_section _bfd_mips_elf_relocate_section
2144 #define elf_backend_link_output_symbol_hook \
2145 _bfd_mips_elf_link_output_symbol_hook
2146 #define elf_backend_finish_dynamic_symbol \
2147 _bfd_mips_elf_finish_dynamic_symbol
2148 #define elf_backend_finish_dynamic_sections \
2149 _bfd_mips_elf_finish_dynamic_sections
2150 #define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook
2151 #define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook
2152 #define elf_backend_got_header_size (4*MIPS_RESERVED_GOTNO)
2153 #define elf_backend_plt_header_size 0
2154 #define elf_backend_may_use_rel_p 1
2156 /* We don't set bfd_elf64_bfd_is_local_label_name because the 32-bit
2157 MIPS-specific function only applies to IRIX5, which had no 64-bit
2159 #define bfd_elf64_find_nearest_line _bfd_mips_elf_find_nearest_line
2160 #define bfd_elf64_set_section_contents _bfd_mips_elf_set_section_contents
2161 #define bfd_elf64_bfd_link_hash_table_create \
2162 _bfd_mips_elf_link_hash_table_create
2163 #define bfd_elf64_bfd_final_link _bfd_mips_elf_final_link
2164 #define bfd_elf64_bfd_copy_private_bfd_data \
2165 _bfd_mips_elf_copy_private_bfd_data
2166 #define bfd_elf64_bfd_merge_private_bfd_data \
2167 _bfd_mips_elf_merge_private_bfd_data
2168 #define bfd_elf64_bfd_set_private_flags _bfd_mips_elf_set_private_flags
2169 #define bfd_elf64_bfd_print_private_bfd_data \
2170 _bfd_mips_elf_print_private_bfd_data
2172 #define bfd_elf64_get_reloc_upper_bound mips_elf64_get_reloc_upper_bound
2173 #define bfd_elf64_bfd_reloc_type_lookup mips_elf64_reloc_type_lookup
2174 #define bfd_elf64_archive_functions
2175 #define bfd_elf64_archive_slurp_armap mips_elf64_slurp_armap
2176 #define bfd_elf64_archive_slurp_extended_name_table \
2177 _bfd_archive_coff_slurp_extended_name_table
2178 #define bfd_elf64_archive_construct_extended_name_table \
2179 _bfd_archive_coff_construct_extended_name_table
2180 #define bfd_elf64_archive_truncate_arname \
2181 _bfd_archive_coff_truncate_arname
2182 #define bfd_elf64_archive_write_armap mips_elf64_write_armap
2183 #define bfd_elf64_archive_read_ar_hdr _bfd_archive_coff_read_ar_hdr
2184 #define bfd_elf64_archive_openr_next_archived_file \
2185 _bfd_archive_coff_openr_next_archived_file
2186 #define bfd_elf64_archive_get_elt_at_index \
2187 _bfd_archive_coff_get_elt_at_index
2188 #define bfd_elf64_archive_generic_stat_arch_elt \
2189 _bfd_archive_coff_generic_stat_arch_elt
2190 #define bfd_elf64_archive_update_armap_timestamp \
2191 _bfd_archive_coff_update_armap_timestamp
2193 #include "elf64-target.h"
2195 /* Support for traditional mips targets */
2197 #define INCLUDED_TARGET_FILE /* More a type of flag */
2199 #undef TARGET_LITTLE_SYM
2200 #undef TARGET_LITTLE_NAME
2201 #undef TARGET_BIG_SYM
2202 #undef TARGET_BIG_NAME
2204 #define TARGET_LITTLE_SYM bfd_elf64_tradlittlemips_vec
2205 #define TARGET_LITTLE_NAME "elf64-tradlittlemips"
2206 #define TARGET_BIG_SYM bfd_elf64_tradbigmips_vec
2207 #define TARGET_BIG_NAME "elf64-tradbigmips"
2209 /* Include the target file again for this target */
2210 #include "elf64-target.h"