]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - bfd/elfn32-mips.c
* elf64-mips.c (mips_elf64_howto_table_rela): Set src_mask to
[thirdparty/binutils-gdb.git] / bfd / elfn32-mips.c
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.
4
5 Most of the information added by Ian Lance Taylor, Cygnus Support,
6 <ian@cygnus.com>.
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>
11
12 This file is part of BFD, the Binary File Descriptor library.
13
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.
18
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.
23
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. */
28
29
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. */
33
34 #include "sysdep.h"
35 #include "bfd.h"
36 #include "libbfd.h"
37 #include "bfdlink.h"
38 #include "genlink.h"
39 #include "elf-bfd.h"
40 #include "elfxx-mips.h"
41 #include "elf/mips.h"
42
43 /* Get the ECOFF swapping routines. */
44 #include "coff/sym.h"
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"
51
52 static bfd_boolean mips_elf_assign_gp
53 (bfd *, bfd_vma *);
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
77 (bfd *, asymbol *);
78 static bfd_boolean mips_elf_n32_object_p
79 (bfd *);
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
85 (bfd *);
86
87 extern const bfd_target bfd_elf32_nbigmips_vec;
88 extern const bfd_target bfd_elf32_nlittlemips_vec;
89
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)
93
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)
97
98 /* The number of local .got entries we reserve. */
99 #define MIPS_RESERVED_GOTNO (2)
100
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)
104
105 /* The relocation table used for SHT_REL sections. */
106
107 static reloc_howto_type elf_mips_howto_table_rel[] =
108 {
109 /* No relocation. */
110 HOWTO (R_MIPS_NONE, /* type */
111 0, /* rightshift */
112 0, /* size (0 = byte, 1 = short, 2 = long) */
113 0, /* bitsize */
114 FALSE, /* pc_relative */
115 0, /* bitpos */
116 complain_overflow_dont, /* complain_on_overflow */
117 _bfd_mips_elf_generic_reloc, /* special_function */
118 "R_MIPS_NONE", /* name */
119 FALSE, /* partial_inplace */
120 0, /* src_mask */
121 0, /* dst_mask */
122 FALSE), /* pcrel_offset */
123
124 /* 16 bit relocation. */
125 HOWTO (R_MIPS_16, /* type */
126 0, /* rightshift */
127 2, /* size (0 = byte, 1 = short, 2 = long) */
128 16, /* bitsize */
129 FALSE, /* pc_relative */
130 0, /* bitpos */
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 */
138
139 /* 32 bit relocation. */
140 HOWTO (R_MIPS_32, /* type */
141 0, /* rightshift */
142 2, /* size (0 = byte, 1 = short, 2 = long) */
143 32, /* bitsize */
144 FALSE, /* pc_relative */
145 0, /* bitpos */
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 */
153
154 /* 32 bit symbol relative relocation. */
155 HOWTO (R_MIPS_REL32, /* type */
156 0, /* rightshift */
157 2, /* size (0 = byte, 1 = short, 2 = long) */
158 32, /* bitsize */
159 FALSE, /* pc_relative */
160 0, /* bitpos */
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 */
168
169 /* 26 bit jump address. */
170 HOWTO (R_MIPS_26, /* type */
171 2, /* rightshift */
172 2, /* size (0 = byte, 1 = short, 2 = long) */
173 26, /* bitsize */
174 FALSE, /* pc_relative */
175 0, /* bitpos */
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 */
186
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. */
189
190 /* High 16 bits of symbol value. */
191 HOWTO (R_MIPS_HI16, /* type */
192 16, /* rightshift */
193 2, /* size (0 = byte, 1 = short, 2 = long) */
194 16, /* bitsize */
195 FALSE, /* pc_relative */
196 0, /* bitpos */
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 */
204
205 /* Low 16 bits of symbol value. */
206 HOWTO (R_MIPS_LO16, /* type */
207 0, /* rightshift */
208 2, /* size (0 = byte, 1 = short, 2 = long) */
209 16, /* bitsize */
210 FALSE, /* pc_relative */
211 0, /* bitpos */
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 */
219
220 /* GP relative reference. */
221 HOWTO (R_MIPS_GPREL16, /* type */
222 0, /* rightshift */
223 2, /* size (0 = byte, 1 = short, 2 = long) */
224 16, /* bitsize */
225 FALSE, /* pc_relative */
226 0, /* bitpos */
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 */
234
235 /* Reference to literal section. */
236 HOWTO (R_MIPS_LITERAL, /* type */
237 0, /* rightshift */
238 2, /* size (0 = byte, 1 = short, 2 = long) */
239 16, /* bitsize */
240 FALSE, /* pc_relative */
241 0, /* bitpos */
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 */
249
250 /* Reference to global offset table. */
251 HOWTO (R_MIPS_GOT16, /* type */
252 0, /* rightshift */
253 2, /* size (0 = byte, 1 = short, 2 = long) */
254 16, /* bitsize */
255 FALSE, /* pc_relative */
256 0, /* bitpos */
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 */
264
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 */
269 2, /* rightshift */
270 2, /* size (0 = byte, 1 = short, 2 = long) */
271 16, /* bitsize */
272 TRUE, /* pc_relative */
273 0, /* bitpos */
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 */
281
282 /* 16 bit call through global offset table. */
283 HOWTO (R_MIPS_CALL16, /* type */
284 0, /* rightshift */
285 2, /* size (0 = byte, 1 = short, 2 = long) */
286 16, /* bitsize */
287 FALSE, /* pc_relative */
288 0, /* bitpos */
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 */
296
297 /* 32 bit GP relative reference. */
298 HOWTO (R_MIPS_GPREL32, /* type */
299 0, /* rightshift */
300 2, /* size (0 = byte, 1 = short, 2 = long) */
301 32, /* bitsize */
302 FALSE, /* pc_relative */
303 0, /* bitpos */
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 */
311
312 /* The remaining relocs are defined on Irix 5, although they are
313 not defined by the ABI. */
314 EMPTY_HOWTO (13),
315 EMPTY_HOWTO (14),
316 EMPTY_HOWTO (15),
317
318 /* A 5 bit shift field. */
319 HOWTO (R_MIPS_SHIFT5, /* type */
320 0, /* rightshift */
321 2, /* size (0 = byte, 1 = short, 2 = long) */
322 5, /* bitsize */
323 FALSE, /* pc_relative */
324 6, /* bitpos */
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 */
332
333 /* A 6 bit shift field. */
334 HOWTO (R_MIPS_SHIFT6, /* type */
335 0, /* rightshift */
336 2, /* size (0 = byte, 1 = short, 2 = long) */
337 6, /* bitsize */
338 FALSE, /* pc_relative */
339 6, /* bitpos */
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 */
347
348 /* A 64 bit relocation. */
349 HOWTO (R_MIPS_64, /* type */
350 0, /* rightshift */
351 4, /* size (0 = byte, 1 = short, 2 = long) */
352 64, /* bitsize */
353 FALSE, /* pc_relative */
354 0, /* bitpos */
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 */
362
363 /* Displacement in the global offset table. */
364 HOWTO (R_MIPS_GOT_DISP, /* type */
365 0, /* rightshift */
366 2, /* size (0 = byte, 1 = short, 2 = long) */
367 16, /* bitsize */
368 FALSE, /* pc_relative */
369 0, /* bitpos */
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 */
377
378 /* Displacement to page pointer in the global offset table. */
379 HOWTO (R_MIPS_GOT_PAGE, /* type */
380 0, /* rightshift */
381 2, /* size (0 = byte, 1 = short, 2 = long) */
382 16, /* bitsize */
383 FALSE, /* pc_relative */
384 0, /* bitpos */
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 */
392
393 /* Offset from page pointer in the global offset table. */
394 HOWTO (R_MIPS_GOT_OFST, /* type */
395 0, /* rightshift */
396 2, /* size (0 = byte, 1 = short, 2 = long) */
397 16, /* bitsize */
398 FALSE, /* pc_relative */
399 0, /* bitpos */
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 */
407
408 /* High 16 bits of displacement in global offset table. */
409 HOWTO (R_MIPS_GOT_HI16, /* type */
410 0, /* rightshift */
411 2, /* size (0 = byte, 1 = short, 2 = long) */
412 16, /* bitsize */
413 FALSE, /* pc_relative */
414 0, /* bitpos */
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 */
422
423 /* Low 16 bits of displacement in global offset table. */
424 HOWTO (R_MIPS_GOT_LO16, /* type */
425 0, /* rightshift */
426 2, /* size (0 = byte, 1 = short, 2 = long) */
427 16, /* bitsize */
428 FALSE, /* pc_relative */
429 0, /* bitpos */
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 */
437
438 /* 64 bit subtraction. */
439 HOWTO (R_MIPS_SUB, /* type */
440 0, /* rightshift */
441 4, /* size (0 = byte, 1 = short, 2 = long) */
442 64, /* bitsize */
443 FALSE, /* pc_relative */
444 0, /* bitpos */
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 */
452
453 /* Insert the addend as an instruction. */
454 /* FIXME: Not handled correctly. */
455 HOWTO (R_MIPS_INSERT_A, /* type */
456 0, /* rightshift */
457 2, /* size (0 = byte, 1 = short, 2 = long) */
458 32, /* bitsize */
459 FALSE, /* pc_relative */
460 0, /* bitpos */
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 */
468
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 */
473 0, /* rightshift */
474 2, /* size (0 = byte, 1 = short, 2 = long) */
475 32, /* bitsize */
476 FALSE, /* pc_relative */
477 0, /* bitpos */
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 */
485
486 /* Delete a 32 bit instruction. */
487 /* FIXME: Not handled correctly. */
488 HOWTO (R_MIPS_DELETE, /* type */
489 0, /* rightshift */
490 2, /* size (0 = byte, 1 = short, 2 = long) */
491 32, /* bitsize */
492 FALSE, /* pc_relative */
493 0, /* bitpos */
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 */
501
502 /* The MIPS ELF64 ABI Draft wants us to support these for REL relocations.
503 We don't, because
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
506 fallable heuristics.
507 b) No other NewABI toolchain actually emits such relocations. */
508 EMPTY_HOWTO (R_MIPS_HIGHER),
509 EMPTY_HOWTO (R_MIPS_HIGHEST),
510
511 /* High 16 bits of displacement in global offset table. */
512 HOWTO (R_MIPS_CALL_HI16, /* type */
513 0, /* rightshift */
514 2, /* size (0 = byte, 1 = short, 2 = long) */
515 16, /* bitsize */
516 FALSE, /* pc_relative */
517 0, /* bitpos */
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 */
525
526 /* Low 16 bits of displacement in global offset table. */
527 HOWTO (R_MIPS_CALL_LO16, /* type */
528 0, /* rightshift */
529 2, /* size (0 = byte, 1 = short, 2 = long) */
530 16, /* bitsize */
531 FALSE, /* pc_relative */
532 0, /* bitpos */
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 */
540
541 /* Section displacement. */
542 HOWTO (R_MIPS_SCN_DISP, /* type */
543 0, /* rightshift */
544 2, /* size (0 = byte, 1 = short, 2 = long) */
545 32, /* bitsize */
546 FALSE, /* pc_relative */
547 0, /* bitpos */
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 */
555
556 HOWTO (R_MIPS_REL16, /* type */
557 0, /* rightshift */
558 1, /* size (0 = byte, 1 = short, 2 = long) */
559 16, /* bitsize */
560 FALSE, /* pc_relative */
561 0, /* bitpos */
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 */
569
570 /* These two are obsolete. */
571 EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
572 EMPTY_HOWTO (R_MIPS_PJUMP),
573
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 */
577 0, /* rightshift */
578 2, /* size (0 = byte, 1 = short, 2 = long) */
579 32, /* bitsize */
580 FALSE, /* pc_relative */
581 0, /* bitpos */
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 */
589
590 /* Protected jump conversion. This is an optimization hint. No
591 relocation is required for correctness. */
592 HOWTO (R_MIPS_JALR, /* type */
593 0, /* rightshift */
594 2, /* size (0 = byte, 1 = short, 2 = long) */
595 32, /* bitsize */
596 FALSE, /* pc_relative */
597 0, /* bitpos */
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 */
605
606 /* TLS GD/LD dynamic relocations. */
607 HOWTO (R_MIPS_TLS_DTPMOD32, /* type */
608 0, /* rightshift */
609 2, /* size (0 = byte, 1 = short, 2 = long) */
610 32, /* bitsize */
611 FALSE, /* pc_relative */
612 0, /* bitpos */
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 */
620
621 HOWTO (R_MIPS_TLS_DTPREL32, /* type */
622 0, /* rightshift */
623 2, /* size (0 = byte, 1 = short, 2 = long) */
624 32, /* bitsize */
625 FALSE, /* pc_relative */
626 0, /* bitpos */
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 */
634
635 EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64),
636 EMPTY_HOWTO (R_MIPS_TLS_DTPREL64),
637
638 /* TLS general dynamic variable reference. */
639 HOWTO (R_MIPS_TLS_GD, /* type */
640 0, /* rightshift */
641 2, /* size (0 = byte, 1 = short, 2 = long) */
642 16, /* bitsize */
643 FALSE, /* pc_relative */
644 0, /* bitpos */
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 */
652
653 /* TLS local dynamic variable reference. */
654 HOWTO (R_MIPS_TLS_LDM, /* type */
655 0, /* rightshift */
656 2, /* size (0 = byte, 1 = short, 2 = long) */
657 16, /* bitsize */
658 FALSE, /* pc_relative */
659 0, /* bitpos */
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 */
667
668 /* TLS local dynamic offset. */
669 HOWTO (R_MIPS_TLS_DTPREL_HI16, /* type */
670 0, /* rightshift */
671 2, /* size (0 = byte, 1 = short, 2 = long) */
672 16, /* bitsize */
673 FALSE, /* pc_relative */
674 0, /* bitpos */
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 */
682
683 /* TLS local dynamic offset. */
684 HOWTO (R_MIPS_TLS_DTPREL_LO16, /* type */
685 0, /* rightshift */
686 2, /* size (0 = byte, 1 = short, 2 = long) */
687 16, /* bitsize */
688 FALSE, /* pc_relative */
689 0, /* bitpos */
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 */
697
698 /* TLS thread pointer offset. */
699 HOWTO (R_MIPS_TLS_GOTTPREL, /* type */
700 0, /* rightshift */
701 2, /* size (0 = byte, 1 = short, 2 = long) */
702 16, /* bitsize */
703 FALSE, /* pc_relative */
704 0, /* bitpos */
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 */
712
713 /* TLS IE dynamic relocations. */
714 HOWTO (R_MIPS_TLS_TPREL32, /* type */
715 0, /* rightshift */
716 2, /* size (0 = byte, 1 = short, 2 = long) */
717 32, /* bitsize */
718 FALSE, /* pc_relative */
719 0, /* bitpos */
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 */
727
728 EMPTY_HOWTO (R_MIPS_TLS_TPREL64),
729
730 /* TLS thread pointer offset. */
731 HOWTO (R_MIPS_TLS_TPREL_HI16, /* type */
732 0, /* rightshift */
733 2, /* size (0 = byte, 1 = short, 2 = long) */
734 16, /* bitsize */
735 FALSE, /* pc_relative */
736 0, /* bitpos */
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 */
744
745 /* TLS thread pointer offset. */
746 HOWTO (R_MIPS_TLS_TPREL_LO16, /* type */
747 0, /* rightshift */
748 2, /* size (0 = byte, 1 = short, 2 = long) */
749 16, /* bitsize */
750 FALSE, /* pc_relative */
751 0, /* bitpos */
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 */
759
760 /* 32 bit relocation with no addend. */
761 HOWTO (R_MIPS_GLOB_DAT, /* type */
762 0, /* rightshift */
763 2, /* size (0 = byte, 1 = short, 2 = long) */
764 32, /* bitsize */
765 FALSE, /* pc_relative */
766 0, /* bitpos */
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 */
771 0x0, /* src_mask */
772 0xffffffff, /* dst_mask */
773 FALSE), /* pcrel_offset */
774 };
775
776 /* The relocation table used for SHT_RELA sections. */
777
778 static reloc_howto_type elf_mips_howto_table_rela[] =
779 {
780 /* No relocation. */
781 HOWTO (R_MIPS_NONE, /* type */
782 0, /* rightshift */
783 0, /* size (0 = byte, 1 = short, 2 = long) */
784 0, /* bitsize */
785 FALSE, /* pc_relative */
786 0, /* bitpos */
787 complain_overflow_dont, /* complain_on_overflow */
788 _bfd_mips_elf_generic_reloc, /* special_function */
789 "R_MIPS_NONE", /* name */
790 FALSE, /* partial_inplace */
791 0, /* src_mask */
792 0, /* dst_mask */
793 FALSE), /* pcrel_offset */
794
795 /* 16 bit relocation. */
796 HOWTO (R_MIPS_16, /* type */
797 0, /* rightshift */
798 2, /* size (0 = byte, 1 = short, 2 = long) */
799 16, /* bitsize */
800 FALSE, /* pc_relative */
801 0, /* bitpos */
802 complain_overflow_signed, /* complain_on_overflow */
803 _bfd_mips_elf_generic_reloc, /* special_function */
804 "R_MIPS_16", /* name */
805 FALSE, /* partial_inplace */
806 0, /* src_mask */
807 0x0000, /* dst_mask */
808 FALSE), /* pcrel_offset */
809
810 /* 32 bit relocation. */
811 HOWTO (R_MIPS_32, /* type */
812 0, /* rightshift */
813 2, /* size (0 = byte, 1 = short, 2 = long) */
814 32, /* bitsize */
815 FALSE, /* pc_relative */
816 0, /* bitpos */
817 complain_overflow_dont, /* complain_on_overflow */
818 _bfd_mips_elf_generic_reloc, /* special_function */
819 "R_MIPS_32", /* name */
820 FALSE, /* partial_inplace */
821 0, /* src_mask */
822 0xffffffff, /* dst_mask */
823 FALSE), /* pcrel_offset */
824
825 /* 32 bit symbol relative relocation. */
826 HOWTO (R_MIPS_REL32, /* type */
827 0, /* rightshift */
828 2, /* size (0 = byte, 1 = short, 2 = long) */
829 32, /* bitsize */
830 FALSE, /* pc_relative */
831 0, /* bitpos */
832 complain_overflow_dont, /* complain_on_overflow */
833 _bfd_mips_elf_generic_reloc, /* special_function */
834 "R_MIPS_REL32", /* name */
835 FALSE, /* partial_inplace */
836 0, /* src_mask */
837 0xffffffff, /* dst_mask */
838 FALSE), /* pcrel_offset */
839
840 /* 26 bit jump address. */
841 HOWTO (R_MIPS_26, /* type */
842 2, /* rightshift */
843 2, /* size (0 = byte, 1 = short, 2 = long) */
844 26, /* bitsize */
845 FALSE, /* pc_relative */
846 0, /* bitpos */
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 */
854 0, /* src_mask */
855 0x03ffffff, /* dst_mask */
856 FALSE), /* pcrel_offset */
857
858 /* High 16 bits of symbol value. */
859 HOWTO (R_MIPS_HI16, /* type */
860 0, /* rightshift */
861 2, /* size (0 = byte, 1 = short, 2 = long) */
862 16, /* bitsize */
863 FALSE, /* pc_relative */
864 0, /* bitpos */
865 complain_overflow_dont, /* complain_on_overflow */
866 _bfd_mips_elf_generic_reloc, /* special_function */
867 "R_MIPS_HI16", /* name */
868 FALSE, /* partial_inplace */
869 0, /* src_mask */
870 0x0000ffff, /* dst_mask */
871 FALSE), /* pcrel_offset */
872
873 /* Low 16 bits of symbol value. */
874 HOWTO (R_MIPS_LO16, /* type */
875 0, /* rightshift */
876 2, /* size (0 = byte, 1 = short, 2 = long) */
877 16, /* bitsize */
878 FALSE, /* pc_relative */
879 0, /* bitpos */
880 complain_overflow_dont, /* complain_on_overflow */
881 _bfd_mips_elf_generic_reloc, /* special_function */
882 "R_MIPS_LO16", /* name */
883 FALSE, /* partial_inplace */
884 0, /* src_mask */
885 0x0000ffff, /* dst_mask */
886 FALSE), /* pcrel_offset */
887
888 /* GP relative reference. */
889 HOWTO (R_MIPS_GPREL16, /* type */
890 0, /* rightshift */
891 2, /* size (0 = byte, 1 = short, 2 = long) */
892 16, /* bitsize */
893 FALSE, /* pc_relative */
894 0, /* bitpos */
895 complain_overflow_signed, /* complain_on_overflow */
896 mips_elf_gprel16_reloc, /* special_function */
897 "R_MIPS_GPREL16", /* name */
898 FALSE, /* partial_inplace */
899 0, /* src_mask */
900 0x0000ffff, /* dst_mask */
901 FALSE), /* pcrel_offset */
902
903 /* Reference to literal section. */
904 HOWTO (R_MIPS_LITERAL, /* type */
905 0, /* rightshift */
906 2, /* size (0 = byte, 1 = short, 2 = long) */
907 16, /* bitsize */
908 FALSE, /* pc_relative */
909 0, /* bitpos */
910 complain_overflow_signed, /* complain_on_overflow */
911 mips_elf_literal_reloc, /* special_function */
912 "R_MIPS_LITERAL", /* name */
913 FALSE, /* partial_inplace */
914 0, /* src_mask */
915 0x0000ffff, /* dst_mask */
916 FALSE), /* pcrel_offset */
917
918 /* Reference to global offset table. */
919 HOWTO (R_MIPS_GOT16, /* type */
920 0, /* rightshift */
921 2, /* size (0 = byte, 1 = short, 2 = long) */
922 16, /* bitsize */
923 FALSE, /* pc_relative */
924 0, /* bitpos */
925 complain_overflow_signed, /* complain_on_overflow */
926 _bfd_mips_elf_generic_reloc, /* special_function */
927 "R_MIPS_GOT16", /* name */
928 FALSE, /* partial_inplace */
929 0, /* src_mask */
930 0x0000ffff, /* dst_mask */
931 FALSE), /* pcrel_offset */
932
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 */
937 2, /* rightshift */
938 2, /* size (0 = byte, 1 = short, 2 = long) */
939 16, /* bitsize */
940 TRUE, /* pc_relative */
941 0, /* bitpos */
942 complain_overflow_signed, /* complain_on_overflow */
943 _bfd_mips_elf_generic_reloc, /* special_function */
944 "R_MIPS_PC16", /* name */
945 FALSE, /* partial_inplace */
946 0, /* src_mask */
947 0x0000ffff, /* dst_mask */
948 TRUE), /* pcrel_offset */
949
950 /* 16 bit call through global offset table. */
951 HOWTO (R_MIPS_CALL16, /* type */
952 0, /* rightshift */
953 2, /* size (0 = byte, 1 = short, 2 = long) */
954 16, /* bitsize */
955 FALSE, /* pc_relative */
956 0, /* bitpos */
957 complain_overflow_signed, /* complain_on_overflow */
958 _bfd_mips_elf_generic_reloc, /* special_function */
959 "R_MIPS_CALL16", /* name */
960 FALSE, /* partial_inplace */
961 0, /* src_mask */
962 0x0000ffff, /* dst_mask */
963 FALSE), /* pcrel_offset */
964
965 /* 32 bit GP relative reference. */
966 HOWTO (R_MIPS_GPREL32, /* type */
967 0, /* rightshift */
968 2, /* size (0 = byte, 1 = short, 2 = long) */
969 32, /* bitsize */
970 FALSE, /* pc_relative */
971 0, /* bitpos */
972 complain_overflow_dont, /* complain_on_overflow */
973 mips_elf_gprel32_reloc, /* special_function */
974 "R_MIPS_GPREL32", /* name */
975 FALSE, /* partial_inplace */
976 0, /* src_mask */
977 0xffffffff, /* dst_mask */
978 FALSE), /* pcrel_offset */
979
980 EMPTY_HOWTO (13),
981 EMPTY_HOWTO (14),
982 EMPTY_HOWTO (15),
983
984 /* A 5 bit shift field. */
985 HOWTO (R_MIPS_SHIFT5, /* type */
986 0, /* rightshift */
987 2, /* size (0 = byte, 1 = short, 2 = long) */
988 5, /* bitsize */
989 FALSE, /* pc_relative */
990 6, /* bitpos */
991 complain_overflow_bitfield, /* complain_on_overflow */
992 _bfd_mips_elf_generic_reloc, /* special_function */
993 "R_MIPS_SHIFT5", /* name */
994 FALSE, /* partial_inplace */
995 0, /* src_mask */
996 0x000007c0, /* dst_mask */
997 FALSE), /* pcrel_offset */
998
999 /* A 6 bit shift field. */
1000 HOWTO (R_MIPS_SHIFT6, /* type */
1001 0, /* rightshift */
1002 2, /* size (0 = byte, 1 = short, 2 = long) */
1003 6, /* bitsize */
1004 FALSE, /* pc_relative */
1005 6, /* bitpos */
1006 complain_overflow_bitfield, /* complain_on_overflow */
1007 mips_elf_shift6_reloc, /* special_function */
1008 "R_MIPS_SHIFT6", /* name */
1009 FALSE, /* partial_inplace */
1010 0, /* src_mask */
1011 0x000007c4, /* dst_mask */
1012 FALSE), /* pcrel_offset */
1013
1014 /* 64 bit relocation. */
1015 HOWTO (R_MIPS_64, /* type */
1016 0, /* rightshift */
1017 4, /* size (0 = byte, 1 = short, 2 = long) */
1018 64, /* bitsize */
1019 FALSE, /* pc_relative */
1020 0, /* bitpos */
1021 complain_overflow_dont, /* complain_on_overflow */
1022 _bfd_mips_elf_generic_reloc, /* special_function */
1023 "R_MIPS_64", /* name */
1024 FALSE, /* partial_inplace */
1025 0, /* src_mask */
1026 MINUS_ONE, /* dst_mask */
1027 FALSE), /* pcrel_offset */
1028
1029 /* Displacement in the global offset table. */
1030 HOWTO (R_MIPS_GOT_DISP, /* type */
1031 0, /* rightshift */
1032 2, /* size (0 = byte, 1 = short, 2 = long) */
1033 16, /* bitsize */
1034 FALSE, /* pc_relative */
1035 0, /* bitpos */
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 */
1040 0, /* src_mask */
1041 0x0000ffff, /* dst_mask */
1042 FALSE), /* pcrel_offset */
1043
1044 /* Displacement to page pointer in the global offset table. */
1045 HOWTO (R_MIPS_GOT_PAGE, /* type */
1046 0, /* rightshift */
1047 2, /* size (0 = byte, 1 = short, 2 = long) */
1048 16, /* bitsize */
1049 FALSE, /* pc_relative */
1050 0, /* bitpos */
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 */
1055 0, /* src_mask */
1056 0x0000ffff, /* dst_mask */
1057 FALSE), /* pcrel_offset */
1058
1059 /* Offset from page pointer in the global offset table. */
1060 HOWTO (R_MIPS_GOT_OFST, /* type */
1061 0, /* rightshift */
1062 2, /* size (0 = byte, 1 = short, 2 = long) */
1063 16, /* bitsize */
1064 FALSE, /* pc_relative */
1065 0, /* bitpos */
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 */
1070 0, /* src_mask */
1071 0x0000ffff, /* dst_mask */
1072 FALSE), /* pcrel_offset */
1073
1074 /* High 16 bits of displacement in global offset table. */
1075 HOWTO (R_MIPS_GOT_HI16, /* type */
1076 0, /* rightshift */
1077 2, /* size (0 = byte, 1 = short, 2 = long) */
1078 16, /* bitsize */
1079 FALSE, /* pc_relative */
1080 0, /* bitpos */
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 */
1085 0, /* src_mask */
1086 0x0000ffff, /* dst_mask */
1087 FALSE), /* pcrel_offset */
1088
1089 /* Low 16 bits of displacement in global offset table. */
1090 HOWTO (R_MIPS_GOT_LO16, /* type */
1091 0, /* rightshift */
1092 2, /* size (0 = byte, 1 = short, 2 = long) */
1093 16, /* bitsize */
1094 FALSE, /* pc_relative */
1095 0, /* bitpos */
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 */
1100 0, /* src_mask */
1101 0x0000ffff, /* dst_mask */
1102 FALSE), /* pcrel_offset */
1103
1104 /* 64 bit subtraction. */
1105 HOWTO (R_MIPS_SUB, /* type */
1106 0, /* rightshift */
1107 4, /* size (0 = byte, 1 = short, 2 = long) */
1108 64, /* bitsize */
1109 FALSE, /* pc_relative */
1110 0, /* bitpos */
1111 complain_overflow_dont, /* complain_on_overflow */
1112 _bfd_mips_elf_generic_reloc, /* special_function */
1113 "R_MIPS_SUB", /* name */
1114 FALSE, /* partial_inplace */
1115 0, /* src_mask */
1116 MINUS_ONE, /* dst_mask */
1117 FALSE), /* pcrel_offset */
1118
1119 /* Insert the addend as an instruction. */
1120 /* FIXME: Not handled correctly. */
1121 HOWTO (R_MIPS_INSERT_A, /* type */
1122 0, /* rightshift */
1123 2, /* size (0 = byte, 1 = short, 2 = long) */
1124 32, /* bitsize */
1125 FALSE, /* pc_relative */
1126 0, /* bitpos */
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 */
1131 0, /* src_mask */
1132 0xffffffff, /* dst_mask */
1133 FALSE), /* pcrel_offset */
1134
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 */
1139 0, /* rightshift */
1140 2, /* size (0 = byte, 1 = short, 2 = long) */
1141 32, /* bitsize */
1142 FALSE, /* pc_relative */
1143 0, /* bitpos */
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 */
1148 0, /* src_mask */
1149 0xffffffff, /* dst_mask */
1150 FALSE), /* pcrel_offset */
1151
1152 /* Delete a 32 bit instruction. */
1153 /* FIXME: Not handled correctly. */
1154 HOWTO (R_MIPS_DELETE, /* type */
1155 0, /* rightshift */
1156 2, /* size (0 = byte, 1 = short, 2 = long) */
1157 32, /* bitsize */
1158 FALSE, /* pc_relative */
1159 0, /* bitpos */
1160 complain_overflow_dont, /* complain_on_overflow */
1161 _bfd_mips_elf_generic_reloc, /* special_function */
1162 "R_MIPS_DELETE", /* name */
1163 FALSE, /* partial_inplace */
1164 0, /* src_mask */
1165 0xffffffff, /* dst_mask */
1166 FALSE), /* pcrel_offset */
1167
1168 /* Get the higher value of a 64 bit addend. */
1169 HOWTO (R_MIPS_HIGHER, /* type */
1170 0, /* rightshift */
1171 2, /* size (0 = byte, 1 = short, 2 = long) */
1172 16, /* bitsize */
1173 FALSE, /* pc_relative */
1174 0, /* bitpos */
1175 complain_overflow_dont, /* complain_on_overflow */
1176 _bfd_mips_elf_generic_reloc, /* special_function */
1177 "R_MIPS_HIGHER", /* name */
1178 FALSE, /* partial_inplace */
1179 0, /* src_mask */
1180 0x0000ffff, /* dst_mask */
1181 FALSE), /* pcrel_offset */
1182
1183 /* Get the highest value of a 64 bit addend. */
1184 HOWTO (R_MIPS_HIGHEST, /* type */
1185 0, /* rightshift */
1186 2, /* size (0 = byte, 1 = short, 2 = long) */
1187 16, /* bitsize */
1188 FALSE, /* pc_relative */
1189 0, /* bitpos */
1190 complain_overflow_dont, /* complain_on_overflow */
1191 _bfd_mips_elf_generic_reloc, /* special_function */
1192 "R_MIPS_HIGHEST", /* name */
1193 FALSE, /* partial_inplace */
1194 0, /* src_mask */
1195 0x0000ffff, /* dst_mask */
1196 FALSE), /* pcrel_offset */
1197
1198 /* High 16 bits of displacement in global offset table. */
1199 HOWTO (R_MIPS_CALL_HI16, /* type */
1200 0, /* rightshift */
1201 2, /* size (0 = byte, 1 = short, 2 = long) */
1202 16, /* bitsize */
1203 FALSE, /* pc_relative */
1204 0, /* bitpos */
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 */
1209 0, /* src_mask */
1210 0x0000ffff, /* dst_mask */
1211 FALSE), /* pcrel_offset */
1212
1213 /* Low 16 bits of displacement in global offset table. */
1214 HOWTO (R_MIPS_CALL_LO16, /* type */
1215 0, /* rightshift */
1216 2, /* size (0 = byte, 1 = short, 2 = long) */
1217 16, /* bitsize */
1218 FALSE, /* pc_relative */
1219 0, /* bitpos */
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 */
1224 0, /* src_mask */
1225 0x0000ffff, /* dst_mask */
1226 FALSE), /* pcrel_offset */
1227
1228 /* Section displacement, used by an associated event location section. */
1229 HOWTO (R_MIPS_SCN_DISP, /* type */
1230 0, /* rightshift */
1231 2, /* size (0 = byte, 1 = short, 2 = long) */
1232 32, /* bitsize */
1233 FALSE, /* pc_relative */
1234 0, /* bitpos */
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 */
1239 0, /* src_mask */
1240 0xffffffff, /* dst_mask */
1241 FALSE), /* pcrel_offset */
1242
1243 /* 16 bit relocation. */
1244 HOWTO (R_MIPS_REL16, /* type */
1245 0, /* rightshift */
1246 1, /* size (0 = byte, 1 = short, 2 = long) */
1247 16, /* bitsize */
1248 FALSE, /* pc_relative */
1249 0, /* bitpos */
1250 complain_overflow_signed, /* complain_on_overflow */
1251 _bfd_mips_elf_generic_reloc, /* special_function */
1252 "R_MIPS_REL16", /* name */
1253 FALSE, /* partial_inplace */
1254 0, /* src_mask */
1255 0xffff, /* dst_mask */
1256 FALSE), /* pcrel_offset */
1257
1258 /* These two are obsolete. */
1259 EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
1260 EMPTY_HOWTO (R_MIPS_PJUMP),
1261
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 */
1265 0, /* rightshift */
1266 2, /* size (0 = byte, 1 = short, 2 = long) */
1267 32, /* bitsize */
1268 FALSE, /* pc_relative */
1269 0, /* bitpos */
1270 complain_overflow_dont, /* complain_on_overflow */
1271 _bfd_mips_elf_generic_reloc, /* special_function */
1272 "R_MIPS_RELGOT", /* name */
1273 FALSE, /* partial_inplace */
1274 0, /* src_mask */
1275 0xffffffff, /* dst_mask */
1276 FALSE), /* pcrel_offset */
1277
1278 /* Protected jump conversion. This is an optimization hint. No
1279 relocation is required for correctness. */
1280 HOWTO (R_MIPS_JALR, /* type */
1281 0, /* rightshift */
1282 2, /* size (0 = byte, 1 = short, 2 = long) */
1283 32, /* bitsize */
1284 FALSE, /* pc_relative */
1285 0, /* bitpos */
1286 complain_overflow_dont, /* complain_on_overflow */
1287 _bfd_mips_elf_generic_reloc, /* special_function */
1288 "R_MIPS_JALR", /* name */
1289 FALSE, /* partial_inplace */
1290 0, /* src_mask */
1291 0, /* dst_mask */
1292 FALSE), /* pcrel_offset */
1293
1294 /* TLS GD/LD dynamic relocations. */
1295 HOWTO (R_MIPS_TLS_DTPMOD32, /* type */
1296 0, /* rightshift */
1297 2, /* size (0 = byte, 1 = short, 2 = long) */
1298 32, /* bitsize */
1299 FALSE, /* pc_relative */
1300 0, /* bitpos */
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 */
1305 0, /* src_mask */
1306 0xffffffff, /* dst_mask */
1307 FALSE), /* pcrel_offset */
1308
1309 HOWTO (R_MIPS_TLS_DTPREL32, /* type */
1310 0, /* rightshift */
1311 2, /* size (0 = byte, 1 = short, 2 = long) */
1312 32, /* bitsize */
1313 FALSE, /* pc_relative */
1314 0, /* bitpos */
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 */
1319 0, /* src_mask */
1320 0xffffffff, /* dst_mask */
1321 FALSE), /* pcrel_offset */
1322
1323 EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64),
1324 EMPTY_HOWTO (R_MIPS_TLS_DTPREL64),
1325
1326 /* TLS general dynamic variable reference. */
1327 HOWTO (R_MIPS_TLS_GD, /* type */
1328 0, /* rightshift */
1329 2, /* size (0 = byte, 1 = short, 2 = long) */
1330 16, /* bitsize */
1331 FALSE, /* pc_relative */
1332 0, /* bitpos */
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 */
1337 0, /* src_mask */
1338 0x0000ffff, /* dst_mask */
1339 FALSE), /* pcrel_offset */
1340
1341 /* TLS local dynamic variable reference. */
1342 HOWTO (R_MIPS_TLS_LDM, /* type */
1343 0, /* rightshift */
1344 2, /* size (0 = byte, 1 = short, 2 = long) */
1345 16, /* bitsize */
1346 FALSE, /* pc_relative */
1347 0, /* bitpos */
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 */
1352 0, /* src_mask */
1353 0x0000ffff, /* dst_mask */
1354 FALSE), /* pcrel_offset */
1355
1356 /* TLS local dynamic offset. */
1357 HOWTO (R_MIPS_TLS_DTPREL_HI16, /* type */
1358 0, /* rightshift */
1359 2, /* size (0 = byte, 1 = short, 2 = long) */
1360 16, /* bitsize */
1361 FALSE, /* pc_relative */
1362 0, /* bitpos */
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 */
1367 0, /* src_mask */
1368 0x0000ffff, /* dst_mask */
1369 FALSE), /* pcrel_offset */
1370
1371 /* TLS local dynamic offset. */
1372 HOWTO (R_MIPS_TLS_DTPREL_LO16, /* type */
1373 0, /* rightshift */
1374 2, /* size (0 = byte, 1 = short, 2 = long) */
1375 16, /* bitsize */
1376 FALSE, /* pc_relative */
1377 0, /* bitpos */
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 */
1382 0, /* src_mask */
1383 0x0000ffff, /* dst_mask */
1384 FALSE), /* pcrel_offset */
1385
1386 /* TLS thread pointer offset. */
1387 HOWTO (R_MIPS_TLS_GOTTPREL, /* type */
1388 0, /* rightshift */
1389 2, /* size (0 = byte, 1 = short, 2 = long) */
1390 16, /* bitsize */
1391 FALSE, /* pc_relative */
1392 0, /* bitpos */
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 */
1397 0, /* src_mask */
1398 0x0000ffff, /* dst_mask */
1399 FALSE), /* pcrel_offset */
1400
1401 /* TLS IE dynamic relocations. */
1402 HOWTO (R_MIPS_TLS_TPREL32, /* type */
1403 0, /* rightshift */
1404 2, /* size (0 = byte, 1 = short, 2 = long) */
1405 32, /* bitsize */
1406 FALSE, /* pc_relative */
1407 0, /* bitpos */
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 */
1412 0, /* src_mask */
1413 0xffffffff, /* dst_mask */
1414 FALSE), /* pcrel_offset */
1415
1416 EMPTY_HOWTO (R_MIPS_TLS_TPREL64),
1417
1418 /* TLS thread pointer offset. */
1419 HOWTO (R_MIPS_TLS_TPREL_HI16, /* type */
1420 0, /* rightshift */
1421 2, /* size (0 = byte, 1 = short, 2 = long) */
1422 16, /* bitsize */
1423 FALSE, /* pc_relative */
1424 0, /* bitpos */
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 */
1429 0, /* src_mask */
1430 0x0000ffff, /* dst_mask */
1431 FALSE), /* pcrel_offset */
1432
1433 /* TLS thread pointer offset. */
1434 HOWTO (R_MIPS_TLS_TPREL_LO16, /* type */
1435 0, /* rightshift */
1436 2, /* size (0 = byte, 1 = short, 2 = long) */
1437 16, /* bitsize */
1438 FALSE, /* pc_relative */
1439 0, /* bitpos */
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 */
1444 0, /* src_mask */
1445 0x0000ffff, /* dst_mask */
1446 FALSE), /* pcrel_offset */
1447
1448 /* 32 bit relocation with no addend. */
1449 HOWTO (R_MIPS_GLOB_DAT, /* type */
1450 0, /* rightshift */
1451 2, /* size (0 = byte, 1 = short, 2 = long) */
1452 32, /* bitsize */
1453 FALSE, /* pc_relative */
1454 0, /* bitpos */
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 */
1459 0x0, /* src_mask */
1460 0xffffffff, /* dst_mask */
1461 FALSE), /* pcrel_offset */
1462 };
1463
1464 static reloc_howto_type elf_mips16_howto_table_rel[] =
1465 {
1466 /* The reloc used for the mips16 jump instruction. */
1467 HOWTO (R_MIPS16_26, /* type */
1468 2, /* rightshift */
1469 2, /* size (0 = byte, 1 = short, 2 = long) */
1470 26, /* bitsize */
1471 FALSE, /* pc_relative */
1472 0, /* bitpos */
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 */
1483
1484 /* The reloc used for the mips16 gprel instruction. */
1485 HOWTO (R_MIPS16_GPREL, /* type */
1486 0, /* rightshift */
1487 2, /* size (0 = byte, 1 = short, 2 = long) */
1488 16, /* bitsize */
1489 FALSE, /* pc_relative */
1490 0, /* bitpos */
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 */
1498
1499 /* A MIPS16 reference to the global offset table. */
1500 HOWTO (R_MIPS16_GOT16, /* type */
1501 0, /* rightshift */
1502 2, /* size (0 = byte, 1 = short, 2 = long) */
1503 16, /* bitsize */
1504 FALSE, /* pc_relative */
1505 0, /* bitpos */
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 */
1513
1514 /* A MIPS16 call through the global offset table. */
1515 HOWTO (R_MIPS16_CALL16, /* type */
1516 0, /* rightshift */
1517 2, /* size (0 = byte, 1 = short, 2 = long) */
1518 16, /* bitsize */
1519 FALSE, /* pc_relative */
1520 0, /* bitpos */
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 */
1528
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) */
1533 16, /* bitsize */
1534 FALSE, /* pc_relative */
1535 0, /* bitpos */
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 */
1543
1544 /* MIPS16 low 16 bits of symbol value. */
1545 HOWTO (R_MIPS16_LO16, /* type */
1546 0, /* rightshift */
1547 2, /* size (0 = byte, 1 = short, 2 = long) */
1548 16, /* bitsize */
1549 FALSE, /* pc_relative */
1550 0, /* bitpos */
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 */
1558 };
1559
1560 static reloc_howto_type elf_mips16_howto_table_rela[] =
1561 {
1562 /* The reloc used for the mips16 jump instruction. */
1563 HOWTO (R_MIPS16_26, /* type */
1564 2, /* rightshift */
1565 2, /* size (0 = byte, 1 = short, 2 = long) */
1566 26, /* bitsize */
1567 FALSE, /* pc_relative */
1568 0, /* bitpos */
1569 complain_overflow_dont, /* complain_on_overflow */
1570 /* This needs complex overflow
1571 detection, because the upper four
1572 bits must match the PC. */
1573 _bfd_mips_elf_generic_reloc, /* special_function */
1574 "R_MIPS16_26", /* name */
1575 FALSE, /* partial_inplace */
1576 0, /* src_mask */
1577 0x3ffffff, /* dst_mask */
1578 FALSE), /* pcrel_offset */
1579
1580 /* The reloc used for the mips16 gprel instruction. */
1581 HOWTO (R_MIPS16_GPREL, /* type */
1582 0, /* rightshift */
1583 2, /* size (0 = byte, 1 = short, 2 = long) */
1584 16, /* bitsize */
1585 FALSE, /* pc_relative */
1586 0, /* bitpos */
1587 complain_overflow_signed, /* complain_on_overflow */
1588 mips16_gprel_reloc, /* special_function */
1589 "R_MIPS16_GPREL", /* name */
1590 FALSE, /* partial_inplace */
1591 0, /* src_mask */
1592 0x0000ffff, /* dst_mask */
1593 FALSE), /* pcrel_offset */
1594
1595 /* A MIPS16 reference to the global offset table. */
1596 HOWTO (R_MIPS16_GOT16, /* type */
1597 0, /* rightshift */
1598 2, /* size (0 = byte, 1 = short, 2 = long) */
1599 16, /* bitsize */
1600 FALSE, /* pc_relative */
1601 0, /* bitpos */
1602 complain_overflow_dont, /* complain_on_overflow */
1603 _bfd_mips_elf_got16_reloc, /* special_function */
1604 "R_MIPS16_GOT16", /* name */
1605 FALSE, /* partial_inplace */
1606 0, /* src_mask */
1607 0x0000ffff, /* dst_mask */
1608 FALSE), /* pcrel_offset */
1609
1610 /* A MIPS16 call through the global offset table. */
1611 HOWTO (R_MIPS16_CALL16, /* type */
1612 0, /* rightshift */
1613 2, /* size (0 = byte, 1 = short, 2 = long) */
1614 16, /* bitsize */
1615 FALSE, /* pc_relative */
1616 0, /* bitpos */
1617 complain_overflow_dont, /* complain_on_overflow */
1618 _bfd_mips_elf_generic_reloc, /* special_function */
1619 "R_MIPS16_CALL16", /* name */
1620 FALSE, /* partial_inplace */
1621 0, /* src_mask */
1622 0x0000ffff, /* dst_mask */
1623 FALSE), /* pcrel_offset */
1624
1625 /* MIPS16 high 16 bits of symbol value. */
1626 HOWTO (R_MIPS16_HI16, /* type */
1627 16, /* rightshift */
1628 2, /* size (0 = byte, 1 = short, 2 = long) */
1629 16, /* bitsize */
1630 FALSE, /* pc_relative */
1631 0, /* bitpos */
1632 complain_overflow_dont, /* complain_on_overflow */
1633 _bfd_mips_elf_hi16_reloc, /* special_function */
1634 "R_MIPS16_HI16", /* name */
1635 FALSE, /* partial_inplace */
1636 0, /* src_mask */
1637 0x0000ffff, /* dst_mask */
1638 FALSE), /* pcrel_offset */
1639
1640 /* MIPS16 low 16 bits of symbol value. */
1641 HOWTO (R_MIPS16_LO16, /* type */
1642 0, /* rightshift */
1643 2, /* size (0 = byte, 1 = short, 2 = long) */
1644 16, /* bitsize */
1645 FALSE, /* pc_relative */
1646 0, /* bitpos */
1647 complain_overflow_dont, /* complain_on_overflow */
1648 _bfd_mips_elf_lo16_reloc, /* special_function */
1649 "R_MIPS16_LO16", /* name */
1650 FALSE, /* partial_inplace */
1651 0, /* src_mask */
1652 0x0000ffff, /* dst_mask */
1653 FALSE), /* pcrel_offset */
1654 };
1655
1656 static reloc_howto_type elf_micromips_howto_table_rel[] =
1657 {
1658 EMPTY_HOWTO (130),
1659 EMPTY_HOWTO (131),
1660 EMPTY_HOWTO (132),
1661
1662 /* 26 bit jump address. */
1663 HOWTO (R_MICROMIPS_26_S1, /* type */
1664 1, /* rightshift */
1665 2, /* size (0 = byte, 1 = short, 2 = long) */
1666 26, /* bitsize */
1667 FALSE, /* pc_relative */
1668 0, /* bitpos */
1669 complain_overflow_dont, /* complain_on_overflow */
1670 /* This needs complex overflow
1671 detection, because the upper four
1672 bits must match the PC. */
1673 _bfd_mips_elf_generic_reloc, /* special_function */
1674 "R_MICROMIPS_26_S1", /* name */
1675 TRUE, /* partial_inplace */
1676 0x3ffffff, /* src_mask */
1677 0x3ffffff, /* dst_mask */
1678 FALSE), /* pcrel_offset */
1679
1680 /* High 16 bits of symbol value. */
1681 HOWTO (R_MICROMIPS_HI16, /* type */
1682 16, /* rightshift */
1683 2, /* size (0 = byte, 1 = short, 2 = long) */
1684 16, /* bitsize */
1685 FALSE, /* pc_relative */
1686 0, /* bitpos */
1687 complain_overflow_dont, /* complain_on_overflow */
1688 _bfd_mips_elf_hi16_reloc, /* special_function */
1689 "R_MICROMIPS_HI16", /* name */
1690 TRUE, /* partial_inplace */
1691 0x0000ffff, /* src_mask */
1692 0x0000ffff, /* dst_mask */
1693 FALSE), /* pcrel_offset */
1694
1695 /* Low 16 bits of symbol value. */
1696 HOWTO (R_MICROMIPS_LO16, /* type */
1697 0, /* rightshift */
1698 2, /* size (0 = byte, 1 = short, 2 = long) */
1699 16, /* bitsize */
1700 FALSE, /* pc_relative */
1701 0, /* bitpos */
1702 complain_overflow_dont, /* complain_on_overflow */
1703 _bfd_mips_elf_lo16_reloc, /* special_function */
1704 "R_MICROMIPS_LO16", /* name */
1705 TRUE, /* partial_inplace */
1706 0x0000ffff, /* src_mask */
1707 0x0000ffff, /* dst_mask */
1708 FALSE), /* pcrel_offset */
1709
1710 /* GP relative reference. */
1711 HOWTO (R_MICROMIPS_GPREL16, /* type */
1712 0, /* rightshift */
1713 2, /* size (0 = byte, 1 = short, 2 = long) */
1714 16, /* bitsize */
1715 FALSE, /* pc_relative */
1716 0, /* bitpos */
1717 complain_overflow_signed, /* complain_on_overflow */
1718 _bfd_mips_elf32_gprel16_reloc, /* special_function */
1719 "R_MICROMIPS_GPREL16", /* name */
1720 TRUE, /* partial_inplace */
1721 0x0000ffff, /* src_mask */
1722 0x0000ffff, /* dst_mask */
1723 FALSE), /* pcrel_offset */
1724
1725 /* Reference to literal section. */
1726 HOWTO (R_MICROMIPS_LITERAL, /* type */
1727 0, /* rightshift */
1728 2, /* size (0 = byte, 1 = short, 2 = long) */
1729 16, /* bitsize */
1730 FALSE, /* pc_relative */
1731 0, /* bitpos */
1732 complain_overflow_signed, /* complain_on_overflow */
1733 _bfd_mips_elf32_gprel16_reloc, /* special_function */
1734 "R_MICROMIPS_LITERAL", /* name */
1735 TRUE, /* partial_inplace */
1736 0x0000ffff, /* src_mask */
1737 0x0000ffff, /* dst_mask */
1738 FALSE), /* pcrel_offset */
1739
1740 /* Reference to global offset table. */
1741 HOWTO (R_MICROMIPS_GOT16, /* type */
1742 0, /* rightshift */
1743 2, /* size (0 = byte, 1 = short, 2 = long) */
1744 16, /* bitsize */
1745 FALSE, /* pc_relative */
1746 0, /* bitpos */
1747 complain_overflow_signed, /* complain_on_overflow */
1748 _bfd_mips_elf_got16_reloc, /* special_function */
1749 "R_MICROMIPS_GOT16", /* name */
1750 TRUE, /* partial_inplace */
1751 0x0000ffff, /* src_mask */
1752 0x0000ffff, /* dst_mask */
1753 FALSE), /* pcrel_offset */
1754
1755 /* This is for microMIPS branches. */
1756 HOWTO (R_MICROMIPS_PC7_S1, /* type */
1757 1, /* rightshift */
1758 1, /* size (0 = byte, 1 = short, 2 = long) */
1759 7, /* bitsize */
1760 TRUE, /* pc_relative */
1761 0, /* bitpos */
1762 complain_overflow_signed, /* complain_on_overflow */
1763 _bfd_mips_elf_generic_reloc, /* special_function */
1764 "R_MICROMIPS_PC7_S1", /* name */
1765 TRUE, /* partial_inplace */
1766 0x0000007f, /* src_mask */
1767 0x0000007f, /* dst_mask */
1768 TRUE), /* pcrel_offset */
1769
1770 HOWTO (R_MICROMIPS_PC10_S1, /* type */
1771 1, /* rightshift */
1772 1, /* size (0 = byte, 1 = short, 2 = long) */
1773 10, /* bitsize */
1774 TRUE, /* pc_relative */
1775 0, /* bitpos */
1776 complain_overflow_signed, /* complain_on_overflow */
1777 _bfd_mips_elf_generic_reloc, /* special_function */
1778 "R_MICROMIPS_PC10_S1", /* name */
1779 TRUE, /* partial_inplace */
1780 0x000003ff, /* src_mask */
1781 0x000003ff, /* dst_mask */
1782 TRUE), /* pcrel_offset */
1783
1784 HOWTO (R_MICROMIPS_PC16_S1, /* type */
1785 1, /* rightshift */
1786 2, /* size (0 = byte, 1 = short, 2 = long) */
1787 16, /* bitsize */
1788 TRUE, /* pc_relative */
1789 0, /* bitpos */
1790 complain_overflow_signed, /* complain_on_overflow */
1791 _bfd_mips_elf_generic_reloc, /* special_function */
1792 "R_MICROMIPS_PC16_S1", /* name */
1793 TRUE, /* partial_inplace */
1794 0x0000ffff, /* src_mask */
1795 0x0000ffff, /* dst_mask */
1796 TRUE), /* pcrel_offset */
1797
1798 /* 16 bit call through global offset table. */
1799 HOWTO (R_MICROMIPS_CALL16, /* type */
1800 0, /* rightshift */
1801 2, /* size (0 = byte, 1 = short, 2 = long) */
1802 16, /* bitsize */
1803 FALSE, /* pc_relative */
1804 0, /* bitpos */
1805 complain_overflow_signed, /* complain_on_overflow */
1806 _bfd_mips_elf_generic_reloc, /* special_function */
1807 "R_MICROMIPS_CALL16", /* name */
1808 TRUE, /* partial_inplace */
1809 0x0000ffff, /* src_mask */
1810 0x0000ffff, /* dst_mask */
1811 FALSE), /* pcrel_offset */
1812
1813 EMPTY_HOWTO (143),
1814 EMPTY_HOWTO (144),
1815
1816 /* Displacement in the global offset table. */
1817 HOWTO (R_MICROMIPS_GOT_DISP, /* type */
1818 0, /* rightshift */
1819 2, /* size (0 = byte, 1 = short, 2 = long) */
1820 16, /* bitsize */
1821 FALSE, /* pc_relative */
1822 0, /* bitpos */
1823 complain_overflow_signed, /* complain_on_overflow */
1824 _bfd_mips_elf_generic_reloc, /* special_function */
1825 "R_MICROMIPS_GOT_DISP",/* name */
1826 TRUE, /* partial_inplace */
1827 0x0000ffff, /* src_mask */
1828 0x0000ffff, /* dst_mask */
1829 FALSE), /* pcrel_offset */
1830
1831 /* Displacement to page pointer in the global offset table. */
1832 HOWTO (R_MICROMIPS_GOT_PAGE, /* type */
1833 0, /* rightshift */
1834 2, /* size (0 = byte, 1 = short, 2 = long) */
1835 16, /* bitsize */
1836 FALSE, /* pc_relative */
1837 0, /* bitpos */
1838 complain_overflow_signed, /* complain_on_overflow */
1839 _bfd_mips_elf_generic_reloc, /* special_function */
1840 "R_MICROMIPS_GOT_PAGE",/* name */
1841 TRUE, /* partial_inplace */
1842 0x0000ffff, /* src_mask */
1843 0x0000ffff, /* dst_mask */
1844 FALSE), /* pcrel_offset */
1845
1846 /* Offset from page pointer in the global offset table. */
1847 HOWTO (R_MICROMIPS_GOT_OFST, /* type */
1848 0, /* rightshift */
1849 2, /* size (0 = byte, 1 = short, 2 = long) */
1850 16, /* bitsize */
1851 FALSE, /* pc_relative */
1852 0, /* bitpos */
1853 complain_overflow_signed, /* complain_on_overflow */
1854 _bfd_mips_elf_generic_reloc, /* special_function */
1855 "R_MICROMIPS_GOT_OFST",/* name */
1856 TRUE, /* partial_inplace */
1857 0x0000ffff, /* src_mask */
1858 0x0000ffff, /* dst_mask */
1859 FALSE), /* pcrel_offset */
1860
1861 /* High 16 bits of displacement in global offset table. */
1862 HOWTO (R_MICROMIPS_GOT_HI16, /* type */
1863 0, /* rightshift */
1864 2, /* size (0 = byte, 1 = short, 2 = long) */
1865 16, /* bitsize */
1866 FALSE, /* pc_relative */
1867 0, /* bitpos */
1868 complain_overflow_dont, /* complain_on_overflow */
1869 _bfd_mips_elf_generic_reloc, /* special_function */
1870 "R_MICROMIPS_GOT_HI16",/* name */
1871 TRUE, /* partial_inplace */
1872 0x0000ffff, /* src_mask */
1873 0x0000ffff, /* dst_mask */
1874 FALSE), /* pcrel_offset */
1875
1876 /* Low 16 bits of displacement in global offset table. */
1877 HOWTO (R_MICROMIPS_GOT_LO16, /* type */
1878 0, /* rightshift */
1879 2, /* size (0 = byte, 1 = short, 2 = long) */
1880 16, /* bitsize */
1881 FALSE, /* pc_relative */
1882 0, /* bitpos */
1883 complain_overflow_dont, /* complain_on_overflow */
1884 _bfd_mips_elf_generic_reloc, /* special_function */
1885 "R_MICROMIPS_GOT_LO16",/* name */
1886 TRUE, /* partial_inplace */
1887 0x0000ffff, /* src_mask */
1888 0x0000ffff, /* dst_mask */
1889 FALSE), /* pcrel_offset */
1890
1891 /* 64 bit subtraction. Used in the N32 ABI. */
1892 HOWTO (R_MICROMIPS_SUB, /* type */
1893 0, /* rightshift */
1894 4, /* size (0 = byte, 1 = short, 2 = long) */
1895 64, /* bitsize */
1896 FALSE, /* pc_relative */
1897 0, /* bitpos */
1898 complain_overflow_dont, /* complain_on_overflow */
1899 _bfd_mips_elf_generic_reloc, /* special_function */
1900 "R_MICROMIPS_SUB", /* name */
1901 TRUE, /* partial_inplace */
1902 MINUS_ONE, /* src_mask */
1903 MINUS_ONE, /* dst_mask */
1904 FALSE), /* pcrel_offset */
1905
1906 /* We don't support these for REL relocations, because it means building
1907 the addend from a R_MICROMIPS_HIGHEST/R_MICROMIPS_HIGHER/
1908 R_MICROMIPS_HI16/R_MICROMIPS_LO16 sequence with varying ordering,
1909 using fallable heuristics. */
1910 EMPTY_HOWTO (R_MICROMIPS_HIGHER),
1911 EMPTY_HOWTO (R_MICROMIPS_HIGHEST),
1912
1913 /* High 16 bits of displacement in global offset table. */
1914 HOWTO (R_MICROMIPS_CALL_HI16, /* type */
1915 0, /* rightshift */
1916 2, /* size (0 = byte, 1 = short, 2 = long) */
1917 16, /* bitsize */
1918 FALSE, /* pc_relative */
1919 0, /* bitpos */
1920 complain_overflow_dont, /* complain_on_overflow */
1921 _bfd_mips_elf_generic_reloc, /* special_function */
1922 "R_MICROMIPS_CALL_HI16",/* name */
1923 TRUE, /* partial_inplace */
1924 0x0000ffff, /* src_mask */
1925 0x0000ffff, /* dst_mask */
1926 FALSE), /* pcrel_offset */
1927
1928 /* Low 16 bits of displacement in global offset table. */
1929 HOWTO (R_MICROMIPS_CALL_LO16, /* type */
1930 0, /* rightshift */
1931 2, /* size (0 = byte, 1 = short, 2 = long) */
1932 16, /* bitsize */
1933 FALSE, /* pc_relative */
1934 0, /* bitpos */
1935 complain_overflow_dont, /* complain_on_overflow */
1936 _bfd_mips_elf_generic_reloc, /* special_function */
1937 "R_MICROMIPS_CALL_LO16",/* name */
1938 TRUE, /* partial_inplace */
1939 0x0000ffff, /* src_mask */
1940 0x0000ffff, /* dst_mask */
1941 FALSE), /* pcrel_offset */
1942 };
1943
1944 static reloc_howto_type elf_micromips_howto_table_rela[] =
1945 {
1946 EMPTY_HOWTO (130),
1947 EMPTY_HOWTO (131),
1948 EMPTY_HOWTO (132),
1949
1950 /* 26 bit jump address. */
1951 HOWTO (R_MICROMIPS_26_S1, /* type */
1952 1, /* rightshift */
1953 2, /* size (0 = byte, 1 = short, 2 = long) */
1954 26, /* bitsize */
1955 FALSE, /* pc_relative */
1956 0, /* bitpos */
1957 complain_overflow_dont, /* complain_on_overflow */
1958 /* This needs complex overflow
1959 detection, because the upper four
1960 bits must match the PC. */
1961 _bfd_mips_elf_generic_reloc, /* special_function */
1962 "R_MICROMIPS_26_S1", /* name */
1963 FALSE, /* partial_inplace */
1964 0, /* src_mask */
1965 0x3ffffff, /* dst_mask */
1966 FALSE), /* pcrel_offset */
1967
1968 /* High 16 bits of symbol value. */
1969 HOWTO (R_MICROMIPS_HI16, /* type */
1970 16, /* rightshift */
1971 2, /* size (0 = byte, 1 = short, 2 = long) */
1972 16, /* bitsize */
1973 FALSE, /* pc_relative */
1974 0, /* bitpos */
1975 complain_overflow_dont, /* complain_on_overflow */
1976 _bfd_mips_elf_hi16_reloc, /* special_function */
1977 "R_MICROMIPS_HI16", /* name */
1978 FALSE, /* partial_inplace */
1979 0, /* src_mask */
1980 0x0000ffff, /* dst_mask */
1981 FALSE), /* pcrel_offset */
1982
1983 /* Low 16 bits of symbol value. */
1984 HOWTO (R_MICROMIPS_LO16, /* type */
1985 0, /* rightshift */
1986 2, /* size (0 = byte, 1 = short, 2 = long) */
1987 16, /* bitsize */
1988 FALSE, /* pc_relative */
1989 0, /* bitpos */
1990 complain_overflow_dont, /* complain_on_overflow */
1991 _bfd_mips_elf_lo16_reloc, /* special_function */
1992 "R_MICROMIPS_LO16", /* name */
1993 FALSE, /* partial_inplace */
1994 0, /* src_mask */
1995 0x0000ffff, /* dst_mask */
1996 FALSE), /* pcrel_offset */
1997
1998 /* GP relative reference. */
1999 HOWTO (R_MICROMIPS_GPREL16, /* type */
2000 0, /* rightshift */
2001 2, /* size (0 = byte, 1 = short, 2 = long) */
2002 16, /* bitsize */
2003 FALSE, /* pc_relative */
2004 0, /* bitpos */
2005 complain_overflow_signed, /* complain_on_overflow */
2006 _bfd_mips_elf32_gprel16_reloc, /* special_function */
2007 "R_MICROMIPS_GPREL16", /* name */
2008 FALSE, /* partial_inplace */
2009 0, /* src_mask */
2010 0x0000ffff, /* dst_mask */
2011 FALSE), /* pcrel_offset */
2012
2013 /* Reference to literal section. */
2014 HOWTO (R_MICROMIPS_LITERAL, /* type */
2015 0, /* rightshift */
2016 2, /* size (0 = byte, 1 = short, 2 = long) */
2017 16, /* bitsize */
2018 FALSE, /* pc_relative */
2019 0, /* bitpos */
2020 complain_overflow_signed, /* complain_on_overflow */
2021 _bfd_mips_elf32_gprel16_reloc, /* special_function */
2022 "R_MICROMIPS_LITERAL", /* name */
2023 FALSE, /* partial_inplace */
2024 0, /* src_mask */
2025 0x0000ffff, /* dst_mask */
2026 FALSE), /* pcrel_offset */
2027
2028 /* Reference to global offset table. */
2029 HOWTO (R_MICROMIPS_GOT16, /* type */
2030 0, /* rightshift */
2031 2, /* size (0 = byte, 1 = short, 2 = long) */
2032 16, /* bitsize */
2033 FALSE, /* pc_relative */
2034 0, /* bitpos */
2035 complain_overflow_signed, /* complain_on_overflow */
2036 _bfd_mips_elf_got16_reloc, /* special_function */
2037 "R_MICROMIPS_GOT16", /* name */
2038 FALSE, /* partial_inplace */
2039 0, /* src_mask */
2040 0x0000ffff, /* dst_mask */
2041 FALSE), /* pcrel_offset */
2042
2043 /* This is for microMIPS branches. */
2044 HOWTO (R_MICROMIPS_PC7_S1, /* type */
2045 1, /* rightshift */
2046 1, /* size (0 = byte, 1 = short, 2 = long) */
2047 7, /* bitsize */
2048 TRUE, /* pc_relative */
2049 0, /* bitpos */
2050 complain_overflow_signed, /* complain_on_overflow */
2051 _bfd_mips_elf_generic_reloc, /* special_function */
2052 "R_MICROMIPS_PC7_S1", /* name */
2053 FALSE, /* partial_inplace */
2054 0, /* src_mask */
2055 0x0000007f, /* dst_mask */
2056 TRUE), /* pcrel_offset */
2057
2058 HOWTO (R_MICROMIPS_PC10_S1, /* type */
2059 1, /* rightshift */
2060 1, /* size (0 = byte, 1 = short, 2 = long) */
2061 10, /* bitsize */
2062 TRUE, /* pc_relative */
2063 0, /* bitpos */
2064 complain_overflow_signed, /* complain_on_overflow */
2065 _bfd_mips_elf_generic_reloc, /* special_function */
2066 "R_MICROMIPS_PC10_S1", /* name */
2067 FALSE, /* partial_inplace */
2068 0, /* src_mask */
2069 0x000003ff, /* dst_mask */
2070 TRUE), /* pcrel_offset */
2071
2072 HOWTO (R_MICROMIPS_PC16_S1, /* type */
2073 1, /* rightshift */
2074 2, /* size (0 = byte, 1 = short, 2 = long) */
2075 16, /* bitsize */
2076 TRUE, /* pc_relative */
2077 0, /* bitpos */
2078 complain_overflow_signed, /* complain_on_overflow */
2079 _bfd_mips_elf_generic_reloc, /* special_function */
2080 "R_MICROMIPS_PC16_S1", /* name */
2081 FALSE, /* partial_inplace */
2082 0, /* src_mask */
2083 0x0000ffff, /* dst_mask */
2084 TRUE), /* pcrel_offset */
2085
2086 /* 16 bit call through global offset table. */
2087 HOWTO (R_MICROMIPS_CALL16, /* type */
2088 0, /* rightshift */
2089 2, /* size (0 = byte, 1 = short, 2 = long) */
2090 16, /* bitsize */
2091 FALSE, /* pc_relative */
2092 0, /* bitpos */
2093 complain_overflow_signed, /* complain_on_overflow */
2094 _bfd_mips_elf_generic_reloc, /* special_function */
2095 "R_MICROMIPS_CALL16", /* name */
2096 FALSE, /* partial_inplace */
2097 0, /* src_mask */
2098 0x0000ffff, /* dst_mask */
2099 FALSE), /* pcrel_offset */
2100
2101 EMPTY_HOWTO (143),
2102 EMPTY_HOWTO (144),
2103
2104 /* Displacement in the global offset table. */
2105 HOWTO (R_MICROMIPS_GOT_DISP, /* type */
2106 0, /* rightshift */
2107 2, /* size (0 = byte, 1 = short, 2 = long) */
2108 16, /* bitsize */
2109 FALSE, /* pc_relative */
2110 0, /* bitpos */
2111 complain_overflow_signed, /* complain_on_overflow */
2112 _bfd_mips_elf_generic_reloc, /* special_function */
2113 "R_MICROMIPS_GOT_DISP",/* name */
2114 FALSE, /* partial_inplace */
2115 0, /* src_mask */
2116 0x0000ffff, /* dst_mask */
2117 FALSE), /* pcrel_offset */
2118
2119 /* Displacement to page pointer in the global offset table. */
2120 HOWTO (R_MICROMIPS_GOT_PAGE, /* type */
2121 0, /* rightshift */
2122 2, /* size (0 = byte, 1 = short, 2 = long) */
2123 16, /* bitsize */
2124 FALSE, /* pc_relative */
2125 0, /* bitpos */
2126 complain_overflow_signed, /* complain_on_overflow */
2127 _bfd_mips_elf_generic_reloc, /* special_function */
2128 "R_MICROMIPS_GOT_PAGE",/* name */
2129 FALSE, /* partial_inplace */
2130 0, /* src_mask */
2131 0x0000ffff, /* dst_mask */
2132 FALSE), /* pcrel_offset */
2133
2134 /* Offset from page pointer in the global offset table. */
2135 HOWTO (R_MICROMIPS_GOT_OFST, /* type */
2136 0, /* rightshift */
2137 2, /* size (0 = byte, 1 = short, 2 = long) */
2138 16, /* bitsize */
2139 FALSE, /* pc_relative */
2140 0, /* bitpos */
2141 complain_overflow_signed, /* complain_on_overflow */
2142 _bfd_mips_elf_generic_reloc, /* special_function */
2143 "R_MICROMIPS_GOT_OFST",/* name */
2144 FALSE, /* partial_inplace */
2145 0, /* src_mask */
2146 0x0000ffff, /* dst_mask */
2147 FALSE), /* pcrel_offset */
2148
2149 /* High 16 bits of displacement in global offset table. */
2150 HOWTO (R_MICROMIPS_GOT_HI16, /* type */
2151 0, /* rightshift */
2152 2, /* size (0 = byte, 1 = short, 2 = long) */
2153 16, /* bitsize */
2154 FALSE, /* pc_relative */
2155 0, /* bitpos */
2156 complain_overflow_dont, /* complain_on_overflow */
2157 _bfd_mips_elf_generic_reloc, /* special_function */
2158 "R_MICROMIPS_GOT_HI16",/* name */
2159 FALSE, /* partial_inplace */
2160 0, /* src_mask */
2161 0x0000ffff, /* dst_mask */
2162 FALSE), /* pcrel_offset */
2163
2164 /* Low 16 bits of displacement in global offset table. */
2165 HOWTO (R_MICROMIPS_GOT_LO16, /* type */
2166 0, /* rightshift */
2167 2, /* size (0 = byte, 1 = short, 2 = long) */
2168 16, /* bitsize */
2169 FALSE, /* pc_relative */
2170 0, /* bitpos */
2171 complain_overflow_dont, /* complain_on_overflow */
2172 _bfd_mips_elf_generic_reloc, /* special_function */
2173 "R_MICROMIPS_GOT_LO16",/* name */
2174 FALSE, /* partial_inplace */
2175 0, /* src_mask */
2176 0x0000ffff, /* dst_mask */
2177 FALSE), /* pcrel_offset */
2178
2179 /* 64 bit subtraction. Used in the N32 ABI. */
2180 HOWTO (R_MICROMIPS_SUB, /* type */
2181 0, /* rightshift */
2182 4, /* size (0 = byte, 1 = short, 2 = long) */
2183 64, /* bitsize */
2184 FALSE, /* pc_relative */
2185 0, /* bitpos */
2186 complain_overflow_dont, /* complain_on_overflow */
2187 _bfd_mips_elf_generic_reloc, /* special_function */
2188 "R_MICROMIPS_SUB", /* name */
2189 FALSE, /* partial_inplace */
2190 0, /* src_mask */
2191 MINUS_ONE, /* dst_mask */
2192 FALSE), /* pcrel_offset */
2193
2194 /* Get the higher value of a 64 bit addend. */
2195 HOWTO (R_MICROMIPS_HIGHER, /* type */
2196 0, /* rightshift */
2197 2, /* size (0 = byte, 1 = short, 2 = long) */
2198 16, /* bitsize */
2199 FALSE, /* pc_relative */
2200 0, /* bitpos */
2201 complain_overflow_dont, /* complain_on_overflow */
2202 _bfd_mips_elf_generic_reloc, /* special_function */
2203 "R_MICROMIPS_HIGHER", /* name */
2204 FALSE, /* partial_inplace */
2205 0, /* src_mask */
2206 0x0000ffff, /* dst_mask */
2207 FALSE), /* pcrel_offset */
2208
2209 /* Get the highest value of a 64 bit addend. */
2210 HOWTO (R_MICROMIPS_HIGHEST, /* type */
2211 0, /* rightshift */
2212 2, /* size (0 = byte, 1 = short, 2 = long) */
2213 16, /* bitsize */
2214 FALSE, /* pc_relative */
2215 0, /* bitpos */
2216 complain_overflow_dont, /* complain_on_overflow */
2217 _bfd_mips_elf_generic_reloc, /* special_function */
2218 "R_MICROMIPS_HIGHEST", /* name */
2219 FALSE, /* partial_inplace */
2220 0, /* src_mask */
2221 0x0000ffff, /* dst_mask */
2222 FALSE), /* pcrel_offset */
2223
2224 /* High 16 bits of displacement in global offset table. */
2225 HOWTO (R_MICROMIPS_CALL_HI16, /* type */
2226 0, /* rightshift */
2227 2, /* size (0 = byte, 1 = short, 2 = long) */
2228 16, /* bitsize */
2229 FALSE, /* pc_relative */
2230 0, /* bitpos */
2231 complain_overflow_dont, /* complain_on_overflow */
2232 _bfd_mips_elf_generic_reloc, /* special_function */
2233 "R_MICROMIPS_CALL_HI16",/* name */
2234 FALSE, /* partial_inplace */
2235 0, /* src_mask */
2236 0x0000ffff, /* dst_mask */
2237 FALSE), /* pcrel_offset */
2238
2239 /* Low 16 bits of displacement in global offset table. */
2240 HOWTO (R_MICROMIPS_CALL_LO16, /* type */
2241 0, /* rightshift */
2242 2, /* size (0 = byte, 1 = short, 2 = long) */
2243 16, /* bitsize */
2244 FALSE, /* pc_relative */
2245 0, /* bitpos */
2246 complain_overflow_dont, /* complain_on_overflow */
2247 _bfd_mips_elf_generic_reloc, /* special_function */
2248 "R_MICROMIPS_CALL_LO16",/* name */
2249 FALSE, /* partial_inplace */
2250 0, /* src_mask */
2251 0x0000ffff, /* dst_mask */
2252 FALSE), /* pcrel_offset */
2253 };
2254
2255 /* GNU extension to record C++ vtable hierarchy */
2256 static reloc_howto_type elf_mips_gnu_vtinherit_howto =
2257 HOWTO (R_MIPS_GNU_VTINHERIT, /* type */
2258 0, /* rightshift */
2259 2, /* size (0 = byte, 1 = short, 2 = long) */
2260 0, /* bitsize */
2261 FALSE, /* pc_relative */
2262 0, /* bitpos */
2263 complain_overflow_dont, /* complain_on_overflow */
2264 NULL, /* special_function */
2265 "R_MIPS_GNU_VTINHERIT", /* name */
2266 FALSE, /* partial_inplace */
2267 0, /* src_mask */
2268 0, /* dst_mask */
2269 FALSE); /* pcrel_offset */
2270
2271 /* GNU extension to record C++ vtable member usage */
2272 static reloc_howto_type elf_mips_gnu_vtentry_howto =
2273 HOWTO (R_MIPS_GNU_VTENTRY, /* type */
2274 0, /* rightshift */
2275 2, /* size (0 = byte, 1 = short, 2 = long) */
2276 0, /* bitsize */
2277 FALSE, /* pc_relative */
2278 0, /* bitpos */
2279 complain_overflow_dont, /* complain_on_overflow */
2280 _bfd_elf_rel_vtable_reloc_fn, /* special_function */
2281 "R_MIPS_GNU_VTENTRY", /* name */
2282 FALSE, /* partial_inplace */
2283 0, /* src_mask */
2284 0, /* dst_mask */
2285 FALSE); /* pcrel_offset */
2286 \f
2287 /* 16 bit offset for pc-relative branches. */
2288 static reloc_howto_type elf_mips_gnu_rel16_s2 =
2289 HOWTO (R_MIPS_GNU_REL16_S2, /* type */
2290 2, /* rightshift */
2291 2, /* size (0 = byte, 1 = short, 2 = long) */
2292 16, /* bitsize */
2293 TRUE, /* pc_relative */
2294 0, /* bitpos */
2295 complain_overflow_signed, /* complain_on_overflow */
2296 _bfd_mips_elf_generic_reloc, /* special_function */
2297 "R_MIPS_GNU_REL16_S2", /* name */
2298 TRUE, /* partial_inplace */
2299 0x0000ffff, /* src_mask */
2300 0x0000ffff, /* dst_mask */
2301 TRUE); /* pcrel_offset */
2302
2303 /* 16 bit offset for pc-relative branches. */
2304 static reloc_howto_type elf_mips_gnu_rela16_s2 =
2305 HOWTO (R_MIPS_GNU_REL16_S2, /* type */
2306 2, /* rightshift */
2307 2, /* size (0 = byte, 1 = short, 2 = long) */
2308 16, /* bitsize */
2309 TRUE, /* pc_relative */
2310 0, /* bitpos */
2311 complain_overflow_signed, /* complain_on_overflow */
2312 _bfd_mips_elf_generic_reloc, /* special_function */
2313 "R_MIPS_GNU_REL16_S2", /* name */
2314 FALSE, /* partial_inplace */
2315 0, /* src_mask */
2316 0x0000ffff, /* dst_mask */
2317 TRUE); /* pcrel_offset */
2318 \f
2319 /* Originally a VxWorks extension, but now used for other systems too. */
2320 static reloc_howto_type elf_mips_copy_howto =
2321 HOWTO (R_MIPS_COPY, /* type */
2322 0, /* rightshift */
2323 0, /* this one is variable size */
2324 0, /* bitsize */
2325 FALSE, /* pc_relative */
2326 0, /* bitpos */
2327 complain_overflow_bitfield, /* complain_on_overflow */
2328 bfd_elf_generic_reloc, /* special_function */
2329 "R_MIPS_COPY", /* name */
2330 FALSE, /* partial_inplace */
2331 0x0, /* src_mask */
2332 0x0, /* dst_mask */
2333 FALSE); /* pcrel_offset */
2334
2335 /* Originally a VxWorks extension, but now used for other systems too. */
2336 static reloc_howto_type elf_mips_jump_slot_howto =
2337 HOWTO (R_MIPS_JUMP_SLOT, /* type */
2338 0, /* rightshift */
2339 2, /* size (0 = byte, 1 = short, 2 = long) */
2340 32, /* bitsize */
2341 FALSE, /* pc_relative */
2342 0, /* bitpos */
2343 complain_overflow_bitfield, /* complain_on_overflow */
2344 bfd_elf_generic_reloc, /* special_function */
2345 "R_MIPS_JUMP_SLOT", /* name */
2346 FALSE, /* partial_inplace */
2347 0x0, /* src_mask */
2348 0x0, /* dst_mask */
2349 FALSE); /* pcrel_offset */
2350 \f
2351 /* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a
2352 dangerous relocation. */
2353
2354 static bfd_boolean
2355 mips_elf_assign_gp (bfd *output_bfd, bfd_vma *pgp)
2356 {
2357 unsigned int count;
2358 asymbol **sym;
2359 unsigned int i;
2360
2361 /* If we've already figured out what GP will be, just return it. */
2362 *pgp = _bfd_get_gp_value (output_bfd);
2363 if (*pgp)
2364 return TRUE;
2365
2366 count = bfd_get_symcount (output_bfd);
2367 sym = bfd_get_outsymbols (output_bfd);
2368
2369 /* The linker script will have created a symbol named `_gp' with the
2370 appropriate value. */
2371 if (sym == NULL)
2372 i = count;
2373 else
2374 {
2375 for (i = 0; i < count; i++, sym++)
2376 {
2377 register const char *name;
2378
2379 name = bfd_asymbol_name (*sym);
2380 if (*name == '_' && strcmp (name, "_gp") == 0)
2381 {
2382 *pgp = bfd_asymbol_value (*sym);
2383 _bfd_set_gp_value (output_bfd, *pgp);
2384 break;
2385 }
2386 }
2387 }
2388
2389 if (i >= count)
2390 {
2391 /* Only get the error once. */
2392 *pgp = 4;
2393 _bfd_set_gp_value (output_bfd, *pgp);
2394 return FALSE;
2395 }
2396
2397 return TRUE;
2398 }
2399
2400 /* We have to figure out the gp value, so that we can adjust the
2401 symbol value correctly. We look up the symbol _gp in the output
2402 BFD. If we can't find it, we're stuck. We cache it in the ELF
2403 target data. We don't need to adjust the symbol value for an
2404 external symbol if we are producing relocatable output. */
2405
2406 static bfd_reloc_status_type
2407 mips_elf_final_gp (bfd *output_bfd, asymbol *symbol, bfd_boolean relocatable,
2408 char **error_message, bfd_vma *pgp)
2409 {
2410 if (bfd_is_und_section (symbol->section)
2411 && ! relocatable)
2412 {
2413 *pgp = 0;
2414 return bfd_reloc_undefined;
2415 }
2416
2417 *pgp = _bfd_get_gp_value (output_bfd);
2418 if (*pgp == 0
2419 && (! relocatable
2420 || (symbol->flags & BSF_SECTION_SYM) != 0))
2421 {
2422 if (relocatable)
2423 {
2424 /* Make up a value. */
2425 *pgp = symbol->section->output_section->vma /*+ 0x4000*/;
2426 _bfd_set_gp_value (output_bfd, *pgp);
2427 }
2428 else if (!mips_elf_assign_gp (output_bfd, pgp))
2429 {
2430 *error_message =
2431 (char *) _("GP relative relocation when _gp not defined");
2432 return bfd_reloc_dangerous;
2433 }
2434 }
2435
2436 return bfd_reloc_ok;
2437 }
2438
2439 /* Do a R_MIPS_GPREL16 relocation. This is a 16 bit value which must
2440 become the offset from the gp register. */
2441
2442 static bfd_reloc_status_type
2443 mips_elf_gprel16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
2444 asymbol *symbol, void *data ATTRIBUTE_UNUSED,
2445 asection *input_section, bfd *output_bfd,
2446 char **error_message ATTRIBUTE_UNUSED)
2447 {
2448 bfd_boolean relocatable;
2449 bfd_reloc_status_type ret;
2450 bfd_vma gp;
2451
2452 if (output_bfd != NULL)
2453 relocatable = TRUE;
2454 else
2455 {
2456 relocatable = FALSE;
2457 output_bfd = symbol->section->output_section->owner;
2458 }
2459
2460 ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message,
2461 &gp);
2462 if (ret != bfd_reloc_ok)
2463 return ret;
2464
2465 return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
2466 input_section, relocatable,
2467 data, gp);
2468 }
2469
2470 /* Do a R_MIPS_LITERAL relocation. */
2471
2472 static bfd_reloc_status_type
2473 mips_elf_literal_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
2474 void *data, asection *input_section, bfd *output_bfd,
2475 char **error_message)
2476 {
2477 bfd_boolean relocatable;
2478 bfd_reloc_status_type ret;
2479 bfd_vma gp;
2480
2481 /* R_MIPS_LITERAL relocations are defined for local symbols only. */
2482 if (output_bfd != NULL
2483 && (symbol->flags & BSF_SECTION_SYM) == 0
2484 && (symbol->flags & BSF_LOCAL) != 0)
2485 {
2486 *error_message = (char *)
2487 _("literal relocation occurs for an external symbol");
2488 return bfd_reloc_outofrange;
2489 }
2490
2491 /* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */
2492 if (output_bfd != NULL)
2493 relocatable = TRUE;
2494 else
2495 {
2496 relocatable = FALSE;
2497 output_bfd = symbol->section->output_section->owner;
2498 }
2499
2500 ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message,
2501 &gp);
2502 if (ret != bfd_reloc_ok)
2503 return ret;
2504
2505 return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
2506 input_section, relocatable,
2507 data, gp);
2508 }
2509
2510 /* Do a R_MIPS_GPREL32 relocation. This is a 32 bit value which must
2511 become the offset from the gp register. */
2512
2513 static bfd_reloc_status_type
2514 mips_elf_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
2515 void *data, asection *input_section, bfd *output_bfd,
2516 char **error_message)
2517 {
2518 bfd_boolean relocatable;
2519 bfd_reloc_status_type ret;
2520 bfd_vma gp;
2521
2522 /* R_MIPS_GPREL32 relocations are defined for local symbols only. */
2523 if (output_bfd != NULL
2524 && (symbol->flags & BSF_SECTION_SYM) == 0
2525 && (symbol->flags & BSF_LOCAL) != 0)
2526 {
2527 *error_message = (char *)
2528 _("32bits gp relative relocation occurs for an external symbol");
2529 return bfd_reloc_outofrange;
2530 }
2531
2532 if (output_bfd != NULL)
2533 {
2534 relocatable = TRUE;
2535 gp = _bfd_get_gp_value (output_bfd);
2536 }
2537 else
2538 {
2539 relocatable = FALSE;
2540 output_bfd = symbol->section->output_section->owner;
2541
2542 ret = mips_elf_final_gp (output_bfd, symbol, relocatable,
2543 error_message, &gp);
2544 if (ret != bfd_reloc_ok)
2545 return ret;
2546 }
2547
2548 return gprel32_with_gp (abfd, symbol, reloc_entry, input_section,
2549 relocatable, data, gp);
2550 }
2551
2552 static bfd_reloc_status_type
2553 gprel32_with_gp (bfd *abfd, asymbol *symbol, arelent *reloc_entry,
2554 asection *input_section, bfd_boolean relocatable,
2555 void *data, bfd_vma gp)
2556 {
2557 bfd_vma relocation;
2558 unsigned long val;
2559
2560 if (bfd_is_com_section (symbol->section))
2561 relocation = 0;
2562 else
2563 relocation = symbol->value;
2564
2565 relocation += symbol->section->output_section->vma;
2566 relocation += symbol->section->output_offset;
2567
2568 if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
2569 return bfd_reloc_outofrange;
2570
2571 if (reloc_entry->howto->src_mask == 0)
2572 val = 0;
2573 else
2574 val = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
2575
2576 /* Set val to the offset into the section or symbol. */
2577 val += reloc_entry->addend;
2578
2579 /* Adjust val for the final section location and GP value. If we
2580 are producing relocatable output, we don't want to do this for
2581 an external symbol. */
2582 if (! relocatable
2583 || (symbol->flags & BSF_SECTION_SYM) != 0)
2584 val += relocation - gp;
2585
2586 bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address);
2587
2588 if (relocatable)
2589 reloc_entry->address += input_section->output_offset;
2590
2591 return bfd_reloc_ok;
2592 }
2593
2594 /* Do a R_MIPS_SHIFT6 relocation. The MSB of the shift is stored at bit 2,
2595 the rest is at bits 6-10. The bitpos already got right by the howto. */
2596
2597 static bfd_reloc_status_type
2598 mips_elf_shift6_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
2599 void *data, asection *input_section, bfd *output_bfd,
2600 char **error_message)
2601 {
2602 if (reloc_entry->howto->partial_inplace)
2603 {
2604 reloc_entry->addend = ((reloc_entry->addend & 0x00007c0)
2605 | (reloc_entry->addend & 0x00000800) >> 9);
2606 }
2607
2608 return _bfd_mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
2609 input_section, output_bfd,
2610 error_message);
2611 }
2612 \f
2613 /* Handle a mips16 GP relative reloc. */
2614
2615 static bfd_reloc_status_type
2616 mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
2617 void *data, asection *input_section, bfd *output_bfd,
2618 char **error_message)
2619 {
2620 bfd_boolean relocatable;
2621 bfd_reloc_status_type ret;
2622 bfd_byte *location;
2623 bfd_vma gp;
2624
2625 /* If we're relocating, and this is an external symbol, we don't want
2626 to change anything. */
2627 if (output_bfd != NULL
2628 && (symbol->flags & BSF_SECTION_SYM) == 0
2629 && (symbol->flags & BSF_LOCAL) != 0)
2630 {
2631 reloc_entry->address += input_section->output_offset;
2632 return bfd_reloc_ok;
2633 }
2634
2635 if (output_bfd != NULL)
2636 relocatable = TRUE;
2637 else
2638 {
2639 relocatable = FALSE;
2640 output_bfd = symbol->section->output_section->owner;
2641 }
2642
2643 ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message,
2644 &gp);
2645 if (ret != bfd_reloc_ok)
2646 return ret;
2647
2648 location = (bfd_byte *) data + reloc_entry->address;
2649 _bfd_mips_elf_reloc_unshuffle (abfd, reloc_entry->howto->type, FALSE,
2650 location);
2651 ret = _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
2652 input_section, relocatable,
2653 data, gp);
2654 _bfd_mips_elf_reloc_shuffle (abfd, reloc_entry->howto->type, !relocatable,
2655 location);
2656
2657 return ret;
2658 }
2659 \f
2660 /* A mapping from BFD reloc types to MIPS ELF reloc types. */
2661
2662 struct elf_reloc_map {
2663 bfd_reloc_code_real_type bfd_val;
2664 enum elf_mips_reloc_type elf_val;
2665 };
2666
2667 static const struct elf_reloc_map mips_reloc_map[] =
2668 {
2669 { BFD_RELOC_NONE, R_MIPS_NONE },
2670 { BFD_RELOC_16, R_MIPS_16 },
2671 { BFD_RELOC_32, R_MIPS_32 },
2672 /* There is no BFD reloc for R_MIPS_REL32. */
2673 { BFD_RELOC_CTOR, R_MIPS_32 },
2674 { BFD_RELOC_64, R_MIPS_64 },
2675 { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 },
2676 { BFD_RELOC_HI16_S, R_MIPS_HI16 },
2677 { BFD_RELOC_LO16, R_MIPS_LO16 },
2678 { BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
2679 { BFD_RELOC_GPREL32, R_MIPS_GPREL32 },
2680 { BFD_RELOC_MIPS_JMP, R_MIPS_26 },
2681 { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL },
2682 { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 },
2683 { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 },
2684 { BFD_RELOC_MIPS_SHIFT5, R_MIPS_SHIFT5 },
2685 { BFD_RELOC_MIPS_SHIFT6, R_MIPS_SHIFT6 },
2686 { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP },
2687 { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE },
2688 { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST },
2689 { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 },
2690 { BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 },
2691 { BFD_RELOC_MIPS_SUB, R_MIPS_SUB },
2692 { BFD_RELOC_MIPS_INSERT_A, R_MIPS_INSERT_A },
2693 { BFD_RELOC_MIPS_INSERT_B, R_MIPS_INSERT_B },
2694 { BFD_RELOC_MIPS_DELETE, R_MIPS_DELETE },
2695 { BFD_RELOC_MIPS_HIGHEST, R_MIPS_HIGHEST },
2696 { BFD_RELOC_MIPS_HIGHER, R_MIPS_HIGHER },
2697 { BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 },
2698 { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 },
2699 { BFD_RELOC_MIPS_SCN_DISP, R_MIPS_SCN_DISP },
2700 { BFD_RELOC_MIPS_REL16, R_MIPS_REL16 },
2701 /* Use of R_MIPS_ADD_IMMEDIATE and R_MIPS_PJUMP is deprecated. */
2702 { BFD_RELOC_MIPS_RELGOT, R_MIPS_RELGOT },
2703 { BFD_RELOC_MIPS_JALR, R_MIPS_JALR },
2704 { BFD_RELOC_MIPS_TLS_DTPMOD32, R_MIPS_TLS_DTPMOD32 },
2705 { BFD_RELOC_MIPS_TLS_DTPREL32, R_MIPS_TLS_DTPREL32 },
2706 { BFD_RELOC_MIPS_TLS_DTPMOD64, R_MIPS_TLS_DTPMOD64 },
2707 { BFD_RELOC_MIPS_TLS_DTPREL64, R_MIPS_TLS_DTPREL64 },
2708 { BFD_RELOC_MIPS_TLS_GD, R_MIPS_TLS_GD },
2709 { BFD_RELOC_MIPS_TLS_LDM, R_MIPS_TLS_LDM },
2710 { BFD_RELOC_MIPS_TLS_DTPREL_HI16, R_MIPS_TLS_DTPREL_HI16 },
2711 { BFD_RELOC_MIPS_TLS_DTPREL_LO16, R_MIPS_TLS_DTPREL_LO16 },
2712 { BFD_RELOC_MIPS_TLS_GOTTPREL, R_MIPS_TLS_GOTTPREL },
2713 { BFD_RELOC_MIPS_TLS_TPREL32, R_MIPS_TLS_TPREL32 },
2714 { BFD_RELOC_MIPS_TLS_TPREL64, R_MIPS_TLS_TPREL64 },
2715 { BFD_RELOC_MIPS_TLS_TPREL_HI16, R_MIPS_TLS_TPREL_HI16 },
2716 { BFD_RELOC_MIPS_TLS_TPREL_LO16, R_MIPS_TLS_TPREL_LO16 }
2717 };
2718
2719 static const struct elf_reloc_map mips16_reloc_map[] =
2720 {
2721 { BFD_RELOC_MIPS16_JMP, R_MIPS16_26 - R_MIPS16_min },
2722 { BFD_RELOC_MIPS16_GPREL, R_MIPS16_GPREL - R_MIPS16_min },
2723 { BFD_RELOC_MIPS16_GOT16, R_MIPS16_GOT16 - R_MIPS16_min },
2724 { BFD_RELOC_MIPS16_CALL16, R_MIPS16_CALL16 - R_MIPS16_min },
2725 { BFD_RELOC_MIPS16_HI16_S, R_MIPS16_HI16 - R_MIPS16_min },
2726 { BFD_RELOC_MIPS16_LO16, R_MIPS16_LO16 - R_MIPS16_min },
2727 };
2728
2729 static const struct elf_reloc_map micromips_reloc_map[] =
2730 {
2731 { BFD_RELOC_MICROMIPS_JMP, R_MICROMIPS_26_S1 - R_MICROMIPS_min },
2732 { BFD_RELOC_MICROMIPS_HI16_S, R_MICROMIPS_HI16 - R_MICROMIPS_min },
2733 { BFD_RELOC_MICROMIPS_LO16, R_MICROMIPS_LO16 - R_MICROMIPS_min },
2734 { BFD_RELOC_MICROMIPS_GPREL16, R_MICROMIPS_GPREL16 - R_MICROMIPS_min },
2735 { BFD_RELOC_MICROMIPS_LITERAL, R_MICROMIPS_LITERAL - R_MICROMIPS_min },
2736 { BFD_RELOC_MICROMIPS_GOT16, R_MICROMIPS_GOT16 - R_MICROMIPS_min },
2737 { BFD_RELOC_MICROMIPS_7_PCREL_S1, R_MICROMIPS_PC7_S1 - R_MICROMIPS_min },
2738 { BFD_RELOC_MICROMIPS_10_PCREL_S1, R_MICROMIPS_PC10_S1 - R_MICROMIPS_min },
2739 { BFD_RELOC_MICROMIPS_16_PCREL_S1, R_MICROMIPS_PC16_S1 - R_MICROMIPS_min },
2740 { BFD_RELOC_MICROMIPS_CALL16, R_MICROMIPS_CALL16 - R_MICROMIPS_min },
2741 { BFD_RELOC_MICROMIPS_GOT_DISP, R_MICROMIPS_GOT_DISP - R_MICROMIPS_min },
2742 { BFD_RELOC_MICROMIPS_GOT_PAGE, R_MICROMIPS_GOT_PAGE - R_MICROMIPS_min },
2743 { BFD_RELOC_MICROMIPS_GOT_OFST, R_MICROMIPS_GOT_OFST - R_MICROMIPS_min },
2744 { BFD_RELOC_MICROMIPS_GOT_HI16, R_MICROMIPS_GOT_HI16 - R_MICROMIPS_min },
2745 { BFD_RELOC_MICROMIPS_GOT_LO16, R_MICROMIPS_GOT_LO16 - R_MICROMIPS_min },
2746 { BFD_RELOC_MICROMIPS_SUB, R_MICROMIPS_SUB - R_MICROMIPS_min },
2747 { BFD_RELOC_MICROMIPS_HIGHER, R_MICROMIPS_HIGHER - R_MICROMIPS_min },
2748 { BFD_RELOC_MICROMIPS_HIGHEST, R_MICROMIPS_HIGHEST - R_MICROMIPS_min },
2749 { BFD_RELOC_MICROMIPS_CALL_HI16, R_MICROMIPS_CALL_HI16 - R_MICROMIPS_min },
2750 { BFD_RELOC_MICROMIPS_CALL_LO16, R_MICROMIPS_CALL_LO16 - R_MICROMIPS_min },
2751 };
2752
2753 /* Given a BFD reloc type, return a howto structure. */
2754
2755 static reloc_howto_type *
2756 bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
2757 bfd_reloc_code_real_type code)
2758 {
2759 unsigned int i;
2760 /* FIXME: We default to RELA here instead of choosing the right
2761 relocation variant. */
2762 reloc_howto_type *howto_table = elf_mips_howto_table_rela;
2763 reloc_howto_type *howto16_table = elf_mips16_howto_table_rela;
2764 reloc_howto_type *howto_micromips_table = elf_micromips_howto_table_rela;
2765
2766 for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map);
2767 i++)
2768 {
2769 if (mips_reloc_map[i].bfd_val == code)
2770 return &howto_table[(int) mips_reloc_map[i].elf_val];
2771 }
2772
2773 for (i = 0; i < sizeof (mips16_reloc_map) / sizeof (struct elf_reloc_map);
2774 i++)
2775 {
2776 if (mips16_reloc_map[i].bfd_val == code)
2777 return &howto16_table[(int) mips16_reloc_map[i].elf_val];
2778 }
2779
2780 for (i = 0; i < sizeof (micromips_reloc_map) / sizeof (struct elf_reloc_map);
2781 i++)
2782 {
2783 if (micromips_reloc_map[i].bfd_val == code)
2784 return &howto_micromips_table[(int) micromips_reloc_map[i].elf_val];
2785 }
2786
2787 switch (code)
2788 {
2789 case BFD_RELOC_VTABLE_INHERIT:
2790 return &elf_mips_gnu_vtinherit_howto;
2791 case BFD_RELOC_VTABLE_ENTRY:
2792 return &elf_mips_gnu_vtentry_howto;
2793 case BFD_RELOC_MIPS_COPY:
2794 return &elf_mips_copy_howto;
2795 case BFD_RELOC_MIPS_JUMP_SLOT:
2796 return &elf_mips_jump_slot_howto;
2797 default:
2798 bfd_set_error (bfd_error_bad_value);
2799 return NULL;
2800 }
2801 }
2802
2803 static reloc_howto_type *
2804 bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
2805 const char *r_name)
2806 {
2807 unsigned int i;
2808
2809 for (i = 0;
2810 i < (sizeof (elf_mips_howto_table_rela)
2811 / sizeof (elf_mips_howto_table_rela[0]));
2812 i++)
2813 if (elf_mips_howto_table_rela[i].name != NULL
2814 && strcasecmp (elf_mips_howto_table_rela[i].name, r_name) == 0)
2815 return &elf_mips_howto_table_rela[i];
2816
2817 for (i = 0;
2818 i < (sizeof (elf_mips16_howto_table_rela)
2819 / sizeof (elf_mips16_howto_table_rela[0]));
2820 i++)
2821 if (elf_mips16_howto_table_rela[i].name != NULL
2822 && strcasecmp (elf_mips16_howto_table_rela[i].name, r_name) == 0)
2823 return &elf_mips16_howto_table_rela[i];
2824
2825 for (i = 0;
2826 i < (sizeof (elf_micromips_howto_table_rela)
2827 / sizeof (elf_micromips_howto_table_rela[0]));
2828 i++)
2829 if (elf_micromips_howto_table_rela[i].name != NULL
2830 && strcasecmp (elf_micromips_howto_table_rela[i].name, r_name) == 0)
2831 return &elf_micromips_howto_table_rela[i];
2832
2833 if (strcasecmp (elf_mips_gnu_vtinherit_howto.name, r_name) == 0)
2834 return &elf_mips_gnu_vtinherit_howto;
2835 if (strcasecmp (elf_mips_gnu_vtentry_howto.name, r_name) == 0)
2836 return &elf_mips_gnu_vtentry_howto;
2837 if (strcasecmp (elf_mips_gnu_rel16_s2.name, r_name) == 0)
2838 return &elf_mips_gnu_rel16_s2;
2839 if (strcasecmp (elf_mips_gnu_rela16_s2.name, r_name) == 0)
2840 return &elf_mips_gnu_rela16_s2;
2841 if (strcasecmp (elf_mips_copy_howto.name, r_name) == 0)
2842 return &elf_mips_copy_howto;
2843 if (strcasecmp (elf_mips_jump_slot_howto.name, r_name) == 0)
2844 return &elf_mips_jump_slot_howto;
2845
2846 return NULL;
2847 }
2848
2849 /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
2850
2851 static reloc_howto_type *
2852 mips_elf_n32_rtype_to_howto (unsigned int r_type, bfd_boolean rela_p)
2853 {
2854 switch (r_type)
2855 {
2856 case R_MIPS_GNU_VTINHERIT:
2857 return &elf_mips_gnu_vtinherit_howto;
2858 case R_MIPS_GNU_VTENTRY:
2859 return &elf_mips_gnu_vtentry_howto;
2860 case R_MIPS_GNU_REL16_S2:
2861 if (rela_p)
2862 return &elf_mips_gnu_rela16_s2;
2863 else
2864 return &elf_mips_gnu_rel16_s2;
2865 case R_MIPS_COPY:
2866 return &elf_mips_copy_howto;
2867 case R_MIPS_JUMP_SLOT:
2868 return &elf_mips_jump_slot_howto;
2869 default:
2870 if (r_type >= R_MICROMIPS_min && r_type < R_MICROMIPS_max)
2871 {
2872 if (rela_p)
2873 return &elf_micromips_howto_table_rela[r_type - R_MICROMIPS_min];
2874 else
2875 return &elf_micromips_howto_table_rel[r_type - R_MICROMIPS_min];
2876 }
2877 if (r_type >= R_MIPS16_min && r_type < R_MIPS16_max)
2878 {
2879 if (rela_p)
2880 return &elf_mips16_howto_table_rela[r_type - R_MIPS16_min];
2881 else
2882 return &elf_mips16_howto_table_rel[r_type - R_MIPS16_min];
2883 }
2884 BFD_ASSERT (r_type < (unsigned int) R_MIPS_max);
2885 if (rela_p)
2886 return &elf_mips_howto_table_rela[r_type];
2887 else
2888 return &elf_mips_howto_table_rel[r_type];
2889 break;
2890 }
2891 }
2892
2893 /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
2894
2895 static void
2896 mips_info_to_howto_rel (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst)
2897 {
2898 unsigned int r_type;
2899
2900 r_type = ELF32_R_TYPE (dst->r_info);
2901 cache_ptr->howto = mips_elf_n32_rtype_to_howto (r_type, FALSE);
2902
2903 /* The addend for a GPREL16 or LITERAL relocation comes from the GP
2904 value for the object file. We get the addend now, rather than
2905 when we do the relocation, because the symbol manipulations done
2906 by the linker may cause us to lose track of the input BFD. */
2907 if (((*cache_ptr->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0
2908 && (gprel16_reloc_p (r_type) || r_type == (unsigned int) R_MIPS_LITERAL))
2909 cache_ptr->addend = elf_gp (abfd);
2910 }
2911
2912 /* Given a MIPS Elf_Internal_Rela, fill in an arelent structure. */
2913
2914 static void
2915 mips_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED,
2916 arelent *cache_ptr, Elf_Internal_Rela *dst)
2917 {
2918 unsigned int r_type;
2919
2920 r_type = ELF32_R_TYPE (dst->r_info);
2921 cache_ptr->howto = mips_elf_n32_rtype_to_howto (r_type, TRUE);
2922 cache_ptr->addend = dst->r_addend;
2923 }
2924 \f
2925 /* Determine whether a symbol is global for the purposes of splitting
2926 the symbol table into global symbols and local symbols. At least
2927 on Irix 5, this split must be between section symbols and all other
2928 symbols. On most ELF targets the split is between static symbols
2929 and externally visible symbols. */
2930
2931 static bfd_boolean
2932 mips_elf_sym_is_global (bfd *abfd ATTRIBUTE_UNUSED, asymbol *sym)
2933 {
2934 if (SGI_COMPAT (abfd))
2935 return (sym->flags & BSF_SECTION_SYM) == 0;
2936 else
2937 return ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE)) != 0
2938 || bfd_is_und_section (bfd_get_section (sym))
2939 || bfd_is_com_section (bfd_get_section (sym)));
2940 }
2941 \f
2942 /* Set the right machine number for a MIPS ELF file. */
2943
2944 static bfd_boolean
2945 mips_elf_n32_object_p (bfd *abfd)
2946 {
2947 unsigned long mach;
2948
2949 /* Irix 5 and 6 are broken. Object file symbol tables are not always
2950 sorted correctly such that local symbols precede global symbols,
2951 and the sh_info field in the symbol table is not always right. */
2952 if (SGI_COMPAT (abfd))
2953 elf_bad_symtab (abfd) = TRUE;
2954
2955 mach = _bfd_elf_mips_mach (elf_elfheader (abfd)->e_flags);
2956 bfd_default_set_arch_mach (abfd, bfd_arch_mips, mach);
2957
2958 if (! ABI_N32_P(abfd))
2959 return FALSE;
2960
2961 return TRUE;
2962 }
2963 \f
2964 /* Support for core dump NOTE sections. */
2965 static bfd_boolean
2966 elf32_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
2967 {
2968 int offset;
2969 unsigned int size;
2970
2971 switch (note->descsz)
2972 {
2973 default:
2974 return FALSE;
2975
2976 case 440: /* Linux/MIPS N32 */
2977 /* pr_cursig */
2978 elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
2979
2980 /* pr_pid */
2981 elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
2982
2983 /* pr_reg */
2984 offset = 72;
2985 size = 360;
2986
2987 break;
2988 }
2989
2990 /* Make a ".reg/999" section. */
2991 return _bfd_elfcore_make_pseudosection (abfd, ".reg", size,
2992 note->descpos + offset);
2993 }
2994
2995 static bfd_boolean
2996 elf32_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
2997 {
2998 switch (note->descsz)
2999 {
3000 default:
3001 return FALSE;
3002
3003 case 128: /* Linux/MIPS elf_prpsinfo */
3004 elf_tdata (abfd)->core_program
3005 = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
3006 elf_tdata (abfd)->core_command
3007 = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
3008 }
3009
3010 /* Note that for some reason, a spurious space is tacked
3011 onto the end of the args in some (at least one anyway)
3012 implementations, so strip it off if it exists. */
3013
3014 {
3015 char *command = elf_tdata (abfd)->core_command;
3016 int n = strlen (command);
3017
3018 if (0 < n && command[n - 1] == ' ')
3019 command[n - 1] = '\0';
3020 }
3021
3022 return TRUE;
3023 }
3024 \f
3025 /* Depending on the target vector we generate some version of Irix
3026 executables or "normal" MIPS ELF ABI executables. */
3027 static irix_compat_t
3028 elf_n32_mips_irix_compat (bfd *abfd)
3029 {
3030 if ((abfd->xvec == &bfd_elf32_nbigmips_vec)
3031 || (abfd->xvec == &bfd_elf32_nlittlemips_vec))
3032 return ict_irix6;
3033 else
3034 return ict_none;
3035 }
3036 \f
3037 /* ECOFF swapping routines. These are used when dealing with the
3038 .mdebug section, which is in the ECOFF debugging format. */
3039 static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
3040 /* Symbol table magic number. */
3041 magicSym,
3042 /* Alignment of debugging information. E.g., 4. */
3043 4,
3044 /* Sizes of external symbolic information. */
3045 sizeof (struct hdr_ext),
3046 sizeof (struct dnr_ext),
3047 sizeof (struct pdr_ext),
3048 sizeof (struct sym_ext),
3049 sizeof (struct opt_ext),
3050 sizeof (struct fdr_ext),
3051 sizeof (struct rfd_ext),
3052 sizeof (struct ext_ext),
3053 /* Functions to swap in external symbolic data. */
3054 ecoff_swap_hdr_in,
3055 ecoff_swap_dnr_in,
3056 ecoff_swap_pdr_in,
3057 ecoff_swap_sym_in,
3058 ecoff_swap_opt_in,
3059 ecoff_swap_fdr_in,
3060 ecoff_swap_rfd_in,
3061 ecoff_swap_ext_in,
3062 _bfd_ecoff_swap_tir_in,
3063 _bfd_ecoff_swap_rndx_in,
3064 /* Functions to swap out external symbolic data. */
3065 ecoff_swap_hdr_out,
3066 ecoff_swap_dnr_out,
3067 ecoff_swap_pdr_out,
3068 ecoff_swap_sym_out,
3069 ecoff_swap_opt_out,
3070 ecoff_swap_fdr_out,
3071 ecoff_swap_rfd_out,
3072 ecoff_swap_ext_out,
3073 _bfd_ecoff_swap_tir_out,
3074 _bfd_ecoff_swap_rndx_out,
3075 /* Function to read in symbolic data. */
3076 _bfd_mips_elf_read_ecoff_info
3077 };
3078 \f
3079 #define ELF_ARCH bfd_arch_mips
3080 #define ELF_TARGET_ID MIPS_ELF_DATA
3081 #define ELF_MACHINE_CODE EM_MIPS
3082
3083 #define elf_backend_collect TRUE
3084 #define elf_backend_type_change_ok TRUE
3085 #define elf_backend_can_gc_sections TRUE
3086 #define elf_info_to_howto mips_info_to_howto_rela
3087 #define elf_info_to_howto_rel mips_info_to_howto_rel
3088 #define elf_backend_sym_is_global mips_elf_sym_is_global
3089 #define elf_backend_object_p mips_elf_n32_object_p
3090 #define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing
3091 #define elf_backend_section_processing _bfd_mips_elf_section_processing
3092 #define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr
3093 #define elf_backend_fake_sections _bfd_mips_elf_fake_sections
3094 #define elf_backend_section_from_bfd_section \
3095 _bfd_mips_elf_section_from_bfd_section
3096 #define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook
3097 #define elf_backend_link_output_symbol_hook \
3098 _bfd_mips_elf_link_output_symbol_hook
3099 #define elf_backend_create_dynamic_sections \
3100 _bfd_mips_elf_create_dynamic_sections
3101 #define elf_backend_check_relocs _bfd_mips_elf_check_relocs
3102 #define elf_backend_merge_symbol_attribute \
3103 _bfd_mips_elf_merge_symbol_attribute
3104 #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag
3105 #define elf_backend_adjust_dynamic_symbol \
3106 _bfd_mips_elf_adjust_dynamic_symbol
3107 #define elf_backend_always_size_sections \
3108 _bfd_mips_elf_always_size_sections
3109 #define elf_backend_size_dynamic_sections \
3110 _bfd_mips_elf_size_dynamic_sections
3111 #define elf_backend_init_index_section _bfd_elf_init_1_index_section
3112 #define elf_backend_relocate_section _bfd_mips_elf_relocate_section
3113 #define elf_backend_finish_dynamic_symbol \
3114 _bfd_mips_elf_finish_dynamic_symbol
3115 #define elf_backend_finish_dynamic_sections \
3116 _bfd_mips_elf_finish_dynamic_sections
3117 #define elf_backend_final_write_processing \
3118 _bfd_mips_elf_final_write_processing
3119 #define elf_backend_additional_program_headers \
3120 _bfd_mips_elf_additional_program_headers
3121 #define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map
3122 #define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook
3123 #define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook
3124 #define elf_backend_copy_indirect_symbol \
3125 _bfd_mips_elf_copy_indirect_symbol
3126 #define elf_backend_grok_prstatus elf32_mips_grok_prstatus
3127 #define elf_backend_grok_psinfo elf32_mips_grok_psinfo
3128 #define elf_backend_ecoff_debug_swap &mips_elf32_ecoff_debug_swap
3129
3130 #define elf_backend_got_header_size (4 * MIPS_RESERVED_GOTNO)
3131
3132 /* MIPS n32 ELF can use a mixture of REL and RELA, but some Relocations
3133 work better/work only in RELA, so we default to this. */
3134 #define elf_backend_may_use_rel_p 1
3135 #define elf_backend_may_use_rela_p 1
3136 #define elf_backend_default_use_rela_p 1
3137 #define elf_backend_rela_plts_and_copies_p 0
3138 #define elf_backend_sign_extend_vma TRUE
3139 #define elf_backend_plt_readonly 1
3140 #define elf_backend_plt_sym_val _bfd_mips_elf_plt_sym_val
3141
3142 #define elf_backend_discard_info _bfd_mips_elf_discard_info
3143 #define elf_backend_ignore_discarded_relocs \
3144 _bfd_mips_elf_ignore_discarded_relocs
3145 #define elf_backend_write_section _bfd_mips_elf_write_section
3146 #define elf_backend_mips_irix_compat elf_n32_mips_irix_compat
3147 #define elf_backend_mips_rtype_to_howto mips_elf_n32_rtype_to_howto
3148 #define bfd_elf32_bfd_is_target_special_symbol \
3149 _bfd_mips_elf_is_target_special_symbol
3150 #define bfd_elf32_find_nearest_line _bfd_mips_elf_find_nearest_line
3151 #define bfd_elf32_find_inliner_info _bfd_mips_elf_find_inliner_info
3152 #define bfd_elf32_new_section_hook _bfd_mips_elf_new_section_hook
3153 #define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents
3154 #define bfd_elf32_bfd_get_relocated_section_contents \
3155 _bfd_elf_mips_get_relocated_section_contents
3156 #define bfd_elf32_bfd_link_hash_table_create \
3157 _bfd_mips_elf_link_hash_table_create
3158 #define bfd_elf32_bfd_final_link _bfd_mips_elf_final_link
3159 #define bfd_elf32_bfd_merge_private_bfd_data \
3160 _bfd_mips_elf_merge_private_bfd_data
3161 #define bfd_elf32_bfd_set_private_flags _bfd_mips_elf_set_private_flags
3162 #define bfd_elf32_bfd_print_private_bfd_data \
3163 _bfd_mips_elf_print_private_bfd_data
3164 #define bfd_elf32_bfd_relax_section _bfd_mips_relax_section
3165
3166 /* Support for SGI-ish mips targets using n32 ABI. */
3167
3168 #define TARGET_LITTLE_SYM bfd_elf32_nlittlemips_vec
3169 #define TARGET_LITTLE_NAME "elf32-nlittlemips"
3170 #define TARGET_BIG_SYM bfd_elf32_nbigmips_vec
3171 #define TARGET_BIG_NAME "elf32-nbigmips"
3172
3173 #define ELF_MAXPAGESIZE 0x10000
3174 #define ELF_COMMONPAGESIZE 0x1000
3175
3176 #include "elf32-target.h"
3177
3178 /* Support for traditional mips targets using n32 ABI. */
3179 #undef TARGET_LITTLE_SYM
3180 #undef TARGET_LITTLE_NAME
3181 #undef TARGET_BIG_SYM
3182 #undef TARGET_BIG_NAME
3183
3184 #undef ELF_MAXPAGESIZE
3185 #undef ELF_COMMONPAGESIZE
3186
3187 #define TARGET_LITTLE_SYM bfd_elf32_ntradlittlemips_vec
3188 #define TARGET_LITTLE_NAME "elf32-ntradlittlemips"
3189 #define TARGET_BIG_SYM bfd_elf32_ntradbigmips_vec
3190 #define TARGET_BIG_NAME "elf32-ntradbigmips"
3191
3192 #define ELF_MAXPAGESIZE 0x10000
3193 #define ELF_COMMONPAGESIZE 0x1000
3194 #define elf32_bed elf32_tradbed
3195
3196 /* Include the target file again for this target. */
3197 #include "elf32-target.h"
3198
3199
3200 /* FreeBSD support. */
3201
3202 #undef TARGET_LITTLE_SYM
3203 #undef TARGET_LITTLE_NAME
3204 #undef TARGET_BIG_SYM
3205 #undef TARGET_BIG_NAME
3206
3207 #define TARGET_LITTLE_SYM bfd_elf32_ntradlittlemips_freebsd_vec
3208 #define TARGET_LITTLE_NAME "elf32-ntradlittlemips-freebsd"
3209 #define TARGET_BIG_SYM bfd_elf32_ntradbigmips_freebsd_vec
3210 #define TARGET_BIG_NAME "elf32-ntradbigmips-freebsd"
3211
3212 #undef ELF_OSABI
3213 #define ELF_OSABI ELFOSABI_FREEBSD
3214
3215 /* The kernel recognizes executables as valid only if they carry a
3216 "FreeBSD" label in the ELF header. So we put this label on all
3217 executables and (for simplicity) also all other object files. */
3218
3219 static void
3220 elf_fbsd_post_process_headers (bfd *abfd, struct bfd_link_info *info)
3221 {
3222 _bfd_elf_set_osabi (abfd, info);
3223 }
3224
3225 #undef elf_backend_post_process_headers
3226 #define elf_backend_post_process_headers elf_fbsd_post_process_headers
3227 #undef elf32_bed
3228 #define elf32_bed elf32_fbsd_tradbed
3229
3230 #include "elf32-target.h"