]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - bfd/elf64-mips.c
* elf64-mips.c: Extensive additions to provide better support for
[thirdparty/binutils-gdb.git] / bfd / elf64-mips.c
1 /* MIPS-specific support for 64-bit ELF
2 Copyright 1996 Free Software Foundation, Inc.
3 Ian Lance Taylor, Cygnus Support
4
5 This file is part of BFD, the Binary File Descriptor library.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20
21 /* This file supports the 64-bit MIPS ELF ABI.
22
23 The MIPS 64-bit ELF ABI uses an unusual reloc format. This file
24 overrides the usual ELF reloc handling, and handles reading and
25 writing the relocations here. */
26
27 #include "bfd.h"
28 #include "sysdep.h"
29 #include "libbfd.h"
30 #include "bfdlink.h"
31 #include "genlink.h"
32 #include "elf-bfd.h"
33 #include "elf/mips.h"
34
35 /* Get the ECOFF swapping routines. The 64-bit ABI is not supposed to
36 use ECOFF. However, we support it anyhow for an easier changeover. */
37 #include "coff/sym.h"
38 #include "coff/symconst.h"
39 #include "coff/internal.h"
40 #include "coff/ecoff.h"
41 /* The 64 bit versions of the mdebug data structures are in alpha.h. */
42 #include "coff/alpha.h"
43 #define ECOFF_64
44 #include "ecoffswap.h"
45
46 static void mips_elf64_swap_reloc_in
47 PARAMS ((bfd *, const Elf64_Mips_External_Rel *,
48 Elf64_Mips_Internal_Rel *));
49 static void mips_elf64_swap_reloca_in
50 PARAMS ((bfd *, const Elf64_Mips_External_Rela *,
51 Elf64_Mips_Internal_Rela *));
52 #if 0
53 static void mips_elf64_swap_reloc_out
54 PARAMS ((bfd *, const Elf64_Mips_Internal_Rel *,
55 Elf64_Mips_External_Rel *));
56 #endif
57 static void mips_elf64_swap_reloca_out
58 PARAMS ((bfd *, const Elf64_Mips_Internal_Rela *,
59 Elf64_Mips_External_Rela *));
60 static reloc_howto_type *mips_elf64_reloc_type_lookup
61 PARAMS ((bfd *, bfd_reloc_code_real_type));
62 static long mips_elf64_get_reloc_upper_bound PARAMS ((bfd *, asection *));
63 static boolean mips_elf64_slurp_one_reloc_table
64 PARAMS ((bfd *, asection *, asymbol **, const Elf_Internal_Shdr *));
65 static boolean mips_elf64_slurp_reloc_table
66 PARAMS ((bfd *, asection *, asymbol **));
67 static void mips_elf64_write_relocs PARAMS ((bfd *, asection *, PTR));
68 static boolean mips_elf64_section_from_shdr
69 PARAMS ((bfd *, Elf_Internal_Shdr *, char *));
70
71 /* The relocation types. */
72
73 enum mips_elf64_reloc_type
74 {
75 R_MIPS_NONE = 0,
76 R_MIPS_16 = 1,
77 R_MIPS_32 = 2,
78 R_MIPS_ADD = 2,
79 R_MIPS_REL32 = 3,
80 R_MIPS_REL = 3,
81 R_MIPS_26 = 4,
82 R_MIPS_HI16 = 5,
83 R_MIPS_LO16 = 6,
84 R_MIPS_GPREL16 = 7,
85 R_MIPS_GPREL = 7,
86 R_MIPS_LITERAL = 8,
87 R_MIPS_GOT16 = 9,
88 R_MIPS_GOT = 9,
89 R_MIPS_PC16 = 10,
90 R_MIPS_CALL16 = 11,
91 R_MIPS_CALL = 11,
92 R_MIPS_GPREL32 = 12,
93 R_MIPS_SHIFT5 = 16,
94 R_MIPS_SHIFT6 = 17,
95 R_MIPS_64 = 18,
96 R_MIPS_GOT_DISP = 19,
97 R_MIPS_GOT_PAGE = 20,
98 R_MIPS_GOT_OFST = 21,
99 R_MIPS_GOT_HI16 = 22,
100 R_MIPS_GOT_LO16 = 23,
101 R_MIPS_SUB = 24,
102 R_MIPS_INSERT_A = 25,
103 R_MIPS_INSERT_B = 26,
104 R_MIPS_DELETE = 27,
105 R_MIPS_HIGHER = 28,
106 R_MIPS_HIGHEST = 29,
107 R_MIPS_CALL_HI16 = 30,
108 R_MIPS_CALL_LO16 = 31,
109 R_MIPS_SCN_DISP = 32,
110 R_MIPS_REL16 = 33,
111 R_MIPS_ADD_IMMEDIATE = 34,
112 R_MIPS_PJUMP = 35,
113 R_MIPS_RELGOT = 36
114 };
115
116 /* In case we're on a 32-bit machine, construct a 64-bit "-1" value
117 from smaller values. Start with zero, widen, *then* decrement. */
118 #define MINUS_ONE (((bfd_vma)0) - 1)
119
120 /* FIXME: These need to be rewritten, or we need to use the versions
121 in elf32-mips.c. */
122 #define mips_elf_hi16_reloc bfd_elf_generic_reloc
123 #define mips_elf_lo16_reloc bfd_elf_generic_reloc
124 #define mips_elf_gprel16_reloc bfd_elf_generic_reloc
125 #define mips_elf_got16_reloc bfd_elf_generic_reloc
126 #define mips_elf_gprel32_reloc bfd_elf_generic_reloc
127
128 /* The relocation table used for SHT_REL sections. */
129
130 static reloc_howto_type mips_elf64_howto_table_rel[] =
131 {
132 /* No relocation. */
133 HOWTO (R_MIPS_NONE, /* type */
134 0, /* rightshift */
135 0, /* size (0 = byte, 1 = short, 2 = long) */
136 0, /* bitsize */
137 false, /* pc_relative */
138 0, /* bitpos */
139 complain_overflow_dont, /* complain_on_overflow */
140 bfd_elf_generic_reloc, /* special_function */
141 "R_MIPS_NONE", /* name */
142 false, /* partial_inplace */
143 0, /* src_mask */
144 0, /* dst_mask */
145 false), /* pcrel_offset */
146
147 /* 16 bit relocation. */
148 HOWTO (R_MIPS_16, /* type */
149 0, /* rightshift */
150 1, /* size (0 = byte, 1 = short, 2 = long) */
151 16, /* bitsize */
152 false, /* pc_relative */
153 0, /* bitpos */
154 complain_overflow_bitfield, /* complain_on_overflow */
155 bfd_elf_generic_reloc, /* special_function */
156 "R_MIPS_16", /* name */
157 true, /* partial_inplace */
158 0xffff, /* src_mask */
159 0xffff, /* dst_mask */
160 false), /* pcrel_offset */
161
162 /* 32 bit relocation. */
163 HOWTO (R_MIPS_32, /* type */
164 0, /* rightshift */
165 2, /* size (0 = byte, 1 = short, 2 = long) */
166 32, /* bitsize */
167 false, /* pc_relative */
168 0, /* bitpos */
169 complain_overflow_bitfield, /* complain_on_overflow */
170 bfd_elf_generic_reloc, /* special_function */
171 "R_MIPS_32", /* name */
172 true, /* partial_inplace */
173 0xffffffff, /* src_mask */
174 0xffffffff, /* dst_mask */
175 false), /* pcrel_offset */
176
177 /* 32 bit symbol relative relocation. */
178 HOWTO (R_MIPS_REL32, /* type */
179 0, /* rightshift */
180 2, /* size (0 = byte, 1 = short, 2 = long) */
181 32, /* bitsize */
182 false, /* pc_relative */
183 0, /* bitpos */
184 complain_overflow_bitfield, /* complain_on_overflow */
185 bfd_elf_generic_reloc, /* special_function */
186 "R_MIPS_REL32", /* name */
187 true, /* partial_inplace */
188 0xffffffff, /* src_mask */
189 0xffffffff, /* dst_mask */
190 false), /* pcrel_offset */
191
192 /* 26 bit branch address. */
193 HOWTO (R_MIPS_26, /* type */
194 2, /* rightshift */
195 2, /* size (0 = byte, 1 = short, 2 = long) */
196 26, /* bitsize */
197 false, /* pc_relative */
198 0, /* bitpos */
199 complain_overflow_dont, /* complain_on_overflow */
200 /* This needs complex overflow
201 detection, because the upper four
202 bits must match the PC. */
203 bfd_elf_generic_reloc, /* special_function */
204 "R_MIPS_26", /* name */
205 true, /* partial_inplace */
206 0x3ffffff, /* src_mask */
207 0x3ffffff, /* dst_mask */
208 false), /* pcrel_offset */
209
210 /* High 16 bits of symbol value. */
211 HOWTO (R_MIPS_HI16, /* type */
212 0, /* rightshift */
213 2, /* size (0 = byte, 1 = short, 2 = long) */
214 16, /* bitsize */
215 false, /* pc_relative */
216 0, /* bitpos */
217 complain_overflow_dont, /* complain_on_overflow */
218 mips_elf_hi16_reloc, /* special_function */
219 "R_MIPS_HI16", /* name */
220 true, /* partial_inplace */
221 0xffff, /* src_mask */
222 0xffff, /* dst_mask */
223 false), /* pcrel_offset */
224
225 /* Low 16 bits of symbol value. */
226 HOWTO (R_MIPS_LO16, /* type */
227 0, /* rightshift */
228 2, /* size (0 = byte, 1 = short, 2 = long) */
229 16, /* bitsize */
230 false, /* pc_relative */
231 0, /* bitpos */
232 complain_overflow_dont, /* complain_on_overflow */
233 mips_elf_lo16_reloc, /* special_function */
234 "R_MIPS_LO16", /* name */
235 true, /* partial_inplace */
236 0xffff, /* src_mask */
237 0xffff, /* dst_mask */
238 false), /* pcrel_offset */
239
240 /* GP relative reference. */
241 HOWTO (R_MIPS_GPREL16, /* type */
242 0, /* rightshift */
243 2, /* size (0 = byte, 1 = short, 2 = long) */
244 16, /* bitsize */
245 false, /* pc_relative */
246 0, /* bitpos */
247 complain_overflow_signed, /* complain_on_overflow */
248 mips_elf_gprel16_reloc, /* special_function */
249 "R_MIPS_GPREL16", /* name */
250 true, /* partial_inplace */
251 0xffff, /* src_mask */
252 0xffff, /* dst_mask */
253 false), /* pcrel_offset */
254
255 /* Reference to literal section. */
256 HOWTO (R_MIPS_LITERAL, /* type */
257 0, /* rightshift */
258 2, /* size (0 = byte, 1 = short, 2 = long) */
259 16, /* bitsize */
260 false, /* pc_relative */
261 0, /* bitpos */
262 complain_overflow_signed, /* complain_on_overflow */
263 mips_elf_gprel16_reloc, /* special_function */
264 "R_MIPS_LITERAL", /* name */
265 true, /* partial_inplace */
266 0xffff, /* src_mask */
267 0xffff, /* dst_mask */
268 false), /* pcrel_offset */
269
270 /* Reference to global offset table. */
271 HOWTO (R_MIPS_GOT16, /* type */
272 0, /* rightshift */
273 2, /* size (0 = byte, 1 = short, 2 = long) */
274 16, /* bitsize */
275 false, /* pc_relative */
276 0, /* bitpos */
277 complain_overflow_signed, /* complain_on_overflow */
278 mips_elf_got16_reloc, /* special_function */
279 "R_MIPS_GOT16", /* name */
280 false, /* partial_inplace */
281 0, /* src_mask */
282 0xffff, /* dst_mask */
283 false), /* pcrel_offset */
284
285 /* 16 bit PC relative reference. */
286 HOWTO (R_MIPS_PC16, /* type */
287 0, /* rightshift */
288 2, /* size (0 = byte, 1 = short, 2 = long) */
289 16, /* bitsize */
290 true, /* pc_relative */
291 0, /* bitpos */
292 complain_overflow_signed, /* complain_on_overflow */
293 bfd_elf_generic_reloc, /* special_function */
294 "R_MIPS_PC16", /* name */
295 true, /* partial_inplace */
296 0xffff, /* src_mask */
297 0xffff, /* dst_mask */
298 false), /* pcrel_offset */
299
300 /* 16 bit call through global offset table. */
301 /* FIXME: This is not handled correctly. */
302 HOWTO (R_MIPS_CALL16, /* type */
303 0, /* rightshift */
304 2, /* size (0 = byte, 1 = short, 2 = long) */
305 16, /* bitsize */
306 false, /* pc_relative */
307 0, /* bitpos */
308 complain_overflow_signed, /* complain_on_overflow */
309 bfd_elf_generic_reloc, /* special_function */
310 "R_MIPS_CALL16", /* name */
311 false, /* partial_inplace */
312 0, /* src_mask */
313 0xffff, /* dst_mask */
314 false), /* pcrel_offset */
315
316 /* 32 bit GP relative reference. */
317 HOWTO (R_MIPS_GPREL32, /* type */
318 0, /* rightshift */
319 2, /* size (0 = byte, 1 = short, 2 = long) */
320 32, /* bitsize */
321 false, /* pc_relative */
322 0, /* bitpos */
323 complain_overflow_bitfield, /* complain_on_overflow */
324 mips_elf_gprel32_reloc, /* special_function */
325 "R_MIPS_GPREL32", /* name */
326 true, /* partial_inplace */
327 0xffffffff, /* src_mask */
328 0xffffffff, /* dst_mask */
329 false), /* pcrel_offset */
330
331 { 13 },
332 { 14 },
333 { 15 },
334
335 /* A 5 bit shift field. */
336 HOWTO (R_MIPS_SHIFT5, /* type */
337 0, /* rightshift */
338 2, /* size (0 = byte, 1 = short, 2 = long) */
339 5, /* bitsize */
340 false, /* pc_relative */
341 6, /* bitpos */
342 complain_overflow_bitfield, /* complain_on_overflow */
343 bfd_elf_generic_reloc, /* special_function */
344 "R_MIPS_SHIFT5", /* name */
345 true, /* partial_inplace */
346 0x000007c0, /* src_mask */
347 0x000007c0, /* dst_mask */
348 false), /* pcrel_offset */
349
350 /* A 6 bit shift field. */
351 /* FIXME: This is not handled correctly; a special function is
352 needed to put the most significant bit in the right place. */
353 HOWTO (R_MIPS_SHIFT6, /* type */
354 0, /* rightshift */
355 2, /* size (0 = byte, 1 = short, 2 = long) */
356 6, /* bitsize */
357 false, /* pc_relative */
358 6, /* bitpos */
359 complain_overflow_bitfield, /* complain_on_overflow */
360 bfd_elf_generic_reloc, /* special_function */
361 "R_MIPS_SHIFT6", /* name */
362 true, /* partial_inplace */
363 0x000007c4, /* src_mask */
364 0x000007c4, /* dst_mask */
365 false), /* pcrel_offset */
366
367 /* 64 bit relocation. */
368 HOWTO (R_MIPS_64, /* type */
369 0, /* rightshift */
370 4, /* size (0 = byte, 1 = short, 2 = long) */
371 64, /* bitsize */
372 false, /* pc_relative */
373 0, /* bitpos */
374 complain_overflow_bitfield, /* complain_on_overflow */
375 bfd_elf_generic_reloc, /* special_function */
376 "R_MIPS_64", /* name */
377 true, /* partial_inplace */
378 MINUS_ONE, /* src_mask */
379 MINUS_ONE, /* dst_mask */
380 false), /* pcrel_offset */
381
382 /* Displacement in the global offset table. */
383 /* FIXME: Not handled correctly. */
384 HOWTO (R_MIPS_GOT_DISP, /* type */
385 0, /* rightshift */
386 2, /* size (0 = byte, 1 = short, 2 = long) */
387 16, /* bitsize */
388 false, /* pc_relative */
389 0, /* bitpos */
390 complain_overflow_bitfield, /* complain_on_overflow */
391 bfd_elf_generic_reloc, /* special_function */
392 "R_MIPS_GOT_DISP", /* name */
393 true, /* partial_inplace */
394 0x0000ffff, /* src_mask */
395 0x0000ffff, /* dst_mask */
396 false), /* pcrel_offset */
397
398 /* Displacement to page pointer in the global offset table. */
399 /* FIXME: Not handled correctly. */
400 HOWTO (R_MIPS_GOT_PAGE, /* type */
401 0, /* rightshift */
402 2, /* size (0 = byte, 1 = short, 2 = long) */
403 16, /* bitsize */
404 false, /* pc_relative */
405 0, /* bitpos */
406 complain_overflow_bitfield, /* complain_on_overflow */
407 bfd_elf_generic_reloc, /* special_function */
408 "R_MIPS_GOT_PAGE", /* name */
409 true, /* partial_inplace */
410 0x0000ffff, /* src_mask */
411 0x0000ffff, /* dst_mask */
412 false), /* pcrel_offset */
413
414 /* Offset from page pointer in the global offset table. */
415 /* FIXME: Not handled correctly. */
416 HOWTO (R_MIPS_GOT_OFST, /* type */
417 0, /* rightshift */
418 2, /* size (0 = byte, 1 = short, 2 = long) */
419 16, /* bitsize */
420 false, /* pc_relative */
421 0, /* bitpos */
422 complain_overflow_bitfield, /* complain_on_overflow */
423 bfd_elf_generic_reloc, /* special_function */
424 "R_MIPS_GOT_OFST", /* name */
425 true, /* partial_inplace */
426 0x0000ffff, /* src_mask */
427 0x0000ffff, /* dst_mask */
428 false), /* pcrel_offset */
429
430 /* High 16 bits of displacement in global offset table. */
431 /* FIXME: Not handled correctly. */
432 HOWTO (R_MIPS_GOT_HI16, /* type */
433 0, /* rightshift */
434 2, /* size (0 = byte, 1 = short, 2 = long) */
435 16, /* bitsize */
436 false, /* pc_relative */
437 0, /* bitpos */
438 complain_overflow_dont, /* complain_on_overflow */
439 bfd_elf_generic_reloc, /* special_function */
440 "R_MIPS_GOT_HI16", /* name */
441 true, /* partial_inplace */
442 0x0000ffff, /* src_mask */
443 0x0000ffff, /* dst_mask */
444 false), /* pcrel_offset */
445
446 /* Low 16 bits of displacement in global offset table. */
447 /* FIXME: Not handled correctly. */
448 HOWTO (R_MIPS_GOT_LO16, /* type */
449 0, /* rightshift */
450 2, /* size (0 = byte, 1 = short, 2 = long) */
451 16, /* bitsize */
452 false, /* pc_relative */
453 0, /* bitpos */
454 complain_overflow_dont, /* complain_on_overflow */
455 bfd_elf_generic_reloc, /* special_function */
456 "R_MIPS_GOT_LO16", /* name */
457 true, /* partial_inplace */
458 0x0000ffff, /* src_mask */
459 0x0000ffff, /* dst_mask */
460 false), /* pcrel_offset */
461
462 /* 64 bit substraction. */
463 /* FIXME: Not handled correctly. */
464 HOWTO (R_MIPS_SUB, /* type */
465 0, /* rightshift */
466 4, /* size (0 = byte, 1 = short, 2 = long) */
467 64, /* bitsize */
468 false, /* pc_relative */
469 0, /* bitpos */
470 complain_overflow_bitfield, /* complain_on_overflow */
471 bfd_elf_generic_reloc, /* special_function */
472 "R_MIPS_SUB", /* name */
473 true, /* partial_inplace */
474 MINUS_ONE, /* src_mask */
475 MINUS_ONE, /* dst_mask */
476 false), /* pcrel_offset */
477
478 /* Insert the addend as an instruction. */
479 /* FIXME: Not handled correctly. */
480 HOWTO (R_MIPS_INSERT_A, /* type */
481 0, /* rightshift */
482 0, /* size (0 = byte, 1 = short, 2 = long) */
483 0, /* bitsize */
484 false, /* pc_relative */
485 0, /* bitpos */
486 complain_overflow_dont, /* complain_on_overflow */
487 bfd_elf_generic_reloc, /* special_function */
488 "R_MIPS_INSERT_A", /* name */
489 false, /* partial_inplace */
490 0, /* src_mask */
491 0, /* dst_mask */
492 false), /* pcrel_offset */
493
494 /* Insert the addend as an instruction, and change all relocations
495 to refer to the old instruction at the address. */
496 /* FIXME: Not handled correctly. */
497 HOWTO (R_MIPS_INSERT_B, /* type */
498 0, /* rightshift */
499 0, /* size (0 = byte, 1 = short, 2 = long) */
500 0, /* bitsize */
501 false, /* pc_relative */
502 0, /* bitpos */
503 complain_overflow_dont, /* complain_on_overflow */
504 bfd_elf_generic_reloc, /* special_function */
505 "R_MIPS_INSERT_B", /* name */
506 false, /* partial_inplace */
507 0, /* src_mask */
508 0, /* dst_mask */
509 false), /* pcrel_offset */
510
511 /* Delete a 32 bit instruction. */
512 /* FIXME: Not handled correctly. */
513 HOWTO (R_MIPS_DELETE, /* type */
514 0, /* rightshift */
515 0, /* size (0 = byte, 1 = short, 2 = long) */
516 0, /* bitsize */
517 false, /* pc_relative */
518 0, /* bitpos */
519 complain_overflow_dont, /* complain_on_overflow */
520 bfd_elf_generic_reloc, /* special_function */
521 "R_MIPS_DELETE", /* name */
522 false, /* partial_inplace */
523 0, /* src_mask */
524 0, /* dst_mask */
525 false), /* pcrel_offset */
526
527 /* Get the higher value of a 64 bit addend. */
528 /* FIXME: Not handled correctly. */
529 HOWTO (R_MIPS_HIGHER, /* type */
530 0, /* rightshift */
531 2, /* size (0 = byte, 1 = short, 2 = long) */
532 16, /* bitsize */
533 false, /* pc_relative */
534 0, /* bitpos */
535 complain_overflow_dont, /* complain_on_overflow */
536 bfd_elf_generic_reloc, /* special_function */
537 "R_MIPS_HIGHER", /* name */
538 true, /* partial_inplace */
539 0xffff, /* src_mask */
540 0xffff, /* dst_mask */
541 false), /* pcrel_offset */
542
543 /* Get the highest value of a 64 bit addend. */
544 /* FIXME: Not handled correctly. */
545 HOWTO (R_MIPS_HIGHEST, /* type */
546 0, /* rightshift */
547 2, /* size (0 = byte, 1 = short, 2 = long) */
548 16, /* bitsize */
549 false, /* pc_relative */
550 0, /* bitpos */
551 complain_overflow_dont, /* complain_on_overflow */
552 bfd_elf_generic_reloc, /* special_function */
553 "R_MIPS_HIGHEST", /* name */
554 true, /* partial_inplace */
555 0xffff, /* src_mask */
556 0xffff, /* dst_mask */
557 false), /* pcrel_offset */
558
559 /* High 16 bits of displacement in global offset table. */
560 /* FIXME: Not handled correctly. */
561 HOWTO (R_MIPS_CALL_HI16, /* type */
562 0, /* rightshift */
563 2, /* size (0 = byte, 1 = short, 2 = long) */
564 16, /* bitsize */
565 false, /* pc_relative */
566 0, /* bitpos */
567 complain_overflow_dont, /* complain_on_overflow */
568 bfd_elf_generic_reloc, /* special_function */
569 "R_MIPS_CALL_HI16", /* name */
570 true, /* partial_inplace */
571 0x0000ffff, /* src_mask */
572 0x0000ffff, /* dst_mask */
573 false), /* pcrel_offset */
574
575 /* Low 16 bits of displacement in global offset table. */
576 /* FIXME: Not handled correctly. */
577 HOWTO (R_MIPS_CALL_LO16, /* type */
578 0, /* rightshift */
579 2, /* size (0 = byte, 1 = short, 2 = long) */
580 16, /* bitsize */
581 false, /* pc_relative */
582 0, /* bitpos */
583 complain_overflow_dont, /* complain_on_overflow */
584 bfd_elf_generic_reloc, /* special_function */
585 "R_MIPS_CALL_LO16", /* name */
586 true, /* partial_inplace */
587 0x0000ffff, /* src_mask */
588 0x0000ffff, /* dst_mask */
589 false), /* pcrel_offset */
590
591 /* I'm not sure what the remaining relocs are, but they are defined
592 on Irix 6. */
593
594 HOWTO (R_MIPS_SCN_DISP, /* type */
595 0, /* rightshift */
596 0, /* size (0 = byte, 1 = short, 2 = long) */
597 0, /* bitsize */
598 false, /* pc_relative */
599 0, /* bitpos */
600 complain_overflow_dont, /* complain_on_overflow */
601 bfd_elf_generic_reloc, /* special_function */
602 "R_MIPS_SCN_DISP", /* name */
603 false, /* partial_inplace */
604 0, /* src_mask */
605 0, /* dst_mask */
606 false), /* pcrel_offset */
607
608 HOWTO (R_MIPS_REL16, /* type */
609 0, /* rightshift */
610 0, /* size (0 = byte, 1 = short, 2 = long) */
611 0, /* bitsize */
612 false, /* pc_relative */
613 0, /* bitpos */
614 complain_overflow_dont, /* complain_on_overflow */
615 bfd_elf_generic_reloc, /* special_function */
616 "R_MIPS_REL16", /* name */
617 false, /* partial_inplace */
618 0, /* src_mask */
619 0, /* dst_mask */
620 false), /* pcrel_offset */
621
622 HOWTO (R_MIPS_ADD_IMMEDIATE, /* type */
623 0, /* rightshift */
624 0, /* size (0 = byte, 1 = short, 2 = long) */
625 0, /* bitsize */
626 false, /* pc_relative */
627 0, /* bitpos */
628 complain_overflow_dont, /* complain_on_overflow */
629 bfd_elf_generic_reloc, /* special_function */
630 "R_MIPS_ADD_IMMEDIATE", /* name */
631 false, /* partial_inplace */
632 0, /* src_mask */
633 0, /* dst_mask */
634 false), /* pcrel_offset */
635
636 HOWTO (R_MIPS_PJUMP, /* type */
637 0, /* rightshift */
638 0, /* size (0 = byte, 1 = short, 2 = long) */
639 0, /* bitsize */
640 false, /* pc_relative */
641 0, /* bitpos */
642 complain_overflow_dont, /* complain_on_overflow */
643 bfd_elf_generic_reloc, /* special_function */
644 "R_MIPS_PJUMP", /* name */
645 false, /* partial_inplace */
646 0, /* src_mask */
647 0, /* dst_mask */
648 false), /* pcrel_offset */
649
650 HOWTO (R_MIPS_RELGOT, /* type */
651 0, /* rightshift */
652 0, /* size (0 = byte, 1 = short, 2 = long) */
653 0, /* bitsize */
654 false, /* pc_relative */
655 0, /* bitpos */
656 complain_overflow_dont, /* complain_on_overflow */
657 bfd_elf_generic_reloc, /* special_function */
658 "R_MIPS_RELGOT", /* name */
659 false, /* partial_inplace */
660 0, /* src_mask */
661 0, /* dst_mask */
662 false) /* pcrel_offset */
663 };
664
665 /* The relocation table used for SHT_RELA sections. */
666
667 static reloc_howto_type mips_elf64_howto_table_rela[] =
668 {
669 /* No relocation. */
670 HOWTO (R_MIPS_NONE, /* type */
671 0, /* rightshift */
672 0, /* size (0 = byte, 1 = short, 2 = long) */
673 0, /* bitsize */
674 false, /* pc_relative */
675 0, /* bitpos */
676 complain_overflow_dont, /* complain_on_overflow */
677 bfd_elf_generic_reloc, /* special_function */
678 "R_MIPS_NONE", /* name */
679 false, /* partial_inplace */
680 0, /* src_mask */
681 0, /* dst_mask */
682 false), /* pcrel_offset */
683
684 /* 16 bit relocation. */
685 HOWTO (R_MIPS_16, /* type */
686 0, /* rightshift */
687 1, /* size (0 = byte, 1 = short, 2 = long) */
688 16, /* bitsize */
689 false, /* pc_relative */
690 0, /* bitpos */
691 complain_overflow_bitfield, /* complain_on_overflow */
692 bfd_elf_generic_reloc, /* special_function */
693 "R_MIPS_16", /* name */
694 true, /* partial_inplace */
695 0, /* src_mask */
696 0xffff, /* dst_mask */
697 false), /* pcrel_offset */
698
699 /* 32 bit relocation. */
700 HOWTO (R_MIPS_32, /* type */
701 0, /* rightshift */
702 2, /* size (0 = byte, 1 = short, 2 = long) */
703 32, /* bitsize */
704 false, /* pc_relative */
705 0, /* bitpos */
706 complain_overflow_bitfield, /* complain_on_overflow */
707 bfd_elf_generic_reloc, /* special_function */
708 "R_MIPS_32", /* name */
709 true, /* partial_inplace */
710 0, /* src_mask */
711 0xffffffff, /* dst_mask */
712 false), /* pcrel_offset */
713
714 /* 32 bit symbol relative relocation. */
715 HOWTO (R_MIPS_REL32, /* type */
716 0, /* rightshift */
717 2, /* size (0 = byte, 1 = short, 2 = long) */
718 32, /* bitsize */
719 false, /* pc_relative */
720 0, /* bitpos */
721 complain_overflow_bitfield, /* complain_on_overflow */
722 bfd_elf_generic_reloc, /* special_function */
723 "R_MIPS_REL32", /* name */
724 true, /* partial_inplace */
725 0, /* src_mask */
726 0xffffffff, /* dst_mask */
727 false), /* pcrel_offset */
728
729 /* 26 bit branch address. */
730 HOWTO (R_MIPS_26, /* type */
731 2, /* rightshift */
732 2, /* size (0 = byte, 1 = short, 2 = long) */
733 26, /* bitsize */
734 false, /* pc_relative */
735 0, /* bitpos */
736 complain_overflow_dont, /* complain_on_overflow */
737 /* This needs complex overflow
738 detection, because the upper four
739 bits must match the PC. */
740 bfd_elf_generic_reloc, /* special_function */
741 "R_MIPS_26", /* name */
742 true, /* partial_inplace */
743 0, /* src_mask */
744 0x3ffffff, /* dst_mask */
745 false), /* pcrel_offset */
746
747 /* High 16 bits of symbol value. */
748 HOWTO (R_MIPS_HI16, /* type */
749 0, /* rightshift */
750 2, /* size (0 = byte, 1 = short, 2 = long) */
751 16, /* bitsize */
752 false, /* pc_relative */
753 0, /* bitpos */
754 complain_overflow_dont, /* complain_on_overflow */
755 bfd_elf_generic_reloc, /* special_function */
756 "R_MIPS_HI16", /* name */
757 true, /* partial_inplace */
758 0, /* src_mask */
759 0xffff, /* dst_mask */
760 false), /* pcrel_offset */
761
762 /* Low 16 bits of symbol value. */
763 HOWTO (R_MIPS_LO16, /* type */
764 0, /* rightshift */
765 2, /* size (0 = byte, 1 = short, 2 = long) */
766 16, /* bitsize */
767 false, /* pc_relative */
768 0, /* bitpos */
769 complain_overflow_dont, /* complain_on_overflow */
770 bfd_elf_generic_reloc, /* special_function */
771 "R_MIPS_LO16", /* name */
772 true, /* partial_inplace */
773 0, /* src_mask */
774 0xffff, /* dst_mask */
775 false), /* pcrel_offset */
776
777 /* GP relative reference. */
778 HOWTO (R_MIPS_GPREL16, /* type */
779 0, /* rightshift */
780 2, /* size (0 = byte, 1 = short, 2 = long) */
781 16, /* bitsize */
782 false, /* pc_relative */
783 0, /* bitpos */
784 complain_overflow_signed, /* complain_on_overflow */
785 mips_elf_gprel16_reloc, /* special_function */
786 "R_MIPS_GPREL16", /* name */
787 true, /* partial_inplace */
788 0, /* src_mask */
789 0xffff, /* dst_mask */
790 false), /* pcrel_offset */
791
792 /* Reference to literal section. */
793 HOWTO (R_MIPS_LITERAL, /* type */
794 0, /* rightshift */
795 2, /* size (0 = byte, 1 = short, 2 = long) */
796 16, /* bitsize */
797 false, /* pc_relative */
798 0, /* bitpos */
799 complain_overflow_signed, /* complain_on_overflow */
800 mips_elf_gprel16_reloc, /* special_function */
801 "R_MIPS_LITERAL", /* name */
802 true, /* partial_inplace */
803 0, /* src_mask */
804 0xffff, /* dst_mask */
805 false), /* pcrel_offset */
806
807 /* Reference to global offset table. */
808 HOWTO (R_MIPS_GOT16, /* type */
809 0, /* rightshift */
810 2, /* size (0 = byte, 1 = short, 2 = long) */
811 16, /* bitsize */
812 false, /* pc_relative */
813 0, /* bitpos */
814 complain_overflow_signed, /* complain_on_overflow */
815 mips_elf_got16_reloc, /* special_function */
816 "R_MIPS_GOT16", /* name */
817 false, /* partial_inplace */
818 0, /* src_mask */
819 0xffff, /* dst_mask */
820 false), /* pcrel_offset */
821
822 /* 16 bit PC relative reference. */
823 HOWTO (R_MIPS_PC16, /* type */
824 0, /* rightshift */
825 2, /* size (0 = byte, 1 = short, 2 = long) */
826 16, /* bitsize */
827 true, /* pc_relative */
828 0, /* bitpos */
829 complain_overflow_signed, /* complain_on_overflow */
830 bfd_elf_generic_reloc, /* special_function */
831 "R_MIPS_PC16", /* name */
832 true, /* partial_inplace */
833 0, /* src_mask */
834 0xffff, /* dst_mask */
835 false), /* pcrel_offset */
836
837 /* 16 bit call through global offset table. */
838 /* FIXME: This is not handled correctly. */
839 HOWTO (R_MIPS_CALL16, /* type */
840 0, /* rightshift */
841 2, /* size (0 = byte, 1 = short, 2 = long) */
842 16, /* bitsize */
843 false, /* pc_relative */
844 0, /* bitpos */
845 complain_overflow_signed, /* complain_on_overflow */
846 bfd_elf_generic_reloc, /* special_function */
847 "R_MIPS_CALL16", /* name */
848 false, /* partial_inplace */
849 0, /* src_mask */
850 0xffff, /* dst_mask */
851 false), /* pcrel_offset */
852
853 /* 32 bit GP relative reference. */
854 HOWTO (R_MIPS_GPREL32, /* type */
855 0, /* rightshift */
856 2, /* size (0 = byte, 1 = short, 2 = long) */
857 32, /* bitsize */
858 false, /* pc_relative */
859 0, /* bitpos */
860 complain_overflow_bitfield, /* complain_on_overflow */
861 mips_elf_gprel32_reloc, /* special_function */
862 "R_MIPS_GPREL32", /* name */
863 true, /* partial_inplace */
864 0, /* src_mask */
865 0xffffffff, /* dst_mask */
866 false), /* pcrel_offset */
867
868 { 13 },
869 { 14 },
870 { 15 },
871
872 /* A 5 bit shift field. */
873 HOWTO (R_MIPS_SHIFT5, /* type */
874 0, /* rightshift */
875 2, /* size (0 = byte, 1 = short, 2 = long) */
876 5, /* bitsize */
877 false, /* pc_relative */
878 6, /* bitpos */
879 complain_overflow_bitfield, /* complain_on_overflow */
880 bfd_elf_generic_reloc, /* special_function */
881 "R_MIPS_SHIFT5", /* name */
882 true, /* partial_inplace */
883 0, /* src_mask */
884 0x000007c0, /* dst_mask */
885 false), /* pcrel_offset */
886
887 /* A 6 bit shift field. */
888 /* FIXME: This is not handled correctly; a special function is
889 needed to put the most significant bit in the right place. */
890 HOWTO (R_MIPS_SHIFT6, /* type */
891 0, /* rightshift */
892 2, /* size (0 = byte, 1 = short, 2 = long) */
893 6, /* bitsize */
894 false, /* pc_relative */
895 6, /* bitpos */
896 complain_overflow_bitfield, /* complain_on_overflow */
897 bfd_elf_generic_reloc, /* special_function */
898 "R_MIPS_SHIFT6", /* name */
899 true, /* partial_inplace */
900 0, /* src_mask */
901 0x000007c4, /* dst_mask */
902 false), /* pcrel_offset */
903
904 /* 64 bit relocation. */
905 HOWTO (R_MIPS_64, /* type */
906 0, /* rightshift */
907 4, /* size (0 = byte, 1 = short, 2 = long) */
908 64, /* bitsize */
909 false, /* pc_relative */
910 0, /* bitpos */
911 complain_overflow_bitfield, /* complain_on_overflow */
912 bfd_elf_generic_reloc, /* special_function */
913 "R_MIPS_64", /* name */
914 true, /* partial_inplace */
915 0, /* src_mask */
916 MINUS_ONE, /* dst_mask */
917 false), /* pcrel_offset */
918
919 /* Displacement in the global offset table. */
920 /* FIXME: Not handled correctly. */
921 HOWTO (R_MIPS_GOT_DISP, /* type */
922 0, /* rightshift */
923 2, /* size (0 = byte, 1 = short, 2 = long) */
924 16, /* bitsize */
925 false, /* pc_relative */
926 0, /* bitpos */
927 complain_overflow_bitfield, /* complain_on_overflow */
928 bfd_elf_generic_reloc, /* special_function */
929 "R_MIPS_GOT_DISP", /* name */
930 true, /* partial_inplace */
931 0, /* src_mask */
932 0x0000ffff, /* dst_mask */
933 false), /* pcrel_offset */
934
935 /* Displacement to page pointer in the global offset table. */
936 /* FIXME: Not handled correctly. */
937 HOWTO (R_MIPS_GOT_PAGE, /* type */
938 0, /* rightshift */
939 2, /* size (0 = byte, 1 = short, 2 = long) */
940 16, /* bitsize */
941 false, /* pc_relative */
942 0, /* bitpos */
943 complain_overflow_bitfield, /* complain_on_overflow */
944 bfd_elf_generic_reloc, /* special_function */
945 "R_MIPS_GOT_PAGE", /* name */
946 true, /* partial_inplace */
947 0, /* src_mask */
948 0x0000ffff, /* dst_mask */
949 false), /* pcrel_offset */
950
951 /* Offset from page pointer in the global offset table. */
952 /* FIXME: Not handled correctly. */
953 HOWTO (R_MIPS_GOT_OFST, /* type */
954 0, /* rightshift */
955 2, /* size (0 = byte, 1 = short, 2 = long) */
956 16, /* bitsize */
957 false, /* pc_relative */
958 0, /* bitpos */
959 complain_overflow_bitfield, /* complain_on_overflow */
960 bfd_elf_generic_reloc, /* special_function */
961 "R_MIPS_GOT_OFST", /* name */
962 true, /* partial_inplace */
963 0, /* src_mask */
964 0x0000ffff, /* dst_mask */
965 false), /* pcrel_offset */
966
967 /* High 16 bits of displacement in global offset table. */
968 /* FIXME: Not handled correctly. */
969 HOWTO (R_MIPS_GOT_HI16, /* type */
970 0, /* rightshift */
971 2, /* size (0 = byte, 1 = short, 2 = long) */
972 16, /* bitsize */
973 false, /* pc_relative */
974 0, /* bitpos */
975 complain_overflow_dont, /* complain_on_overflow */
976 bfd_elf_generic_reloc, /* special_function */
977 "R_MIPS_GOT_HI16", /* name */
978 true, /* partial_inplace */
979 0, /* src_mask */
980 0x0000ffff, /* dst_mask */
981 false), /* pcrel_offset */
982
983 /* Low 16 bits of displacement in global offset table. */
984 /* FIXME: Not handled correctly. */
985 HOWTO (R_MIPS_GOT_LO16, /* type */
986 0, /* rightshift */
987 2, /* size (0 = byte, 1 = short, 2 = long) */
988 16, /* bitsize */
989 false, /* pc_relative */
990 0, /* bitpos */
991 complain_overflow_dont, /* complain_on_overflow */
992 bfd_elf_generic_reloc, /* special_function */
993 "R_MIPS_GOT_LO16", /* name */
994 true, /* partial_inplace */
995 0, /* src_mask */
996 0x0000ffff, /* dst_mask */
997 false), /* pcrel_offset */
998
999 /* 64 bit substraction. */
1000 /* FIXME: Not handled correctly. */
1001 HOWTO (R_MIPS_SUB, /* type */
1002 0, /* rightshift */
1003 4, /* size (0 = byte, 1 = short, 2 = long) */
1004 64, /* bitsize */
1005 false, /* pc_relative */
1006 0, /* bitpos */
1007 complain_overflow_bitfield, /* complain_on_overflow */
1008 bfd_elf_generic_reloc, /* special_function */
1009 "R_MIPS_SUB", /* name */
1010 true, /* partial_inplace */
1011 0, /* src_mask */
1012 MINUS_ONE, /* dst_mask */
1013 false), /* pcrel_offset */
1014
1015 /* Insert the addend as an instruction. */
1016 /* FIXME: Not handled correctly. */
1017 HOWTO (R_MIPS_INSERT_A, /* type */
1018 0, /* rightshift */
1019 0, /* size (0 = byte, 1 = short, 2 = long) */
1020 0, /* bitsize */
1021 false, /* pc_relative */
1022 0, /* bitpos */
1023 complain_overflow_dont, /* complain_on_overflow */
1024 bfd_elf_generic_reloc, /* special_function */
1025 "R_MIPS_INSERT_A", /* name */
1026 false, /* partial_inplace */
1027 0, /* src_mask */
1028 0, /* dst_mask */
1029 false), /* pcrel_offset */
1030
1031 /* Insert the addend as an instruction, and change all relocations
1032 to refer to the old instruction at the address. */
1033 /* FIXME: Not handled correctly. */
1034 HOWTO (R_MIPS_INSERT_B, /* type */
1035 0, /* rightshift */
1036 0, /* size (0 = byte, 1 = short, 2 = long) */
1037 0, /* bitsize */
1038 false, /* pc_relative */
1039 0, /* bitpos */
1040 complain_overflow_dont, /* complain_on_overflow */
1041 bfd_elf_generic_reloc, /* special_function */
1042 "R_MIPS_INSERT_B", /* name */
1043 false, /* partial_inplace */
1044 0, /* src_mask */
1045 0, /* dst_mask */
1046 false), /* pcrel_offset */
1047
1048 /* Delete a 32 bit instruction. */
1049 /* FIXME: Not handled correctly. */
1050 HOWTO (R_MIPS_DELETE, /* type */
1051 0, /* rightshift */
1052 0, /* size (0 = byte, 1 = short, 2 = long) */
1053 0, /* bitsize */
1054 false, /* pc_relative */
1055 0, /* bitpos */
1056 complain_overflow_dont, /* complain_on_overflow */
1057 bfd_elf_generic_reloc, /* special_function */
1058 "R_MIPS_DELETE", /* name */
1059 false, /* partial_inplace */
1060 0, /* src_mask */
1061 0, /* dst_mask */
1062 false), /* pcrel_offset */
1063
1064 /* Get the higher value of a 64 bit addend. */
1065 /* FIXME: Not handled correctly. */
1066 HOWTO (R_MIPS_HIGHER, /* type */
1067 0, /* rightshift */
1068 2, /* size (0 = byte, 1 = short, 2 = long) */
1069 16, /* bitsize */
1070 false, /* pc_relative */
1071 0, /* bitpos */
1072 complain_overflow_dont, /* complain_on_overflow */
1073 bfd_elf_generic_reloc, /* special_function */
1074 "R_MIPS_HIGHER", /* name */
1075 true, /* partial_inplace */
1076 0, /* src_mask */
1077 0xffff, /* dst_mask */
1078 false), /* pcrel_offset */
1079
1080 /* Get the highest value of a 64 bit addend. */
1081 /* FIXME: Not handled correctly. */
1082 HOWTO (R_MIPS_HIGHEST, /* type */
1083 0, /* rightshift */
1084 2, /* size (0 = byte, 1 = short, 2 = long) */
1085 16, /* bitsize */
1086 false, /* pc_relative */
1087 0, /* bitpos */
1088 complain_overflow_dont, /* complain_on_overflow */
1089 bfd_elf_generic_reloc, /* special_function */
1090 "R_MIPS_HIGHEST", /* name */
1091 true, /* partial_inplace */
1092 0, /* src_mask */
1093 0xffff, /* dst_mask */
1094 false), /* pcrel_offset */
1095
1096 /* High 16 bits of displacement in global offset table. */
1097 /* FIXME: Not handled correctly. */
1098 HOWTO (R_MIPS_CALL_HI16, /* type */
1099 0, /* rightshift */
1100 2, /* size (0 = byte, 1 = short, 2 = long) */
1101 16, /* bitsize */
1102 false, /* pc_relative */
1103 0, /* bitpos */
1104 complain_overflow_dont, /* complain_on_overflow */
1105 bfd_elf_generic_reloc, /* special_function */
1106 "R_MIPS_CALL_HI16", /* name */
1107 true, /* partial_inplace */
1108 0, /* src_mask */
1109 0x0000ffff, /* dst_mask */
1110 false), /* pcrel_offset */
1111
1112 /* Low 16 bits of displacement in global offset table. */
1113 /* FIXME: Not handled correctly. */
1114 HOWTO (R_MIPS_CALL_LO16, /* type */
1115 0, /* rightshift */
1116 2, /* size (0 = byte, 1 = short, 2 = long) */
1117 16, /* bitsize */
1118 false, /* pc_relative */
1119 0, /* bitpos */
1120 complain_overflow_dont, /* complain_on_overflow */
1121 bfd_elf_generic_reloc, /* special_function */
1122 "R_MIPS_CALL_LO16", /* name */
1123 true, /* partial_inplace */
1124 0, /* src_mask */
1125 0x0000ffff, /* dst_mask */
1126 false), /* pcrel_offset */
1127
1128 /* I'm not sure what the remaining relocs are, but they are defined
1129 on Irix 6. */
1130
1131 HOWTO (R_MIPS_SCN_DISP, /* type */
1132 0, /* rightshift */
1133 0, /* size (0 = byte, 1 = short, 2 = long) */
1134 0, /* bitsize */
1135 false, /* pc_relative */
1136 0, /* bitpos */
1137 complain_overflow_dont, /* complain_on_overflow */
1138 bfd_elf_generic_reloc, /* special_function */
1139 "R_MIPS_SCN_DISP", /* name */
1140 false, /* partial_inplace */
1141 0, /* src_mask */
1142 0, /* dst_mask */
1143 false), /* pcrel_offset */
1144
1145 HOWTO (R_MIPS_REL16, /* type */
1146 0, /* rightshift */
1147 0, /* size (0 = byte, 1 = short, 2 = long) */
1148 0, /* bitsize */
1149 false, /* pc_relative */
1150 0, /* bitpos */
1151 complain_overflow_dont, /* complain_on_overflow */
1152 bfd_elf_generic_reloc, /* special_function */
1153 "R_MIPS_REL16", /* name */
1154 false, /* partial_inplace */
1155 0, /* src_mask */
1156 0, /* dst_mask */
1157 false), /* pcrel_offset */
1158
1159 HOWTO (R_MIPS_ADD_IMMEDIATE, /* type */
1160 0, /* rightshift */
1161 0, /* size (0 = byte, 1 = short, 2 = long) */
1162 0, /* bitsize */
1163 false, /* pc_relative */
1164 0, /* bitpos */
1165 complain_overflow_dont, /* complain_on_overflow */
1166 bfd_elf_generic_reloc, /* special_function */
1167 "R_MIPS_ADD_IMMEDIATE", /* name */
1168 false, /* partial_inplace */
1169 0, /* src_mask */
1170 0, /* dst_mask */
1171 false), /* pcrel_offset */
1172
1173 HOWTO (R_MIPS_PJUMP, /* type */
1174 0, /* rightshift */
1175 0, /* size (0 = byte, 1 = short, 2 = long) */
1176 0, /* bitsize */
1177 false, /* pc_relative */
1178 0, /* bitpos */
1179 complain_overflow_dont, /* complain_on_overflow */
1180 bfd_elf_generic_reloc, /* special_function */
1181 "R_MIPS_PJUMP", /* name */
1182 false, /* partial_inplace */
1183 0, /* src_mask */
1184 0, /* dst_mask */
1185 false), /* pcrel_offset */
1186
1187 HOWTO (R_MIPS_RELGOT, /* type */
1188 0, /* rightshift */
1189 0, /* size (0 = byte, 1 = short, 2 = long) */
1190 0, /* bitsize */
1191 false, /* pc_relative */
1192 0, /* bitpos */
1193 complain_overflow_dont, /* complain_on_overflow */
1194 bfd_elf_generic_reloc, /* special_function */
1195 "R_MIPS_RELGOT", /* name */
1196 false, /* partial_inplace */
1197 0, /* src_mask */
1198 0, /* dst_mask */
1199 false) /* pcrel_offset */
1200 };
1201
1202 /* Swap in a MIPS 64-bit Rel reloc. */
1203
1204 static void
1205 mips_elf64_swap_reloc_in (abfd, src, dst)
1206 bfd *abfd;
1207 const Elf64_Mips_External_Rel *src;
1208 Elf64_Mips_Internal_Rel *dst;
1209 {
1210 dst->r_offset = bfd_h_get_64 (abfd, (bfd_byte *) src->r_offset);
1211 dst->r_sym = bfd_h_get_32 (abfd, (bfd_byte *) src->r_sym);
1212 dst->r_ssym = bfd_h_get_8 (abfd, (bfd_byte *) src->r_ssym);
1213 dst->r_type3 = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type3);
1214 dst->r_type2 = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type2);
1215 dst->r_type = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type);
1216 }
1217
1218 /* Swap in a MIPS 64-bit Rela reloc. */
1219
1220 static void
1221 mips_elf64_swap_reloca_in (abfd, src, dst)
1222 bfd *abfd;
1223 const Elf64_Mips_External_Rela *src;
1224 Elf64_Mips_Internal_Rela *dst;
1225 {
1226 dst->r_offset = bfd_h_get_64 (abfd, (bfd_byte *) src->r_offset);
1227 dst->r_sym = bfd_h_get_32 (abfd, (bfd_byte *) src->r_sym);
1228 dst->r_ssym = bfd_h_get_8 (abfd, (bfd_byte *) src->r_ssym);
1229 dst->r_type3 = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type3);
1230 dst->r_type2 = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type2);
1231 dst->r_type = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type);
1232 dst->r_addend = bfd_h_get_64 (abfd, (bfd_byte *) src->r_addend);
1233 }
1234
1235 #if 0
1236
1237 /* This is not currently used. */
1238
1239 /* Swap out a MIPS 64-bit Rel reloc. */
1240
1241 static void
1242 mips_elf64_swap_reloc_out (abfd, src, dst)
1243 bfd *abfd;
1244 const Elf64_Mips_Internal_Rel *src;
1245 Elf64_Mips_External_Rel *dst;
1246 {
1247 bfd_h_put_64 (abfd, src->r_offset, (bfd_byte *) dst->r_offset);
1248 bfd_h_put_32 (abfd, src->r_sym, (bfd_byte *) dst->r_sym);
1249 bfd_h_put_8 (abfd, src->r_ssym, (bfd_byte *) dst->r_ssym);
1250 bfd_h_put_8 (abfd, src->r_type3, (bfd_byte *) dst->r_type3);
1251 bfd_h_put_8 (abfd, src->r_type2, (bfd_byte *) dst->r_type2);
1252 bfd_h_put_8 (abfd, src->r_type, (bfd_byte *) dst->r_type);
1253 }
1254
1255 #endif /* 0 */
1256
1257 /* Swap out a MIPS 64-bit Rela reloc. */
1258
1259 static void
1260 mips_elf64_swap_reloca_out (abfd, src, dst)
1261 bfd *abfd;
1262 const Elf64_Mips_Internal_Rela *src;
1263 Elf64_Mips_External_Rela *dst;
1264 {
1265 bfd_h_put_64 (abfd, src->r_offset, (bfd_byte *) dst->r_offset);
1266 bfd_h_put_32 (abfd, src->r_sym, (bfd_byte *) dst->r_sym);
1267 bfd_h_put_8 (abfd, src->r_ssym, (bfd_byte *) dst->r_ssym);
1268 bfd_h_put_8 (abfd, src->r_type3, (bfd_byte *) dst->r_type3);
1269 bfd_h_put_8 (abfd, src->r_type2, (bfd_byte *) dst->r_type2);
1270 bfd_h_put_8 (abfd, src->r_type, (bfd_byte *) dst->r_type);
1271 bfd_h_put_64 (abfd, src->r_offset, (bfd_byte *) dst->r_offset);
1272 }
1273
1274 /* A mapping from BFD reloc types to MIPS ELF reloc types. */
1275
1276 struct elf_reloc_map
1277 {
1278 bfd_reloc_code_real_type bfd_reloc_val;
1279 enum mips_elf64_reloc_type elf_reloc_val;
1280 };
1281
1282 static CONST struct elf_reloc_map mips_reloc_map[] =
1283 {
1284 { BFD_RELOC_NONE, R_MIPS_NONE, },
1285 { BFD_RELOC_16, R_MIPS_16 },
1286 { BFD_RELOC_32, R_MIPS_32 },
1287 { BFD_RELOC_64, R_MIPS_64 },
1288 { BFD_RELOC_CTOR, R_MIPS_64 },
1289 { BFD_RELOC_32_PCREL, R_MIPS_REL32 },
1290 { BFD_RELOC_MIPS_JMP, R_MIPS_26 },
1291 { BFD_RELOC_HI16_S, R_MIPS_HI16 },
1292 { BFD_RELOC_LO16, R_MIPS_LO16 },
1293 { BFD_RELOC_MIPS_GPREL, R_MIPS_GPREL16 },
1294 { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL },
1295 { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 },
1296 { BFD_RELOC_16_PCREL, R_MIPS_PC16 },
1297 { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 },
1298 { BFD_RELOC_MIPS_GPREL32, R_MIPS_GPREL32 },
1299 { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 },
1300 { BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 },
1301 { BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 },
1302 { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 }
1303 };
1304
1305 /* Given a BFD reloc type, return a howto structure. */
1306
1307 static reloc_howto_type *
1308 mips_elf64_reloc_type_lookup (abfd, code)
1309 bfd *abfd;
1310 bfd_reloc_code_real_type code;
1311 {
1312 unsigned int i;
1313
1314 for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map); i++)
1315 {
1316 if (mips_reloc_map[i].bfd_reloc_val == code)
1317 {
1318 int v;
1319
1320 v = (int) mips_reloc_map[i].elf_reloc_val;
1321 return &mips_elf64_howto_table_rel[v];
1322 }
1323 }
1324
1325 return NULL;
1326 }
1327
1328 /* Since each entry in an SHT_REL or SHT_RELA section can represent up
1329 to three relocs, we must tell the user to allocate more space. */
1330
1331 static long
1332 mips_elf64_get_reloc_upper_bound (abfd, sec)
1333 bfd *abfd;
1334 asection *sec;
1335 {
1336 return (sec->reloc_count * 3 + 1) * sizeof (arelent *);
1337 }
1338
1339 /* Read the relocations from one reloc section. */
1340
1341 static boolean
1342 mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, rel_hdr)
1343 bfd *abfd;
1344 asection *asect;
1345 asymbol **symbols;
1346 const Elf_Internal_Shdr *rel_hdr;
1347 {
1348 PTR allocated = NULL;
1349 bfd_byte *native_relocs;
1350 arelent *relents;
1351 arelent *relent;
1352 unsigned int count;
1353 unsigned int i;
1354 int entsize;
1355 reloc_howto_type *howto_table;
1356
1357 allocated = (PTR) bfd_malloc (rel_hdr->sh_size);
1358 if (allocated == NULL)
1359 goto error_return;
1360
1361 if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0
1362 || (bfd_read (allocated, 1, rel_hdr->sh_size, abfd) != rel_hdr->sh_size))
1363 goto error_return;
1364
1365 native_relocs = (bfd_byte *) allocated;
1366
1367 relents = asect->relocation + asect->reloc_count;
1368
1369 entsize = rel_hdr->sh_entsize;
1370 BFD_ASSERT (entsize == sizeof (Elf64_Mips_External_Rel)
1371 || entsize == sizeof (Elf64_Mips_External_Rela));
1372
1373 count = rel_hdr->sh_size / entsize;
1374
1375 if (entsize == sizeof (Elf64_Mips_External_Rel))
1376 howto_table = mips_elf64_howto_table_rel;
1377 else
1378 howto_table = mips_elf64_howto_table_rela;
1379
1380 relent = relents;
1381 for (i = 0; i < count; i++, native_relocs += entsize)
1382 {
1383 Elf64_Mips_Internal_Rela rela;
1384 boolean used_sym, used_ssym;
1385 int ir;
1386
1387 if (entsize == sizeof (Elf64_Mips_External_Rela))
1388 mips_elf64_swap_reloca_in (abfd,
1389 (Elf64_Mips_External_Rela *) native_relocs,
1390 &rela);
1391 else
1392 {
1393 Elf64_Mips_Internal_Rel rel;
1394
1395 mips_elf64_swap_reloc_in (abfd,
1396 (Elf64_Mips_External_Rel *) native_relocs,
1397 &rel);
1398 rela.r_offset = rel.r_offset;
1399 rela.r_sym = rel.r_sym;
1400 rela.r_ssym = rel.r_ssym;
1401 rela.r_type3 = rel.r_type3;
1402 rela.r_type2 = rel.r_type2;
1403 rela.r_type = rel.r_type;
1404 rela.r_addend = 0;
1405 }
1406
1407 /* Each entry represents up to three actual relocations. */
1408
1409 used_sym = false;
1410 used_ssym = false;
1411 for (ir = 0; ir < 3; ir++)
1412 {
1413 enum mips_elf64_reloc_type type;
1414
1415 switch (ir)
1416 {
1417 default:
1418 abort ();
1419 case 0:
1420 type = (enum mips_elf64_reloc_type) rela.r_type;
1421 break;
1422 case 1:
1423 type = (enum mips_elf64_reloc_type) rela.r_type2;
1424 break;
1425 case 2:
1426 type = (enum mips_elf64_reloc_type) rela.r_type3;
1427 break;
1428 }
1429
1430 if (type == R_MIPS_NONE)
1431 {
1432 /* There are no more relocations in this entry. If this
1433 is the first entry, we need to generate a dummy
1434 relocation so that the generic linker knows that
1435 there has been a break in the sequence of relocations
1436 applying to a particular address. */
1437 if (ir == 0)
1438 {
1439 relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
1440 if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
1441 relent->address = rela.r_offset;
1442 else
1443 relent->address = rela.r_offset - asect->vma;
1444 relent->addend = 0;
1445 relent->howto = &howto_table[(int) R_MIPS_NONE];
1446 ++relent;
1447 }
1448 break;
1449 }
1450
1451 /* Some types require symbols, whereas some do not. */
1452 switch (type)
1453 {
1454 case R_MIPS_NONE:
1455 case R_MIPS_LITERAL:
1456 case R_MIPS_INSERT_A:
1457 case R_MIPS_INSERT_B:
1458 case R_MIPS_DELETE:
1459 relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
1460 break;
1461
1462 default:
1463 if (! used_sym)
1464 {
1465 if (rela.r_sym == 0)
1466 relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
1467 else
1468 {
1469 asymbol **ps, *s;
1470
1471 ps = symbols + rela.r_sym - 1;
1472 s = *ps;
1473 if ((s->flags & BSF_SECTION_SYM) == 0)
1474 relent->sym_ptr_ptr = ps;
1475 else
1476 relent->sym_ptr_ptr = s->section->symbol_ptr_ptr;
1477 }
1478
1479 used_sym = true;
1480 }
1481 else if (! used_ssym)
1482 {
1483 switch (rela.r_ssym)
1484 {
1485 case RSS_UNDEF:
1486 relent->sym_ptr_ptr =
1487 bfd_abs_section_ptr->symbol_ptr_ptr;
1488 break;
1489
1490 case RSS_GP:
1491 case RSS_GP0:
1492 case RSS_LOC:
1493 /* FIXME: I think these need to be handled using
1494 special howto structures. */
1495 BFD_ASSERT (0);
1496 break;
1497
1498 default:
1499 BFD_ASSERT (0);
1500 break;
1501 }
1502
1503 used_ssym = true;
1504 }
1505 else
1506 relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
1507
1508 break;
1509 }
1510
1511 /* The address of an ELF reloc is section relative for an
1512 object file, and absolute for an executable file or
1513 shared library. The address of a BFD reloc is always
1514 section relative. */
1515 if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
1516 relent->address = rela.r_offset;
1517 else
1518 relent->address = rela.r_offset - asect->vma;
1519
1520 relent->addend = rela.r_addend;
1521
1522 relent->howto = &howto_table[(int) type];
1523
1524 ++relent;
1525 }
1526 }
1527
1528 asect->reloc_count += relent - relents;
1529
1530 if (allocated != NULL)
1531 free (allocated);
1532
1533 return true;
1534
1535 error_return:
1536 if (allocated != NULL)
1537 free (allocated);
1538 return false;
1539 }
1540
1541 /* Read the relocations. On Irix 6, there can be two reloc sections
1542 associated with a single data section. */
1543
1544 static boolean
1545 mips_elf64_slurp_reloc_table (abfd, asect, symbols)
1546 bfd *abfd;
1547 asection *asect;
1548 asymbol **symbols;
1549 {
1550 struct bfd_elf_section_data * const d = elf_section_data (asect);
1551
1552 if (asect->relocation != NULL
1553 || (asect->flags & SEC_RELOC) == 0
1554 || asect->reloc_count == 0)
1555 return true;
1556
1557 /* Allocate space for 3 arelent structures for each Rel structure. */
1558 asect->relocation = ((arelent *)
1559 bfd_alloc (abfd,
1560 asect->reloc_count * 3 * sizeof (arelent)));
1561 if (asect->relocation == NULL)
1562 return false;
1563
1564 /* The slurp_one_reloc_table routine increments reloc_count. */
1565 asect->reloc_count = 0;
1566
1567 if (! mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, &d->rel_hdr))
1568 return false;
1569 if (d->rel_hdr2 != NULL)
1570 {
1571 if (! mips_elf64_slurp_one_reloc_table (abfd, asect, symbols,
1572 d->rel_hdr2))
1573 return false;
1574 }
1575
1576 return true;
1577 }
1578
1579 /* Write out the relocations. */
1580
1581 static void
1582 mips_elf64_write_relocs (abfd, sec, data)
1583 bfd *abfd;
1584 asection *sec;
1585 PTR data;
1586 {
1587 boolean *failedp = (boolean *) data;
1588 unsigned int count;
1589 Elf_Internal_Shdr *rela_hdr;
1590 Elf64_Mips_External_Rela *ext_rela;
1591 unsigned int idx;
1592 asymbol *last_sym = 0;
1593 int last_sym_idx = 0;
1594
1595 /* If we have already failed, don't do anything. */
1596 if (*failedp)
1597 return;
1598
1599 if ((sec->flags & SEC_RELOC) == 0)
1600 return;
1601
1602 /* The linker backend writes the relocs out itself, and sets the
1603 reloc_count field to zero to inhibit writing them here. Also,
1604 sometimes the SEC_RELOC flag gets set even when there aren't any
1605 relocs. */
1606 if (sec->reloc_count == 0)
1607 return;
1608
1609 /* We can combine up to three relocs that refer to the same address
1610 if the latter relocs have no associated symbol. */
1611 count = 0;
1612 for (idx = 0; idx < sec->reloc_count; idx++)
1613 {
1614 bfd_vma addr;
1615 unsigned int i;
1616
1617 ++count;
1618
1619 addr = sec->orelocation[idx]->address;
1620 for (i = 0; i < 2; i++)
1621 {
1622 arelent *r;
1623
1624 if (idx + 1 >= sec->reloc_count)
1625 break;
1626 r = sec->orelocation[idx + 1];
1627 if (r->address != addr
1628 || ! bfd_is_abs_section ((*r->sym_ptr_ptr)->section)
1629 || (*r->sym_ptr_ptr)->value != 0)
1630 break;
1631
1632 /* We can merge the reloc at IDX + 1 with the reloc at IDX. */
1633
1634 ++idx;
1635 }
1636 }
1637
1638 rela_hdr = &elf_section_data (sec)->rel_hdr;
1639
1640 rela_hdr->sh_size = rela_hdr->sh_entsize * count;
1641 rela_hdr->contents = (PTR) bfd_alloc (abfd, rela_hdr->sh_size);
1642 if (rela_hdr->contents == NULL)
1643 {
1644 *failedp = true;
1645 return;
1646 }
1647
1648 ext_rela = (Elf64_Mips_External_Rela *) rela_hdr->contents;
1649 for (idx = 0; idx < sec->reloc_count; idx++, ext_rela++)
1650 {
1651 arelent *ptr;
1652 Elf64_Mips_Internal_Rela int_rela;
1653 asymbol *sym;
1654 int n;
1655 unsigned int i;
1656
1657 ptr = sec->orelocation[idx];
1658
1659 /* The address of an ELF reloc is section relative for an object
1660 file, and absolute for an executable file or shared library.
1661 The address of a BFD reloc is always section relative. */
1662 if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
1663 int_rela.r_offset = ptr->address;
1664 else
1665 int_rela.r_offset = ptr->address + sec->vma;
1666
1667 sym = *ptr->sym_ptr_ptr;
1668 if (sym == last_sym)
1669 n = last_sym_idx;
1670 else
1671 {
1672 last_sym = sym;
1673 n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
1674 if (n < 0)
1675 {
1676 *failedp = true;
1677 return;
1678 }
1679 last_sym_idx = n;
1680 }
1681
1682 int_rela.r_sym = n;
1683
1684 int_rela.r_addend = ptr->addend;
1685
1686 int_rela.r_ssym = RSS_UNDEF;
1687
1688 if ((*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
1689 && ! _bfd_elf_validate_reloc (abfd, ptr))
1690 {
1691 *failedp = true;
1692 return;
1693 }
1694
1695 int_rela.r_type = ptr->howto->type;
1696 int_rela.r_type2 = (int) R_MIPS_NONE;
1697 int_rela.r_type3 = (int) R_MIPS_NONE;
1698
1699 for (i = 0; i < 2; i++)
1700 {
1701 arelent *r;
1702
1703 if (idx + 1 >= sec->reloc_count)
1704 break;
1705 r = sec->orelocation[idx + 1];
1706 if (r->address != ptr->address
1707 || ! bfd_is_abs_section ((*r->sym_ptr_ptr)->section)
1708 || (*r->sym_ptr_ptr)->value != 0)
1709 break;
1710
1711 /* We can merge the reloc at IDX + 1 with the reloc at IDX. */
1712
1713 if (i == 0)
1714 int_rela.r_type2 = r->howto->type;
1715 else
1716 int_rela.r_type3 = r->howto->type;
1717
1718 ++idx;
1719 }
1720
1721 mips_elf64_swap_reloca_out (abfd, &int_rela, ext_rela);
1722 }
1723
1724 BFD_ASSERT (ext_rela - (Elf64_Mips_External_Rela *) rela_hdr->contents
1725 == count);
1726 }
1727 \f
1728 /* Handle a 64-bit MIPS ELF specific section. */
1729
1730 static boolean
1731 mips_elf64_section_from_shdr (abfd, hdr, name)
1732 bfd *abfd;
1733 Elf_Internal_Shdr *hdr;
1734 char *name;
1735 {
1736 if (! _bfd_mips_elf_section_from_shdr (abfd, hdr, name))
1737 return false;
1738
1739 return true;
1740 }
1741 \f
1742 /* ECOFF swapping routines. These are used when dealing with the
1743 .mdebug section, which is in the ECOFF debugging format. */
1744 static const struct ecoff_debug_swap mips_elf64_ecoff_debug_swap =
1745 {
1746 /* Symbol table magic number. */
1747 magicSym2,
1748 /* Alignment of debugging information. E.g., 4. */
1749 8,
1750 /* Sizes of external symbolic information. */
1751 sizeof (struct hdr_ext),
1752 sizeof (struct dnr_ext),
1753 sizeof (struct pdr_ext),
1754 sizeof (struct sym_ext),
1755 sizeof (struct opt_ext),
1756 sizeof (struct fdr_ext),
1757 sizeof (struct rfd_ext),
1758 sizeof (struct ext_ext),
1759 /* Functions to swap in external symbolic data. */
1760 ecoff_swap_hdr_in,
1761 ecoff_swap_dnr_in,
1762 ecoff_swap_pdr_in,
1763 ecoff_swap_sym_in,
1764 ecoff_swap_opt_in,
1765 ecoff_swap_fdr_in,
1766 ecoff_swap_rfd_in,
1767 ecoff_swap_ext_in,
1768 _bfd_ecoff_swap_tir_in,
1769 _bfd_ecoff_swap_rndx_in,
1770 /* Functions to swap out external symbolic data. */
1771 ecoff_swap_hdr_out,
1772 ecoff_swap_dnr_out,
1773 ecoff_swap_pdr_out,
1774 ecoff_swap_sym_out,
1775 ecoff_swap_opt_out,
1776 ecoff_swap_fdr_out,
1777 ecoff_swap_rfd_out,
1778 ecoff_swap_ext_out,
1779 _bfd_ecoff_swap_tir_out,
1780 _bfd_ecoff_swap_rndx_out,
1781 /* Function to read in symbolic data. */
1782 _bfd_mips_elf_read_ecoff_info
1783 };
1784 \f
1785 /* Relocations in the 64 bit MIPS ELF ABI are more complex than in
1786 standard ELF. This structure is used to redirect the relocation
1787 handling routines. */
1788
1789 const struct elf_size_info mips_elf64_size_info =
1790 {
1791 sizeof (Elf64_External_Ehdr),
1792 sizeof (Elf64_External_Phdr),
1793 sizeof (Elf64_External_Shdr),
1794 sizeof (Elf64_Mips_External_Rel),
1795 sizeof (Elf64_Mips_External_Rela),
1796 sizeof (Elf64_External_Sym),
1797 sizeof (Elf64_External_Dyn),
1798 sizeof (Elf_External_Note),
1799 64, /* arch_size */
1800 8, /* file_align */
1801 ELFCLASS64,
1802 EV_CURRENT,
1803 bfd_elf64_write_out_phdrs,
1804 bfd_elf64_write_shdrs_and_ehdr,
1805 mips_elf64_write_relocs,
1806 bfd_elf64_swap_symbol_out,
1807 mips_elf64_slurp_reloc_table,
1808 bfd_elf64_slurp_symbol_table,
1809 bfd_elf64_swap_dyn_in
1810 };
1811
1812 #define TARGET_LITTLE_SYM bfd_elf64_littlemips_vec
1813 #define TARGET_LITTLE_NAME "elf64-littlemips"
1814 #define TARGET_BIG_SYM bfd_elf64_bigmips_vec
1815 #define TARGET_BIG_NAME "elf64-bigmips"
1816 #define ELF_ARCH bfd_arch_mips
1817 #define ELF_MACHINE_CODE EM_MIPS
1818 #define ELF_MAXPAGESIZE 0x1000
1819 #define elf_backend_size_info mips_elf64_size_info
1820 #define elf_backend_object_p _bfd_mips_elf_object_p
1821 #define elf_backend_section_from_shdr mips_elf64_section_from_shdr
1822 #define elf_backend_fake_sections _bfd_mips_elf_fake_sections
1823 #define elf_backend_section_from_bfd_section \
1824 _bfd_mips_elf_section_from_bfd_section
1825 #define elf_backend_section_processing _bfd_mips_elf_section_processing
1826 #define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing
1827 #define elf_backend_final_write_processing \
1828 _bfd_mips_elf_final_write_processing
1829 #define elf_backend_ecoff_debug_swap &mips_elf64_ecoff_debug_swap
1830
1831 #define bfd_elf64_get_reloc_upper_bound mips_elf64_get_reloc_upper_bound
1832 #define bfd_elf64_bfd_reloc_type_lookup mips_elf64_reloc_type_lookup
1833
1834 #include "elf64-target.h"