1 /* MIPS-specific support for 32-bit ELF
2 Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
3 2003, 2004 Free Software Foundation, Inc.
5 Most of the information added by Ian Lance Taylor, Cygnus Support,
7 N32/64 ABI support added by Mark Mitchell, CodeSourcery, LLC.
8 <mark@codesourcery.com>
9 Traditional MIPS targets support added by Koundinya.K, Dansk Data
10 Elektronik & Operations Research Group. <kk@ddeorg.soft.net>
12 This file is part of BFD, the Binary File Descriptor library.
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 2 of the License, or
17 (at your option) any later version.
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, write to the Free Software
26 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
28 /* This file handles MIPS ELF targets. SGI Irix 5 uses a slightly
29 different MIPS ELF from other targets. This matters when linking.
30 This file supports both, switching at runtime. */
38 #include "elfxx-mips.h"
41 /* Get the ECOFF swapping routines. */
43 #include "coff/symconst.h"
44 #include "coff/internal.h"
45 #include "coff/ecoff.h"
46 #include "coff/mips.h"
47 #define ECOFF_SIGNED_32
48 #include "ecoffswap.h"
50 static bfd_boolean mips_elf_assign_gp
52 static bfd_reloc_status_type mips_elf_final_gp
53 (bfd
*, asymbol
*, bfd_boolean
, char **, bfd_vma
*);
54 static bfd_reloc_status_type mips_elf_gprel16_reloc
55 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
56 static bfd_reloc_status_type mips_elf_literal_reloc
57 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
58 static bfd_reloc_status_type mips_elf_gprel32_reloc
59 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
60 static bfd_reloc_status_type gprel32_with_gp
61 (bfd
*, asymbol
*, arelent
*, asection
*, bfd_boolean
, void *, bfd_vma
);
62 static bfd_reloc_status_type mips_elf_shift6_reloc
63 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
64 static bfd_reloc_status_type mips16_jump_reloc
65 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
66 static bfd_reloc_status_type mips16_gprel_reloc
67 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
68 static reloc_howto_type
*bfd_elf32_bfd_reloc_type_lookup
69 (bfd
*, bfd_reloc_code_real_type
);
70 static reloc_howto_type
*mips_elf_n32_rtype_to_howto
71 (unsigned int, bfd_boolean
);
72 static void mips_info_to_howto_rel
73 (bfd
*, arelent
*, Elf_Internal_Rela
*);
74 static void mips_info_to_howto_rela
75 (bfd
*, arelent
*, Elf_Internal_Rela
*);
76 static bfd_boolean mips_elf_sym_is_global
78 static bfd_boolean mips_elf_n32_object_p
80 static bfd_boolean elf32_mips_grok_prstatus
81 (bfd
*, Elf_Internal_Note
*);
82 static bfd_boolean elf32_mips_grok_psinfo
83 (bfd
*, Elf_Internal_Note
*);
84 static irix_compat_t elf_n32_mips_irix_compat
87 extern const bfd_target bfd_elf32_nbigmips_vec
;
88 extern const bfd_target bfd_elf32_nlittlemips_vec
;
90 /* Nonzero if ABFD is using the N32 ABI. */
91 #define ABI_N32_P(abfd) \
92 ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0)
94 /* Whether we are trying to be compatible with IRIX at all. */
95 #define SGI_COMPAT(abfd) \
96 (elf_n32_mips_irix_compat (abfd) != ict_none)
98 /* The number of local .got entries we reserve. */
99 #define MIPS_RESERVED_GOTNO (2)
101 /* In case we're on a 32-bit machine, construct a 64-bit "-1" value
102 from smaller values. Start with zero, widen, *then* decrement. */
103 #define MINUS_ONE (((bfd_vma)0) - 1)
105 /* The relocation table used for SHT_REL sections. */
107 static reloc_howto_type elf_mips_howto_table_rel
[] =
110 HOWTO (R_MIPS_NONE
, /* type */
112 0, /* size (0 = byte, 1 = short, 2 = long) */
114 FALSE
, /* pc_relative */
116 complain_overflow_dont
, /* complain_on_overflow */
117 _bfd_mips_elf_generic_reloc
, /* special_function */
118 "R_MIPS_NONE", /* name */
119 FALSE
, /* partial_inplace */
122 FALSE
), /* pcrel_offset */
124 /* 16 bit relocation. */
125 HOWTO (R_MIPS_16
, /* type */
127 2, /* size (0 = byte, 1 = short, 2 = long) */
129 FALSE
, /* pc_relative */
131 complain_overflow_signed
, /* complain_on_overflow */
132 _bfd_mips_elf_generic_reloc
, /* special_function */
133 "R_MIPS_16", /* name */
134 TRUE
, /* partial_inplace */
135 0x0000ffff, /* src_mask */
136 0x0000ffff, /* dst_mask */
137 FALSE
), /* pcrel_offset */
139 /* 32 bit relocation. */
140 HOWTO (R_MIPS_32
, /* type */
142 2, /* size (0 = byte, 1 = short, 2 = long) */
144 FALSE
, /* pc_relative */
146 complain_overflow_dont
, /* complain_on_overflow */
147 _bfd_mips_elf_generic_reloc
, /* special_function */
148 "R_MIPS_32", /* name */
149 TRUE
, /* partial_inplace */
150 0xffffffff, /* src_mask */
151 0xffffffff, /* dst_mask */
152 FALSE
), /* pcrel_offset */
154 /* 32 bit symbol relative relocation. */
155 HOWTO (R_MIPS_REL32
, /* type */
157 2, /* size (0 = byte, 1 = short, 2 = long) */
159 FALSE
, /* pc_relative */
161 complain_overflow_dont
, /* complain_on_overflow */
162 _bfd_mips_elf_generic_reloc
, /* special_function */
163 "R_MIPS_REL32", /* name */
164 TRUE
, /* partial_inplace */
165 0xffffffff, /* src_mask */
166 0xffffffff, /* dst_mask */
167 FALSE
), /* pcrel_offset */
169 /* 26 bit jump address. */
170 HOWTO (R_MIPS_26
, /* type */
172 2, /* size (0 = byte, 1 = short, 2 = long) */
174 FALSE
, /* pc_relative */
176 complain_overflow_dont
, /* complain_on_overflow */
177 /* This needs complex overflow
178 detection, because the upper four
179 bits must match the PC + 4. */
180 _bfd_mips_elf_generic_reloc
, /* special_function */
181 "R_MIPS_26", /* name */
182 TRUE
, /* partial_inplace */
183 0x03ffffff, /* src_mask */
184 0x03ffffff, /* dst_mask */
185 FALSE
), /* pcrel_offset */
187 /* R_MIPS_HI16 and R_MIPS_LO16 are unsupported for NewABI REL.
188 However, the native IRIX6 tools use them, so we try our best. */
190 /* High 16 bits of symbol value. */
191 HOWTO (R_MIPS_HI16
, /* 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_hi16_reloc
, /* special_function */
199 "R_MIPS_HI16", /* name */
200 TRUE
, /* partial_inplace */
201 0x0000ffff, /* src_mask */
202 0x0000ffff, /* dst_mask */
203 FALSE
), /* pcrel_offset */
205 /* Low 16 bits of symbol value. */
206 HOWTO (R_MIPS_LO16
, /* type */
208 2, /* size (0 = byte, 1 = short, 2 = long) */
210 FALSE
, /* pc_relative */
212 complain_overflow_dont
, /* complain_on_overflow */
213 _bfd_mips_elf_lo16_reloc
, /* special_function */
214 "R_MIPS_LO16", /* name */
215 TRUE
, /* partial_inplace */
216 0x0000ffff, /* src_mask */
217 0x0000ffff, /* dst_mask */
218 FALSE
), /* pcrel_offset */
220 /* GP relative reference. */
221 HOWTO (R_MIPS_GPREL16
, /* type */
223 2, /* size (0 = byte, 1 = short, 2 = long) */
225 FALSE
, /* pc_relative */
227 complain_overflow_signed
, /* complain_on_overflow */
228 mips_elf_gprel16_reloc
, /* special_function */
229 "R_MIPS_GPREL16", /* name */
230 TRUE
, /* partial_inplace */
231 0x0000ffff, /* src_mask */
232 0x0000ffff, /* dst_mask */
233 FALSE
), /* pcrel_offset */
235 /* Reference to literal section. */
236 HOWTO (R_MIPS_LITERAL
, /* type */
238 2, /* size (0 = byte, 1 = short, 2 = long) */
240 FALSE
, /* pc_relative */
242 complain_overflow_signed
, /* complain_on_overflow */
243 mips_elf_literal_reloc
, /* special_function */
244 "R_MIPS_LITERAL", /* name */
245 TRUE
, /* partial_inplace */
246 0x0000ffff, /* src_mask */
247 0x0000ffff, /* dst_mask */
248 FALSE
), /* pcrel_offset */
250 /* Reference to global offset table. */
251 HOWTO (R_MIPS_GOT16
, /* type */
253 2, /* size (0 = byte, 1 = short, 2 = long) */
255 FALSE
, /* pc_relative */
257 complain_overflow_signed
, /* complain_on_overflow */
258 _bfd_mips_elf_got16_reloc
, /* special_function */
259 "R_MIPS_GOT16", /* name */
260 TRUE
, /* partial_inplace */
261 0x0000ffff, /* src_mask */
262 0x0000ffff, /* dst_mask */
263 FALSE
), /* pcrel_offset */
265 /* 16 bit PC relative reference. */
266 HOWTO (R_MIPS_PC16
, /* type */
268 2, /* size (0 = byte, 1 = short, 2 = long) */
270 TRUE
, /* pc_relative */
272 complain_overflow_signed
, /* complain_on_overflow */
273 _bfd_mips_elf_generic_reloc
, /* special_function */
274 "R_MIPS_PC16", /* name */
275 TRUE
, /* partial_inplace */
276 0x0000ffff, /* src_mask */
277 0x0000ffff, /* dst_mask */
278 TRUE
), /* pcrel_offset */
280 /* 16 bit call through global offset table. */
281 HOWTO (R_MIPS_CALL16
, /* type */
283 2, /* size (0 = byte, 1 = short, 2 = long) */
285 FALSE
, /* pc_relative */
287 complain_overflow_signed
, /* complain_on_overflow */
288 _bfd_mips_elf_generic_reloc
, /* special_function */
289 "R_MIPS_CALL16", /* name */
290 TRUE
, /* partial_inplace */
291 0x0000ffff, /* src_mask */
292 0x0000ffff, /* dst_mask */
293 FALSE
), /* pcrel_offset */
295 /* 32 bit GP relative reference. */
296 HOWTO (R_MIPS_GPREL32
, /* type */
298 2, /* size (0 = byte, 1 = short, 2 = long) */
300 FALSE
, /* pc_relative */
302 complain_overflow_dont
, /* complain_on_overflow */
303 mips_elf_gprel32_reloc
, /* special_function */
304 "R_MIPS_GPREL32", /* name */
305 TRUE
, /* partial_inplace */
306 0xffffffff, /* src_mask */
307 0xffffffff, /* dst_mask */
308 FALSE
), /* pcrel_offset */
310 /* The remaining relocs are defined on Irix 5, although they are
311 not defined by the ABI. */
316 /* A 5 bit shift field. */
317 HOWTO (R_MIPS_SHIFT5
, /* type */
319 2, /* size (0 = byte, 1 = short, 2 = long) */
321 FALSE
, /* pc_relative */
323 complain_overflow_bitfield
, /* complain_on_overflow */
324 _bfd_mips_elf_generic_reloc
, /* special_function */
325 "R_MIPS_SHIFT5", /* name */
326 TRUE
, /* partial_inplace */
327 0x000007c0, /* src_mask */
328 0x000007c0, /* dst_mask */
329 FALSE
), /* pcrel_offset */
331 /* A 6 bit shift field. */
332 HOWTO (R_MIPS_SHIFT6
, /* type */
334 2, /* size (0 = byte, 1 = short, 2 = long) */
336 FALSE
, /* pc_relative */
338 complain_overflow_bitfield
, /* complain_on_overflow */
339 mips_elf_shift6_reloc
, /* special_function */
340 "R_MIPS_SHIFT6", /* name */
341 TRUE
, /* partial_inplace */
342 0x000007c4, /* src_mask */
343 0x000007c4, /* dst_mask */
344 FALSE
), /* pcrel_offset */
346 /* A 64 bit relocation. */
347 HOWTO (R_MIPS_64
, /* type */
349 4, /* size (0 = byte, 1 = short, 2 = long) */
351 FALSE
, /* pc_relative */
353 complain_overflow_dont
, /* complain_on_overflow */
354 _bfd_mips_elf_generic_reloc
, /* special_function */
355 "R_MIPS_64", /* name */
356 TRUE
, /* partial_inplace */
357 MINUS_ONE
, /* src_mask */
358 MINUS_ONE
, /* dst_mask */
359 FALSE
), /* pcrel_offset */
361 /* Displacement in the global offset table. */
362 HOWTO (R_MIPS_GOT_DISP
, /* type */
364 2, /* size (0 = byte, 1 = short, 2 = long) */
366 FALSE
, /* pc_relative */
368 complain_overflow_signed
, /* complain_on_overflow */
369 _bfd_mips_elf_generic_reloc
, /* special_function */
370 "R_MIPS_GOT_DISP", /* name */
371 TRUE
, /* partial_inplace */
372 0x0000ffff, /* src_mask */
373 0x0000ffff, /* dst_mask */
374 FALSE
), /* pcrel_offset */
376 /* Displacement to page pointer in the global offset table. */
377 HOWTO (R_MIPS_GOT_PAGE
, /* type */
379 2, /* size (0 = byte, 1 = short, 2 = long) */
381 FALSE
, /* pc_relative */
383 complain_overflow_signed
, /* complain_on_overflow */
384 _bfd_mips_elf_generic_reloc
, /* special_function */
385 "R_MIPS_GOT_PAGE", /* name */
386 TRUE
, /* partial_inplace */
387 0x0000ffff, /* src_mask */
388 0x0000ffff, /* dst_mask */
389 FALSE
), /* pcrel_offset */
391 /* Offset from page pointer in the global offset table. */
392 HOWTO (R_MIPS_GOT_OFST
, /* type */
394 2, /* size (0 = byte, 1 = short, 2 = long) */
396 FALSE
, /* pc_relative */
398 complain_overflow_signed
, /* complain_on_overflow */
399 _bfd_mips_elf_generic_reloc
, /* special_function */
400 "R_MIPS_GOT_OFST", /* name */
401 TRUE
, /* partial_inplace */
402 0x0000ffff, /* src_mask */
403 0x0000ffff, /* dst_mask */
404 FALSE
), /* pcrel_offset */
406 /* High 16 bits of displacement in global offset table. */
407 HOWTO (R_MIPS_GOT_HI16
, /* type */
409 2, /* size (0 = byte, 1 = short, 2 = long) */
411 FALSE
, /* pc_relative */
413 complain_overflow_dont
, /* complain_on_overflow */
414 _bfd_mips_elf_generic_reloc
, /* special_function */
415 "R_MIPS_GOT_HI16", /* name */
416 TRUE
, /* partial_inplace */
417 0x0000ffff, /* src_mask */
418 0x0000ffff, /* dst_mask */
419 FALSE
), /* pcrel_offset */
421 /* Low 16 bits of displacement in global offset table. */
422 HOWTO (R_MIPS_GOT_LO16
, /* type */
424 2, /* size (0 = byte, 1 = short, 2 = long) */
426 FALSE
, /* pc_relative */
428 complain_overflow_dont
, /* complain_on_overflow */
429 _bfd_mips_elf_generic_reloc
, /* special_function */
430 "R_MIPS_GOT_LO16", /* name */
431 TRUE
, /* partial_inplace */
432 0x0000ffff, /* src_mask */
433 0x0000ffff, /* dst_mask */
434 FALSE
), /* pcrel_offset */
436 /* 64 bit subtraction. */
437 HOWTO (R_MIPS_SUB
, /* type */
439 4, /* size (0 = byte, 1 = short, 2 = long) */
441 FALSE
, /* pc_relative */
443 complain_overflow_dont
, /* complain_on_overflow */
444 _bfd_mips_elf_generic_reloc
, /* special_function */
445 "R_MIPS_SUB", /* name */
446 TRUE
, /* partial_inplace */
447 MINUS_ONE
, /* src_mask */
448 MINUS_ONE
, /* dst_mask */
449 FALSE
), /* pcrel_offset */
451 /* Insert the addend as an instruction. */
452 /* FIXME: Not handled correctly. */
453 HOWTO (R_MIPS_INSERT_A
, /* type */
455 2, /* size (0 = byte, 1 = short, 2 = long) */
457 FALSE
, /* pc_relative */
459 complain_overflow_dont
, /* complain_on_overflow */
460 _bfd_mips_elf_generic_reloc
, /* special_function */
461 "R_MIPS_INSERT_A", /* name */
462 TRUE
, /* partial_inplace */
463 0xffffffff, /* src_mask */
464 0xffffffff, /* dst_mask */
465 FALSE
), /* pcrel_offset */
467 /* Insert the addend as an instruction, and change all relocations
468 to refer to the old instruction at the address. */
469 /* FIXME: Not handled correctly. */
470 HOWTO (R_MIPS_INSERT_B
, /* type */
472 2, /* size (0 = byte, 1 = short, 2 = long) */
474 FALSE
, /* pc_relative */
476 complain_overflow_dont
, /* complain_on_overflow */
477 _bfd_mips_elf_generic_reloc
, /* special_function */
478 "R_MIPS_INSERT_B", /* name */
479 TRUE
, /* partial_inplace */
480 0xffffffff, /* src_mask */
481 0xffffffff, /* dst_mask */
482 FALSE
), /* pcrel_offset */
484 /* Delete a 32 bit instruction. */
485 /* FIXME: Not handled correctly. */
486 HOWTO (R_MIPS_DELETE
, /* type */
488 2, /* size (0 = byte, 1 = short, 2 = long) */
490 FALSE
, /* pc_relative */
492 complain_overflow_dont
, /* complain_on_overflow */
493 _bfd_mips_elf_generic_reloc
, /* special_function */
494 "R_MIPS_DELETE", /* name */
495 TRUE
, /* partial_inplace */
496 0xffffffff, /* src_mask */
497 0xffffffff, /* dst_mask */
498 FALSE
), /* pcrel_offset */
500 /* The MIPS ELF64 ABI Draft wants us to support these for REL relocations.
502 a) It means building the addend from a R_MIPS_HIGHEST/R_MIPS_HIGHER/
503 R_MIPS_HI16/R_MIPS_LO16 sequence with varying ordering, using
505 b) No other NEwABI toolchain actually emits such relocations. */
506 EMPTY_HOWTO (R_MIPS_HIGHER
),
507 EMPTY_HOWTO (R_MIPS_HIGHEST
),
509 /* High 16 bits of displacement in global offset table. */
510 HOWTO (R_MIPS_CALL_HI16
, /* type */
512 2, /* size (0 = byte, 1 = short, 2 = long) */
514 FALSE
, /* pc_relative */
516 complain_overflow_dont
, /* complain_on_overflow */
517 _bfd_mips_elf_generic_reloc
, /* special_function */
518 "R_MIPS_CALL_HI16", /* name */
519 TRUE
, /* partial_inplace */
520 0x0000ffff, /* src_mask */
521 0x0000ffff, /* dst_mask */
522 FALSE
), /* pcrel_offset */
524 /* Low 16 bits of displacement in global offset table. */
525 HOWTO (R_MIPS_CALL_LO16
, /* type */
527 2, /* size (0 = byte, 1 = short, 2 = long) */
529 FALSE
, /* pc_relative */
531 complain_overflow_dont
, /* complain_on_overflow */
532 _bfd_mips_elf_generic_reloc
, /* special_function */
533 "R_MIPS_CALL_LO16", /* name */
534 TRUE
, /* partial_inplace */
535 0x0000ffff, /* src_mask */
536 0x0000ffff, /* dst_mask */
537 FALSE
), /* pcrel_offset */
539 /* Section displacement. */
540 HOWTO (R_MIPS_SCN_DISP
, /* type */
542 2, /* size (0 = byte, 1 = short, 2 = long) */
544 FALSE
, /* pc_relative */
546 complain_overflow_dont
, /* complain_on_overflow */
547 _bfd_mips_elf_generic_reloc
, /* special_function */
548 "R_MIPS_SCN_DISP", /* name */
549 TRUE
, /* partial_inplace */
550 0xffffffff, /* src_mask */
551 0xffffffff, /* dst_mask */
552 FALSE
), /* pcrel_offset */
554 HOWTO (R_MIPS_REL16
, /* type */
556 1, /* size (0 = byte, 1 = short, 2 = long) */
558 FALSE
, /* pc_relative */
560 complain_overflow_signed
, /* complain_on_overflow */
561 _bfd_mips_elf_generic_reloc
, /* special_function */
562 "R_MIPS_REL16", /* name */
563 TRUE
, /* partial_inplace */
564 0xffff, /* src_mask */
565 0xffff, /* dst_mask */
566 FALSE
), /* pcrel_offset */
568 /* These two are obsolete. */
569 EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE
),
570 EMPTY_HOWTO (R_MIPS_PJUMP
),
572 /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
573 It must be used for multigot GOT's (and only there). */
574 HOWTO (R_MIPS_RELGOT
, /* type */
576 2, /* size (0 = byte, 1 = short, 2 = long) */
578 FALSE
, /* pc_relative */
580 complain_overflow_dont
, /* complain_on_overflow */
581 _bfd_mips_elf_generic_reloc
, /* special_function */
582 "R_MIPS_RELGOT", /* name */
583 TRUE
, /* partial_inplace */
584 0xffffffff, /* src_mask */
585 0xffffffff, /* dst_mask */
586 FALSE
), /* pcrel_offset */
588 /* Protected jump conversion. This is an optimization hint. No
589 relocation is required for correctness. */
590 HOWTO (R_MIPS_JALR
, /* type */
592 2, /* size (0 = byte, 1 = short, 2 = long) */
594 FALSE
, /* pc_relative */
596 complain_overflow_dont
, /* complain_on_overflow */
597 _bfd_mips_elf_generic_reloc
, /* special_function */
598 "R_MIPS_JALR", /* name */
599 FALSE
, /* partial_inplace */
600 0x00000000, /* src_mask */
601 0x00000000, /* dst_mask */
602 FALSE
), /* pcrel_offset */
605 /* The relocation table used for SHT_RELA sections. */
607 static reloc_howto_type elf_mips_howto_table_rela
[] =
610 HOWTO (R_MIPS_NONE
, /* type */
612 0, /* size (0 = byte, 1 = short, 2 = long) */
614 FALSE
, /* pc_relative */
616 complain_overflow_dont
, /* complain_on_overflow */
617 _bfd_mips_elf_generic_reloc
, /* special_function */
618 "R_MIPS_NONE", /* name */
619 FALSE
, /* partial_inplace */
622 FALSE
), /* pcrel_offset */
624 /* 16 bit relocation. */
625 HOWTO (R_MIPS_16
, /* type */
627 2, /* size (0 = byte, 1 = short, 2 = long) */
629 FALSE
, /* pc_relative */
631 complain_overflow_signed
, /* complain_on_overflow */
632 _bfd_mips_elf_generic_reloc
, /* special_function */
633 "R_MIPS_16", /* name */
634 FALSE
, /* partial_inplace */
636 0x0000, /* dst_mask */
637 FALSE
), /* pcrel_offset */
639 /* 32 bit relocation. */
640 HOWTO (R_MIPS_32
, /* type */
642 2, /* size (0 = byte, 1 = short, 2 = long) */
644 FALSE
, /* pc_relative */
646 complain_overflow_dont
, /* complain_on_overflow */
647 _bfd_mips_elf_generic_reloc
, /* special_function */
648 "R_MIPS_32", /* name */
649 FALSE
, /* partial_inplace */
651 0xffffffff, /* dst_mask */
652 FALSE
), /* pcrel_offset */
654 /* 32 bit symbol relative relocation. */
655 HOWTO (R_MIPS_REL32
, /* type */
657 2, /* size (0 = byte, 1 = short, 2 = long) */
659 FALSE
, /* pc_relative */
661 complain_overflow_dont
, /* complain_on_overflow */
662 _bfd_mips_elf_generic_reloc
, /* special_function */
663 "R_MIPS_REL32", /* name */
664 FALSE
, /* partial_inplace */
666 0xffffffff, /* dst_mask */
667 FALSE
), /* pcrel_offset */
669 /* 26 bit jump address. */
670 HOWTO (R_MIPS_26
, /* type */
672 2, /* size (0 = byte, 1 = short, 2 = long) */
674 FALSE
, /* pc_relative */
676 complain_overflow_dont
, /* complain_on_overflow */
677 /* This needs complex overflow
678 detection, because the upper 36
679 bits must match the PC + 4. */
680 _bfd_mips_elf_generic_reloc
, /* special_function */
681 "R_MIPS_26", /* name */
682 FALSE
, /* partial_inplace */
684 0x03ffffff, /* dst_mask */
685 FALSE
), /* pcrel_offset */
687 /* High 16 bits of symbol value. */
688 HOWTO (R_MIPS_HI16
, /* type */
690 2, /* size (0 = byte, 1 = short, 2 = long) */
692 FALSE
, /* pc_relative */
694 complain_overflow_dont
, /* complain_on_overflow */
695 _bfd_mips_elf_generic_reloc
, /* special_function */
696 "R_MIPS_HI16", /* name */
697 FALSE
, /* partial_inplace */
699 0x0000ffff, /* dst_mask */
700 FALSE
), /* pcrel_offset */
702 /* Low 16 bits of symbol value. */
703 HOWTO (R_MIPS_LO16
, /* type */
705 2, /* size (0 = byte, 1 = short, 2 = long) */
707 FALSE
, /* pc_relative */
709 complain_overflow_dont
, /* complain_on_overflow */
710 _bfd_mips_elf_generic_reloc
, /* special_function */
711 "R_MIPS_LO16", /* name */
712 FALSE
, /* partial_inplace */
714 0x0000ffff, /* dst_mask */
715 FALSE
), /* pcrel_offset */
717 /* GP relative reference. */
718 HOWTO (R_MIPS_GPREL16
, /* type */
720 2, /* size (0 = byte, 1 = short, 2 = long) */
722 FALSE
, /* pc_relative */
724 complain_overflow_signed
, /* complain_on_overflow */
725 mips_elf_gprel16_reloc
, /* special_function */
726 "R_MIPS_GPREL16", /* name */
727 FALSE
, /* partial_inplace */
729 0x0000ffff, /* dst_mask */
730 FALSE
), /* pcrel_offset */
732 /* Reference to literal section. */
733 HOWTO (R_MIPS_LITERAL
, /* type */
735 2, /* size (0 = byte, 1 = short, 2 = long) */
737 FALSE
, /* pc_relative */
739 complain_overflow_signed
, /* complain_on_overflow */
740 mips_elf_literal_reloc
, /* special_function */
741 "R_MIPS_LITERAL", /* name */
742 FALSE
, /* partial_inplace */
744 0x0000ffff, /* dst_mask */
745 FALSE
), /* pcrel_offset */
747 /* Reference to global offset table. */
748 HOWTO (R_MIPS_GOT16
, /* type */
750 2, /* size (0 = byte, 1 = short, 2 = long) */
752 FALSE
, /* pc_relative */
754 complain_overflow_signed
, /* complain_on_overflow */
755 _bfd_mips_elf_generic_reloc
, /* special_function */
756 "R_MIPS_GOT16", /* name */
757 FALSE
, /* partial_inplace */
759 0x0000ffff, /* dst_mask */
760 FALSE
), /* pcrel_offset */
762 /* 16 bit PC relative reference. */
763 HOWTO (R_MIPS_PC16
, /* type */
765 2, /* size (0 = byte, 1 = short, 2 = long) */
767 TRUE
, /* pc_relative */
769 complain_overflow_signed
, /* complain_on_overflow */
770 _bfd_mips_elf_generic_reloc
, /* special_function */
771 "R_MIPS_PC16", /* name */
772 FALSE
, /* partial_inplace */
774 0x0000ffff, /* dst_mask */
775 TRUE
), /* pcrel_offset */
777 /* 16 bit call through global offset table. */
778 HOWTO (R_MIPS_CALL16
, /* type */
780 2, /* size (0 = byte, 1 = short, 2 = long) */
782 FALSE
, /* pc_relative */
784 complain_overflow_signed
, /* complain_on_overflow */
785 _bfd_mips_elf_generic_reloc
, /* special_function */
786 "R_MIPS_CALL16", /* name */
787 FALSE
, /* partial_inplace */
789 0x0000ffff, /* dst_mask */
790 FALSE
), /* pcrel_offset */
792 /* 32 bit GP relative reference. */
793 HOWTO (R_MIPS_GPREL32
, /* type */
795 2, /* size (0 = byte, 1 = short, 2 = long) */
797 FALSE
, /* pc_relative */
799 complain_overflow_dont
, /* complain_on_overflow */
800 mips_elf_gprel32_reloc
, /* special_function */
801 "R_MIPS_GPREL32", /* name */
802 FALSE
, /* partial_inplace */
804 0xffffffff, /* dst_mask */
805 FALSE
), /* pcrel_offset */
811 /* A 5 bit shift field. */
812 HOWTO (R_MIPS_SHIFT5
, /* type */
814 2, /* size (0 = byte, 1 = short, 2 = long) */
816 FALSE
, /* pc_relative */
818 complain_overflow_bitfield
, /* complain_on_overflow */
819 _bfd_mips_elf_generic_reloc
, /* special_function */
820 "R_MIPS_SHIFT5", /* name */
821 FALSE
, /* partial_inplace */
823 0x000007c0, /* dst_mask */
824 FALSE
), /* pcrel_offset */
826 /* A 6 bit shift field. */
827 HOWTO (R_MIPS_SHIFT6
, /* type */
829 2, /* size (0 = byte, 1 = short, 2 = long) */
831 FALSE
, /* pc_relative */
833 complain_overflow_bitfield
, /* complain_on_overflow */
834 mips_elf_shift6_reloc
, /* special_function */
835 "R_MIPS_SHIFT6", /* name */
836 FALSE
, /* partial_inplace */
838 0x000007c4, /* dst_mask */
839 FALSE
), /* pcrel_offset */
841 /* 64 bit relocation. */
842 HOWTO (R_MIPS_64
, /* type */
844 4, /* size (0 = byte, 1 = short, 2 = long) */
846 FALSE
, /* pc_relative */
848 complain_overflow_dont
, /* complain_on_overflow */
849 _bfd_mips_elf_generic_reloc
, /* special_function */
850 "R_MIPS_64", /* name */
851 FALSE
, /* partial_inplace */
853 MINUS_ONE
, /* dst_mask */
854 FALSE
), /* pcrel_offset */
856 /* Displacement in the global offset table. */
857 HOWTO (R_MIPS_GOT_DISP
, /* type */
859 2, /* size (0 = byte, 1 = short, 2 = long) */
861 FALSE
, /* pc_relative */
863 complain_overflow_signed
, /* complain_on_overflow */
864 _bfd_mips_elf_generic_reloc
, /* special_function */
865 "R_MIPS_GOT_DISP", /* name */
866 FALSE
, /* partial_inplace */
868 0x0000ffff, /* dst_mask */
869 FALSE
), /* pcrel_offset */
871 /* Displacement to page pointer in the global offset table. */
872 HOWTO (R_MIPS_GOT_PAGE
, /* type */
874 2, /* size (0 = byte, 1 = short, 2 = long) */
876 FALSE
, /* pc_relative */
878 complain_overflow_signed
, /* complain_on_overflow */
879 _bfd_mips_elf_generic_reloc
, /* special_function */
880 "R_MIPS_GOT_PAGE", /* name */
881 FALSE
, /* partial_inplace */
883 0x0000ffff, /* dst_mask */
884 FALSE
), /* pcrel_offset */
886 /* Offset from page pointer in the global offset table. */
887 HOWTO (R_MIPS_GOT_OFST
, /* type */
889 2, /* size (0 = byte, 1 = short, 2 = long) */
891 FALSE
, /* pc_relative */
893 complain_overflow_signed
, /* complain_on_overflow */
894 _bfd_mips_elf_generic_reloc
, /* special_function */
895 "R_MIPS_GOT_OFST", /* name */
896 FALSE
, /* partial_inplace */
898 0x0000ffff, /* dst_mask */
899 FALSE
), /* pcrel_offset */
901 /* High 16 bits of displacement in global offset table. */
902 HOWTO (R_MIPS_GOT_HI16
, /* type */
904 2, /* size (0 = byte, 1 = short, 2 = long) */
906 FALSE
, /* pc_relative */
908 complain_overflow_dont
, /* complain_on_overflow */
909 _bfd_mips_elf_generic_reloc
, /* special_function */
910 "R_MIPS_GOT_HI16", /* name */
911 FALSE
, /* partial_inplace */
913 0x0000ffff, /* dst_mask */
914 FALSE
), /* pcrel_offset */
916 /* Low 16 bits of displacement in global offset table. */
917 HOWTO (R_MIPS_GOT_LO16
, /* type */
919 2, /* size (0 = byte, 1 = short, 2 = long) */
921 FALSE
, /* pc_relative */
923 complain_overflow_dont
, /* complain_on_overflow */
924 _bfd_mips_elf_generic_reloc
, /* special_function */
925 "R_MIPS_GOT_LO16", /* name */
926 FALSE
, /* partial_inplace */
928 0x0000ffff, /* dst_mask */
929 FALSE
), /* pcrel_offset */
931 /* 64 bit subtraction. */
932 HOWTO (R_MIPS_SUB
, /* type */
934 4, /* size (0 = byte, 1 = short, 2 = long) */
936 FALSE
, /* pc_relative */
938 complain_overflow_dont
, /* complain_on_overflow */
939 _bfd_mips_elf_generic_reloc
, /* special_function */
940 "R_MIPS_SUB", /* name */
941 FALSE
, /* partial_inplace */
943 MINUS_ONE
, /* dst_mask */
944 FALSE
), /* pcrel_offset */
946 /* Insert the addend as an instruction. */
947 /* FIXME: Not handled correctly. */
948 HOWTO (R_MIPS_INSERT_A
, /* type */
950 2, /* size (0 = byte, 1 = short, 2 = long) */
952 FALSE
, /* pc_relative */
954 complain_overflow_dont
, /* complain_on_overflow */
955 _bfd_mips_elf_generic_reloc
, /* special_function */
956 "R_MIPS_INSERT_A", /* name */
957 FALSE
, /* partial_inplace */
959 0xffffffff, /* dst_mask */
960 FALSE
), /* pcrel_offset */
962 /* Insert the addend as an instruction, and change all relocations
963 to refer to the old instruction at the address. */
964 /* FIXME: Not handled correctly. */
965 HOWTO (R_MIPS_INSERT_B
, /* type */
967 2, /* size (0 = byte, 1 = short, 2 = long) */
969 FALSE
, /* pc_relative */
971 complain_overflow_dont
, /* complain_on_overflow */
972 _bfd_mips_elf_generic_reloc
, /* special_function */
973 "R_MIPS_INSERT_B", /* name */
974 FALSE
, /* partial_inplace */
976 0xffffffff, /* dst_mask */
977 FALSE
), /* pcrel_offset */
979 /* Delete a 32 bit instruction. */
980 /* FIXME: Not handled correctly. */
981 HOWTO (R_MIPS_DELETE
, /* type */
983 2, /* size (0 = byte, 1 = short, 2 = long) */
985 FALSE
, /* pc_relative */
987 complain_overflow_dont
, /* complain_on_overflow */
988 _bfd_mips_elf_generic_reloc
, /* special_function */
989 "R_MIPS_DELETE", /* name */
990 FALSE
, /* partial_inplace */
992 0xffffffff, /* dst_mask */
993 FALSE
), /* pcrel_offset */
995 /* Get the higher value of a 64 bit addend. */
996 HOWTO (R_MIPS_HIGHER
, /* type */
998 2, /* size (0 = byte, 1 = short, 2 = long) */
1000 FALSE
, /* pc_relative */
1002 complain_overflow_dont
, /* complain_on_overflow */
1003 _bfd_mips_elf_generic_reloc
, /* special_function */
1004 "R_MIPS_HIGHER", /* name */
1005 FALSE
, /* partial_inplace */
1007 0x0000ffff, /* dst_mask */
1008 FALSE
), /* pcrel_offset */
1010 /* Get the highest value of a 64 bit addend. */
1011 HOWTO (R_MIPS_HIGHEST
, /* type */
1013 2, /* size (0 = byte, 1 = short, 2 = long) */
1015 FALSE
, /* pc_relative */
1017 complain_overflow_dont
, /* complain_on_overflow */
1018 _bfd_mips_elf_generic_reloc
, /* special_function */
1019 "R_MIPS_HIGHEST", /* name */
1020 FALSE
, /* partial_inplace */
1022 0x0000ffff, /* dst_mask */
1023 FALSE
), /* pcrel_offset */
1025 /* High 16 bits of displacement in global offset table. */
1026 HOWTO (R_MIPS_CALL_HI16
, /* type */
1028 2, /* size (0 = byte, 1 = short, 2 = long) */
1030 FALSE
, /* pc_relative */
1032 complain_overflow_dont
, /* complain_on_overflow */
1033 _bfd_mips_elf_generic_reloc
, /* special_function */
1034 "R_MIPS_CALL_HI16", /* name */
1035 FALSE
, /* partial_inplace */
1037 0x0000ffff, /* dst_mask */
1038 FALSE
), /* pcrel_offset */
1040 /* Low 16 bits of displacement in global offset table. */
1041 HOWTO (R_MIPS_CALL_LO16
, /* type */
1043 2, /* size (0 = byte, 1 = short, 2 = long) */
1045 FALSE
, /* pc_relative */
1047 complain_overflow_dont
, /* complain_on_overflow */
1048 _bfd_mips_elf_generic_reloc
, /* special_function */
1049 "R_MIPS_CALL_LO16", /* name */
1050 FALSE
, /* partial_inplace */
1052 0x0000ffff, /* dst_mask */
1053 FALSE
), /* pcrel_offset */
1055 /* Section displacement, used by an associated event location section. */
1056 HOWTO (R_MIPS_SCN_DISP
, /* type */
1058 2, /* size (0 = byte, 1 = short, 2 = long) */
1060 FALSE
, /* pc_relative */
1062 complain_overflow_dont
, /* complain_on_overflow */
1063 _bfd_mips_elf_generic_reloc
, /* special_function */
1064 "R_MIPS_SCN_DISP", /* name */
1065 FALSE
, /* partial_inplace */
1067 0xffffffff, /* dst_mask */
1068 FALSE
), /* pcrel_offset */
1070 /* 16 bit relocation. */
1071 HOWTO (R_MIPS_REL16
, /* type */
1073 1, /* size (0 = byte, 1 = short, 2 = long) */
1075 FALSE
, /* pc_relative */
1077 complain_overflow_signed
, /* complain_on_overflow */
1078 _bfd_mips_elf_generic_reloc
, /* special_function */
1079 "R_MIPS_REL16", /* name */
1080 FALSE
, /* partial_inplace */
1082 0xffff, /* dst_mask */
1083 FALSE
), /* pcrel_offset */
1085 /* These two are obsolete. */
1086 EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE
),
1087 EMPTY_HOWTO (R_MIPS_PJUMP
),
1089 /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
1090 It must be used for multigot GOT's (and only there). */
1091 HOWTO (R_MIPS_RELGOT
, /* type */
1093 2, /* size (0 = byte, 1 = short, 2 = long) */
1095 FALSE
, /* pc_relative */
1097 complain_overflow_dont
, /* complain_on_overflow */
1098 _bfd_mips_elf_generic_reloc
, /* special_function */
1099 "R_MIPS_RELGOT", /* name */
1100 FALSE
, /* partial_inplace */
1102 0xffffffff, /* dst_mask */
1103 FALSE
), /* pcrel_offset */
1105 /* Protected jump conversion. This is an optimization hint. No
1106 relocation is required for correctness. */
1107 HOWTO (R_MIPS_JALR
, /* type */
1109 2, /* size (0 = byte, 1 = short, 2 = long) */
1111 FALSE
, /* pc_relative */
1113 complain_overflow_dont
, /* complain_on_overflow */
1114 _bfd_mips_elf_generic_reloc
, /* special_function */
1115 "R_MIPS_JALR", /* name */
1116 FALSE
, /* partial_inplace */
1118 0xffffffff, /* dst_mask */
1119 FALSE
), /* pcrel_offset */
1122 /* The reloc used for the mips16 jump instruction. */
1123 static reloc_howto_type elf_mips16_jump_howto
=
1124 HOWTO (R_MIPS16_26
, /* type */
1126 2, /* size (0 = byte, 1 = short, 2 = long) */
1128 FALSE
, /* pc_relative */
1130 complain_overflow_dont
, /* complain_on_overflow */
1131 /* This needs complex overflow
1132 detection, because the upper four
1133 bits must match the PC. */
1134 mips16_jump_reloc
, /* special_function */
1135 "R_MIPS16_26", /* name */
1136 TRUE
, /* partial_inplace */
1137 0x3ffffff, /* src_mask */
1138 0x3ffffff, /* dst_mask */
1139 FALSE
); /* pcrel_offset */
1141 /* The reloc used for the mips16 gprel instruction. */
1142 static reloc_howto_type elf_mips16_gprel_howto
=
1143 HOWTO (R_MIPS16_GPREL
, /* type */
1145 2, /* size (0 = byte, 1 = short, 2 = long) */
1147 FALSE
, /* pc_relative */
1149 complain_overflow_signed
, /* complain_on_overflow */
1150 mips16_gprel_reloc
, /* special_function */
1151 "R_MIPS16_GPREL", /* name */
1152 TRUE
, /* partial_inplace */
1153 0x07ff001f, /* src_mask */
1154 0x07ff001f, /* dst_mask */
1155 FALSE
); /* pcrel_offset */
1157 /* GNU extension to record C++ vtable hierarchy */
1158 static reloc_howto_type elf_mips_gnu_vtinherit_howto
=
1159 HOWTO (R_MIPS_GNU_VTINHERIT
, /* type */
1161 2, /* size (0 = byte, 1 = short, 2 = long) */
1163 FALSE
, /* pc_relative */
1165 complain_overflow_dont
, /* complain_on_overflow */
1166 NULL
, /* special_function */
1167 "R_MIPS_GNU_VTINHERIT", /* name */
1168 FALSE
, /* partial_inplace */
1171 FALSE
); /* pcrel_offset */
1173 /* GNU extension to record C++ vtable member usage */
1174 static reloc_howto_type elf_mips_gnu_vtentry_howto
=
1175 HOWTO (R_MIPS_GNU_VTENTRY
, /* type */
1177 2, /* size (0 = byte, 1 = short, 2 = long) */
1179 FALSE
, /* pc_relative */
1181 complain_overflow_dont
, /* complain_on_overflow */
1182 _bfd_elf_rel_vtable_reloc_fn
, /* special_function */
1183 "R_MIPS_GNU_VTENTRY", /* name */
1184 FALSE
, /* partial_inplace */
1187 FALSE
); /* pcrel_offset */
1189 /* 16 bit offset for pc-relative branches. */
1190 static reloc_howto_type elf_mips_gnu_rel16_s2
=
1191 HOWTO (R_MIPS_GNU_REL16_S2
, /* type */
1193 2, /* size (0 = byte, 1 = short, 2 = long) */
1195 TRUE
, /* pc_relative */
1197 complain_overflow_signed
, /* complain_on_overflow */
1198 _bfd_mips_elf_generic_reloc
, /* special_function */
1199 "R_MIPS_GNU_REL16_S2", /* name */
1200 TRUE
, /* partial_inplace */
1201 0x0000ffff, /* src_mask */
1202 0x0000ffff, /* dst_mask */
1203 TRUE
); /* pcrel_offset */
1205 /* 16 bit offset for pc-relative branches. */
1206 static reloc_howto_type elf_mips_gnu_rela16_s2
=
1207 HOWTO (R_MIPS_GNU_REL16_S2
, /* type */
1209 2, /* size (0 = byte, 1 = short, 2 = long) */
1211 TRUE
, /* pc_relative */
1213 complain_overflow_signed
, /* complain_on_overflow */
1214 _bfd_mips_elf_generic_reloc
, /* special_function */
1215 "R_MIPS_GNU_REL16_S2", /* name */
1216 FALSE
, /* partial_inplace */
1218 0x0000ffff, /* dst_mask */
1219 TRUE
); /* pcrel_offset */
1221 /* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a
1222 dangerous relocation. */
1225 mips_elf_assign_gp (bfd
*output_bfd
, bfd_vma
*pgp
)
1231 /* If we've already figured out what GP will be, just return it. */
1232 *pgp
= _bfd_get_gp_value (output_bfd
);
1236 count
= bfd_get_symcount (output_bfd
);
1237 sym
= bfd_get_outsymbols (output_bfd
);
1239 /* The linker script will have created a symbol named `_gp' with the
1240 appropriate value. */
1245 for (i
= 0; i
< count
; i
++, sym
++)
1247 register const char *name
;
1249 name
= bfd_asymbol_name (*sym
);
1250 if (*name
== '_' && strcmp (name
, "_gp") == 0)
1252 *pgp
= bfd_asymbol_value (*sym
);
1253 _bfd_set_gp_value (output_bfd
, *pgp
);
1261 /* Only get the error once. */
1263 _bfd_set_gp_value (output_bfd
, *pgp
);
1270 /* We have to figure out the gp value, so that we can adjust the
1271 symbol value correctly. We look up the symbol _gp in the output
1272 BFD. If we can't find it, we're stuck. We cache it in the ELF
1273 target data. We don't need to adjust the symbol value for an
1274 external symbol if we are producing relocatable output. */
1276 static bfd_reloc_status_type
1277 mips_elf_final_gp (bfd
*output_bfd
, asymbol
*symbol
, bfd_boolean relocatable
,
1278 char **error_message
, bfd_vma
*pgp
)
1280 if (bfd_is_und_section (symbol
->section
)
1284 return bfd_reloc_undefined
;
1287 *pgp
= _bfd_get_gp_value (output_bfd
);
1290 || (symbol
->flags
& BSF_SECTION_SYM
) != 0))
1294 /* Make up a value. */
1295 *pgp
= symbol
->section
->output_section
->vma
/*+ 0x4000*/;
1296 _bfd_set_gp_value (output_bfd
, *pgp
);
1298 else if (!mips_elf_assign_gp (output_bfd
, pgp
))
1301 (char *) _("GP relative relocation when _gp not defined");
1302 return bfd_reloc_dangerous
;
1306 return bfd_reloc_ok
;
1309 /* Do a R_MIPS_GPREL16 relocation. This is a 16 bit value which must
1310 become the offset from the gp register. */
1312 static bfd_reloc_status_type
1313 mips_elf_gprel16_reloc (bfd
*abfd ATTRIBUTE_UNUSED
, arelent
*reloc_entry
,
1314 asymbol
*symbol
, void *data ATTRIBUTE_UNUSED
,
1315 asection
*input_section
, bfd
*output_bfd
,
1316 char **error_message ATTRIBUTE_UNUSED
)
1318 bfd_boolean relocatable
;
1319 bfd_reloc_status_type ret
;
1322 if (output_bfd
!= NULL
)
1326 relocatable
= FALSE
;
1327 output_bfd
= symbol
->section
->output_section
->owner
;
1330 ret
= mips_elf_final_gp (output_bfd
, symbol
, relocatable
, error_message
,
1332 if (ret
!= bfd_reloc_ok
)
1335 return _bfd_mips_elf_gprel16_with_gp (abfd
, symbol
, reloc_entry
,
1336 input_section
, relocatable
,
1340 /* Do a R_MIPS_LITERAL relocation. */
1342 static bfd_reloc_status_type
1343 mips_elf_literal_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
1344 void *data
, asection
*input_section
, bfd
*output_bfd
,
1345 char **error_message
)
1347 bfd_boolean relocatable
;
1348 bfd_reloc_status_type ret
;
1351 /* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */
1352 if (output_bfd
!= NULL
)
1356 relocatable
= FALSE
;
1357 output_bfd
= symbol
->section
->output_section
->owner
;
1360 ret
= mips_elf_final_gp (output_bfd
, symbol
, relocatable
, error_message
,
1362 if (ret
!= bfd_reloc_ok
)
1365 return _bfd_mips_elf_gprel16_with_gp (abfd
, symbol
, reloc_entry
,
1366 input_section
, relocatable
,
1370 /* Do a R_MIPS_GPREL32 relocation. This is a 32 bit value which must
1371 become the offset from the gp register. */
1373 static bfd_reloc_status_type
1374 mips_elf_gprel32_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
1375 void *data
, asection
*input_section
, bfd
*output_bfd
,
1376 char **error_message
)
1378 bfd_boolean relocatable
;
1379 bfd_reloc_status_type ret
;
1382 /* R_MIPS_GPREL32 relocations are defined for local symbols only. */
1383 if (output_bfd
!= NULL
1384 && (symbol
->flags
& BSF_SECTION_SYM
) == 0
1385 && (symbol
->flags
& BSF_LOCAL
) != 0)
1387 *error_message
= (char *)
1388 _("32bits gp relative relocation occurs for an external symbol");
1389 return bfd_reloc_outofrange
;
1392 if (output_bfd
!= NULL
)
1395 gp
= _bfd_get_gp_value (output_bfd
);
1399 relocatable
= FALSE
;
1400 output_bfd
= symbol
->section
->output_section
->owner
;
1402 ret
= mips_elf_final_gp (output_bfd
, symbol
, relocatable
,
1403 error_message
, &gp
);
1404 if (ret
!= bfd_reloc_ok
)
1408 return gprel32_with_gp (abfd
, symbol
, reloc_entry
, input_section
,
1409 relocatable
, data
, gp
);
1412 static bfd_reloc_status_type
1413 gprel32_with_gp (bfd
*abfd
, asymbol
*symbol
, arelent
*reloc_entry
,
1414 asection
*input_section
, bfd_boolean relocatable
,
1415 void *data
, bfd_vma gp
)
1421 if (bfd_is_com_section (symbol
->section
))
1424 relocation
= symbol
->value
;
1426 relocation
+= symbol
->section
->output_section
->vma
;
1427 relocation
+= symbol
->section
->output_offset
;
1429 sz
= input_section
->rawsize
? input_section
->rawsize
: input_section
->size
;
1430 if (reloc_entry
->address
> sz
)
1431 return bfd_reloc_outofrange
;
1433 if (reloc_entry
->howto
->src_mask
== 0)
1436 val
= bfd_get_32 (abfd
, (bfd_byte
*) data
+ reloc_entry
->address
);
1438 /* Set val to the offset into the section or symbol. */
1439 val
+= reloc_entry
->addend
;
1441 /* Adjust val for the final section location and GP value. If we
1442 are producing relocatable output, we don't want to do this for
1443 an external symbol. */
1445 || (symbol
->flags
& BSF_SECTION_SYM
) != 0)
1446 val
+= relocation
- gp
;
1448 bfd_put_32 (abfd
, val
, (bfd_byte
*) data
+ reloc_entry
->address
);
1451 reloc_entry
->address
+= input_section
->output_offset
;
1453 return bfd_reloc_ok
;
1456 /* Do a R_MIPS_SHIFT6 relocation. The MSB of the shift is stored at bit 2,
1457 the rest is at bits 6-10. The bitpos already got right by the howto. */
1459 static bfd_reloc_status_type
1460 mips_elf_shift6_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
1461 void *data
, asection
*input_section
, bfd
*output_bfd
,
1462 char **error_message
)
1464 if (reloc_entry
->howto
->partial_inplace
)
1466 reloc_entry
->addend
= ((reloc_entry
->addend
& 0x00007c0)
1467 | (reloc_entry
->addend
& 0x00000800) >> 9);
1470 return _bfd_mips_elf_generic_reloc (abfd
, reloc_entry
, symbol
, data
,
1471 input_section
, output_bfd
,
1475 /* Handle a mips16 jump. */
1477 static bfd_reloc_status_type
1478 mips16_jump_reloc (bfd
*abfd ATTRIBUTE_UNUSED
,
1479 arelent
*reloc_entry ATTRIBUTE_UNUSED
,
1480 asymbol
*symbol ATTRIBUTE_UNUSED
,
1481 void *data ATTRIBUTE_UNUSED
,
1482 asection
*input_section
, bfd
*output_bfd ATTRIBUTE_UNUSED
,
1483 char **error_message ATTRIBUTE_UNUSED
)
1485 static bfd_boolean warned
= FALSE
;
1489 (*_bfd_error_handler
)
1490 (_("Linking mips16 objects into %s format is not supported"),
1491 bfd_get_target (input_section
->output_section
->owner
));
1494 return bfd_reloc_undefined
;
1497 /* Handle a mips16 GP relative reloc. */
1499 static bfd_reloc_status_type
1500 mips16_gprel_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
1501 void *data
, asection
*input_section
, bfd
*output_bfd
,
1502 char **error_message
)
1504 bfd_boolean relocatable
;
1505 bfd_reloc_status_type ret
;
1507 unsigned short extend
= 0;
1508 unsigned short insn
= 0;
1513 if (output_bfd
!= NULL
)
1517 relocatable
= FALSE
;
1518 output_bfd
= symbol
->section
->output_section
->owner
;
1521 ret
= mips_elf_final_gp (output_bfd
, symbol
, relocatable
, error_message
,
1523 if (ret
!= bfd_reloc_ok
)
1526 sz
= input_section
->rawsize
? input_section
->rawsize
: input_section
->size
;
1527 if (reloc_entry
->address
> sz
)
1528 return bfd_reloc_outofrange
;
1530 if (bfd_is_com_section (symbol
->section
))
1533 relocation
= symbol
->value
;
1535 relocation
+= symbol
->section
->output_section
->vma
;
1536 relocation
+= symbol
->section
->output_offset
;
1538 /* Set val to the offset into the section or symbol. */
1539 val
= reloc_entry
->addend
;
1541 if (reloc_entry
->howto
->partial_inplace
)
1543 /* Pick up the mips16 extend instruction and the real instruction. */
1544 extend
= bfd_get_16 (abfd
, (bfd_byte
*) data
+ reloc_entry
->address
);
1545 insn
= bfd_get_16 (abfd
, (bfd_byte
*) data
+ reloc_entry
->address
+ 2);
1546 val
+= ((extend
& 0x1f) << 11) | (extend
& 0x7e0) | (insn
& 0x1f);
1549 _bfd_mips_elf_sign_extend(val
, 16);
1551 /* Adjust val for the final section location and GP value. If we
1552 are producing relocatable output, we don't want to do this for
1553 an external symbol. */
1555 || (symbol
->flags
& BSF_SECTION_SYM
) != 0)
1556 val
+= relocation
- gp
;
1558 if (reloc_entry
->howto
->partial_inplace
)
1561 (extend
& 0xf800) | ((val
>> 11) & 0x1f) | (val
& 0x7e0),
1562 (bfd_byte
*) data
+ reloc_entry
->address
);
1564 (insn
& 0xffe0) | (val
& 0x1f),
1565 (bfd_byte
*) data
+ reloc_entry
->address
+ 2);
1568 reloc_entry
->addend
= val
;
1571 reloc_entry
->address
+= input_section
->output_offset
;
1572 else if (((val
& ~0xffff) != ~0xffff) && ((val
& ~0xffff) != 0))
1573 return bfd_reloc_overflow
;
1575 return bfd_reloc_ok
;
1578 /* A mapping from BFD reloc types to MIPS ELF reloc types. */
1580 struct elf_reloc_map
{
1581 bfd_reloc_code_real_type bfd_val
;
1582 enum elf_mips_reloc_type elf_val
;
1585 static const struct elf_reloc_map mips_reloc_map
[] =
1587 { BFD_RELOC_NONE
, R_MIPS_NONE
},
1588 { BFD_RELOC_16
, R_MIPS_16
},
1589 { BFD_RELOC_32
, R_MIPS_32
},
1590 /* There is no BFD reloc for R_MIPS_REL32. */
1591 { BFD_RELOC_CTOR
, R_MIPS_32
},
1592 { BFD_RELOC_64
, R_MIPS_64
},
1593 { BFD_RELOC_16_PCREL
, R_MIPS_PC16
},
1594 { BFD_RELOC_HI16_S
, R_MIPS_HI16
},
1595 { BFD_RELOC_LO16
, R_MIPS_LO16
},
1596 { BFD_RELOC_GPREL16
, R_MIPS_GPREL16
},
1597 { BFD_RELOC_GPREL32
, R_MIPS_GPREL32
},
1598 { BFD_RELOC_MIPS_JMP
, R_MIPS_26
},
1599 { BFD_RELOC_MIPS_LITERAL
, R_MIPS_LITERAL
},
1600 { BFD_RELOC_MIPS_GOT16
, R_MIPS_GOT16
},
1601 { BFD_RELOC_MIPS_CALL16
, R_MIPS_CALL16
},
1602 { BFD_RELOC_MIPS_SHIFT5
, R_MIPS_SHIFT5
},
1603 { BFD_RELOC_MIPS_SHIFT6
, R_MIPS_SHIFT6
},
1604 { BFD_RELOC_MIPS_GOT_DISP
, R_MIPS_GOT_DISP
},
1605 { BFD_RELOC_MIPS_GOT_PAGE
, R_MIPS_GOT_PAGE
},
1606 { BFD_RELOC_MIPS_GOT_OFST
, R_MIPS_GOT_OFST
},
1607 { BFD_RELOC_MIPS_GOT_HI16
, R_MIPS_GOT_HI16
},
1608 { BFD_RELOC_MIPS_GOT_LO16
, R_MIPS_GOT_LO16
},
1609 { BFD_RELOC_MIPS_SUB
, R_MIPS_SUB
},
1610 { BFD_RELOC_MIPS_INSERT_A
, R_MIPS_INSERT_A
},
1611 { BFD_RELOC_MIPS_INSERT_B
, R_MIPS_INSERT_B
},
1612 { BFD_RELOC_MIPS_DELETE
, R_MIPS_DELETE
},
1613 { BFD_RELOC_MIPS_HIGHEST
, R_MIPS_HIGHEST
},
1614 { BFD_RELOC_MIPS_HIGHER
, R_MIPS_HIGHER
},
1615 { BFD_RELOC_MIPS_CALL_HI16
, R_MIPS_CALL_HI16
},
1616 { BFD_RELOC_MIPS_CALL_LO16
, R_MIPS_CALL_LO16
},
1617 { BFD_RELOC_MIPS_SCN_DISP
, R_MIPS_SCN_DISP
},
1618 { BFD_RELOC_MIPS_REL16
, R_MIPS_REL16
},
1619 /* Use of R_MIPS_ADD_IMMEDIATE and R_MIPS_PJUMP is deprecated. */
1620 { BFD_RELOC_MIPS_RELGOT
, R_MIPS_RELGOT
},
1621 { BFD_RELOC_MIPS_JALR
, R_MIPS_JALR
}
1624 /* Given a BFD reloc type, return a howto structure. */
1626 static reloc_howto_type
*
1627 bfd_elf32_bfd_reloc_type_lookup (bfd
*abfd ATTRIBUTE_UNUSED
,
1628 bfd_reloc_code_real_type code
)
1631 /* FIXME: We default to RELA here instead of choosing the right
1632 relocation variant. */
1633 reloc_howto_type
*howto_table
= elf_mips_howto_table_rela
;
1635 for (i
= 0; i
< sizeof (mips_reloc_map
) / sizeof (struct elf_reloc_map
);
1638 if (mips_reloc_map
[i
].bfd_val
== code
)
1639 return &howto_table
[(int) mips_reloc_map
[i
].elf_val
];
1644 case BFD_RELOC_MIPS16_JMP
:
1645 return &elf_mips16_jump_howto
;
1646 case BFD_RELOC_MIPS16_GPREL
:
1647 return &elf_mips16_gprel_howto
;
1648 case BFD_RELOC_VTABLE_INHERIT
:
1649 return &elf_mips_gnu_vtinherit_howto
;
1650 case BFD_RELOC_VTABLE_ENTRY
:
1651 return &elf_mips_gnu_vtentry_howto
;
1652 case BFD_RELOC_16_PCREL_S2
:
1653 return &elf_mips_gnu_rela16_s2
;
1655 bfd_set_error (bfd_error_bad_value
);
1660 /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
1662 static reloc_howto_type
*
1663 mips_elf_n32_rtype_to_howto (unsigned int r_type
, bfd_boolean rela_p
)
1668 return &elf_mips16_jump_howto
;
1669 case R_MIPS16_GPREL
:
1670 return &elf_mips16_gprel_howto
;
1671 case R_MIPS_GNU_VTINHERIT
:
1672 return &elf_mips_gnu_vtinherit_howto
;
1673 case R_MIPS_GNU_VTENTRY
:
1674 return &elf_mips_gnu_vtentry_howto
;
1675 case R_MIPS_GNU_REL16_S2
:
1677 return &elf_mips_gnu_rela16_s2
;
1679 return &elf_mips_gnu_rel16_s2
;
1681 BFD_ASSERT (r_type
< (unsigned int) R_MIPS_max
);
1683 return &elf_mips_howto_table_rela
[r_type
];
1685 return &elf_mips_howto_table_rel
[r_type
];
1690 /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
1693 mips_info_to_howto_rel (bfd
*abfd
, arelent
*cache_ptr
, Elf_Internal_Rela
*dst
)
1695 unsigned int r_type
;
1697 r_type
= ELF32_R_TYPE (dst
->r_info
);
1698 cache_ptr
->howto
= mips_elf_n32_rtype_to_howto (r_type
, FALSE
);
1700 /* The addend for a GPREL16 or LITERAL relocation comes from the GP
1701 value for the object file. We get the addend now, rather than
1702 when we do the relocation, because the symbol manipulations done
1703 by the linker may cause us to lose track of the input BFD. */
1704 if (((*cache_ptr
->sym_ptr_ptr
)->flags
& BSF_SECTION_SYM
) != 0
1705 && (r_type
== (unsigned int) R_MIPS_GPREL16
1706 || r_type
== (unsigned int) R_MIPS_LITERAL
))
1707 cache_ptr
->addend
= elf_gp (abfd
);
1710 /* Given a MIPS Elf_Internal_Rela, fill in an arelent structure. */
1713 mips_info_to_howto_rela (bfd
*abfd ATTRIBUTE_UNUSED
,
1714 arelent
*cache_ptr
, Elf_Internal_Rela
*dst
)
1716 unsigned int r_type
;
1718 r_type
= ELF32_R_TYPE (dst
->r_info
);
1719 cache_ptr
->howto
= mips_elf_n32_rtype_to_howto (r_type
, TRUE
);
1720 cache_ptr
->addend
= dst
->r_addend
;
1723 /* Determine whether a symbol is global for the purposes of splitting
1724 the symbol table into global symbols and local symbols. At least
1725 on Irix 5, this split must be between section symbols and all other
1726 symbols. On most ELF targets the split is between static symbols
1727 and externally visible symbols. */
1730 mips_elf_sym_is_global (bfd
*abfd ATTRIBUTE_UNUSED
, asymbol
*sym
)
1732 if (SGI_COMPAT (abfd
))
1733 return (sym
->flags
& BSF_SECTION_SYM
) == 0;
1735 return ((sym
->flags
& (BSF_GLOBAL
| BSF_WEAK
)) != 0
1736 || bfd_is_und_section (bfd_get_section (sym
))
1737 || bfd_is_com_section (bfd_get_section (sym
)));
1740 /* Set the right machine number for a MIPS ELF file. */
1743 mips_elf_n32_object_p (bfd
*abfd
)
1747 /* Irix 5 and 6 are broken. Object file symbol tables are not always
1748 sorted correctly such that local symbols precede global symbols,
1749 and the sh_info field in the symbol table is not always right. */
1750 if (SGI_COMPAT (abfd
))
1751 elf_bad_symtab (abfd
) = TRUE
;
1753 mach
= _bfd_elf_mips_mach (elf_elfheader (abfd
)->e_flags
);
1754 bfd_default_set_arch_mach (abfd
, bfd_arch_mips
, mach
);
1756 if (! ABI_N32_P(abfd
))
1762 /* Support for core dump NOTE sections. */
1764 elf32_mips_grok_prstatus (bfd
*abfd
, Elf_Internal_Note
*note
)
1769 switch (note
->descsz
)
1774 case 440: /* Linux/MIPS N32 */
1776 elf_tdata (abfd
)->core_signal
= bfd_get_16 (abfd
, note
->descdata
+ 12);
1779 elf_tdata (abfd
)->core_pid
= bfd_get_32 (abfd
, note
->descdata
+ 24);
1788 /* Make a ".reg/999" section. */
1789 return _bfd_elfcore_make_pseudosection (abfd
, ".reg", size
,
1790 note
->descpos
+ offset
);
1794 elf32_mips_grok_psinfo (bfd
*abfd
, Elf_Internal_Note
*note
)
1796 switch (note
->descsz
)
1801 case 128: /* Linux/MIPS elf_prpsinfo */
1802 elf_tdata (abfd
)->core_program
1803 = _bfd_elfcore_strndup (abfd
, note
->descdata
+ 32, 16);
1804 elf_tdata (abfd
)->core_command
1805 = _bfd_elfcore_strndup (abfd
, note
->descdata
+ 48, 80);
1808 /* Note that for some reason, a spurious space is tacked
1809 onto the end of the args in some (at least one anyway)
1810 implementations, so strip it off if it exists. */
1813 char *command
= elf_tdata (abfd
)->core_command
;
1814 int n
= strlen (command
);
1816 if (0 < n
&& command
[n
- 1] == ' ')
1817 command
[n
- 1] = '\0';
1823 /* Depending on the target vector we generate some version of Irix
1824 executables or "normal" MIPS ELF ABI executables. */
1825 static irix_compat_t
1826 elf_n32_mips_irix_compat (bfd
*abfd
)
1828 if ((abfd
->xvec
== &bfd_elf32_nbigmips_vec
)
1829 || (abfd
->xvec
== &bfd_elf32_nlittlemips_vec
))
1835 /* ECOFF swapping routines. These are used when dealing with the
1836 .mdebug section, which is in the ECOFF debugging format. */
1837 static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap
= {
1838 /* Symbol table magic number. */
1840 /* Alignment of debugging information. E.g., 4. */
1842 /* Sizes of external symbolic information. */
1843 sizeof (struct hdr_ext
),
1844 sizeof (struct dnr_ext
),
1845 sizeof (struct pdr_ext
),
1846 sizeof (struct sym_ext
),
1847 sizeof (struct opt_ext
),
1848 sizeof (struct fdr_ext
),
1849 sizeof (struct rfd_ext
),
1850 sizeof (struct ext_ext
),
1851 /* Functions to swap in external symbolic data. */
1860 _bfd_ecoff_swap_tir_in
,
1861 _bfd_ecoff_swap_rndx_in
,
1862 /* Functions to swap out external symbolic data. */
1871 _bfd_ecoff_swap_tir_out
,
1872 _bfd_ecoff_swap_rndx_out
,
1873 /* Function to read in symbolic data. */
1874 _bfd_mips_elf_read_ecoff_info
1877 #define ELF_ARCH bfd_arch_mips
1878 #define ELF_MACHINE_CODE EM_MIPS
1880 #define elf_backend_collect TRUE
1881 #define elf_backend_type_change_ok TRUE
1882 #define elf_backend_can_gc_sections TRUE
1883 #define elf_info_to_howto mips_info_to_howto_rela
1884 #define elf_info_to_howto_rel mips_info_to_howto_rel
1885 #define elf_backend_sym_is_global mips_elf_sym_is_global
1886 #define elf_backend_object_p mips_elf_n32_object_p
1887 #define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing
1888 #define elf_backend_section_processing _bfd_mips_elf_section_processing
1889 #define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr
1890 #define elf_backend_fake_sections _bfd_mips_elf_fake_sections
1891 #define elf_backend_section_from_bfd_section \
1892 _bfd_mips_elf_section_from_bfd_section
1893 #define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook
1894 #define elf_backend_link_output_symbol_hook \
1895 _bfd_mips_elf_link_output_symbol_hook
1896 #define elf_backend_create_dynamic_sections \
1897 _bfd_mips_elf_create_dynamic_sections
1898 #define elf_backend_check_relocs _bfd_mips_elf_check_relocs
1899 #define elf_backend_adjust_dynamic_symbol \
1900 _bfd_mips_elf_adjust_dynamic_symbol
1901 #define elf_backend_always_size_sections \
1902 _bfd_mips_elf_always_size_sections
1903 #define elf_backend_size_dynamic_sections \
1904 _bfd_mips_elf_size_dynamic_sections
1905 #define elf_backend_relocate_section _bfd_mips_elf_relocate_section
1906 #define elf_backend_finish_dynamic_symbol \
1907 _bfd_mips_elf_finish_dynamic_symbol
1908 #define elf_backend_finish_dynamic_sections \
1909 _bfd_mips_elf_finish_dynamic_sections
1910 #define elf_backend_final_write_processing \
1911 _bfd_mips_elf_final_write_processing
1912 #define elf_backend_additional_program_headers \
1913 _bfd_mips_elf_additional_program_headers
1914 #define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map
1915 #define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook
1916 #define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook
1917 #define elf_backend_copy_indirect_symbol \
1918 _bfd_mips_elf_copy_indirect_symbol
1919 #define elf_backend_hide_symbol _bfd_mips_elf_hide_symbol
1920 #define elf_backend_grok_prstatus elf32_mips_grok_prstatus
1921 #define elf_backend_grok_psinfo elf32_mips_grok_psinfo
1922 #define elf_backend_ecoff_debug_swap &mips_elf32_ecoff_debug_swap
1924 #define elf_backend_got_header_size (4 * MIPS_RESERVED_GOTNO)
1926 /* MIPS n32 ELF can use a mixture of REL and RELA, but some Relocations
1927 work better/work only in RELA, so we default to this. */
1928 #define elf_backend_may_use_rel_p 1
1929 #define elf_backend_may_use_rela_p 1
1930 #define elf_backend_default_use_rela_p 1
1931 #define elf_backend_sign_extend_vma TRUE
1933 #define elf_backend_discard_info _bfd_mips_elf_discard_info
1934 #define elf_backend_ignore_discarded_relocs \
1935 _bfd_mips_elf_ignore_discarded_relocs
1936 #define elf_backend_write_section _bfd_mips_elf_write_section
1937 #define elf_backend_mips_irix_compat elf_n32_mips_irix_compat
1938 #define elf_backend_mips_rtype_to_howto mips_elf_n32_rtype_to_howto
1939 #define bfd_elf32_find_nearest_line _bfd_mips_elf_find_nearest_line
1940 #define bfd_elf32_new_section_hook _bfd_mips_elf_new_section_hook
1941 #define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents
1942 #define bfd_elf32_bfd_get_relocated_section_contents \
1943 _bfd_elf_mips_get_relocated_section_contents
1944 #define bfd_elf32_bfd_link_hash_table_create \
1945 _bfd_mips_elf_link_hash_table_create
1946 #define bfd_elf32_bfd_final_link _bfd_mips_elf_final_link
1947 #define bfd_elf32_bfd_merge_private_bfd_data \
1948 _bfd_mips_elf_merge_private_bfd_data
1949 #define bfd_elf32_bfd_set_private_flags _bfd_mips_elf_set_private_flags
1950 #define bfd_elf32_bfd_print_private_bfd_data \
1951 _bfd_mips_elf_print_private_bfd_data
1952 #define bfd_elf32_bfd_relax_section _bfd_mips_relax_section
1954 /* Support for SGI-ish mips targets using n32 ABI. */
1956 #define TARGET_LITTLE_SYM bfd_elf32_nlittlemips_vec
1957 #define TARGET_LITTLE_NAME "elf32-nlittlemips"
1958 #define TARGET_BIG_SYM bfd_elf32_nbigmips_vec
1959 #define TARGET_BIG_NAME "elf32-nbigmips"
1961 /* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses
1962 a value of 0x1000, and we are compatible.
1963 FIXME: How does this affect NewABI? */
1964 #define ELF_MAXPAGESIZE 0x1000
1966 #include "elf32-target.h"
1968 /* Support for traditional mips targets using n32 ABI. */
1969 #undef TARGET_LITTLE_SYM
1970 #undef TARGET_LITTLE_NAME
1971 #undef TARGET_BIG_SYM
1972 #undef TARGET_BIG_NAME
1974 #undef ELF_MAXPAGESIZE
1976 #define TARGET_LITTLE_SYM bfd_elf32_ntradlittlemips_vec
1977 #define TARGET_LITTLE_NAME "elf32-ntradlittlemips"
1978 #define TARGET_BIG_SYM bfd_elf32_ntradbigmips_vec
1979 #define TARGET_BIG_NAME "elf32-ntradbigmips"
1981 /* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses
1982 page sizes of up to that limit, so we need to respect it. */
1983 #define ELF_MAXPAGESIZE 0x10000
1984 #define elf32_bed elf32_tradbed
1986 /* Include the target file again for this target. */
1987 #include "elf32-target.h"