1 /* MIPS-specific support for 32-bit ELF
2 Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
3 2003, 2004, 2005, 2006, 2007, 2008, 2009 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 3 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., 51 Franklin Street - Fifth Floor, Boston,
27 MA 02110-1301, USA. */
30 /* This file handles MIPS ELF targets. SGI Irix 5 uses a slightly
31 different MIPS ELF from other targets. This matters when linking.
32 This file supports both, switching at runtime. */
40 #include "elfxx-mips.h"
43 /* Get the ECOFF swapping routines. */
45 #include "coff/symconst.h"
46 #include "coff/internal.h"
47 #include "coff/ecoff.h"
48 #include "coff/mips.h"
49 #define ECOFF_SIGNED_32
50 #include "ecoffswap.h"
52 static bfd_boolean mips_elf_assign_gp
54 static bfd_reloc_status_type mips_elf_final_gp
55 (bfd
*, asymbol
*, bfd_boolean
, char **, bfd_vma
*);
56 static bfd_reloc_status_type mips_elf_gprel16_reloc
57 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
58 static bfd_reloc_status_type mips_elf_literal_reloc
59 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
60 static bfd_reloc_status_type mips_elf_gprel32_reloc
61 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
62 static bfd_reloc_status_type gprel32_with_gp
63 (bfd
*, asymbol
*, arelent
*, asection
*, bfd_boolean
, void *, bfd_vma
);
64 static bfd_reloc_status_type mips_elf_shift6_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. Note that the ABI document has a typo
266 and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
267 We do the right thing here. */
268 HOWTO (R_MIPS_PC16
, /* type */
270 2, /* size (0 = byte, 1 = short, 2 = long) */
272 TRUE
, /* pc_relative */
274 complain_overflow_signed
, /* complain_on_overflow */
275 _bfd_mips_elf_generic_reloc
, /* special_function */
276 "R_MIPS_PC16", /* name */
277 TRUE
, /* partial_inplace */
278 0x0000ffff, /* src_mask */
279 0x0000ffff, /* dst_mask */
280 TRUE
), /* pcrel_offset */
282 /* 16 bit call through global offset table. */
283 HOWTO (R_MIPS_CALL16
, /* type */
285 2, /* size (0 = byte, 1 = short, 2 = long) */
287 FALSE
, /* pc_relative */
289 complain_overflow_signed
, /* complain_on_overflow */
290 _bfd_mips_elf_generic_reloc
, /* special_function */
291 "R_MIPS_CALL16", /* name */
292 TRUE
, /* partial_inplace */
293 0x0000ffff, /* src_mask */
294 0x0000ffff, /* dst_mask */
295 FALSE
), /* pcrel_offset */
297 /* 32 bit GP relative reference. */
298 HOWTO (R_MIPS_GPREL32
, /* type */
300 2, /* size (0 = byte, 1 = short, 2 = long) */
302 FALSE
, /* pc_relative */
304 complain_overflow_dont
, /* complain_on_overflow */
305 mips_elf_gprel32_reloc
, /* special_function */
306 "R_MIPS_GPREL32", /* name */
307 TRUE
, /* partial_inplace */
308 0xffffffff, /* src_mask */
309 0xffffffff, /* dst_mask */
310 FALSE
), /* pcrel_offset */
312 /* The remaining relocs are defined on Irix 5, although they are
313 not defined by the ABI. */
318 /* A 5 bit shift field. */
319 HOWTO (R_MIPS_SHIFT5
, /* type */
321 2, /* size (0 = byte, 1 = short, 2 = long) */
323 FALSE
, /* pc_relative */
325 complain_overflow_bitfield
, /* complain_on_overflow */
326 _bfd_mips_elf_generic_reloc
, /* special_function */
327 "R_MIPS_SHIFT5", /* name */
328 TRUE
, /* partial_inplace */
329 0x000007c0, /* src_mask */
330 0x000007c0, /* dst_mask */
331 FALSE
), /* pcrel_offset */
333 /* A 6 bit shift field. */
334 HOWTO (R_MIPS_SHIFT6
, /* type */
336 2, /* size (0 = byte, 1 = short, 2 = long) */
338 FALSE
, /* pc_relative */
340 complain_overflow_bitfield
, /* complain_on_overflow */
341 mips_elf_shift6_reloc
, /* special_function */
342 "R_MIPS_SHIFT6", /* name */
343 TRUE
, /* partial_inplace */
344 0x000007c4, /* src_mask */
345 0x000007c4, /* dst_mask */
346 FALSE
), /* pcrel_offset */
348 /* A 64 bit relocation. */
349 HOWTO (R_MIPS_64
, /* type */
351 4, /* size (0 = byte, 1 = short, 2 = long) */
353 FALSE
, /* pc_relative */
355 complain_overflow_dont
, /* complain_on_overflow */
356 _bfd_mips_elf_generic_reloc
, /* special_function */
357 "R_MIPS_64", /* name */
358 TRUE
, /* partial_inplace */
359 MINUS_ONE
, /* src_mask */
360 MINUS_ONE
, /* dst_mask */
361 FALSE
), /* pcrel_offset */
363 /* Displacement in the global offset table. */
364 HOWTO (R_MIPS_GOT_DISP
, /* type */
366 2, /* size (0 = byte, 1 = short, 2 = long) */
368 FALSE
, /* pc_relative */
370 complain_overflow_signed
, /* complain_on_overflow */
371 _bfd_mips_elf_generic_reloc
, /* special_function */
372 "R_MIPS_GOT_DISP", /* name */
373 TRUE
, /* partial_inplace */
374 0x0000ffff, /* src_mask */
375 0x0000ffff, /* dst_mask */
376 FALSE
), /* pcrel_offset */
378 /* Displacement to page pointer in the global offset table. */
379 HOWTO (R_MIPS_GOT_PAGE
, /* type */
381 2, /* size (0 = byte, 1 = short, 2 = long) */
383 FALSE
, /* pc_relative */
385 complain_overflow_signed
, /* complain_on_overflow */
386 _bfd_mips_elf_generic_reloc
, /* special_function */
387 "R_MIPS_GOT_PAGE", /* name */
388 TRUE
, /* partial_inplace */
389 0x0000ffff, /* src_mask */
390 0x0000ffff, /* dst_mask */
391 FALSE
), /* pcrel_offset */
393 /* Offset from page pointer in the global offset table. */
394 HOWTO (R_MIPS_GOT_OFST
, /* type */
396 2, /* size (0 = byte, 1 = short, 2 = long) */
398 FALSE
, /* pc_relative */
400 complain_overflow_signed
, /* complain_on_overflow */
401 _bfd_mips_elf_generic_reloc
, /* special_function */
402 "R_MIPS_GOT_OFST", /* name */
403 TRUE
, /* partial_inplace */
404 0x0000ffff, /* src_mask */
405 0x0000ffff, /* dst_mask */
406 FALSE
), /* pcrel_offset */
408 /* High 16 bits of displacement in global offset table. */
409 HOWTO (R_MIPS_GOT_HI16
, /* type */
411 2, /* size (0 = byte, 1 = short, 2 = long) */
413 FALSE
, /* pc_relative */
415 complain_overflow_dont
, /* complain_on_overflow */
416 _bfd_mips_elf_generic_reloc
, /* special_function */
417 "R_MIPS_GOT_HI16", /* name */
418 TRUE
, /* partial_inplace */
419 0x0000ffff, /* src_mask */
420 0x0000ffff, /* dst_mask */
421 FALSE
), /* pcrel_offset */
423 /* Low 16 bits of displacement in global offset table. */
424 HOWTO (R_MIPS_GOT_LO16
, /* type */
426 2, /* size (0 = byte, 1 = short, 2 = long) */
428 FALSE
, /* pc_relative */
430 complain_overflow_dont
, /* complain_on_overflow */
431 _bfd_mips_elf_generic_reloc
, /* special_function */
432 "R_MIPS_GOT_LO16", /* name */
433 TRUE
, /* partial_inplace */
434 0x0000ffff, /* src_mask */
435 0x0000ffff, /* dst_mask */
436 FALSE
), /* pcrel_offset */
438 /* 64 bit subtraction. */
439 HOWTO (R_MIPS_SUB
, /* type */
441 4, /* size (0 = byte, 1 = short, 2 = long) */
443 FALSE
, /* pc_relative */
445 complain_overflow_dont
, /* complain_on_overflow */
446 _bfd_mips_elf_generic_reloc
, /* special_function */
447 "R_MIPS_SUB", /* name */
448 TRUE
, /* partial_inplace */
449 MINUS_ONE
, /* src_mask */
450 MINUS_ONE
, /* dst_mask */
451 FALSE
), /* pcrel_offset */
453 /* Insert the addend as an instruction. */
454 /* FIXME: Not handled correctly. */
455 HOWTO (R_MIPS_INSERT_A
, /* type */
457 2, /* size (0 = byte, 1 = short, 2 = long) */
459 FALSE
, /* pc_relative */
461 complain_overflow_dont
, /* complain_on_overflow */
462 _bfd_mips_elf_generic_reloc
, /* special_function */
463 "R_MIPS_INSERT_A", /* name */
464 TRUE
, /* partial_inplace */
465 0xffffffff, /* src_mask */
466 0xffffffff, /* dst_mask */
467 FALSE
), /* pcrel_offset */
469 /* Insert the addend as an instruction, and change all relocations
470 to refer to the old instruction at the address. */
471 /* FIXME: Not handled correctly. */
472 HOWTO (R_MIPS_INSERT_B
, /* type */
474 2, /* size (0 = byte, 1 = short, 2 = long) */
476 FALSE
, /* pc_relative */
478 complain_overflow_dont
, /* complain_on_overflow */
479 _bfd_mips_elf_generic_reloc
, /* special_function */
480 "R_MIPS_INSERT_B", /* name */
481 TRUE
, /* partial_inplace */
482 0xffffffff, /* src_mask */
483 0xffffffff, /* dst_mask */
484 FALSE
), /* pcrel_offset */
486 /* Delete a 32 bit instruction. */
487 /* FIXME: Not handled correctly. */
488 HOWTO (R_MIPS_DELETE
, /* type */
490 2, /* size (0 = byte, 1 = short, 2 = long) */
492 FALSE
, /* pc_relative */
494 complain_overflow_dont
, /* complain_on_overflow */
495 _bfd_mips_elf_generic_reloc
, /* special_function */
496 "R_MIPS_DELETE", /* name */
497 TRUE
, /* partial_inplace */
498 0xffffffff, /* src_mask */
499 0xffffffff, /* dst_mask */
500 FALSE
), /* pcrel_offset */
502 /* The MIPS ELF64 ABI Draft wants us to support these for REL relocations.
504 a) It means building the addend from a R_MIPS_HIGHEST/R_MIPS_HIGHER/
505 R_MIPS_HI16/R_MIPS_LO16 sequence with varying ordering, using
507 b) No other NewABI toolchain actually emits such relocations. */
508 EMPTY_HOWTO (R_MIPS_HIGHER
),
509 EMPTY_HOWTO (R_MIPS_HIGHEST
),
511 /* High 16 bits of displacement in global offset table. */
512 HOWTO (R_MIPS_CALL_HI16
, /* type */
514 2, /* size (0 = byte, 1 = short, 2 = long) */
516 FALSE
, /* pc_relative */
518 complain_overflow_dont
, /* complain_on_overflow */
519 _bfd_mips_elf_generic_reloc
, /* special_function */
520 "R_MIPS_CALL_HI16", /* name */
521 TRUE
, /* partial_inplace */
522 0x0000ffff, /* src_mask */
523 0x0000ffff, /* dst_mask */
524 FALSE
), /* pcrel_offset */
526 /* Low 16 bits of displacement in global offset table. */
527 HOWTO (R_MIPS_CALL_LO16
, /* type */
529 2, /* size (0 = byte, 1 = short, 2 = long) */
531 FALSE
, /* pc_relative */
533 complain_overflow_dont
, /* complain_on_overflow */
534 _bfd_mips_elf_generic_reloc
, /* special_function */
535 "R_MIPS_CALL_LO16", /* name */
536 TRUE
, /* partial_inplace */
537 0x0000ffff, /* src_mask */
538 0x0000ffff, /* dst_mask */
539 FALSE
), /* pcrel_offset */
541 /* Section displacement. */
542 HOWTO (R_MIPS_SCN_DISP
, /* type */
544 2, /* size (0 = byte, 1 = short, 2 = long) */
546 FALSE
, /* pc_relative */
548 complain_overflow_dont
, /* complain_on_overflow */
549 _bfd_mips_elf_generic_reloc
, /* special_function */
550 "R_MIPS_SCN_DISP", /* name */
551 TRUE
, /* partial_inplace */
552 0xffffffff, /* src_mask */
553 0xffffffff, /* dst_mask */
554 FALSE
), /* pcrel_offset */
556 HOWTO (R_MIPS_REL16
, /* type */
558 1, /* size (0 = byte, 1 = short, 2 = long) */
560 FALSE
, /* pc_relative */
562 complain_overflow_signed
, /* complain_on_overflow */
563 _bfd_mips_elf_generic_reloc
, /* special_function */
564 "R_MIPS_REL16", /* name */
565 TRUE
, /* partial_inplace */
566 0xffff, /* src_mask */
567 0xffff, /* dst_mask */
568 FALSE
), /* pcrel_offset */
570 /* These two are obsolete. */
571 EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE
),
572 EMPTY_HOWTO (R_MIPS_PJUMP
),
574 /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
575 It must be used for multigot GOT's (and only there). */
576 HOWTO (R_MIPS_RELGOT
, /* type */
578 2, /* size (0 = byte, 1 = short, 2 = long) */
580 FALSE
, /* pc_relative */
582 complain_overflow_dont
, /* complain_on_overflow */
583 _bfd_mips_elf_generic_reloc
, /* special_function */
584 "R_MIPS_RELGOT", /* name */
585 TRUE
, /* partial_inplace */
586 0xffffffff, /* src_mask */
587 0xffffffff, /* dst_mask */
588 FALSE
), /* pcrel_offset */
590 /* Protected jump conversion. This is an optimization hint. No
591 relocation is required for correctness. */
592 HOWTO (R_MIPS_JALR
, /* type */
594 2, /* size (0 = byte, 1 = short, 2 = long) */
596 FALSE
, /* pc_relative */
598 complain_overflow_dont
, /* complain_on_overflow */
599 _bfd_mips_elf_generic_reloc
, /* special_function */
600 "R_MIPS_JALR", /* name */
601 FALSE
, /* partial_inplace */
602 0x00000000, /* src_mask */
603 0x00000000, /* dst_mask */
604 FALSE
), /* pcrel_offset */
606 /* TLS GD/LD dynamic relocations. */
607 HOWTO (R_MIPS_TLS_DTPMOD32
, /* type */
609 2, /* size (0 = byte, 1 = short, 2 = long) */
611 FALSE
, /* pc_relative */
613 complain_overflow_dont
, /* complain_on_overflow */
614 _bfd_mips_elf_generic_reloc
, /* special_function */
615 "R_MIPS_TLS_DTPMOD32", /* name */
616 TRUE
, /* partial_inplace */
617 0xffffffff, /* src_mask */
618 0xffffffff, /* dst_mask */
619 FALSE
), /* pcrel_offset */
621 HOWTO (R_MIPS_TLS_DTPREL32
, /* type */
623 2, /* size (0 = byte, 1 = short, 2 = long) */
625 FALSE
, /* pc_relative */
627 complain_overflow_dont
, /* complain_on_overflow */
628 _bfd_mips_elf_generic_reloc
, /* special_function */
629 "R_MIPS_TLS_DTPREL32", /* name */
630 TRUE
, /* partial_inplace */
631 0xffffffff, /* src_mask */
632 0xffffffff, /* dst_mask */
633 FALSE
), /* pcrel_offset */
635 EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64
),
636 EMPTY_HOWTO (R_MIPS_TLS_DTPREL64
),
638 /* TLS general dynamic variable reference. */
639 HOWTO (R_MIPS_TLS_GD
, /* type */
641 2, /* size (0 = byte, 1 = short, 2 = long) */
643 FALSE
, /* pc_relative */
645 complain_overflow_signed
, /* complain_on_overflow */
646 _bfd_mips_elf_generic_reloc
, /* special_function */
647 "R_MIPS_TLS_GD", /* name */
648 TRUE
, /* partial_inplace */
649 0x0000ffff, /* src_mask */
650 0x0000ffff, /* dst_mask */
651 FALSE
), /* pcrel_offset */
653 /* TLS local dynamic variable reference. */
654 HOWTO (R_MIPS_TLS_LDM
, /* type */
656 2, /* size (0 = byte, 1 = short, 2 = long) */
658 FALSE
, /* pc_relative */
660 complain_overflow_signed
, /* complain_on_overflow */
661 _bfd_mips_elf_generic_reloc
, /* special_function */
662 "R_MIPS_TLS_LDM", /* name */
663 TRUE
, /* partial_inplace */
664 0x0000ffff, /* src_mask */
665 0x0000ffff, /* dst_mask */
666 FALSE
), /* pcrel_offset */
668 /* TLS local dynamic offset. */
669 HOWTO (R_MIPS_TLS_DTPREL_HI16
, /* type */
671 2, /* size (0 = byte, 1 = short, 2 = long) */
673 FALSE
, /* pc_relative */
675 complain_overflow_signed
, /* complain_on_overflow */
676 _bfd_mips_elf_generic_reloc
, /* special_function */
677 "R_MIPS_TLS_DTPREL_HI16", /* name */
678 TRUE
, /* partial_inplace */
679 0x0000ffff, /* src_mask */
680 0x0000ffff, /* dst_mask */
681 FALSE
), /* pcrel_offset */
683 /* TLS local dynamic offset. */
684 HOWTO (R_MIPS_TLS_DTPREL_LO16
, /* type */
686 2, /* size (0 = byte, 1 = short, 2 = long) */
688 FALSE
, /* pc_relative */
690 complain_overflow_signed
, /* complain_on_overflow */
691 _bfd_mips_elf_generic_reloc
, /* special_function */
692 "R_MIPS_TLS_DTPREL_LO16", /* name */
693 TRUE
, /* partial_inplace */
694 0x0000ffff, /* src_mask */
695 0x0000ffff, /* dst_mask */
696 FALSE
), /* pcrel_offset */
698 /* TLS thread pointer offset. */
699 HOWTO (R_MIPS_TLS_GOTTPREL
, /* type */
701 2, /* size (0 = byte, 1 = short, 2 = long) */
703 FALSE
, /* pc_relative */
705 complain_overflow_signed
, /* complain_on_overflow */
706 _bfd_mips_elf_generic_reloc
, /* special_function */
707 "R_MIPS_TLS_GOTTPREL", /* name */
708 TRUE
, /* partial_inplace */
709 0x0000ffff, /* src_mask */
710 0x0000ffff, /* dst_mask */
711 FALSE
), /* pcrel_offset */
713 /* TLS IE dynamic relocations. */
714 HOWTO (R_MIPS_TLS_TPREL32
, /* type */
716 2, /* size (0 = byte, 1 = short, 2 = long) */
718 FALSE
, /* pc_relative */
720 complain_overflow_dont
, /* complain_on_overflow */
721 _bfd_mips_elf_generic_reloc
, /* special_function */
722 "R_MIPS_TLS_TPREL32", /* name */
723 TRUE
, /* partial_inplace */
724 0xffffffff, /* src_mask */
725 0xffffffff, /* dst_mask */
726 FALSE
), /* pcrel_offset */
728 EMPTY_HOWTO (R_MIPS_TLS_TPREL64
),
730 /* TLS thread pointer offset. */
731 HOWTO (R_MIPS_TLS_TPREL_HI16
, /* type */
733 2, /* size (0 = byte, 1 = short, 2 = long) */
735 FALSE
, /* pc_relative */
737 complain_overflow_signed
, /* complain_on_overflow */
738 _bfd_mips_elf_generic_reloc
, /* special_function */
739 "R_MIPS_TLS_TPREL_HI16", /* name */
740 TRUE
, /* partial_inplace */
741 0x0000ffff, /* src_mask */
742 0x0000ffff, /* dst_mask */
743 FALSE
), /* pcrel_offset */
745 /* TLS thread pointer offset. */
746 HOWTO (R_MIPS_TLS_TPREL_LO16
, /* type */
748 2, /* size (0 = byte, 1 = short, 2 = long) */
750 FALSE
, /* pc_relative */
752 complain_overflow_signed
, /* complain_on_overflow */
753 _bfd_mips_elf_generic_reloc
, /* special_function */
754 "R_MIPS_TLS_TPREL_LO16", /* name */
755 TRUE
, /* partial_inplace */
756 0x0000ffff, /* src_mask */
757 0x0000ffff, /* dst_mask */
758 FALSE
), /* pcrel_offset */
760 /* 32 bit relocation with no addend. */
761 HOWTO (R_MIPS_GLOB_DAT
, /* type */
763 2, /* size (0 = byte, 1 = short, 2 = long) */
765 FALSE
, /* pc_relative */
767 complain_overflow_dont
, /* complain_on_overflow */
768 _bfd_mips_elf_generic_reloc
, /* special_function */
769 "R_MIPS_GLOB_DAT", /* name */
770 FALSE
, /* partial_inplace */
772 0xffffffff, /* dst_mask */
773 FALSE
), /* pcrel_offset */
776 /* The relocation table used for SHT_RELA sections. */
778 static reloc_howto_type elf_mips_howto_table_rela
[] =
781 HOWTO (R_MIPS_NONE
, /* type */
783 0, /* size (0 = byte, 1 = short, 2 = long) */
785 FALSE
, /* pc_relative */
787 complain_overflow_dont
, /* complain_on_overflow */
788 _bfd_mips_elf_generic_reloc
, /* special_function */
789 "R_MIPS_NONE", /* name */
790 FALSE
, /* partial_inplace */
793 FALSE
), /* pcrel_offset */
795 /* 16 bit relocation. */
796 HOWTO (R_MIPS_16
, /* type */
798 2, /* size (0 = byte, 1 = short, 2 = long) */
800 FALSE
, /* pc_relative */
802 complain_overflow_signed
, /* complain_on_overflow */
803 _bfd_mips_elf_generic_reloc
, /* special_function */
804 "R_MIPS_16", /* name */
805 FALSE
, /* partial_inplace */
807 0x0000, /* dst_mask */
808 FALSE
), /* pcrel_offset */
810 /* 32 bit relocation. */
811 HOWTO (R_MIPS_32
, /* type */
813 2, /* size (0 = byte, 1 = short, 2 = long) */
815 FALSE
, /* pc_relative */
817 complain_overflow_dont
, /* complain_on_overflow */
818 _bfd_mips_elf_generic_reloc
, /* special_function */
819 "R_MIPS_32", /* name */
820 FALSE
, /* partial_inplace */
822 0xffffffff, /* dst_mask */
823 FALSE
), /* pcrel_offset */
825 /* 32 bit symbol relative relocation. */
826 HOWTO (R_MIPS_REL32
, /* type */
828 2, /* size (0 = byte, 1 = short, 2 = long) */
830 FALSE
, /* pc_relative */
832 complain_overflow_dont
, /* complain_on_overflow */
833 _bfd_mips_elf_generic_reloc
, /* special_function */
834 "R_MIPS_REL32", /* name */
835 FALSE
, /* partial_inplace */
837 0xffffffff, /* dst_mask */
838 FALSE
), /* pcrel_offset */
840 /* 26 bit jump address. */
841 HOWTO (R_MIPS_26
, /* type */
843 2, /* size (0 = byte, 1 = short, 2 = long) */
845 FALSE
, /* pc_relative */
847 complain_overflow_dont
, /* complain_on_overflow */
848 /* This needs complex overflow
849 detection, because the upper 36
850 bits must match the PC + 4. */
851 _bfd_mips_elf_generic_reloc
, /* special_function */
852 "R_MIPS_26", /* name */
853 FALSE
, /* partial_inplace */
855 0x03ffffff, /* dst_mask */
856 FALSE
), /* pcrel_offset */
858 /* High 16 bits of symbol value. */
859 HOWTO (R_MIPS_HI16
, /* type */
861 2, /* size (0 = byte, 1 = short, 2 = long) */
863 FALSE
, /* pc_relative */
865 complain_overflow_dont
, /* complain_on_overflow */
866 _bfd_mips_elf_generic_reloc
, /* special_function */
867 "R_MIPS_HI16", /* name */
868 FALSE
, /* partial_inplace */
870 0x0000ffff, /* dst_mask */
871 FALSE
), /* pcrel_offset */
873 /* Low 16 bits of symbol value. */
874 HOWTO (R_MIPS_LO16
, /* type */
876 2, /* size (0 = byte, 1 = short, 2 = long) */
878 FALSE
, /* pc_relative */
880 complain_overflow_dont
, /* complain_on_overflow */
881 _bfd_mips_elf_generic_reloc
, /* special_function */
882 "R_MIPS_LO16", /* name */
883 FALSE
, /* partial_inplace */
885 0x0000ffff, /* dst_mask */
886 FALSE
), /* pcrel_offset */
888 /* GP relative reference. */
889 HOWTO (R_MIPS_GPREL16
, /* type */
891 2, /* size (0 = byte, 1 = short, 2 = long) */
893 FALSE
, /* pc_relative */
895 complain_overflow_signed
, /* complain_on_overflow */
896 mips_elf_gprel16_reloc
, /* special_function */
897 "R_MIPS_GPREL16", /* name */
898 FALSE
, /* partial_inplace */
900 0x0000ffff, /* dst_mask */
901 FALSE
), /* pcrel_offset */
903 /* Reference to literal section. */
904 HOWTO (R_MIPS_LITERAL
, /* type */
906 2, /* size (0 = byte, 1 = short, 2 = long) */
908 FALSE
, /* pc_relative */
910 complain_overflow_signed
, /* complain_on_overflow */
911 mips_elf_literal_reloc
, /* special_function */
912 "R_MIPS_LITERAL", /* name */
913 FALSE
, /* partial_inplace */
915 0x0000ffff, /* dst_mask */
916 FALSE
), /* pcrel_offset */
918 /* Reference to global offset table. */
919 HOWTO (R_MIPS_GOT16
, /* type */
921 2, /* size (0 = byte, 1 = short, 2 = long) */
923 FALSE
, /* pc_relative */
925 complain_overflow_signed
, /* complain_on_overflow */
926 _bfd_mips_elf_generic_reloc
, /* special_function */
927 "R_MIPS_GOT16", /* name */
928 FALSE
, /* partial_inplace */
930 0x0000ffff, /* dst_mask */
931 FALSE
), /* pcrel_offset */
933 /* 16 bit PC relative reference. Note that the ABI document has a typo
934 and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
935 We do the right thing here. */
936 HOWTO (R_MIPS_PC16
, /* type */
938 2, /* size (0 = byte, 1 = short, 2 = long) */
940 TRUE
, /* pc_relative */
942 complain_overflow_signed
, /* complain_on_overflow */
943 _bfd_mips_elf_generic_reloc
, /* special_function */
944 "R_MIPS_PC16", /* name */
945 FALSE
, /* partial_inplace */
947 0x0000ffff, /* dst_mask */
948 TRUE
), /* pcrel_offset */
950 /* 16 bit call through global offset table. */
951 HOWTO (R_MIPS_CALL16
, /* type */
953 2, /* size (0 = byte, 1 = short, 2 = long) */
955 FALSE
, /* pc_relative */
957 complain_overflow_signed
, /* complain_on_overflow */
958 _bfd_mips_elf_generic_reloc
, /* special_function */
959 "R_MIPS_CALL16", /* name */
960 FALSE
, /* partial_inplace */
962 0x0000ffff, /* dst_mask */
963 FALSE
), /* pcrel_offset */
965 /* 32 bit GP relative reference. */
966 HOWTO (R_MIPS_GPREL32
, /* type */
968 2, /* size (0 = byte, 1 = short, 2 = long) */
970 FALSE
, /* pc_relative */
972 complain_overflow_dont
, /* complain_on_overflow */
973 mips_elf_gprel32_reloc
, /* special_function */
974 "R_MIPS_GPREL32", /* name */
975 FALSE
, /* partial_inplace */
977 0xffffffff, /* dst_mask */
978 FALSE
), /* pcrel_offset */
984 /* A 5 bit shift field. */
985 HOWTO (R_MIPS_SHIFT5
, /* type */
987 2, /* size (0 = byte, 1 = short, 2 = long) */
989 FALSE
, /* pc_relative */
991 complain_overflow_bitfield
, /* complain_on_overflow */
992 _bfd_mips_elf_generic_reloc
, /* special_function */
993 "R_MIPS_SHIFT5", /* name */
994 FALSE
, /* partial_inplace */
996 0x000007c0, /* dst_mask */
997 FALSE
), /* pcrel_offset */
999 /* A 6 bit shift field. */
1000 HOWTO (R_MIPS_SHIFT6
, /* type */
1002 2, /* size (0 = byte, 1 = short, 2 = long) */
1004 FALSE
, /* pc_relative */
1006 complain_overflow_bitfield
, /* complain_on_overflow */
1007 mips_elf_shift6_reloc
, /* special_function */
1008 "R_MIPS_SHIFT6", /* name */
1009 FALSE
, /* partial_inplace */
1011 0x000007c4, /* dst_mask */
1012 FALSE
), /* pcrel_offset */
1014 /* 64 bit relocation. */
1015 HOWTO (R_MIPS_64
, /* type */
1017 4, /* size (0 = byte, 1 = short, 2 = long) */
1019 FALSE
, /* pc_relative */
1021 complain_overflow_dont
, /* complain_on_overflow */
1022 _bfd_mips_elf_generic_reloc
, /* special_function */
1023 "R_MIPS_64", /* name */
1024 FALSE
, /* partial_inplace */
1026 MINUS_ONE
, /* dst_mask */
1027 FALSE
), /* pcrel_offset */
1029 /* Displacement in the global offset table. */
1030 HOWTO (R_MIPS_GOT_DISP
, /* type */
1032 2, /* size (0 = byte, 1 = short, 2 = long) */
1034 FALSE
, /* pc_relative */
1036 complain_overflow_signed
, /* complain_on_overflow */
1037 _bfd_mips_elf_generic_reloc
, /* special_function */
1038 "R_MIPS_GOT_DISP", /* name */
1039 FALSE
, /* partial_inplace */
1041 0x0000ffff, /* dst_mask */
1042 FALSE
), /* pcrel_offset */
1044 /* Displacement to page pointer in the global offset table. */
1045 HOWTO (R_MIPS_GOT_PAGE
, /* type */
1047 2, /* size (0 = byte, 1 = short, 2 = long) */
1049 FALSE
, /* pc_relative */
1051 complain_overflow_signed
, /* complain_on_overflow */
1052 _bfd_mips_elf_generic_reloc
, /* special_function */
1053 "R_MIPS_GOT_PAGE", /* name */
1054 FALSE
, /* partial_inplace */
1056 0x0000ffff, /* dst_mask */
1057 FALSE
), /* pcrel_offset */
1059 /* Offset from page pointer in the global offset table. */
1060 HOWTO (R_MIPS_GOT_OFST
, /* type */
1062 2, /* size (0 = byte, 1 = short, 2 = long) */
1064 FALSE
, /* pc_relative */
1066 complain_overflow_signed
, /* complain_on_overflow */
1067 _bfd_mips_elf_generic_reloc
, /* special_function */
1068 "R_MIPS_GOT_OFST", /* name */
1069 FALSE
, /* partial_inplace */
1071 0x0000ffff, /* dst_mask */
1072 FALSE
), /* pcrel_offset */
1074 /* High 16 bits of displacement in global offset table. */
1075 HOWTO (R_MIPS_GOT_HI16
, /* type */
1077 2, /* size (0 = byte, 1 = short, 2 = long) */
1079 FALSE
, /* pc_relative */
1081 complain_overflow_dont
, /* complain_on_overflow */
1082 _bfd_mips_elf_generic_reloc
, /* special_function */
1083 "R_MIPS_GOT_HI16", /* name */
1084 FALSE
, /* partial_inplace */
1086 0x0000ffff, /* dst_mask */
1087 FALSE
), /* pcrel_offset */
1089 /* Low 16 bits of displacement in global offset table. */
1090 HOWTO (R_MIPS_GOT_LO16
, /* type */
1092 2, /* size (0 = byte, 1 = short, 2 = long) */
1094 FALSE
, /* pc_relative */
1096 complain_overflow_dont
, /* complain_on_overflow */
1097 _bfd_mips_elf_generic_reloc
, /* special_function */
1098 "R_MIPS_GOT_LO16", /* name */
1099 FALSE
, /* partial_inplace */
1101 0x0000ffff, /* dst_mask */
1102 FALSE
), /* pcrel_offset */
1104 /* 64 bit subtraction. */
1105 HOWTO (R_MIPS_SUB
, /* type */
1107 4, /* size (0 = byte, 1 = short, 2 = long) */
1109 FALSE
, /* pc_relative */
1111 complain_overflow_dont
, /* complain_on_overflow */
1112 _bfd_mips_elf_generic_reloc
, /* special_function */
1113 "R_MIPS_SUB", /* name */
1114 FALSE
, /* partial_inplace */
1116 MINUS_ONE
, /* dst_mask */
1117 FALSE
), /* pcrel_offset */
1119 /* Insert the addend as an instruction. */
1120 /* FIXME: Not handled correctly. */
1121 HOWTO (R_MIPS_INSERT_A
, /* type */
1123 2, /* size (0 = byte, 1 = short, 2 = long) */
1125 FALSE
, /* pc_relative */
1127 complain_overflow_dont
, /* complain_on_overflow */
1128 _bfd_mips_elf_generic_reloc
, /* special_function */
1129 "R_MIPS_INSERT_A", /* name */
1130 FALSE
, /* partial_inplace */
1132 0xffffffff, /* dst_mask */
1133 FALSE
), /* pcrel_offset */
1135 /* Insert the addend as an instruction, and change all relocations
1136 to refer to the old instruction at the address. */
1137 /* FIXME: Not handled correctly. */
1138 HOWTO (R_MIPS_INSERT_B
, /* type */
1140 2, /* size (0 = byte, 1 = short, 2 = long) */
1142 FALSE
, /* pc_relative */
1144 complain_overflow_dont
, /* complain_on_overflow */
1145 _bfd_mips_elf_generic_reloc
, /* special_function */
1146 "R_MIPS_INSERT_B", /* name */
1147 FALSE
, /* partial_inplace */
1149 0xffffffff, /* dst_mask */
1150 FALSE
), /* pcrel_offset */
1152 /* Delete a 32 bit instruction. */
1153 /* FIXME: Not handled correctly. */
1154 HOWTO (R_MIPS_DELETE
, /* type */
1156 2, /* size (0 = byte, 1 = short, 2 = long) */
1158 FALSE
, /* pc_relative */
1160 complain_overflow_dont
, /* complain_on_overflow */
1161 _bfd_mips_elf_generic_reloc
, /* special_function */
1162 "R_MIPS_DELETE", /* name */
1163 FALSE
, /* partial_inplace */
1165 0xffffffff, /* dst_mask */
1166 FALSE
), /* pcrel_offset */
1168 /* Get the higher value of a 64 bit addend. */
1169 HOWTO (R_MIPS_HIGHER
, /* type */
1171 2, /* size (0 = byte, 1 = short, 2 = long) */
1173 FALSE
, /* pc_relative */
1175 complain_overflow_dont
, /* complain_on_overflow */
1176 _bfd_mips_elf_generic_reloc
, /* special_function */
1177 "R_MIPS_HIGHER", /* name */
1178 FALSE
, /* partial_inplace */
1180 0x0000ffff, /* dst_mask */
1181 FALSE
), /* pcrel_offset */
1183 /* Get the highest value of a 64 bit addend. */
1184 HOWTO (R_MIPS_HIGHEST
, /* type */
1186 2, /* size (0 = byte, 1 = short, 2 = long) */
1188 FALSE
, /* pc_relative */
1190 complain_overflow_dont
, /* complain_on_overflow */
1191 _bfd_mips_elf_generic_reloc
, /* special_function */
1192 "R_MIPS_HIGHEST", /* name */
1193 FALSE
, /* partial_inplace */
1195 0x0000ffff, /* dst_mask */
1196 FALSE
), /* pcrel_offset */
1198 /* High 16 bits of displacement in global offset table. */
1199 HOWTO (R_MIPS_CALL_HI16
, /* type */
1201 2, /* size (0 = byte, 1 = short, 2 = long) */
1203 FALSE
, /* pc_relative */
1205 complain_overflow_dont
, /* complain_on_overflow */
1206 _bfd_mips_elf_generic_reloc
, /* special_function */
1207 "R_MIPS_CALL_HI16", /* name */
1208 FALSE
, /* partial_inplace */
1210 0x0000ffff, /* dst_mask */
1211 FALSE
), /* pcrel_offset */
1213 /* Low 16 bits of displacement in global offset table. */
1214 HOWTO (R_MIPS_CALL_LO16
, /* type */
1216 2, /* size (0 = byte, 1 = short, 2 = long) */
1218 FALSE
, /* pc_relative */
1220 complain_overflow_dont
, /* complain_on_overflow */
1221 _bfd_mips_elf_generic_reloc
, /* special_function */
1222 "R_MIPS_CALL_LO16", /* name */
1223 FALSE
, /* partial_inplace */
1225 0x0000ffff, /* dst_mask */
1226 FALSE
), /* pcrel_offset */
1228 /* Section displacement, used by an associated event location section. */
1229 HOWTO (R_MIPS_SCN_DISP
, /* type */
1231 2, /* size (0 = byte, 1 = short, 2 = long) */
1233 FALSE
, /* pc_relative */
1235 complain_overflow_dont
, /* complain_on_overflow */
1236 _bfd_mips_elf_generic_reloc
, /* special_function */
1237 "R_MIPS_SCN_DISP", /* name */
1238 FALSE
, /* partial_inplace */
1240 0xffffffff, /* dst_mask */
1241 FALSE
), /* pcrel_offset */
1243 /* 16 bit relocation. */
1244 HOWTO (R_MIPS_REL16
, /* type */
1246 1, /* size (0 = byte, 1 = short, 2 = long) */
1248 FALSE
, /* pc_relative */
1250 complain_overflow_signed
, /* complain_on_overflow */
1251 _bfd_mips_elf_generic_reloc
, /* special_function */
1252 "R_MIPS_REL16", /* name */
1253 FALSE
, /* partial_inplace */
1255 0xffff, /* dst_mask */
1256 FALSE
), /* pcrel_offset */
1258 /* These two are obsolete. */
1259 EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE
),
1260 EMPTY_HOWTO (R_MIPS_PJUMP
),
1262 /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
1263 It must be used for multigot GOT's (and only there). */
1264 HOWTO (R_MIPS_RELGOT
, /* type */
1266 2, /* size (0 = byte, 1 = short, 2 = long) */
1268 FALSE
, /* pc_relative */
1270 complain_overflow_dont
, /* complain_on_overflow */
1271 _bfd_mips_elf_generic_reloc
, /* special_function */
1272 "R_MIPS_RELGOT", /* name */
1273 FALSE
, /* partial_inplace */
1275 0xffffffff, /* dst_mask */
1276 FALSE
), /* pcrel_offset */
1278 /* Protected jump conversion. This is an optimization hint. No
1279 relocation is required for correctness. */
1280 HOWTO (R_MIPS_JALR
, /* type */
1282 2, /* size (0 = byte, 1 = short, 2 = long) */
1284 FALSE
, /* pc_relative */
1286 complain_overflow_dont
, /* complain_on_overflow */
1287 _bfd_mips_elf_generic_reloc
, /* special_function */
1288 "R_MIPS_JALR", /* name */
1289 FALSE
, /* partial_inplace */
1292 FALSE
), /* pcrel_offset */
1294 /* TLS GD/LD dynamic relocations. */
1295 HOWTO (R_MIPS_TLS_DTPMOD32
, /* type */
1297 2, /* size (0 = byte, 1 = short, 2 = long) */
1299 FALSE
, /* pc_relative */
1301 complain_overflow_dont
, /* complain_on_overflow */
1302 _bfd_mips_elf_generic_reloc
, /* special_function */
1303 "R_MIPS_TLS_DTPMOD32", /* name */
1304 FALSE
, /* partial_inplace */
1306 0xffffffff, /* dst_mask */
1307 FALSE
), /* pcrel_offset */
1309 HOWTO (R_MIPS_TLS_DTPREL32
, /* type */
1311 2, /* size (0 = byte, 1 = short, 2 = long) */
1313 FALSE
, /* pc_relative */
1315 complain_overflow_dont
, /* complain_on_overflow */
1316 _bfd_mips_elf_generic_reloc
, /* special_function */
1317 "R_MIPS_TLS_DTPREL32", /* name */
1318 FALSE
, /* partial_inplace */
1320 0xffffffff, /* dst_mask */
1321 FALSE
), /* pcrel_offset */
1323 EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64
),
1324 EMPTY_HOWTO (R_MIPS_TLS_DTPREL64
),
1326 /* TLS general dynamic variable reference. */
1327 HOWTO (R_MIPS_TLS_GD
, /* type */
1329 2, /* size (0 = byte, 1 = short, 2 = long) */
1331 FALSE
, /* pc_relative */
1333 complain_overflow_signed
, /* complain_on_overflow */
1334 _bfd_mips_elf_generic_reloc
, /* special_function */
1335 "R_MIPS_TLS_GD", /* name */
1336 FALSE
, /* partial_inplace */
1338 0x0000ffff, /* dst_mask */
1339 FALSE
), /* pcrel_offset */
1341 /* TLS local dynamic variable reference. */
1342 HOWTO (R_MIPS_TLS_LDM
, /* type */
1344 2, /* size (0 = byte, 1 = short, 2 = long) */
1346 FALSE
, /* pc_relative */
1348 complain_overflow_signed
, /* complain_on_overflow */
1349 _bfd_mips_elf_generic_reloc
, /* special_function */
1350 "R_MIPS_TLS_LDM", /* name */
1351 FALSE
, /* partial_inplace */
1353 0x0000ffff, /* dst_mask */
1354 FALSE
), /* pcrel_offset */
1356 /* TLS local dynamic offset. */
1357 HOWTO (R_MIPS_TLS_DTPREL_HI16
, /* type */
1359 2, /* size (0 = byte, 1 = short, 2 = long) */
1361 FALSE
, /* pc_relative */
1363 complain_overflow_signed
, /* complain_on_overflow */
1364 _bfd_mips_elf_generic_reloc
, /* special_function */
1365 "R_MIPS_TLS_DTPREL_HI16", /* name */
1366 FALSE
, /* partial_inplace */
1368 0x0000ffff, /* dst_mask */
1369 FALSE
), /* pcrel_offset */
1371 /* TLS local dynamic offset. */
1372 HOWTO (R_MIPS_TLS_DTPREL_LO16
, /* type */
1374 2, /* size (0 = byte, 1 = short, 2 = long) */
1376 FALSE
, /* pc_relative */
1378 complain_overflow_signed
, /* complain_on_overflow */
1379 _bfd_mips_elf_generic_reloc
, /* special_function */
1380 "R_MIPS_TLS_DTPREL_LO16", /* name */
1381 FALSE
, /* partial_inplace */
1383 0x0000ffff, /* dst_mask */
1384 FALSE
), /* pcrel_offset */
1386 /* TLS thread pointer offset. */
1387 HOWTO (R_MIPS_TLS_GOTTPREL
, /* type */
1389 2, /* size (0 = byte, 1 = short, 2 = long) */
1391 FALSE
, /* pc_relative */
1393 complain_overflow_signed
, /* complain_on_overflow */
1394 _bfd_mips_elf_generic_reloc
, /* special_function */
1395 "R_MIPS_TLS_GOTTPREL", /* name */
1396 FALSE
, /* partial_inplace */
1398 0x0000ffff, /* dst_mask */
1399 FALSE
), /* pcrel_offset */
1401 /* TLS IE dynamic relocations. */
1402 HOWTO (R_MIPS_TLS_TPREL32
, /* type */
1404 2, /* size (0 = byte, 1 = short, 2 = long) */
1406 FALSE
, /* pc_relative */
1408 complain_overflow_dont
, /* complain_on_overflow */
1409 _bfd_mips_elf_generic_reloc
, /* special_function */
1410 "R_MIPS_TLS_TPREL32", /* name */
1411 FALSE
, /* partial_inplace */
1413 0xffffffff, /* dst_mask */
1414 FALSE
), /* pcrel_offset */
1416 EMPTY_HOWTO (R_MIPS_TLS_TPREL64
),
1418 /* TLS thread pointer offset. */
1419 HOWTO (R_MIPS_TLS_TPREL_HI16
, /* type */
1421 2, /* size (0 = byte, 1 = short, 2 = long) */
1423 FALSE
, /* pc_relative */
1425 complain_overflow_signed
, /* complain_on_overflow */
1426 _bfd_mips_elf_generic_reloc
, /* special_function */
1427 "R_MIPS_TLS_TPREL_HI16", /* name */
1428 FALSE
, /* partial_inplace */
1430 0x0000ffff, /* dst_mask */
1431 FALSE
), /* pcrel_offset */
1433 /* TLS thread pointer offset. */
1434 HOWTO (R_MIPS_TLS_TPREL_LO16
, /* type */
1436 2, /* size (0 = byte, 1 = short, 2 = long) */
1438 FALSE
, /* pc_relative */
1440 complain_overflow_signed
, /* complain_on_overflow */
1441 _bfd_mips_elf_generic_reloc
, /* special_function */
1442 "R_MIPS_TLS_TPREL_LO16", /* name */
1443 FALSE
, /* partial_inplace */
1445 0x0000ffff, /* dst_mask */
1446 FALSE
), /* pcrel_offset */
1448 /* 32 bit relocation with no addend. */
1449 HOWTO (R_MIPS_GLOB_DAT
, /* type */
1451 2, /* size (0 = byte, 1 = short, 2 = long) */
1453 FALSE
, /* pc_relative */
1455 complain_overflow_dont
, /* complain_on_overflow */
1456 _bfd_mips_elf_generic_reloc
, /* special_function */
1457 "R_MIPS_GLOB_DAT", /* name */
1458 FALSE
, /* partial_inplace */
1460 0xffffffff, /* dst_mask */
1461 FALSE
), /* pcrel_offset */
1464 static reloc_howto_type elf_mips16_howto_table_rel
[] =
1466 /* The reloc used for the mips16 jump instruction. */
1467 HOWTO (R_MIPS16_26
, /* type */
1469 2, /* size (0 = byte, 1 = short, 2 = long) */
1471 FALSE
, /* pc_relative */
1473 complain_overflow_dont
, /* complain_on_overflow */
1474 /* This needs complex overflow
1475 detection, because the upper four
1476 bits must match the PC. */
1477 _bfd_mips_elf_generic_reloc
, /* special_function */
1478 "R_MIPS16_26", /* name */
1479 TRUE
, /* partial_inplace */
1480 0x3ffffff, /* src_mask */
1481 0x3ffffff, /* dst_mask */
1482 FALSE
), /* pcrel_offset */
1484 /* The reloc used for the mips16 gprel instruction. */
1485 HOWTO (R_MIPS16_GPREL
, /* type */
1487 2, /* size (0 = byte, 1 = short, 2 = long) */
1489 FALSE
, /* pc_relative */
1491 complain_overflow_signed
, /* complain_on_overflow */
1492 mips16_gprel_reloc
, /* special_function */
1493 "R_MIPS16_GPREL", /* name */
1494 TRUE
, /* partial_inplace */
1495 0x0000ffff, /* src_mask */
1496 0x0000ffff, /* dst_mask */
1497 FALSE
), /* pcrel_offset */
1499 /* A MIPS16 reference to the global offset table. */
1500 HOWTO (R_MIPS16_GOT16
, /* type */
1502 2, /* size (0 = byte, 1 = short, 2 = long) */
1504 FALSE
, /* pc_relative */
1506 complain_overflow_dont
, /* complain_on_overflow */
1507 _bfd_mips_elf_got16_reloc
, /* special_function */
1508 "R_MIPS16_GOT16", /* name */
1509 TRUE
, /* partial_inplace */
1510 0x0000ffff, /* src_mask */
1511 0x0000ffff, /* dst_mask */
1512 FALSE
), /* pcrel_offset */
1514 /* A MIPS16 call through the global offset table. */
1515 HOWTO (R_MIPS16_CALL16
, /* type */
1517 2, /* size (0 = byte, 1 = short, 2 = long) */
1519 FALSE
, /* pc_relative */
1521 complain_overflow_dont
, /* complain_on_overflow */
1522 _bfd_mips_elf_generic_reloc
, /* special_function */
1523 "R_MIPS16_CALL16", /* name */
1524 TRUE
, /* partial_inplace */
1525 0x0000ffff, /* src_mask */
1526 0x0000ffff, /* dst_mask */
1527 FALSE
), /* pcrel_offset */
1529 /* MIPS16 high 16 bits of symbol value. */
1530 HOWTO (R_MIPS16_HI16
, /* type */
1531 16, /* rightshift */
1532 2, /* size (0 = byte, 1 = short, 2 = long) */
1534 FALSE
, /* pc_relative */
1536 complain_overflow_dont
, /* complain_on_overflow */
1537 _bfd_mips_elf_hi16_reloc
, /* special_function */
1538 "R_MIPS16_HI16", /* name */
1539 TRUE
, /* partial_inplace */
1540 0x0000ffff, /* src_mask */
1541 0x0000ffff, /* dst_mask */
1542 FALSE
), /* pcrel_offset */
1544 /* MIPS16 low 16 bits of symbol value. */
1545 HOWTO (R_MIPS16_LO16
, /* type */
1547 2, /* size (0 = byte, 1 = short, 2 = long) */
1549 FALSE
, /* pc_relative */
1551 complain_overflow_dont
, /* complain_on_overflow */
1552 _bfd_mips_elf_lo16_reloc
, /* special_function */
1553 "R_MIPS16_LO16", /* name */
1554 TRUE
, /* partial_inplace */
1555 0x0000ffff, /* src_mask */
1556 0x0000ffff, /* dst_mask */
1557 FALSE
), /* pcrel_offset */
1559 /* MIPS16 TLS general dynamic variable reference. */
1560 HOWTO (R_MIPS16_TLS_GD
, /* type */
1562 2, /* size (0 = byte, 1 = short, 2 = long) */
1564 FALSE
, /* pc_relative */
1566 complain_overflow_signed
, /* complain_on_overflow */
1567 _bfd_mips_elf_generic_reloc
, /* special_function */
1568 "R_MIPS16_TLS_GD", /* name */
1569 TRUE
, /* partial_inplace */
1570 0x0000ffff, /* src_mask */
1571 0x0000ffff, /* dst_mask */
1572 FALSE
), /* pcrel_offset */
1574 /* MIPS16 TLS local dynamic variable reference. */
1575 HOWTO (R_MIPS16_TLS_LDM
, /* type */
1577 2, /* size (0 = byte, 1 = short, 2 = long) */
1579 FALSE
, /* pc_relative */
1581 complain_overflow_signed
, /* complain_on_overflow */
1582 _bfd_mips_elf_generic_reloc
, /* special_function */
1583 "R_MIPS16_TLS_LDM", /* name */
1584 TRUE
, /* partial_inplace */
1585 0x0000ffff, /* src_mask */
1586 0x0000ffff, /* dst_mask */
1587 FALSE
), /* pcrel_offset */
1589 /* MIPS16 TLS local dynamic offset. */
1590 HOWTO (R_MIPS16_TLS_DTPREL_HI16
, /* type */
1592 2, /* size (0 = byte, 1 = short, 2 = long) */
1594 FALSE
, /* pc_relative */
1596 complain_overflow_signed
, /* complain_on_overflow */
1597 _bfd_mips_elf_generic_reloc
, /* special_function */
1598 "R_MIPS16_TLS_DTPREL_HI16", /* name */
1599 TRUE
, /* partial_inplace */
1600 0x0000ffff, /* src_mask */
1601 0x0000ffff, /* dst_mask */
1602 FALSE
), /* pcrel_offset */
1604 /* MIPS16 TLS local dynamic offset. */
1605 HOWTO (R_MIPS16_TLS_DTPREL_LO16
, /* type */
1607 2, /* size (0 = byte, 1 = short, 2 = long) */
1609 FALSE
, /* pc_relative */
1611 complain_overflow_signed
, /* complain_on_overflow */
1612 _bfd_mips_elf_generic_reloc
, /* special_function */
1613 "R_MIPS16_TLS_DTPREL_LO16", /* name */
1614 TRUE
, /* partial_inplace */
1615 0x0000ffff, /* src_mask */
1616 0x0000ffff, /* dst_mask */
1617 FALSE
), /* pcrel_offset */
1619 /* MIPS16 TLS thread pointer offset. */
1620 HOWTO (R_MIPS16_TLS_GOTTPREL
, /* type */
1622 2, /* size (0 = byte, 1 = short, 2 = long) */
1624 FALSE
, /* pc_relative */
1626 complain_overflow_signed
, /* complain_on_overflow */
1627 _bfd_mips_elf_generic_reloc
, /* special_function */
1628 "R_MIPS16_TLS_GOTTPREL", /* name */
1629 TRUE
, /* partial_inplace */
1630 0x0000ffff, /* src_mask */
1631 0x0000ffff, /* dst_mask */
1632 FALSE
), /* pcrel_offset */
1634 /* MIPS16 TLS thread pointer offset. */
1635 HOWTO (R_MIPS16_TLS_TPREL_HI16
, /* type */
1637 2, /* size (0 = byte, 1 = short, 2 = long) */
1639 FALSE
, /* pc_relative */
1641 complain_overflow_signed
, /* complain_on_overflow */
1642 _bfd_mips_elf_generic_reloc
, /* special_function */
1643 "R_MIPS16_TLS_TPREL_HI16", /* name */
1644 TRUE
, /* partial_inplace */
1645 0x0000ffff, /* src_mask */
1646 0x0000ffff, /* dst_mask */
1647 FALSE
), /* pcrel_offset */
1649 /* MIPS16 TLS thread pointer offset. */
1650 HOWTO (R_MIPS16_TLS_TPREL_LO16
, /* type */
1652 2, /* size (0 = byte, 1 = short, 2 = long) */
1654 FALSE
, /* pc_relative */
1656 complain_overflow_signed
, /* complain_on_overflow */
1657 _bfd_mips_elf_generic_reloc
, /* special_function */
1658 "R_MIPS16_TLS_TPREL_LO16", /* name */
1659 TRUE
, /* partial_inplace */
1660 0x0000ffff, /* src_mask */
1661 0x0000ffff, /* dst_mask */
1662 FALSE
), /* pcrel_offset */
1665 static reloc_howto_type elf_mips16_howto_table_rela
[] =
1667 /* The reloc used for the mips16 jump instruction. */
1668 HOWTO (R_MIPS16_26
, /* type */
1670 2, /* size (0 = byte, 1 = short, 2 = long) */
1672 FALSE
, /* pc_relative */
1674 complain_overflow_dont
, /* complain_on_overflow */
1675 /* This needs complex overflow
1676 detection, because the upper four
1677 bits must match the PC. */
1678 _bfd_mips_elf_generic_reloc
, /* special_function */
1679 "R_MIPS16_26", /* name */
1680 FALSE
, /* partial_inplace */
1682 0x3ffffff, /* dst_mask */
1683 FALSE
), /* pcrel_offset */
1685 /* The reloc used for the mips16 gprel instruction. */
1686 HOWTO (R_MIPS16_GPREL
, /* type */
1688 2, /* size (0 = byte, 1 = short, 2 = long) */
1690 FALSE
, /* pc_relative */
1692 complain_overflow_signed
, /* complain_on_overflow */
1693 mips16_gprel_reloc
, /* special_function */
1694 "R_MIPS16_GPREL", /* name */
1695 FALSE
, /* partial_inplace */
1697 0x0000ffff, /* dst_mask */
1698 FALSE
), /* pcrel_offset */
1700 /* A MIPS16 reference to the global offset table. */
1701 HOWTO (R_MIPS16_GOT16
, /* type */
1703 2, /* size (0 = byte, 1 = short, 2 = long) */
1705 FALSE
, /* pc_relative */
1707 complain_overflow_dont
, /* complain_on_overflow */
1708 _bfd_mips_elf_got16_reloc
, /* special_function */
1709 "R_MIPS16_GOT16", /* name */
1710 FALSE
, /* partial_inplace */
1712 0x0000ffff, /* dst_mask */
1713 FALSE
), /* pcrel_offset */
1715 /* A MIPS16 call through the global offset table. */
1716 HOWTO (R_MIPS16_CALL16
, /* type */
1718 2, /* size (0 = byte, 1 = short, 2 = long) */
1720 FALSE
, /* pc_relative */
1722 complain_overflow_dont
, /* complain_on_overflow */
1723 _bfd_mips_elf_generic_reloc
, /* special_function */
1724 "R_MIPS16_CALL16", /* name */
1725 FALSE
, /* partial_inplace */
1727 0x0000ffff, /* dst_mask */
1728 FALSE
), /* pcrel_offset */
1730 /* MIPS16 high 16 bits of symbol value. */
1731 HOWTO (R_MIPS16_HI16
, /* type */
1732 16, /* rightshift */
1733 2, /* size (0 = byte, 1 = short, 2 = long) */
1735 FALSE
, /* pc_relative */
1737 complain_overflow_dont
, /* complain_on_overflow */
1738 _bfd_mips_elf_hi16_reloc
, /* special_function */
1739 "R_MIPS16_HI16", /* name */
1740 FALSE
, /* partial_inplace */
1742 0x0000ffff, /* dst_mask */
1743 FALSE
), /* pcrel_offset */
1745 /* MIPS16 low 16 bits of symbol value. */
1746 HOWTO (R_MIPS16_LO16
, /* type */
1748 2, /* size (0 = byte, 1 = short, 2 = long) */
1750 FALSE
, /* pc_relative */
1752 complain_overflow_dont
, /* complain_on_overflow */
1753 _bfd_mips_elf_lo16_reloc
, /* special_function */
1754 "R_MIPS16_LO16", /* name */
1755 FALSE
, /* partial_inplace */
1757 0x0000ffff, /* dst_mask */
1758 FALSE
), /* pcrel_offset */
1760 /* MIPS16 TLS general dynamic variable reference. */
1761 HOWTO (R_MIPS16_TLS_GD
, /* type */
1763 2, /* size (0 = byte, 1 = short, 2 = long) */
1765 FALSE
, /* pc_relative */
1767 complain_overflow_signed
, /* complain_on_overflow */
1768 _bfd_mips_elf_generic_reloc
, /* special_function */
1769 "R_MIPS16_TLS_GD", /* name */
1770 FALSE
, /* partial_inplace */
1771 0x0000ffff, /* src_mask */
1772 0x0000ffff, /* dst_mask */
1773 FALSE
), /* pcrel_offset */
1775 /* MIPS16 TLS local dynamic variable reference. */
1776 HOWTO (R_MIPS16_TLS_LDM
, /* type */
1778 2, /* size (0 = byte, 1 = short, 2 = long) */
1780 FALSE
, /* pc_relative */
1782 complain_overflow_signed
, /* complain_on_overflow */
1783 _bfd_mips_elf_generic_reloc
, /* special_function */
1784 "R_MIPS16_TLS_LDM", /* name */
1785 FALSE
, /* partial_inplace */
1786 0x0000ffff, /* src_mask */
1787 0x0000ffff, /* dst_mask */
1788 FALSE
), /* pcrel_offset */
1790 /* MIPS16 TLS local dynamic offset. */
1791 HOWTO (R_MIPS16_TLS_DTPREL_HI16
, /* type */
1793 2, /* size (0 = byte, 1 = short, 2 = long) */
1795 FALSE
, /* pc_relative */
1797 complain_overflow_signed
, /* complain_on_overflow */
1798 _bfd_mips_elf_generic_reloc
, /* special_function */
1799 "R_MIPS16_TLS_DTPREL_HI16", /* name */
1800 FALSE
, /* partial_inplace */
1801 0x0000ffff, /* src_mask */
1802 0x0000ffff, /* dst_mask */
1803 FALSE
), /* pcrel_offset */
1805 /* MIPS16 TLS local dynamic offset. */
1806 HOWTO (R_MIPS16_TLS_DTPREL_LO16
, /* type */
1808 2, /* size (0 = byte, 1 = short, 2 = long) */
1810 FALSE
, /* pc_relative */
1812 complain_overflow_signed
, /* complain_on_overflow */
1813 _bfd_mips_elf_generic_reloc
, /* special_function */
1814 "R_MIPS16_TLS_DTPREL_LO16", /* name */
1815 FALSE
, /* partial_inplace */
1816 0x0000ffff, /* src_mask */
1817 0x0000ffff, /* dst_mask */
1818 FALSE
), /* pcrel_offset */
1820 /* MIPS16 TLS thread pointer offset. */
1821 HOWTO (R_MIPS16_TLS_GOTTPREL
, /* type */
1823 2, /* size (0 = byte, 1 = short, 2 = long) */
1825 FALSE
, /* pc_relative */
1827 complain_overflow_signed
, /* complain_on_overflow */
1828 _bfd_mips_elf_generic_reloc
, /* special_function */
1829 "R_MIPS16_TLS_GOTTPREL", /* name */
1830 FALSE
, /* partial_inplace */
1831 0x0000ffff, /* src_mask */
1832 0x0000ffff, /* dst_mask */
1833 FALSE
), /* pcrel_offset */
1835 /* MIPS16 TLS thread pointer offset. */
1836 HOWTO (R_MIPS16_TLS_TPREL_HI16
, /* type */
1838 2, /* size (0 = byte, 1 = short, 2 = long) */
1840 FALSE
, /* pc_relative */
1842 complain_overflow_signed
, /* complain_on_overflow */
1843 _bfd_mips_elf_generic_reloc
, /* special_function */
1844 "R_MIPS16_TLS_TPREL_HI16", /* name */
1845 FALSE
, /* partial_inplace */
1846 0x0000ffff, /* src_mask */
1847 0x0000ffff, /* dst_mask */
1848 FALSE
), /* pcrel_offset */
1850 /* MIPS16 TLS thread pointer offset. */
1851 HOWTO (R_MIPS16_TLS_TPREL_LO16
, /* type */
1853 2, /* size (0 = byte, 1 = short, 2 = long) */
1855 FALSE
, /* pc_relative */
1857 complain_overflow_signed
, /* complain_on_overflow */
1858 _bfd_mips_elf_generic_reloc
, /* special_function */
1859 "R_MIPS16_TLS_TPREL_LO16", /* name */
1860 FALSE
, /* partial_inplace */
1861 0x0000ffff, /* src_mask */
1862 0x0000ffff, /* dst_mask */
1863 FALSE
), /* pcrel_offset */
1866 static reloc_howto_type elf_micromips_howto_table_rel
[] =
1872 /* 26 bit jump address. */
1873 HOWTO (R_MICROMIPS_26_S1
, /* type */
1875 2, /* size (0 = byte, 1 = short, 2 = long) */
1877 FALSE
, /* pc_relative */
1879 complain_overflow_dont
, /* complain_on_overflow */
1880 /* This needs complex overflow
1881 detection, because the upper four
1882 bits must match the PC. */
1883 _bfd_mips_elf_generic_reloc
, /* special_function */
1884 "R_MICROMIPS_26_S1", /* name */
1885 TRUE
, /* partial_inplace */
1886 0x3ffffff, /* src_mask */
1887 0x3ffffff, /* dst_mask */
1888 FALSE
), /* pcrel_offset */
1890 /* High 16 bits of symbol value. */
1891 HOWTO (R_MICROMIPS_HI16
, /* type */
1892 16, /* rightshift */
1893 2, /* size (0 = byte, 1 = short, 2 = long) */
1895 FALSE
, /* pc_relative */
1897 complain_overflow_dont
, /* complain_on_overflow */
1898 _bfd_mips_elf_hi16_reloc
, /* special_function */
1899 "R_MICROMIPS_HI16", /* name */
1900 TRUE
, /* partial_inplace */
1901 0x0000ffff, /* src_mask */
1902 0x0000ffff, /* dst_mask */
1903 FALSE
), /* pcrel_offset */
1905 /* Low 16 bits of symbol value. */
1906 HOWTO (R_MICROMIPS_LO16
, /* type */
1908 2, /* size (0 = byte, 1 = short, 2 = long) */
1910 FALSE
, /* pc_relative */
1912 complain_overflow_dont
, /* complain_on_overflow */
1913 _bfd_mips_elf_lo16_reloc
, /* special_function */
1914 "R_MICROMIPS_LO16", /* name */
1915 TRUE
, /* partial_inplace */
1916 0x0000ffff, /* src_mask */
1917 0x0000ffff, /* dst_mask */
1918 FALSE
), /* pcrel_offset */
1920 /* GP relative reference. */
1921 HOWTO (R_MICROMIPS_GPREL16
, /* type */
1923 2, /* size (0 = byte, 1 = short, 2 = long) */
1925 FALSE
, /* pc_relative */
1927 complain_overflow_signed
, /* complain_on_overflow */
1928 _bfd_mips_elf32_gprel16_reloc
, /* special_function */
1929 "R_MICROMIPS_GPREL16", /* name */
1930 TRUE
, /* partial_inplace */
1931 0x0000ffff, /* src_mask */
1932 0x0000ffff, /* dst_mask */
1933 FALSE
), /* pcrel_offset */
1935 /* Reference to literal section. */
1936 HOWTO (R_MICROMIPS_LITERAL
, /* type */
1938 2, /* size (0 = byte, 1 = short, 2 = long) */
1940 FALSE
, /* pc_relative */
1942 complain_overflow_signed
, /* complain_on_overflow */
1943 _bfd_mips_elf32_gprel16_reloc
, /* special_function */
1944 "R_MICROMIPS_LITERAL", /* name */
1945 TRUE
, /* partial_inplace */
1946 0x0000ffff, /* src_mask */
1947 0x0000ffff, /* dst_mask */
1948 FALSE
), /* pcrel_offset */
1950 /* Reference to global offset table. */
1951 HOWTO (R_MICROMIPS_GOT16
, /* type */
1953 2, /* size (0 = byte, 1 = short, 2 = long) */
1955 FALSE
, /* pc_relative */
1957 complain_overflow_signed
, /* complain_on_overflow */
1958 _bfd_mips_elf_got16_reloc
, /* special_function */
1959 "R_MICROMIPS_GOT16", /* name */
1960 TRUE
, /* partial_inplace */
1961 0x0000ffff, /* src_mask */
1962 0x0000ffff, /* dst_mask */
1963 FALSE
), /* pcrel_offset */
1965 /* This is for microMIPS branches. */
1966 HOWTO (R_MICROMIPS_PC7_S1
, /* type */
1968 1, /* size (0 = byte, 1 = short, 2 = long) */
1970 TRUE
, /* pc_relative */
1972 complain_overflow_signed
, /* complain_on_overflow */
1973 _bfd_mips_elf_generic_reloc
, /* special_function */
1974 "R_MICROMIPS_PC7_S1", /* name */
1975 TRUE
, /* partial_inplace */
1976 0x0000007f, /* src_mask */
1977 0x0000007f, /* dst_mask */
1978 TRUE
), /* pcrel_offset */
1980 HOWTO (R_MICROMIPS_PC10_S1
, /* type */
1982 1, /* size (0 = byte, 1 = short, 2 = long) */
1984 TRUE
, /* pc_relative */
1986 complain_overflow_signed
, /* complain_on_overflow */
1987 _bfd_mips_elf_generic_reloc
, /* special_function */
1988 "R_MICROMIPS_PC10_S1", /* name */
1989 TRUE
, /* partial_inplace */
1990 0x000003ff, /* src_mask */
1991 0x000003ff, /* dst_mask */
1992 TRUE
), /* pcrel_offset */
1994 HOWTO (R_MICROMIPS_PC16_S1
, /* type */
1996 2, /* size (0 = byte, 1 = short, 2 = long) */
1998 TRUE
, /* pc_relative */
2000 complain_overflow_signed
, /* complain_on_overflow */
2001 _bfd_mips_elf_generic_reloc
, /* special_function */
2002 "R_MICROMIPS_PC16_S1", /* name */
2003 TRUE
, /* partial_inplace */
2004 0x0000ffff, /* src_mask */
2005 0x0000ffff, /* dst_mask */
2006 TRUE
), /* pcrel_offset */
2008 /* 16 bit call through global offset table. */
2009 HOWTO (R_MICROMIPS_CALL16
, /* type */
2011 2, /* size (0 = byte, 1 = short, 2 = long) */
2013 FALSE
, /* pc_relative */
2015 complain_overflow_signed
, /* complain_on_overflow */
2016 _bfd_mips_elf_generic_reloc
, /* special_function */
2017 "R_MICROMIPS_CALL16", /* name */
2018 TRUE
, /* partial_inplace */
2019 0x0000ffff, /* src_mask */
2020 0x0000ffff, /* dst_mask */
2021 FALSE
), /* pcrel_offset */
2026 /* Displacement in the global offset table. */
2027 HOWTO (R_MICROMIPS_GOT_DISP
, /* type */
2029 2, /* size (0 = byte, 1 = short, 2 = long) */
2031 FALSE
, /* pc_relative */
2033 complain_overflow_signed
, /* complain_on_overflow */
2034 _bfd_mips_elf_generic_reloc
, /* special_function */
2035 "R_MICROMIPS_GOT_DISP",/* name */
2036 TRUE
, /* partial_inplace */
2037 0x0000ffff, /* src_mask */
2038 0x0000ffff, /* dst_mask */
2039 FALSE
), /* pcrel_offset */
2041 /* Displacement to page pointer in the global offset table. */
2042 HOWTO (R_MICROMIPS_GOT_PAGE
, /* type */
2044 2, /* size (0 = byte, 1 = short, 2 = long) */
2046 FALSE
, /* pc_relative */
2048 complain_overflow_signed
, /* complain_on_overflow */
2049 _bfd_mips_elf_generic_reloc
, /* special_function */
2050 "R_MICROMIPS_GOT_PAGE",/* name */
2051 TRUE
, /* partial_inplace */
2052 0x0000ffff, /* src_mask */
2053 0x0000ffff, /* dst_mask */
2054 FALSE
), /* pcrel_offset */
2056 /* Offset from page pointer in the global offset table. */
2057 HOWTO (R_MICROMIPS_GOT_OFST
, /* type */
2059 2, /* size (0 = byte, 1 = short, 2 = long) */
2061 FALSE
, /* pc_relative */
2063 complain_overflow_signed
, /* complain_on_overflow */
2064 _bfd_mips_elf_generic_reloc
, /* special_function */
2065 "R_MICROMIPS_GOT_OFST",/* name */
2066 TRUE
, /* partial_inplace */
2067 0x0000ffff, /* src_mask */
2068 0x0000ffff, /* dst_mask */
2069 FALSE
), /* pcrel_offset */
2071 /* High 16 bits of displacement in global offset table. */
2072 HOWTO (R_MICROMIPS_GOT_HI16
, /* type */
2074 2, /* size (0 = byte, 1 = short, 2 = long) */
2076 FALSE
, /* pc_relative */
2078 complain_overflow_dont
, /* complain_on_overflow */
2079 _bfd_mips_elf_generic_reloc
, /* special_function */
2080 "R_MICROMIPS_GOT_HI16",/* name */
2081 TRUE
, /* partial_inplace */
2082 0x0000ffff, /* src_mask */
2083 0x0000ffff, /* dst_mask */
2084 FALSE
), /* pcrel_offset */
2086 /* Low 16 bits of displacement in global offset table. */
2087 HOWTO (R_MICROMIPS_GOT_LO16
, /* type */
2089 2, /* size (0 = byte, 1 = short, 2 = long) */
2091 FALSE
, /* pc_relative */
2093 complain_overflow_dont
, /* complain_on_overflow */
2094 _bfd_mips_elf_generic_reloc
, /* special_function */
2095 "R_MICROMIPS_GOT_LO16",/* name */
2096 TRUE
, /* partial_inplace */
2097 0x0000ffff, /* src_mask */
2098 0x0000ffff, /* dst_mask */
2099 FALSE
), /* pcrel_offset */
2101 /* 64 bit subtraction. Used in the N32 ABI. */
2102 HOWTO (R_MICROMIPS_SUB
, /* type */
2104 4, /* size (0 = byte, 1 = short, 2 = long) */
2106 FALSE
, /* pc_relative */
2108 complain_overflow_dont
, /* complain_on_overflow */
2109 _bfd_mips_elf_generic_reloc
, /* special_function */
2110 "R_MICROMIPS_SUB", /* name */
2111 TRUE
, /* partial_inplace */
2112 MINUS_ONE
, /* src_mask */
2113 MINUS_ONE
, /* dst_mask */
2114 FALSE
), /* pcrel_offset */
2116 /* We don't support these for REL relocations, because it means building
2117 the addend from a R_MICROMIPS_HIGHEST/R_MICROMIPS_HIGHER/
2118 R_MICROMIPS_HI16/R_MICROMIPS_LO16 sequence with varying ordering,
2119 using fallable heuristics. */
2120 EMPTY_HOWTO (R_MICROMIPS_HIGHER
),
2121 EMPTY_HOWTO (R_MICROMIPS_HIGHEST
),
2123 /* High 16 bits of displacement in global offset table. */
2124 HOWTO (R_MICROMIPS_CALL_HI16
, /* type */
2126 2, /* size (0 = byte, 1 = short, 2 = long) */
2128 FALSE
, /* pc_relative */
2130 complain_overflow_dont
, /* complain_on_overflow */
2131 _bfd_mips_elf_generic_reloc
, /* special_function */
2132 "R_MICROMIPS_CALL_HI16",/* name */
2133 TRUE
, /* partial_inplace */
2134 0x0000ffff, /* src_mask */
2135 0x0000ffff, /* dst_mask */
2136 FALSE
), /* pcrel_offset */
2138 /* Low 16 bits of displacement in global offset table. */
2139 HOWTO (R_MICROMIPS_CALL_LO16
, /* type */
2141 2, /* size (0 = byte, 1 = short, 2 = long) */
2143 FALSE
, /* pc_relative */
2145 complain_overflow_dont
, /* complain_on_overflow */
2146 _bfd_mips_elf_generic_reloc
, /* special_function */
2147 "R_MICROMIPS_CALL_LO16",/* name */
2148 TRUE
, /* partial_inplace */
2149 0x0000ffff, /* src_mask */
2150 0x0000ffff, /* dst_mask */
2151 FALSE
), /* pcrel_offset */
2154 static reloc_howto_type elf_micromips_howto_table_rela
[] =
2160 /* 26 bit jump address. */
2161 HOWTO (R_MICROMIPS_26_S1
, /* type */
2163 2, /* size (0 = byte, 1 = short, 2 = long) */
2165 FALSE
, /* pc_relative */
2167 complain_overflow_dont
, /* complain_on_overflow */
2168 /* This needs complex overflow
2169 detection, because the upper four
2170 bits must match the PC. */
2171 _bfd_mips_elf_generic_reloc
, /* special_function */
2172 "R_MICROMIPS_26_S1", /* name */
2173 FALSE
, /* partial_inplace */
2175 0x3ffffff, /* dst_mask */
2176 FALSE
), /* pcrel_offset */
2178 /* High 16 bits of symbol value. */
2179 HOWTO (R_MICROMIPS_HI16
, /* type */
2180 16, /* rightshift */
2181 2, /* size (0 = byte, 1 = short, 2 = long) */
2183 FALSE
, /* pc_relative */
2185 complain_overflow_dont
, /* complain_on_overflow */
2186 _bfd_mips_elf_hi16_reloc
, /* special_function */
2187 "R_MICROMIPS_HI16", /* name */
2188 FALSE
, /* partial_inplace */
2190 0x0000ffff, /* dst_mask */
2191 FALSE
), /* pcrel_offset */
2193 /* Low 16 bits of symbol value. */
2194 HOWTO (R_MICROMIPS_LO16
, /* type */
2196 2, /* size (0 = byte, 1 = short, 2 = long) */
2198 FALSE
, /* pc_relative */
2200 complain_overflow_dont
, /* complain_on_overflow */
2201 _bfd_mips_elf_lo16_reloc
, /* special_function */
2202 "R_MICROMIPS_LO16", /* name */
2203 FALSE
, /* partial_inplace */
2205 0x0000ffff, /* dst_mask */
2206 FALSE
), /* pcrel_offset */
2208 /* GP relative reference. */
2209 HOWTO (R_MICROMIPS_GPREL16
, /* type */
2211 2, /* size (0 = byte, 1 = short, 2 = long) */
2213 FALSE
, /* pc_relative */
2215 complain_overflow_signed
, /* complain_on_overflow */
2216 _bfd_mips_elf32_gprel16_reloc
, /* special_function */
2217 "R_MICROMIPS_GPREL16", /* name */
2218 FALSE
, /* partial_inplace */
2220 0x0000ffff, /* dst_mask */
2221 FALSE
), /* pcrel_offset */
2223 /* Reference to literal section. */
2224 HOWTO (R_MICROMIPS_LITERAL
, /* type */
2226 2, /* size (0 = byte, 1 = short, 2 = long) */
2228 FALSE
, /* pc_relative */
2230 complain_overflow_signed
, /* complain_on_overflow */
2231 _bfd_mips_elf32_gprel16_reloc
, /* special_function */
2232 "R_MICROMIPS_LITERAL", /* name */
2233 FALSE
, /* partial_inplace */
2235 0x0000ffff, /* dst_mask */
2236 FALSE
), /* pcrel_offset */
2238 /* Reference to global offset table. */
2239 HOWTO (R_MICROMIPS_GOT16
, /* type */
2241 2, /* size (0 = byte, 1 = short, 2 = long) */
2243 FALSE
, /* pc_relative */
2245 complain_overflow_signed
, /* complain_on_overflow */
2246 _bfd_mips_elf_got16_reloc
, /* special_function */
2247 "R_MICROMIPS_GOT16", /* name */
2248 FALSE
, /* partial_inplace */
2250 0x0000ffff, /* dst_mask */
2251 FALSE
), /* pcrel_offset */
2253 /* This is for microMIPS branches. */
2254 HOWTO (R_MICROMIPS_PC7_S1
, /* type */
2256 1, /* size (0 = byte, 1 = short, 2 = long) */
2258 TRUE
, /* pc_relative */
2260 complain_overflow_signed
, /* complain_on_overflow */
2261 _bfd_mips_elf_generic_reloc
, /* special_function */
2262 "R_MICROMIPS_PC7_S1", /* name */
2263 FALSE
, /* partial_inplace */
2265 0x0000007f, /* dst_mask */
2266 TRUE
), /* pcrel_offset */
2268 HOWTO (R_MICROMIPS_PC10_S1
, /* type */
2270 1, /* size (0 = byte, 1 = short, 2 = long) */
2272 TRUE
, /* pc_relative */
2274 complain_overflow_signed
, /* complain_on_overflow */
2275 _bfd_mips_elf_generic_reloc
, /* special_function */
2276 "R_MICROMIPS_PC10_S1", /* name */
2277 FALSE
, /* partial_inplace */
2279 0x000003ff, /* dst_mask */
2280 TRUE
), /* pcrel_offset */
2282 HOWTO (R_MICROMIPS_PC16_S1
, /* type */
2284 2, /* size (0 = byte, 1 = short, 2 = long) */
2286 TRUE
, /* pc_relative */
2288 complain_overflow_signed
, /* complain_on_overflow */
2289 _bfd_mips_elf_generic_reloc
, /* special_function */
2290 "R_MICROMIPS_PC16_S1", /* name */
2291 FALSE
, /* partial_inplace */
2293 0x0000ffff, /* dst_mask */
2294 TRUE
), /* pcrel_offset */
2296 /* 16 bit call through global offset table. */
2297 HOWTO (R_MICROMIPS_CALL16
, /* type */
2299 2, /* size (0 = byte, 1 = short, 2 = long) */
2301 FALSE
, /* pc_relative */
2303 complain_overflow_signed
, /* complain_on_overflow */
2304 _bfd_mips_elf_generic_reloc
, /* special_function */
2305 "R_MICROMIPS_CALL16", /* name */
2306 FALSE
, /* partial_inplace */
2308 0x0000ffff, /* dst_mask */
2309 FALSE
), /* pcrel_offset */
2314 /* Displacement in the global offset table. */
2315 HOWTO (R_MICROMIPS_GOT_DISP
, /* type */
2317 2, /* size (0 = byte, 1 = short, 2 = long) */
2319 FALSE
, /* pc_relative */
2321 complain_overflow_signed
, /* complain_on_overflow */
2322 _bfd_mips_elf_generic_reloc
, /* special_function */
2323 "R_MICROMIPS_GOT_DISP",/* name */
2324 FALSE
, /* partial_inplace */
2326 0x0000ffff, /* dst_mask */
2327 FALSE
), /* pcrel_offset */
2329 /* Displacement to page pointer in the global offset table. */
2330 HOWTO (R_MICROMIPS_GOT_PAGE
, /* type */
2332 2, /* size (0 = byte, 1 = short, 2 = long) */
2334 FALSE
, /* pc_relative */
2336 complain_overflow_signed
, /* complain_on_overflow */
2337 _bfd_mips_elf_generic_reloc
, /* special_function */
2338 "R_MICROMIPS_GOT_PAGE",/* name */
2339 FALSE
, /* partial_inplace */
2341 0x0000ffff, /* dst_mask */
2342 FALSE
), /* pcrel_offset */
2344 /* Offset from page pointer in the global offset table. */
2345 HOWTO (R_MICROMIPS_GOT_OFST
, /* type */
2347 2, /* size (0 = byte, 1 = short, 2 = long) */
2349 FALSE
, /* pc_relative */
2351 complain_overflow_signed
, /* complain_on_overflow */
2352 _bfd_mips_elf_generic_reloc
, /* special_function */
2353 "R_MICROMIPS_GOT_OFST",/* name */
2354 FALSE
, /* partial_inplace */
2356 0x0000ffff, /* dst_mask */
2357 FALSE
), /* pcrel_offset */
2359 /* High 16 bits of displacement in global offset table. */
2360 HOWTO (R_MICROMIPS_GOT_HI16
, /* type */
2362 2, /* size (0 = byte, 1 = short, 2 = long) */
2364 FALSE
, /* pc_relative */
2366 complain_overflow_dont
, /* complain_on_overflow */
2367 _bfd_mips_elf_generic_reloc
, /* special_function */
2368 "R_MICROMIPS_GOT_HI16",/* name */
2369 FALSE
, /* partial_inplace */
2371 0x0000ffff, /* dst_mask */
2372 FALSE
), /* pcrel_offset */
2374 /* Low 16 bits of displacement in global offset table. */
2375 HOWTO (R_MICROMIPS_GOT_LO16
, /* type */
2377 2, /* size (0 = byte, 1 = short, 2 = long) */
2379 FALSE
, /* pc_relative */
2381 complain_overflow_dont
, /* complain_on_overflow */
2382 _bfd_mips_elf_generic_reloc
, /* special_function */
2383 "R_MICROMIPS_GOT_LO16",/* name */
2384 FALSE
, /* partial_inplace */
2386 0x0000ffff, /* dst_mask */
2387 FALSE
), /* pcrel_offset */
2389 /* 64 bit subtraction. Used in the N32 ABI. */
2390 HOWTO (R_MICROMIPS_SUB
, /* type */
2392 4, /* size (0 = byte, 1 = short, 2 = long) */
2394 FALSE
, /* pc_relative */
2396 complain_overflow_dont
, /* complain_on_overflow */
2397 _bfd_mips_elf_generic_reloc
, /* special_function */
2398 "R_MICROMIPS_SUB", /* name */
2399 FALSE
, /* partial_inplace */
2401 MINUS_ONE
, /* dst_mask */
2402 FALSE
), /* pcrel_offset */
2404 /* Get the higher value of a 64 bit addend. */
2405 HOWTO (R_MICROMIPS_HIGHER
, /* type */
2407 2, /* size (0 = byte, 1 = short, 2 = long) */
2409 FALSE
, /* pc_relative */
2411 complain_overflow_dont
, /* complain_on_overflow */
2412 _bfd_mips_elf_generic_reloc
, /* special_function */
2413 "R_MICROMIPS_HIGHER", /* name */
2414 FALSE
, /* partial_inplace */
2416 0x0000ffff, /* dst_mask */
2417 FALSE
), /* pcrel_offset */
2419 /* Get the highest value of a 64 bit addend. */
2420 HOWTO (R_MICROMIPS_HIGHEST
, /* type */
2422 2, /* size (0 = byte, 1 = short, 2 = long) */
2424 FALSE
, /* pc_relative */
2426 complain_overflow_dont
, /* complain_on_overflow */
2427 _bfd_mips_elf_generic_reloc
, /* special_function */
2428 "R_MICROMIPS_HIGHEST", /* name */
2429 FALSE
, /* partial_inplace */
2431 0x0000ffff, /* dst_mask */
2432 FALSE
), /* pcrel_offset */
2434 /* High 16 bits of displacement in global offset table. */
2435 HOWTO (R_MICROMIPS_CALL_HI16
, /* type */
2437 2, /* size (0 = byte, 1 = short, 2 = long) */
2439 FALSE
, /* pc_relative */
2441 complain_overflow_dont
, /* complain_on_overflow */
2442 _bfd_mips_elf_generic_reloc
, /* special_function */
2443 "R_MICROMIPS_CALL_HI16",/* name */
2444 FALSE
, /* partial_inplace */
2446 0x0000ffff, /* dst_mask */
2447 FALSE
), /* pcrel_offset */
2449 /* Low 16 bits of displacement in global offset table. */
2450 HOWTO (R_MICROMIPS_CALL_LO16
, /* type */
2452 2, /* size (0 = byte, 1 = short, 2 = long) */
2454 FALSE
, /* pc_relative */
2456 complain_overflow_dont
, /* complain_on_overflow */
2457 _bfd_mips_elf_generic_reloc
, /* special_function */
2458 "R_MICROMIPS_CALL_LO16",/* name */
2459 FALSE
, /* partial_inplace */
2461 0x0000ffff, /* dst_mask */
2462 FALSE
), /* pcrel_offset */
2465 /* GNU extension to record C++ vtable hierarchy */
2466 static reloc_howto_type elf_mips_gnu_vtinherit_howto
=
2467 HOWTO (R_MIPS_GNU_VTINHERIT
, /* type */
2469 2, /* size (0 = byte, 1 = short, 2 = long) */
2471 FALSE
, /* pc_relative */
2473 complain_overflow_dont
, /* complain_on_overflow */
2474 NULL
, /* special_function */
2475 "R_MIPS_GNU_VTINHERIT", /* name */
2476 FALSE
, /* partial_inplace */
2479 FALSE
); /* pcrel_offset */
2481 /* GNU extension to record C++ vtable member usage */
2482 static reloc_howto_type elf_mips_gnu_vtentry_howto
=
2483 HOWTO (R_MIPS_GNU_VTENTRY
, /* type */
2485 2, /* size (0 = byte, 1 = short, 2 = long) */
2487 FALSE
, /* pc_relative */
2489 complain_overflow_dont
, /* complain_on_overflow */
2490 _bfd_elf_rel_vtable_reloc_fn
, /* special_function */
2491 "R_MIPS_GNU_VTENTRY", /* name */
2492 FALSE
, /* partial_inplace */
2495 FALSE
); /* pcrel_offset */
2497 /* 16 bit offset for pc-relative branches. */
2498 static reloc_howto_type elf_mips_gnu_rel16_s2
=
2499 HOWTO (R_MIPS_GNU_REL16_S2
, /* type */
2501 2, /* size (0 = byte, 1 = short, 2 = long) */
2503 TRUE
, /* pc_relative */
2505 complain_overflow_signed
, /* complain_on_overflow */
2506 _bfd_mips_elf_generic_reloc
, /* special_function */
2507 "R_MIPS_GNU_REL16_S2", /* name */
2508 TRUE
, /* partial_inplace */
2509 0x0000ffff, /* src_mask */
2510 0x0000ffff, /* dst_mask */
2511 TRUE
); /* pcrel_offset */
2513 /* 16 bit offset for pc-relative branches. */
2514 static reloc_howto_type elf_mips_gnu_rela16_s2
=
2515 HOWTO (R_MIPS_GNU_REL16_S2
, /* type */
2517 2, /* size (0 = byte, 1 = short, 2 = long) */
2519 TRUE
, /* pc_relative */
2521 complain_overflow_signed
, /* complain_on_overflow */
2522 _bfd_mips_elf_generic_reloc
, /* special_function */
2523 "R_MIPS_GNU_REL16_S2", /* name */
2524 FALSE
, /* partial_inplace */
2526 0x0000ffff, /* dst_mask */
2527 TRUE
); /* pcrel_offset */
2529 /* Originally a VxWorks extension, but now used for other systems too. */
2530 static reloc_howto_type elf_mips_copy_howto
=
2531 HOWTO (R_MIPS_COPY
, /* type */
2533 0, /* this one is variable size */
2535 FALSE
, /* pc_relative */
2537 complain_overflow_bitfield
, /* complain_on_overflow */
2538 bfd_elf_generic_reloc
, /* special_function */
2539 "R_MIPS_COPY", /* name */
2540 FALSE
, /* partial_inplace */
2543 FALSE
); /* pcrel_offset */
2545 /* Originally a VxWorks extension, but now used for other systems too. */
2546 static reloc_howto_type elf_mips_jump_slot_howto
=
2547 HOWTO (R_MIPS_JUMP_SLOT
, /* type */
2549 2, /* size (0 = byte, 1 = short, 2 = long) */
2551 FALSE
, /* pc_relative */
2553 complain_overflow_bitfield
, /* complain_on_overflow */
2554 bfd_elf_generic_reloc
, /* special_function */
2555 "R_MIPS_JUMP_SLOT", /* name */
2556 FALSE
, /* partial_inplace */
2559 FALSE
); /* pcrel_offset */
2561 /* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a
2562 dangerous relocation. */
2565 mips_elf_assign_gp (bfd
*output_bfd
, bfd_vma
*pgp
)
2571 /* If we've already figured out what GP will be, just return it. */
2572 *pgp
= _bfd_get_gp_value (output_bfd
);
2576 count
= bfd_get_symcount (output_bfd
);
2577 sym
= bfd_get_outsymbols (output_bfd
);
2579 /* The linker script will have created a symbol named `_gp' with the
2580 appropriate value. */
2585 for (i
= 0; i
< count
; i
++, sym
++)
2587 register const char *name
;
2589 name
= bfd_asymbol_name (*sym
);
2590 if (*name
== '_' && strcmp (name
, "_gp") == 0)
2592 *pgp
= bfd_asymbol_value (*sym
);
2593 _bfd_set_gp_value (output_bfd
, *pgp
);
2601 /* Only get the error once. */
2603 _bfd_set_gp_value (output_bfd
, *pgp
);
2610 /* We have to figure out the gp value, so that we can adjust the
2611 symbol value correctly. We look up the symbol _gp in the output
2612 BFD. If we can't find it, we're stuck. We cache it in the ELF
2613 target data. We don't need to adjust the symbol value for an
2614 external symbol if we are producing relocatable output. */
2616 static bfd_reloc_status_type
2617 mips_elf_final_gp (bfd
*output_bfd
, asymbol
*symbol
, bfd_boolean relocatable
,
2618 char **error_message
, bfd_vma
*pgp
)
2620 if (bfd_is_und_section (symbol
->section
)
2624 return bfd_reloc_undefined
;
2627 *pgp
= _bfd_get_gp_value (output_bfd
);
2630 || (symbol
->flags
& BSF_SECTION_SYM
) != 0))
2634 /* Make up a value. */
2635 *pgp
= symbol
->section
->output_section
->vma
/*+ 0x4000*/;
2636 _bfd_set_gp_value (output_bfd
, *pgp
);
2638 else if (!mips_elf_assign_gp (output_bfd
, pgp
))
2641 (char *) _("GP relative relocation when _gp not defined");
2642 return bfd_reloc_dangerous
;
2646 return bfd_reloc_ok
;
2649 /* Do a R_MIPS_GPREL16 relocation. This is a 16 bit value which must
2650 become the offset from the gp register. */
2652 static bfd_reloc_status_type
2653 mips_elf_gprel16_reloc (bfd
*abfd ATTRIBUTE_UNUSED
, arelent
*reloc_entry
,
2654 asymbol
*symbol
, void *data ATTRIBUTE_UNUSED
,
2655 asection
*input_section
, bfd
*output_bfd
,
2656 char **error_message ATTRIBUTE_UNUSED
)
2658 bfd_boolean relocatable
;
2659 bfd_reloc_status_type ret
;
2662 if (output_bfd
!= NULL
)
2666 relocatable
= FALSE
;
2667 output_bfd
= symbol
->section
->output_section
->owner
;
2670 ret
= mips_elf_final_gp (output_bfd
, symbol
, relocatable
, error_message
,
2672 if (ret
!= bfd_reloc_ok
)
2675 return _bfd_mips_elf_gprel16_with_gp (abfd
, symbol
, reloc_entry
,
2676 input_section
, relocatable
,
2680 /* Do a R_MIPS_LITERAL relocation. */
2682 static bfd_reloc_status_type
2683 mips_elf_literal_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
2684 void *data
, asection
*input_section
, bfd
*output_bfd
,
2685 char **error_message
)
2687 bfd_boolean relocatable
;
2688 bfd_reloc_status_type ret
;
2691 /* R_MIPS_LITERAL relocations are defined for local symbols only. */
2692 if (output_bfd
!= NULL
2693 && (symbol
->flags
& BSF_SECTION_SYM
) == 0
2694 && (symbol
->flags
& BSF_LOCAL
) != 0)
2696 *error_message
= (char *)
2697 _("literal relocation occurs for an external symbol");
2698 return bfd_reloc_outofrange
;
2701 /* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */
2702 if (output_bfd
!= NULL
)
2706 relocatable
= FALSE
;
2707 output_bfd
= symbol
->section
->output_section
->owner
;
2710 ret
= mips_elf_final_gp (output_bfd
, symbol
, relocatable
, error_message
,
2712 if (ret
!= bfd_reloc_ok
)
2715 return _bfd_mips_elf_gprel16_with_gp (abfd
, symbol
, reloc_entry
,
2716 input_section
, relocatable
,
2720 /* Do a R_MIPS_GPREL32 relocation. This is a 32 bit value which must
2721 become the offset from the gp register. */
2723 static bfd_reloc_status_type
2724 mips_elf_gprel32_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
2725 void *data
, asection
*input_section
, bfd
*output_bfd
,
2726 char **error_message
)
2728 bfd_boolean relocatable
;
2729 bfd_reloc_status_type ret
;
2732 /* R_MIPS_GPREL32 relocations are defined for local symbols only. */
2733 if (output_bfd
!= NULL
2734 && (symbol
->flags
& BSF_SECTION_SYM
) == 0
2735 && (symbol
->flags
& BSF_LOCAL
) != 0)
2737 *error_message
= (char *)
2738 _("32bits gp relative relocation occurs for an external symbol");
2739 return bfd_reloc_outofrange
;
2742 if (output_bfd
!= NULL
)
2745 gp
= _bfd_get_gp_value (output_bfd
);
2749 relocatable
= FALSE
;
2750 output_bfd
= symbol
->section
->output_section
->owner
;
2752 ret
= mips_elf_final_gp (output_bfd
, symbol
, relocatable
,
2753 error_message
, &gp
);
2754 if (ret
!= bfd_reloc_ok
)
2758 return gprel32_with_gp (abfd
, symbol
, reloc_entry
, input_section
,
2759 relocatable
, data
, gp
);
2762 static bfd_reloc_status_type
2763 gprel32_with_gp (bfd
*abfd
, asymbol
*symbol
, arelent
*reloc_entry
,
2764 asection
*input_section
, bfd_boolean relocatable
,
2765 void *data
, bfd_vma gp
)
2770 if (bfd_is_com_section (symbol
->section
))
2773 relocation
= symbol
->value
;
2775 relocation
+= symbol
->section
->output_section
->vma
;
2776 relocation
+= symbol
->section
->output_offset
;
2778 if (reloc_entry
->address
> bfd_get_section_limit (abfd
, input_section
))
2779 return bfd_reloc_outofrange
;
2781 if (reloc_entry
->howto
->src_mask
== 0)
2784 val
= bfd_get_32 (abfd
, (bfd_byte
*) data
+ reloc_entry
->address
);
2786 /* Set val to the offset into the section or symbol. */
2787 val
+= reloc_entry
->addend
;
2789 /* Adjust val for the final section location and GP value. If we
2790 are producing relocatable output, we don't want to do this for
2791 an external symbol. */
2793 || (symbol
->flags
& BSF_SECTION_SYM
) != 0)
2794 val
+= relocation
- gp
;
2796 bfd_put_32 (abfd
, val
, (bfd_byte
*) data
+ reloc_entry
->address
);
2799 reloc_entry
->address
+= input_section
->output_offset
;
2801 return bfd_reloc_ok
;
2804 /* Do a R_MIPS_SHIFT6 relocation. The MSB of the shift is stored at bit 2,
2805 the rest is at bits 6-10. The bitpos already got right by the howto. */
2807 static bfd_reloc_status_type
2808 mips_elf_shift6_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
2809 void *data
, asection
*input_section
, bfd
*output_bfd
,
2810 char **error_message
)
2812 if (reloc_entry
->howto
->partial_inplace
)
2814 reloc_entry
->addend
= ((reloc_entry
->addend
& 0x00007c0)
2815 | (reloc_entry
->addend
& 0x00000800) >> 9);
2818 return _bfd_mips_elf_generic_reloc (abfd
, reloc_entry
, symbol
, data
,
2819 input_section
, output_bfd
,
2823 /* Handle a mips16 GP relative reloc. */
2825 static bfd_reloc_status_type
2826 mips16_gprel_reloc (bfd
*abfd
, arelent
*reloc_entry
, asymbol
*symbol
,
2827 void *data
, asection
*input_section
, bfd
*output_bfd
,
2828 char **error_message
)
2830 bfd_boolean relocatable
;
2831 bfd_reloc_status_type ret
;
2835 /* If we're relocating, and this is an external symbol, we don't want
2836 to change anything. */
2837 if (output_bfd
!= NULL
2838 && (symbol
->flags
& BSF_SECTION_SYM
) == 0
2839 && (symbol
->flags
& BSF_LOCAL
) != 0)
2841 reloc_entry
->address
+= input_section
->output_offset
;
2842 return bfd_reloc_ok
;
2845 if (output_bfd
!= NULL
)
2849 relocatable
= FALSE
;
2850 output_bfd
= symbol
->section
->output_section
->owner
;
2853 ret
= mips_elf_final_gp (output_bfd
, symbol
, relocatable
, error_message
,
2855 if (ret
!= bfd_reloc_ok
)
2858 location
= (bfd_byte
*) data
+ reloc_entry
->address
;
2859 _bfd_mips_elf_reloc_unshuffle (abfd
, reloc_entry
->howto
->type
, FALSE
,
2861 ret
= _bfd_mips_elf_gprel16_with_gp (abfd
, symbol
, reloc_entry
,
2862 input_section
, relocatable
,
2864 _bfd_mips_elf_reloc_shuffle (abfd
, reloc_entry
->howto
->type
, !relocatable
,
2870 /* A mapping from BFD reloc types to MIPS ELF reloc types. */
2872 struct elf_reloc_map
{
2873 bfd_reloc_code_real_type bfd_val
;
2874 enum elf_mips_reloc_type elf_val
;
2877 static const struct elf_reloc_map mips_reloc_map
[] =
2879 { BFD_RELOC_NONE
, R_MIPS_NONE
},
2880 { BFD_RELOC_16
, R_MIPS_16
},
2881 { BFD_RELOC_32
, R_MIPS_32
},
2882 /* There is no BFD reloc for R_MIPS_REL32. */
2883 { BFD_RELOC_CTOR
, R_MIPS_32
},
2884 { BFD_RELOC_64
, R_MIPS_64
},
2885 { BFD_RELOC_16_PCREL_S2
, R_MIPS_PC16
},
2886 { BFD_RELOC_HI16_S
, R_MIPS_HI16
},
2887 { BFD_RELOC_LO16
, R_MIPS_LO16
},
2888 { BFD_RELOC_GPREL16
, R_MIPS_GPREL16
},
2889 { BFD_RELOC_GPREL32
, R_MIPS_GPREL32
},
2890 { BFD_RELOC_MIPS_JMP
, R_MIPS_26
},
2891 { BFD_RELOC_MIPS_LITERAL
, R_MIPS_LITERAL
},
2892 { BFD_RELOC_MIPS_GOT16
, R_MIPS_GOT16
},
2893 { BFD_RELOC_MIPS_CALL16
, R_MIPS_CALL16
},
2894 { BFD_RELOC_MIPS_SHIFT5
, R_MIPS_SHIFT5
},
2895 { BFD_RELOC_MIPS_SHIFT6
, R_MIPS_SHIFT6
},
2896 { BFD_RELOC_MIPS_GOT_DISP
, R_MIPS_GOT_DISP
},
2897 { BFD_RELOC_MIPS_GOT_PAGE
, R_MIPS_GOT_PAGE
},
2898 { BFD_RELOC_MIPS_GOT_OFST
, R_MIPS_GOT_OFST
},
2899 { BFD_RELOC_MIPS_GOT_HI16
, R_MIPS_GOT_HI16
},
2900 { BFD_RELOC_MIPS_GOT_LO16
, R_MIPS_GOT_LO16
},
2901 { BFD_RELOC_MIPS_SUB
, R_MIPS_SUB
},
2902 { BFD_RELOC_MIPS_INSERT_A
, R_MIPS_INSERT_A
},
2903 { BFD_RELOC_MIPS_INSERT_B
, R_MIPS_INSERT_B
},
2904 { BFD_RELOC_MIPS_DELETE
, R_MIPS_DELETE
},
2905 { BFD_RELOC_MIPS_HIGHEST
, R_MIPS_HIGHEST
},
2906 { BFD_RELOC_MIPS_HIGHER
, R_MIPS_HIGHER
},
2907 { BFD_RELOC_MIPS_CALL_HI16
, R_MIPS_CALL_HI16
},
2908 { BFD_RELOC_MIPS_CALL_LO16
, R_MIPS_CALL_LO16
},
2909 { BFD_RELOC_MIPS_SCN_DISP
, R_MIPS_SCN_DISP
},
2910 { BFD_RELOC_MIPS_REL16
, R_MIPS_REL16
},
2911 /* Use of R_MIPS_ADD_IMMEDIATE and R_MIPS_PJUMP is deprecated. */
2912 { BFD_RELOC_MIPS_RELGOT
, R_MIPS_RELGOT
},
2913 { BFD_RELOC_MIPS_JALR
, R_MIPS_JALR
},
2914 { BFD_RELOC_MIPS_TLS_DTPMOD32
, R_MIPS_TLS_DTPMOD32
},
2915 { BFD_RELOC_MIPS_TLS_DTPREL32
, R_MIPS_TLS_DTPREL32
},
2916 { BFD_RELOC_MIPS_TLS_DTPMOD64
, R_MIPS_TLS_DTPMOD64
},
2917 { BFD_RELOC_MIPS_TLS_DTPREL64
, R_MIPS_TLS_DTPREL64
},
2918 { BFD_RELOC_MIPS_TLS_GD
, R_MIPS_TLS_GD
},
2919 { BFD_RELOC_MIPS_TLS_LDM
, R_MIPS_TLS_LDM
},
2920 { BFD_RELOC_MIPS_TLS_DTPREL_HI16
, R_MIPS_TLS_DTPREL_HI16
},
2921 { BFD_RELOC_MIPS_TLS_DTPREL_LO16
, R_MIPS_TLS_DTPREL_LO16
},
2922 { BFD_RELOC_MIPS_TLS_GOTTPREL
, R_MIPS_TLS_GOTTPREL
},
2923 { BFD_RELOC_MIPS_TLS_TPREL32
, R_MIPS_TLS_TPREL32
},
2924 { BFD_RELOC_MIPS_TLS_TPREL64
, R_MIPS_TLS_TPREL64
},
2925 { BFD_RELOC_MIPS_TLS_TPREL_HI16
, R_MIPS_TLS_TPREL_HI16
},
2926 { BFD_RELOC_MIPS_TLS_TPREL_LO16
, R_MIPS_TLS_TPREL_LO16
}
2929 static const struct elf_reloc_map mips16_reloc_map
[] =
2931 { BFD_RELOC_MIPS16_JMP
, R_MIPS16_26
- R_MIPS16_min
},
2932 { BFD_RELOC_MIPS16_GPREL
, R_MIPS16_GPREL
- R_MIPS16_min
},
2933 { BFD_RELOC_MIPS16_GOT16
, R_MIPS16_GOT16
- R_MIPS16_min
},
2934 { BFD_RELOC_MIPS16_CALL16
, R_MIPS16_CALL16
- R_MIPS16_min
},
2935 { BFD_RELOC_MIPS16_HI16_S
, R_MIPS16_HI16
- R_MIPS16_min
},
2936 { BFD_RELOC_MIPS16_LO16
, R_MIPS16_LO16
- R_MIPS16_min
},
2937 { BFD_RELOC_MIPS16_TLS_GD
, R_MIPS16_TLS_GD
- R_MIPS16_min
},
2938 { BFD_RELOC_MIPS16_TLS_LDM
, R_MIPS16_TLS_LDM
- R_MIPS16_min
},
2939 { BFD_RELOC_MIPS16_TLS_DTPREL_HI16
,
2940 R_MIPS16_TLS_DTPREL_HI16
- R_MIPS16_min
},
2941 { BFD_RELOC_MIPS16_TLS_DTPREL_LO16
,
2942 R_MIPS16_TLS_DTPREL_LO16
- R_MIPS16_min
},
2943 { BFD_RELOC_MIPS16_TLS_GOTTPREL
, R_MIPS16_TLS_GOTTPREL
- R_MIPS16_min
},
2944 { BFD_RELOC_MIPS16_TLS_TPREL_HI16
, R_MIPS16_TLS_TPREL_HI16
- R_MIPS16_min
},
2945 { BFD_RELOC_MIPS16_TLS_TPREL_LO16
, R_MIPS16_TLS_TPREL_LO16
- R_MIPS16_min
}
2948 static const struct elf_reloc_map micromips_reloc_map
[] =
2950 { BFD_RELOC_MICROMIPS_JMP
, R_MICROMIPS_26_S1
- R_MICROMIPS_min
},
2951 { BFD_RELOC_MICROMIPS_HI16_S
, R_MICROMIPS_HI16
- R_MICROMIPS_min
},
2952 { BFD_RELOC_MICROMIPS_LO16
, R_MICROMIPS_LO16
- R_MICROMIPS_min
},
2953 { BFD_RELOC_MICROMIPS_GPREL16
, R_MICROMIPS_GPREL16
- R_MICROMIPS_min
},
2954 { BFD_RELOC_MICROMIPS_LITERAL
, R_MICROMIPS_LITERAL
- R_MICROMIPS_min
},
2955 { BFD_RELOC_MICROMIPS_GOT16
, R_MICROMIPS_GOT16
- R_MICROMIPS_min
},
2956 { BFD_RELOC_MICROMIPS_7_PCREL_S1
, R_MICROMIPS_PC7_S1
- R_MICROMIPS_min
},
2957 { BFD_RELOC_MICROMIPS_10_PCREL_S1
, R_MICROMIPS_PC10_S1
- R_MICROMIPS_min
},
2958 { BFD_RELOC_MICROMIPS_16_PCREL_S1
, R_MICROMIPS_PC16_S1
- R_MICROMIPS_min
},
2959 { BFD_RELOC_MICROMIPS_CALL16
, R_MICROMIPS_CALL16
- R_MICROMIPS_min
},
2960 { BFD_RELOC_MICROMIPS_GOT_DISP
, R_MICROMIPS_GOT_DISP
- R_MICROMIPS_min
},
2961 { BFD_RELOC_MICROMIPS_GOT_PAGE
, R_MICROMIPS_GOT_PAGE
- R_MICROMIPS_min
},
2962 { BFD_RELOC_MICROMIPS_GOT_OFST
, R_MICROMIPS_GOT_OFST
- R_MICROMIPS_min
},
2963 { BFD_RELOC_MICROMIPS_GOT_HI16
, R_MICROMIPS_GOT_HI16
- R_MICROMIPS_min
},
2964 { BFD_RELOC_MICROMIPS_GOT_LO16
, R_MICROMIPS_GOT_LO16
- R_MICROMIPS_min
},
2965 { BFD_RELOC_MICROMIPS_SUB
, R_MICROMIPS_SUB
- R_MICROMIPS_min
},
2966 { BFD_RELOC_MICROMIPS_HIGHER
, R_MICROMIPS_HIGHER
- R_MICROMIPS_min
},
2967 { BFD_RELOC_MICROMIPS_HIGHEST
, R_MICROMIPS_HIGHEST
- R_MICROMIPS_min
},
2968 { BFD_RELOC_MICROMIPS_CALL_HI16
, R_MICROMIPS_CALL_HI16
- R_MICROMIPS_min
},
2969 { BFD_RELOC_MICROMIPS_CALL_LO16
, R_MICROMIPS_CALL_LO16
- R_MICROMIPS_min
},
2972 /* Given a BFD reloc type, return a howto structure. */
2974 static reloc_howto_type
*
2975 bfd_elf32_bfd_reloc_type_lookup (bfd
*abfd ATTRIBUTE_UNUSED
,
2976 bfd_reloc_code_real_type code
)
2979 /* FIXME: We default to RELA here instead of choosing the right
2980 relocation variant. */
2981 reloc_howto_type
*howto_table
= elf_mips_howto_table_rela
;
2982 reloc_howto_type
*howto16_table
= elf_mips16_howto_table_rela
;
2983 reloc_howto_type
*howto_micromips_table
= elf_micromips_howto_table_rela
;
2985 for (i
= 0; i
< sizeof (mips_reloc_map
) / sizeof (struct elf_reloc_map
);
2988 if (mips_reloc_map
[i
].bfd_val
== code
)
2989 return &howto_table
[(int) mips_reloc_map
[i
].elf_val
];
2992 for (i
= 0; i
< sizeof (mips16_reloc_map
) / sizeof (struct elf_reloc_map
);
2995 if (mips16_reloc_map
[i
].bfd_val
== code
)
2996 return &howto16_table
[(int) mips16_reloc_map
[i
].elf_val
];
2999 for (i
= 0; i
< sizeof (micromips_reloc_map
) / sizeof (struct elf_reloc_map
);
3002 if (micromips_reloc_map
[i
].bfd_val
== code
)
3003 return &howto_micromips_table
[(int) micromips_reloc_map
[i
].elf_val
];
3008 case BFD_RELOC_VTABLE_INHERIT
:
3009 return &elf_mips_gnu_vtinherit_howto
;
3010 case BFD_RELOC_VTABLE_ENTRY
:
3011 return &elf_mips_gnu_vtentry_howto
;
3012 case BFD_RELOC_MIPS_COPY
:
3013 return &elf_mips_copy_howto
;
3014 case BFD_RELOC_MIPS_JUMP_SLOT
:
3015 return &elf_mips_jump_slot_howto
;
3017 bfd_set_error (bfd_error_bad_value
);
3022 static reloc_howto_type
*
3023 bfd_elf32_bfd_reloc_name_lookup (bfd
*abfd ATTRIBUTE_UNUSED
,
3029 i
< (sizeof (elf_mips_howto_table_rela
)
3030 / sizeof (elf_mips_howto_table_rela
[0]));
3032 if (elf_mips_howto_table_rela
[i
].name
!= NULL
3033 && strcasecmp (elf_mips_howto_table_rela
[i
].name
, r_name
) == 0)
3034 return &elf_mips_howto_table_rela
[i
];
3037 i
< (sizeof (elf_mips16_howto_table_rela
)
3038 / sizeof (elf_mips16_howto_table_rela
[0]));
3040 if (elf_mips16_howto_table_rela
[i
].name
!= NULL
3041 && strcasecmp (elf_mips16_howto_table_rela
[i
].name
, r_name
) == 0)
3042 return &elf_mips16_howto_table_rela
[i
];
3045 i
< (sizeof (elf_micromips_howto_table_rela
)
3046 / sizeof (elf_micromips_howto_table_rela
[0]));
3048 if (elf_micromips_howto_table_rela
[i
].name
!= NULL
3049 && strcasecmp (elf_micromips_howto_table_rela
[i
].name
, r_name
) == 0)
3050 return &elf_micromips_howto_table_rela
[i
];
3052 if (strcasecmp (elf_mips_gnu_vtinherit_howto
.name
, r_name
) == 0)
3053 return &elf_mips_gnu_vtinherit_howto
;
3054 if (strcasecmp (elf_mips_gnu_vtentry_howto
.name
, r_name
) == 0)
3055 return &elf_mips_gnu_vtentry_howto
;
3056 if (strcasecmp (elf_mips_gnu_rel16_s2
.name
, r_name
) == 0)
3057 return &elf_mips_gnu_rel16_s2
;
3058 if (strcasecmp (elf_mips_gnu_rela16_s2
.name
, r_name
) == 0)
3059 return &elf_mips_gnu_rela16_s2
;
3060 if (strcasecmp (elf_mips_copy_howto
.name
, r_name
) == 0)
3061 return &elf_mips_copy_howto
;
3062 if (strcasecmp (elf_mips_jump_slot_howto
.name
, r_name
) == 0)
3063 return &elf_mips_jump_slot_howto
;
3068 /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
3070 static reloc_howto_type
*
3071 mips_elf_n32_rtype_to_howto (unsigned int r_type
, bfd_boolean rela_p
)
3075 case R_MIPS_GNU_VTINHERIT
:
3076 return &elf_mips_gnu_vtinherit_howto
;
3077 case R_MIPS_GNU_VTENTRY
:
3078 return &elf_mips_gnu_vtentry_howto
;
3079 case R_MIPS_GNU_REL16_S2
:
3081 return &elf_mips_gnu_rela16_s2
;
3083 return &elf_mips_gnu_rel16_s2
;
3085 return &elf_mips_copy_howto
;
3086 case R_MIPS_JUMP_SLOT
:
3087 return &elf_mips_jump_slot_howto
;
3089 if (r_type
>= R_MICROMIPS_min
&& r_type
< R_MICROMIPS_max
)
3092 return &elf_micromips_howto_table_rela
[r_type
- R_MICROMIPS_min
];
3094 return &elf_micromips_howto_table_rel
[r_type
- R_MICROMIPS_min
];
3096 if (r_type
>= R_MIPS16_min
&& r_type
< R_MIPS16_max
)
3099 return &elf_mips16_howto_table_rela
[r_type
- R_MIPS16_min
];
3101 return &elf_mips16_howto_table_rel
[r_type
- R_MIPS16_min
];
3103 BFD_ASSERT (r_type
< (unsigned int) R_MIPS_max
);
3105 return &elf_mips_howto_table_rela
[r_type
];
3107 return &elf_mips_howto_table_rel
[r_type
];
3112 /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
3115 mips_info_to_howto_rel (bfd
*abfd
, arelent
*cache_ptr
, Elf_Internal_Rela
*dst
)
3117 unsigned int r_type
;
3119 r_type
= ELF32_R_TYPE (dst
->r_info
);
3120 cache_ptr
->howto
= mips_elf_n32_rtype_to_howto (r_type
, FALSE
);
3122 /* The addend for a GPREL16 or LITERAL relocation comes from the GP
3123 value for the object file. We get the addend now, rather than
3124 when we do the relocation, because the symbol manipulations done
3125 by the linker may cause us to lose track of the input BFD. */
3126 if (((*cache_ptr
->sym_ptr_ptr
)->flags
& BSF_SECTION_SYM
) != 0
3127 && (gprel16_reloc_p (r_type
) || r_type
== (unsigned int) R_MIPS_LITERAL
))
3128 cache_ptr
->addend
= elf_gp (abfd
);
3131 /* Given a MIPS Elf_Internal_Rela, fill in an arelent structure. */
3134 mips_info_to_howto_rela (bfd
*abfd ATTRIBUTE_UNUSED
,
3135 arelent
*cache_ptr
, Elf_Internal_Rela
*dst
)
3137 unsigned int r_type
;
3139 r_type
= ELF32_R_TYPE (dst
->r_info
);
3140 cache_ptr
->howto
= mips_elf_n32_rtype_to_howto (r_type
, TRUE
);
3141 cache_ptr
->addend
= dst
->r_addend
;
3144 /* Determine whether a symbol is global for the purposes of splitting
3145 the symbol table into global symbols and local symbols. At least
3146 on Irix 5, this split must be between section symbols and all other
3147 symbols. On most ELF targets the split is between static symbols
3148 and externally visible symbols. */
3151 mips_elf_sym_is_global (bfd
*abfd ATTRIBUTE_UNUSED
, asymbol
*sym
)
3153 if (SGI_COMPAT (abfd
))
3154 return (sym
->flags
& BSF_SECTION_SYM
) == 0;
3156 return ((sym
->flags
& (BSF_GLOBAL
| BSF_WEAK
| BSF_GNU_UNIQUE
)) != 0
3157 || bfd_is_und_section (bfd_get_section (sym
))
3158 || bfd_is_com_section (bfd_get_section (sym
)));
3161 /* Set the right machine number for a MIPS ELF file. */
3164 mips_elf_n32_object_p (bfd
*abfd
)
3168 /* Irix 5 and 6 are broken. Object file symbol tables are not always
3169 sorted correctly such that local symbols precede global symbols,
3170 and the sh_info field in the symbol table is not always right. */
3171 if (SGI_COMPAT (abfd
))
3172 elf_bad_symtab (abfd
) = TRUE
;
3174 mach
= _bfd_elf_mips_mach (elf_elfheader (abfd
)->e_flags
);
3175 bfd_default_set_arch_mach (abfd
, bfd_arch_mips
, mach
);
3177 if (! ABI_N32_P(abfd
))
3183 /* Support for core dump NOTE sections. */
3185 elf32_mips_grok_prstatus (bfd
*abfd
, Elf_Internal_Note
*note
)
3190 switch (note
->descsz
)
3195 case 440: /* Linux/MIPS N32 */
3197 elf_tdata (abfd
)->core_signal
= bfd_get_16 (abfd
, note
->descdata
+ 12);
3200 elf_tdata (abfd
)->core_lwpid
= bfd_get_32 (abfd
, note
->descdata
+ 24);
3209 /* Make a ".reg/999" section. */
3210 return _bfd_elfcore_make_pseudosection (abfd
, ".reg", size
,
3211 note
->descpos
+ offset
);
3215 elf32_mips_grok_psinfo (bfd
*abfd
, Elf_Internal_Note
*note
)
3217 switch (note
->descsz
)
3222 case 128: /* Linux/MIPS elf_prpsinfo */
3223 elf_tdata (abfd
)->core_program
3224 = _bfd_elfcore_strndup (abfd
, note
->descdata
+ 32, 16);
3225 elf_tdata (abfd
)->core_command
3226 = _bfd_elfcore_strndup (abfd
, note
->descdata
+ 48, 80);
3229 /* Note that for some reason, a spurious space is tacked
3230 onto the end of the args in some (at least one anyway)
3231 implementations, so strip it off if it exists. */
3234 char *command
= elf_tdata (abfd
)->core_command
;
3235 int n
= strlen (command
);
3237 if (0 < n
&& command
[n
- 1] == ' ')
3238 command
[n
- 1] = '\0';
3244 /* Depending on the target vector we generate some version of Irix
3245 executables or "normal" MIPS ELF ABI executables. */
3246 static irix_compat_t
3247 elf_n32_mips_irix_compat (bfd
*abfd
)
3249 if ((abfd
->xvec
== &bfd_elf32_nbigmips_vec
)
3250 || (abfd
->xvec
== &bfd_elf32_nlittlemips_vec
))
3256 /* ECOFF swapping routines. These are used when dealing with the
3257 .mdebug section, which is in the ECOFF debugging format. */
3258 static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap
= {
3259 /* Symbol table magic number. */
3261 /* Alignment of debugging information. E.g., 4. */
3263 /* Sizes of external symbolic information. */
3264 sizeof (struct hdr_ext
),
3265 sizeof (struct dnr_ext
),
3266 sizeof (struct pdr_ext
),
3267 sizeof (struct sym_ext
),
3268 sizeof (struct opt_ext
),
3269 sizeof (struct fdr_ext
),
3270 sizeof (struct rfd_ext
),
3271 sizeof (struct ext_ext
),
3272 /* Functions to swap in external symbolic data. */
3281 _bfd_ecoff_swap_tir_in
,
3282 _bfd_ecoff_swap_rndx_in
,
3283 /* Functions to swap out external symbolic data. */
3292 _bfd_ecoff_swap_tir_out
,
3293 _bfd_ecoff_swap_rndx_out
,
3294 /* Function to read in symbolic data. */
3295 _bfd_mips_elf_read_ecoff_info
3298 #define ELF_ARCH bfd_arch_mips
3299 #define ELF_TARGET_ID MIPS_ELF_DATA
3300 #define ELF_MACHINE_CODE EM_MIPS
3302 #define elf_backend_collect TRUE
3303 #define elf_backend_type_change_ok TRUE
3304 #define elf_backend_can_gc_sections TRUE
3305 #define elf_info_to_howto mips_info_to_howto_rela
3306 #define elf_info_to_howto_rel mips_info_to_howto_rel
3307 #define elf_backend_sym_is_global mips_elf_sym_is_global
3308 #define elf_backend_object_p mips_elf_n32_object_p
3309 #define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing
3310 #define elf_backend_section_processing _bfd_mips_elf_section_processing
3311 #define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr
3312 #define elf_backend_fake_sections _bfd_mips_elf_fake_sections
3313 #define elf_backend_section_from_bfd_section \
3314 _bfd_mips_elf_section_from_bfd_section
3315 #define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook
3316 #define elf_backend_link_output_symbol_hook \
3317 _bfd_mips_elf_link_output_symbol_hook
3318 #define elf_backend_create_dynamic_sections \
3319 _bfd_mips_elf_create_dynamic_sections
3320 #define elf_backend_check_relocs _bfd_mips_elf_check_relocs
3321 #define elf_backend_merge_symbol_attribute \
3322 _bfd_mips_elf_merge_symbol_attribute
3323 #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag
3324 #define elf_backend_adjust_dynamic_symbol \
3325 _bfd_mips_elf_adjust_dynamic_symbol
3326 #define elf_backend_always_size_sections \
3327 _bfd_mips_elf_always_size_sections
3328 #define elf_backend_size_dynamic_sections \
3329 _bfd_mips_elf_size_dynamic_sections
3330 #define elf_backend_init_index_section _bfd_elf_init_1_index_section
3331 #define elf_backend_relocate_section _bfd_mips_elf_relocate_section
3332 #define elf_backend_finish_dynamic_symbol \
3333 _bfd_mips_elf_finish_dynamic_symbol
3334 #define elf_backend_finish_dynamic_sections \
3335 _bfd_mips_elf_finish_dynamic_sections
3336 #define elf_backend_final_write_processing \
3337 _bfd_mips_elf_final_write_processing
3338 #define elf_backend_additional_program_headers \
3339 _bfd_mips_elf_additional_program_headers
3340 #define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map
3341 #define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook
3342 #define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook
3343 #define elf_backend_copy_indirect_symbol \
3344 _bfd_mips_elf_copy_indirect_symbol
3345 #define elf_backend_grok_prstatus elf32_mips_grok_prstatus
3346 #define elf_backend_grok_psinfo elf32_mips_grok_psinfo
3347 #define elf_backend_ecoff_debug_swap &mips_elf32_ecoff_debug_swap
3349 #define elf_backend_got_header_size (4 * MIPS_RESERVED_GOTNO)
3351 /* MIPS n32 ELF can use a mixture of REL and RELA, but some Relocations
3352 work better/work only in RELA, so we default to this. */
3353 #define elf_backend_may_use_rel_p 1
3354 #define elf_backend_may_use_rela_p 1
3355 #define elf_backend_default_use_rela_p 1
3356 #define elf_backend_rela_plts_and_copies_p 0
3357 #define elf_backend_sign_extend_vma TRUE
3358 #define elf_backend_plt_readonly 1
3359 #define elf_backend_plt_sym_val _bfd_mips_elf_plt_sym_val
3361 #define elf_backend_discard_info _bfd_mips_elf_discard_info
3362 #define elf_backend_ignore_discarded_relocs \
3363 _bfd_mips_elf_ignore_discarded_relocs
3364 #define elf_backend_write_section _bfd_mips_elf_write_section
3365 #define elf_backend_mips_irix_compat elf_n32_mips_irix_compat
3366 #define elf_backend_mips_rtype_to_howto mips_elf_n32_rtype_to_howto
3367 #define bfd_elf32_bfd_is_target_special_symbol \
3368 _bfd_mips_elf_is_target_special_symbol
3369 #define bfd_elf32_find_nearest_line _bfd_mips_elf_find_nearest_line
3370 #define bfd_elf32_find_inliner_info _bfd_mips_elf_find_inliner_info
3371 #define bfd_elf32_new_section_hook _bfd_mips_elf_new_section_hook
3372 #define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents
3373 #define bfd_elf32_bfd_get_relocated_section_contents \
3374 _bfd_elf_mips_get_relocated_section_contents
3375 #define bfd_elf32_bfd_link_hash_table_create \
3376 _bfd_mips_elf_link_hash_table_create
3377 #define bfd_elf32_bfd_final_link _bfd_mips_elf_final_link
3378 #define bfd_elf32_bfd_merge_private_bfd_data \
3379 _bfd_mips_elf_merge_private_bfd_data
3380 #define bfd_elf32_bfd_set_private_flags _bfd_mips_elf_set_private_flags
3381 #define bfd_elf32_bfd_print_private_bfd_data \
3382 _bfd_mips_elf_print_private_bfd_data
3383 #define bfd_elf32_bfd_relax_section _bfd_mips_relax_section
3385 /* Support for SGI-ish mips targets using n32 ABI. */
3387 #define TARGET_LITTLE_SYM bfd_elf32_nlittlemips_vec
3388 #define TARGET_LITTLE_NAME "elf32-nlittlemips"
3389 #define TARGET_BIG_SYM bfd_elf32_nbigmips_vec
3390 #define TARGET_BIG_NAME "elf32-nbigmips"
3392 #define ELF_MAXPAGESIZE 0x10000
3393 #define ELF_COMMONPAGESIZE 0x1000
3395 #include "elf32-target.h"
3397 /* Support for traditional mips targets using n32 ABI. */
3398 #undef TARGET_LITTLE_SYM
3399 #undef TARGET_LITTLE_NAME
3400 #undef TARGET_BIG_SYM
3401 #undef TARGET_BIG_NAME
3403 #undef ELF_MAXPAGESIZE
3404 #undef ELF_COMMONPAGESIZE
3406 #define TARGET_LITTLE_SYM bfd_elf32_ntradlittlemips_vec
3407 #define TARGET_LITTLE_NAME "elf32-ntradlittlemips"
3408 #define TARGET_BIG_SYM bfd_elf32_ntradbigmips_vec
3409 #define TARGET_BIG_NAME "elf32-ntradbigmips"
3411 #define ELF_MAXPAGESIZE 0x10000
3412 #define ELF_COMMONPAGESIZE 0x1000
3413 #define elf32_bed elf32_tradbed
3415 /* Include the target file again for this target. */
3416 #include "elf32-target.h"
3419 /* FreeBSD support. */
3421 #undef TARGET_LITTLE_SYM
3422 #undef TARGET_LITTLE_NAME
3423 #undef TARGET_BIG_SYM
3424 #undef TARGET_BIG_NAME
3426 #define TARGET_LITTLE_SYM bfd_elf32_ntradlittlemips_freebsd_vec
3427 #define TARGET_LITTLE_NAME "elf32-ntradlittlemips-freebsd"
3428 #define TARGET_BIG_SYM bfd_elf32_ntradbigmips_freebsd_vec
3429 #define TARGET_BIG_NAME "elf32-ntradbigmips-freebsd"
3432 #define ELF_OSABI ELFOSABI_FREEBSD
3434 /* The kernel recognizes executables as valid only if they carry a
3435 "FreeBSD" label in the ELF header. So we put this label on all
3436 executables and (for simplicity) also all other object files. */
3439 elf_fbsd_post_process_headers (bfd
*abfd
, struct bfd_link_info
*info
)
3441 _bfd_elf_set_osabi (abfd
, info
);
3444 #undef elf_backend_post_process_headers
3445 #define elf_backend_post_process_headers elf_fbsd_post_process_headers
3447 #define elf32_bed elf32_fbsd_tradbed
3449 #include "elf32-target.h"