/src/binutils-gdb/bfd/elf32-mips.c
Line | Count | Source |
1 | | /* MIPS-specific support for 32-bit ELF |
2 | | Copyright (C) 1993-2026 Free Software Foundation, Inc. |
3 | | |
4 | | Most of the information added by Ian Lance Taylor, Cygnus Support, |
5 | | <ian@cygnus.com>. |
6 | | N32/64 ABI support added by Mark Mitchell, CodeSourcery, LLC. |
7 | | <mark@codesourcery.com> |
8 | | Traditional MIPS targets support added by Koundinya.K, Dansk Data |
9 | | Elektronik & Operations Research Group. <kk@ddeorg.soft.net> |
10 | | |
11 | | This file is part of BFD, the Binary File Descriptor library. |
12 | | |
13 | | This program is free software; you can redistribute it and/or modify |
14 | | it under the terms of the GNU General Public License as published by |
15 | | the Free Software Foundation; either version 3 of the License, or |
16 | | (at your option) any later version. |
17 | | |
18 | | This program is distributed in the hope that it will be useful, |
19 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 | | GNU General Public License for more details. |
22 | | |
23 | | You should have received a copy of the GNU General Public License |
24 | | along with this program; if not, write to the Free Software |
25 | | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
26 | | MA 02110-1301, USA. */ |
27 | | |
28 | | |
29 | | /* This file handles MIPS ELF targets. SGI Irix 5 uses a slightly |
30 | | different MIPS ELF from other targets. This matters when linking. |
31 | | This file supports both, switching at runtime. */ |
32 | | |
33 | | #include "sysdep.h" |
34 | | #include "bfd.h" |
35 | | #include "libbfd.h" |
36 | | #include "libiberty.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 | | #include "elf-vxworks.h" |
43 | | |
44 | | /* Get the ECOFF swapping routines. */ |
45 | | #include "coff/sym.h" |
46 | | #include "coff/symconst.h" |
47 | | #include "coff/internal.h" |
48 | | #include "coff/ecoff.h" |
49 | | #include "coff/mips.h" |
50 | | #define ECOFF_SIGNED_32 |
51 | | #include "ecoffswap.h" |
52 | | |
53 | | static bfd_reloc_status_type gprel32_with_gp |
54 | | (bfd *, asymbol *, arelent *, asection *, bool, void *, bfd_vma); |
55 | | static bfd_reloc_status_type mips_elf_gprel32_reloc |
56 | | (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); |
57 | | static bfd_reloc_status_type mips32_64bit_reloc |
58 | | (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); |
59 | | static bool mips_info_to_howto_rel |
60 | | (bfd *, arelent *, Elf_Internal_Rela *); |
61 | | static bool mips_info_to_howto_rela |
62 | | (bfd *, arelent *, Elf_Internal_Rela *); |
63 | | static bool mips_elf_sym_is_global |
64 | | (bfd *, asymbol *); |
65 | | static bool mips_elf32_elfsym_local_is_section |
66 | | (bfd *); |
67 | | static bool mips_elf32_object_p |
68 | | (bfd *); |
69 | | static bool mips_elf_is_local_label_name |
70 | | (bfd *, const char *); |
71 | | static bfd_reloc_status_type mips16_gprel_reloc |
72 | | (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); |
73 | | static bfd_reloc_status_type mips_elf_final_gp |
74 | | (bfd *, asymbol *, bool, char **, bfd_vma *); |
75 | | static bool mips_elf_assign_gp |
76 | | (bfd *, bfd_vma *); |
77 | | static bool elf32_mips_grok_prstatus |
78 | | (bfd *, Elf_Internal_Note *); |
79 | | static bool elf32_mips_grok_psinfo |
80 | | (bfd *, Elf_Internal_Note *); |
81 | | static irix_compat_t elf32_mips_irix_compat |
82 | | (bfd *); |
83 | | |
84 | | extern const bfd_target mips_elf32_be_vec; |
85 | | extern const bfd_target mips_elf32_le_vec; |
86 | | |
87 | | /* Nonzero if ABFD is using the N32 ABI. */ |
88 | | #define ABI_N32_P(abfd) \ |
89 | 3.12k | ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0) |
90 | | |
91 | | /* Whether we are trying to be compatible with IRIX at all. */ |
92 | | #define SGI_COMPAT(abfd) \ |
93 | 1.85k | (elf32_mips_irix_compat (abfd) != ict_none) |
94 | | |
95 | | /* The number of local .got entries we reserve. */ |
96 | | #define MIPS_RESERVED_GOTNO (2) |
97 | | |
98 | | /* In case we're on a 32-bit machine, construct a 64-bit "-1" value |
99 | | from smaller values. Start with zero, widen, *then* decrement. */ |
100 | | #define MINUS_ONE (((bfd_vma)0) - 1) |
101 | | |
102 | | /* The relocation table used for SHT_REL sections. */ |
103 | | |
104 | | static reloc_howto_type elf_mips_howto_table_rel[] = |
105 | | { |
106 | | /* No relocation. */ |
107 | | HOWTO (R_MIPS_NONE, /* type */ |
108 | | 0, /* rightshift */ |
109 | | 0, /* size */ |
110 | | 0, /* bitsize */ |
111 | | false, /* pc_relative */ |
112 | | 0, /* bitpos */ |
113 | | complain_overflow_dont, /* complain_on_overflow */ |
114 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
115 | | "R_MIPS_NONE", /* name */ |
116 | | false, /* partial_inplace */ |
117 | | 0, /* src_mask */ |
118 | | 0, /* dst_mask */ |
119 | | false), /* pcrel_offset */ |
120 | | |
121 | | /* 16 bit relocation. */ |
122 | | HOWTO (R_MIPS_16, /* type */ |
123 | | 0, /* rightshift */ |
124 | | 4, /* size */ |
125 | | 16, /* bitsize */ |
126 | | false, /* pc_relative */ |
127 | | 0, /* bitpos */ |
128 | | complain_overflow_signed, /* complain_on_overflow */ |
129 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
130 | | "R_MIPS_16", /* name */ |
131 | | true, /* partial_inplace */ |
132 | | 0x0000ffff, /* src_mask */ |
133 | | 0x0000ffff, /* dst_mask */ |
134 | | false), /* pcrel_offset */ |
135 | | |
136 | | /* 32 bit relocation. */ |
137 | | HOWTO (R_MIPS_32, /* type */ |
138 | | 0, /* rightshift */ |
139 | | 4, /* size */ |
140 | | 32, /* bitsize */ |
141 | | false, /* pc_relative */ |
142 | | 0, /* bitpos */ |
143 | | complain_overflow_dont, /* complain_on_overflow */ |
144 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
145 | | "R_MIPS_32", /* name */ |
146 | | true, /* partial_inplace */ |
147 | | 0xffffffff, /* src_mask */ |
148 | | 0xffffffff, /* dst_mask */ |
149 | | false), /* pcrel_offset */ |
150 | | |
151 | | /* 32 bit symbol relative relocation. */ |
152 | | HOWTO (R_MIPS_REL32, /* type */ |
153 | | 0, /* rightshift */ |
154 | | 4, /* size */ |
155 | | 32, /* bitsize */ |
156 | | false, /* pc_relative */ |
157 | | 0, /* bitpos */ |
158 | | complain_overflow_dont, /* complain_on_overflow */ |
159 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
160 | | "R_MIPS_REL32", /* name */ |
161 | | true, /* partial_inplace */ |
162 | | 0xffffffff, /* src_mask */ |
163 | | 0xffffffff, /* dst_mask */ |
164 | | false), /* pcrel_offset */ |
165 | | |
166 | | /* 26 bit jump address. */ |
167 | | HOWTO (R_MIPS_26, /* type */ |
168 | | 2, /* rightshift */ |
169 | | 4, /* size */ |
170 | | 26, /* bitsize */ |
171 | | false, /* pc_relative */ |
172 | | 0, /* bitpos */ |
173 | | complain_overflow_dont, /* complain_on_overflow */ |
174 | | /* This needs complex overflow |
175 | | detection, because the upper four |
176 | | bits must match the PC + 4. */ |
177 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
178 | | "R_MIPS_26", /* name */ |
179 | | true, /* partial_inplace */ |
180 | | 0x03ffffff, /* src_mask */ |
181 | | 0x03ffffff, /* dst_mask */ |
182 | | false), /* pcrel_offset */ |
183 | | |
184 | | /* High 16 bits of symbol value. */ |
185 | | HOWTO (R_MIPS_HI16, /* type */ |
186 | | 16, /* rightshift */ |
187 | | 4, /* size */ |
188 | | 16, /* bitsize */ |
189 | | false, /* pc_relative */ |
190 | | 0, /* bitpos */ |
191 | | complain_overflow_dont, /* complain_on_overflow */ |
192 | | _bfd_mips_elf_hi16_reloc, /* special_function */ |
193 | | "R_MIPS_HI16", /* name */ |
194 | | true, /* partial_inplace */ |
195 | | 0x0000ffff, /* src_mask */ |
196 | | 0x0000ffff, /* dst_mask */ |
197 | | false), /* pcrel_offset */ |
198 | | |
199 | | /* Low 16 bits of symbol value. */ |
200 | | HOWTO (R_MIPS_LO16, /* type */ |
201 | | 0, /* rightshift */ |
202 | | 4, /* size */ |
203 | | 16, /* bitsize */ |
204 | | false, /* pc_relative */ |
205 | | 0, /* bitpos */ |
206 | | complain_overflow_dont, /* complain_on_overflow */ |
207 | | _bfd_mips_elf_lo16_reloc, /* special_function */ |
208 | | "R_MIPS_LO16", /* name */ |
209 | | true, /* partial_inplace */ |
210 | | 0x0000ffff, /* src_mask */ |
211 | | 0x0000ffff, /* dst_mask */ |
212 | | false), /* pcrel_offset */ |
213 | | |
214 | | /* GP relative reference. */ |
215 | | HOWTO (R_MIPS_GPREL16, /* type */ |
216 | | 0, /* rightshift */ |
217 | | 4, /* size */ |
218 | | 16, /* bitsize */ |
219 | | false, /* pc_relative */ |
220 | | 0, /* bitpos */ |
221 | | complain_overflow_signed, /* complain_on_overflow */ |
222 | | _bfd_mips_elf32_gprel16_reloc, /* special_function */ |
223 | | "R_MIPS_GPREL16", /* name */ |
224 | | true, /* partial_inplace */ |
225 | | 0x0000ffff, /* src_mask */ |
226 | | 0x0000ffff, /* dst_mask */ |
227 | | false), /* pcrel_offset */ |
228 | | |
229 | | /* Reference to literal section. */ |
230 | | HOWTO (R_MIPS_LITERAL, /* type */ |
231 | | 0, /* rightshift */ |
232 | | 4, /* size */ |
233 | | 16, /* bitsize */ |
234 | | false, /* pc_relative */ |
235 | | 0, /* bitpos */ |
236 | | complain_overflow_signed, /* complain_on_overflow */ |
237 | | _bfd_mips_elf32_gprel16_reloc, /* special_function */ |
238 | | "R_MIPS_LITERAL", /* name */ |
239 | | true, /* partial_inplace */ |
240 | | 0x0000ffff, /* src_mask */ |
241 | | 0x0000ffff, /* dst_mask */ |
242 | | false), /* pcrel_offset */ |
243 | | |
244 | | /* Reference to global offset table. */ |
245 | | HOWTO (R_MIPS_GOT16, /* type */ |
246 | | 0, /* rightshift */ |
247 | | 4, /* size */ |
248 | | 16, /* bitsize */ |
249 | | false, /* pc_relative */ |
250 | | 0, /* bitpos */ |
251 | | complain_overflow_signed, /* complain_on_overflow */ |
252 | | _bfd_mips_elf_got16_reloc, /* special_function */ |
253 | | "R_MIPS_GOT16", /* name */ |
254 | | true, /* partial_inplace */ |
255 | | 0x0000ffff, /* src_mask */ |
256 | | 0x0000ffff, /* dst_mask */ |
257 | | false), /* pcrel_offset */ |
258 | | |
259 | | /* 16 bit PC relative reference. Note that the ABI document has a typo |
260 | | and claims R_MIPS_PC16 to be not rightshifted, rendering it useless. |
261 | | We do the right thing here. */ |
262 | | HOWTO (R_MIPS_PC16, /* type */ |
263 | | 2, /* rightshift */ |
264 | | 4, /* size */ |
265 | | 16, /* bitsize */ |
266 | | true, /* pc_relative */ |
267 | | 0, /* bitpos */ |
268 | | complain_overflow_signed, /* complain_on_overflow */ |
269 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
270 | | "R_MIPS_PC16", /* name */ |
271 | | true, /* partial_inplace */ |
272 | | 0x0000ffff, /* src_mask */ |
273 | | 0x0000ffff, /* dst_mask */ |
274 | | true), /* pcrel_offset */ |
275 | | |
276 | | /* 16 bit call through global offset table. */ |
277 | | HOWTO (R_MIPS_CALL16, /* type */ |
278 | | 0, /* rightshift */ |
279 | | 4, /* size */ |
280 | | 16, /* bitsize */ |
281 | | false, /* pc_relative */ |
282 | | 0, /* bitpos */ |
283 | | complain_overflow_signed, /* complain_on_overflow */ |
284 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
285 | | "R_MIPS_CALL16", /* name */ |
286 | | true, /* partial_inplace */ |
287 | | 0x0000ffff, /* src_mask */ |
288 | | 0x0000ffff, /* dst_mask */ |
289 | | false), /* pcrel_offset */ |
290 | | |
291 | | /* 32 bit GP relative reference. */ |
292 | | HOWTO (R_MIPS_GPREL32, /* type */ |
293 | | 0, /* rightshift */ |
294 | | 4, /* size */ |
295 | | 32, /* bitsize */ |
296 | | false, /* pc_relative */ |
297 | | 0, /* bitpos */ |
298 | | complain_overflow_dont, /* complain_on_overflow */ |
299 | | mips_elf_gprel32_reloc, /* special_function */ |
300 | | "R_MIPS_GPREL32", /* name */ |
301 | | true, /* partial_inplace */ |
302 | | 0xffffffff, /* src_mask */ |
303 | | 0xffffffff, /* dst_mask */ |
304 | | false), /* pcrel_offset */ |
305 | | |
306 | | /* The remaining relocs are defined on Irix 5, although they are |
307 | | not defined by the ABI. */ |
308 | | EMPTY_HOWTO (13), |
309 | | EMPTY_HOWTO (14), |
310 | | EMPTY_HOWTO (15), |
311 | | |
312 | | /* A 5 bit shift field. */ |
313 | | HOWTO (R_MIPS_SHIFT5, /* type */ |
314 | | 0, /* rightshift */ |
315 | | 4, /* size */ |
316 | | 5, /* bitsize */ |
317 | | false, /* pc_relative */ |
318 | | 6, /* bitpos */ |
319 | | complain_overflow_bitfield, /* complain_on_overflow */ |
320 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
321 | | "R_MIPS_SHIFT5", /* name */ |
322 | | true, /* partial_inplace */ |
323 | | 0x000007c0, /* src_mask */ |
324 | | 0x000007c0, /* dst_mask */ |
325 | | false), /* pcrel_offset */ |
326 | | |
327 | | /* A 6 bit shift field. */ |
328 | | /* FIXME: This is not handled correctly; a special function is |
329 | | needed to put the most significant bit in the right place. */ |
330 | | HOWTO (R_MIPS_SHIFT6, /* type */ |
331 | | 0, /* rightshift */ |
332 | | 4, /* size */ |
333 | | 6, /* bitsize */ |
334 | | false, /* pc_relative */ |
335 | | 6, /* bitpos */ |
336 | | complain_overflow_bitfield, /* complain_on_overflow */ |
337 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
338 | | "R_MIPS_SHIFT6", /* name */ |
339 | | true, /* partial_inplace */ |
340 | | 0x000007c4, /* src_mask */ |
341 | | 0x000007c4, /* dst_mask */ |
342 | | false), /* pcrel_offset */ |
343 | | |
344 | | /* A 64 bit relocation. */ |
345 | | HOWTO (R_MIPS_64, /* type */ |
346 | | 0, /* rightshift */ |
347 | | 8, /* size */ |
348 | | 64, /* bitsize */ |
349 | | false, /* pc_relative */ |
350 | | 0, /* bitpos */ |
351 | | complain_overflow_dont, /* complain_on_overflow */ |
352 | | mips32_64bit_reloc, /* special_function */ |
353 | | "R_MIPS_64", /* name */ |
354 | | true, /* partial_inplace */ |
355 | | MINUS_ONE, /* src_mask */ |
356 | | MINUS_ONE, /* dst_mask */ |
357 | | false), /* pcrel_offset */ |
358 | | |
359 | | /* Displacement in the global offset table. */ |
360 | | HOWTO (R_MIPS_GOT_DISP, /* type */ |
361 | | 0, /* rightshift */ |
362 | | 4, /* size */ |
363 | | 16, /* bitsize */ |
364 | | false, /* pc_relative */ |
365 | | 0, /* bitpos */ |
366 | | complain_overflow_signed, /* complain_on_overflow */ |
367 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
368 | | "R_MIPS_GOT_DISP", /* name */ |
369 | | true, /* partial_inplace */ |
370 | | 0x0000ffff, /* src_mask */ |
371 | | 0x0000ffff, /* dst_mask */ |
372 | | false), /* pcrel_offset */ |
373 | | |
374 | | /* Displacement to page pointer in the global offset table. */ |
375 | | HOWTO (R_MIPS_GOT_PAGE, /* type */ |
376 | | 0, /* rightshift */ |
377 | | 4, /* size */ |
378 | | 16, /* bitsize */ |
379 | | false, /* pc_relative */ |
380 | | 0, /* bitpos */ |
381 | | complain_overflow_signed, /* complain_on_overflow */ |
382 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
383 | | "R_MIPS_GOT_PAGE", /* name */ |
384 | | true, /* partial_inplace */ |
385 | | 0x0000ffff, /* src_mask */ |
386 | | 0x0000ffff, /* dst_mask */ |
387 | | false), /* pcrel_offset */ |
388 | | |
389 | | /* Offset from page pointer in the global offset table. */ |
390 | | HOWTO (R_MIPS_GOT_OFST, /* type */ |
391 | | 0, /* rightshift */ |
392 | | 4, /* size */ |
393 | | 16, /* bitsize */ |
394 | | false, /* pc_relative */ |
395 | | 0, /* bitpos */ |
396 | | complain_overflow_signed, /* complain_on_overflow */ |
397 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
398 | | "R_MIPS_GOT_OFST", /* name */ |
399 | | true, /* partial_inplace */ |
400 | | 0x0000ffff, /* src_mask */ |
401 | | 0x0000ffff, /* dst_mask */ |
402 | | false), /* pcrel_offset */ |
403 | | |
404 | | /* High 16 bits of displacement in global offset table. */ |
405 | | HOWTO (R_MIPS_GOT_HI16, /* type */ |
406 | | 16, /* rightshift */ |
407 | | 4, /* size */ |
408 | | 16, /* bitsize */ |
409 | | false, /* pc_relative */ |
410 | | 0, /* bitpos */ |
411 | | complain_overflow_dont, /* complain_on_overflow */ |
412 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
413 | | "R_MIPS_GOT_HI16", /* name */ |
414 | | true, /* partial_inplace */ |
415 | | 0x0000ffff, /* src_mask */ |
416 | | 0x0000ffff, /* dst_mask */ |
417 | | false), /* pcrel_offset */ |
418 | | |
419 | | /* Low 16 bits of displacement in global offset table. */ |
420 | | HOWTO (R_MIPS_GOT_LO16, /* type */ |
421 | | 0, /* rightshift */ |
422 | | 4, /* size */ |
423 | | 16, /* bitsize */ |
424 | | false, /* pc_relative */ |
425 | | 0, /* bitpos */ |
426 | | complain_overflow_dont, /* complain_on_overflow */ |
427 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
428 | | "R_MIPS_GOT_LO16", /* name */ |
429 | | true, /* partial_inplace */ |
430 | | 0x0000ffff, /* src_mask */ |
431 | | 0x0000ffff, /* dst_mask */ |
432 | | false), /* pcrel_offset */ |
433 | | |
434 | | /* 64 bit subtraction. Used in the N32 ABI. */ |
435 | | HOWTO (R_MIPS_SUB, /* type */ |
436 | | 0, /* rightshift */ |
437 | | 8, /* size */ |
438 | | 64, /* bitsize */ |
439 | | false, /* pc_relative */ |
440 | | 0, /* bitpos */ |
441 | | complain_overflow_dont, /* complain_on_overflow */ |
442 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
443 | | "R_MIPS_SUB", /* name */ |
444 | | true, /* partial_inplace */ |
445 | | MINUS_ONE, /* src_mask */ |
446 | | MINUS_ONE, /* dst_mask */ |
447 | | false), /* pcrel_offset */ |
448 | | |
449 | | /* Used to cause the linker to insert and delete instructions? */ |
450 | | EMPTY_HOWTO (R_MIPS_INSERT_A), |
451 | | EMPTY_HOWTO (R_MIPS_INSERT_B), |
452 | | EMPTY_HOWTO (R_MIPS_DELETE), |
453 | | |
454 | | /* Get the higher value of a 64 bit addend. */ |
455 | | HOWTO (R_MIPS_HIGHER, /* type */ |
456 | | 32, /* rightshift */ |
457 | | 4, /* size */ |
458 | | 16, /* 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_HIGHER", /* name */ |
464 | | true, /* partial_inplace */ |
465 | | 0x0000ffff, /* src_mask */ |
466 | | 0x0000ffff, /* dst_mask */ |
467 | | false), /* pcrel_offset */ |
468 | | |
469 | | /* Get the highest value of a 64 bit addend. */ |
470 | | HOWTO (R_MIPS_HIGHEST, /* type */ |
471 | | 48, /* rightshift */ |
472 | | 4, /* size */ |
473 | | 16, /* bitsize */ |
474 | | false, /* pc_relative */ |
475 | | 0, /* bitpos */ |
476 | | complain_overflow_dont, /* complain_on_overflow */ |
477 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
478 | | "R_MIPS_HIGHEST", /* name */ |
479 | | true, /* partial_inplace */ |
480 | | 0x0000ffff, /* src_mask */ |
481 | | 0x0000ffff, /* dst_mask */ |
482 | | false), /* pcrel_offset */ |
483 | | |
484 | | /* High 16 bits of displacement in global offset table. */ |
485 | | HOWTO (R_MIPS_CALL_HI16, /* type */ |
486 | | 16, /* rightshift */ |
487 | | 4, /* size */ |
488 | | 16, /* bitsize */ |
489 | | false, /* pc_relative */ |
490 | | 0, /* bitpos */ |
491 | | complain_overflow_dont, /* complain_on_overflow */ |
492 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
493 | | "R_MIPS_CALL_HI16", /* name */ |
494 | | true, /* partial_inplace */ |
495 | | 0x0000ffff, /* src_mask */ |
496 | | 0x0000ffff, /* dst_mask */ |
497 | | false), /* pcrel_offset */ |
498 | | |
499 | | /* Low 16 bits of displacement in global offset table. */ |
500 | | HOWTO (R_MIPS_CALL_LO16, /* type */ |
501 | | 0, /* rightshift */ |
502 | | 4, /* size */ |
503 | | 16, /* bitsize */ |
504 | | false, /* pc_relative */ |
505 | | 0, /* bitpos */ |
506 | | complain_overflow_dont, /* complain_on_overflow */ |
507 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
508 | | "R_MIPS_CALL_LO16", /* name */ |
509 | | true, /* partial_inplace */ |
510 | | 0x0000ffff, /* src_mask */ |
511 | | 0x0000ffff, /* dst_mask */ |
512 | | false), /* pcrel_offset */ |
513 | | |
514 | | /* Section displacement. */ |
515 | | HOWTO (R_MIPS_SCN_DISP, /* type */ |
516 | | 0, /* rightshift */ |
517 | | 4, /* size */ |
518 | | 32, /* bitsize */ |
519 | | false, /* pc_relative */ |
520 | | 0, /* bitpos */ |
521 | | complain_overflow_dont, /* complain_on_overflow */ |
522 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
523 | | "R_MIPS_SCN_DISP", /* name */ |
524 | | true, /* partial_inplace */ |
525 | | 0xffffffff, /* src_mask */ |
526 | | 0xffffffff, /* dst_mask */ |
527 | | false), /* pcrel_offset */ |
528 | | |
529 | | EMPTY_HOWTO (R_MIPS_REL16), |
530 | | EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE), |
531 | | EMPTY_HOWTO (R_MIPS_PJUMP), |
532 | | EMPTY_HOWTO (R_MIPS_RELGOT), |
533 | | |
534 | | /* Protected jump conversion. This is an optimization hint. No |
535 | | relocation is required for correctness. */ |
536 | | HOWTO (R_MIPS_JALR, /* type */ |
537 | | 0, /* rightshift */ |
538 | | 4, /* size */ |
539 | | 32, /* bitsize */ |
540 | | false, /* pc_relative */ |
541 | | 0, /* bitpos */ |
542 | | complain_overflow_dont, /* complain_on_overflow */ |
543 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
544 | | "R_MIPS_JALR", /* name */ |
545 | | false, /* partial_inplace */ |
546 | | 0x00000000, /* src_mask */ |
547 | | 0x00000000, /* dst_mask */ |
548 | | false), /* pcrel_offset */ |
549 | | |
550 | | /* TLS GD/LD dynamic relocations. */ |
551 | | HOWTO (R_MIPS_TLS_DTPMOD32, /* type */ |
552 | | 0, /* rightshift */ |
553 | | 4, /* size */ |
554 | | 32, /* bitsize */ |
555 | | false, /* pc_relative */ |
556 | | 0, /* bitpos */ |
557 | | complain_overflow_dont, /* complain_on_overflow */ |
558 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
559 | | "R_MIPS_TLS_DTPMOD32", /* name */ |
560 | | true, /* partial_inplace */ |
561 | | 0xffffffff, /* src_mask */ |
562 | | 0xffffffff, /* dst_mask */ |
563 | | false), /* pcrel_offset */ |
564 | | |
565 | | HOWTO (R_MIPS_TLS_DTPREL32, /* type */ |
566 | | 0, /* rightshift */ |
567 | | 4, /* size */ |
568 | | 32, /* bitsize */ |
569 | | false, /* pc_relative */ |
570 | | 0, /* bitpos */ |
571 | | complain_overflow_dont, /* complain_on_overflow */ |
572 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
573 | | "R_MIPS_TLS_DTPREL32", /* name */ |
574 | | true, /* partial_inplace */ |
575 | | 0xffffffff, /* src_mask */ |
576 | | 0xffffffff, /* dst_mask */ |
577 | | false), /* pcrel_offset */ |
578 | | |
579 | | EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64), |
580 | | EMPTY_HOWTO (R_MIPS_TLS_DTPREL64), |
581 | | |
582 | | /* TLS general dynamic variable reference. */ |
583 | | HOWTO (R_MIPS_TLS_GD, /* type */ |
584 | | 0, /* rightshift */ |
585 | | 4, /* size */ |
586 | | 16, /* bitsize */ |
587 | | false, /* pc_relative */ |
588 | | 0, /* bitpos */ |
589 | | complain_overflow_signed, /* complain_on_overflow */ |
590 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
591 | | "R_MIPS_TLS_GD", /* name */ |
592 | | true, /* partial_inplace */ |
593 | | 0x0000ffff, /* src_mask */ |
594 | | 0x0000ffff, /* dst_mask */ |
595 | | false), /* pcrel_offset */ |
596 | | |
597 | | /* TLS local dynamic variable reference. */ |
598 | | HOWTO (R_MIPS_TLS_LDM, /* type */ |
599 | | 0, /* rightshift */ |
600 | | 4, /* size */ |
601 | | 16, /* bitsize */ |
602 | | false, /* pc_relative */ |
603 | | 0, /* bitpos */ |
604 | | complain_overflow_signed, /* complain_on_overflow */ |
605 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
606 | | "R_MIPS_TLS_LDM", /* name */ |
607 | | true, /* partial_inplace */ |
608 | | 0x0000ffff, /* src_mask */ |
609 | | 0x0000ffff, /* dst_mask */ |
610 | | false), /* pcrel_offset */ |
611 | | |
612 | | /* TLS local dynamic offset. */ |
613 | | HOWTO (R_MIPS_TLS_DTPREL_HI16, /* type */ |
614 | | 16, /* rightshift */ |
615 | | 4, /* size */ |
616 | | 16, /* bitsize */ |
617 | | false, /* pc_relative */ |
618 | | 0, /* bitpos */ |
619 | | complain_overflow_signed, /* complain_on_overflow */ |
620 | | _bfd_mips_elf_hi16_reloc, /* special_function */ |
621 | | "R_MIPS_TLS_DTPREL_HI16", /* name */ |
622 | | true, /* partial_inplace */ |
623 | | 0x0000ffff, /* src_mask */ |
624 | | 0x0000ffff, /* dst_mask */ |
625 | | false), /* pcrel_offset */ |
626 | | |
627 | | /* TLS local dynamic offset. */ |
628 | | HOWTO (R_MIPS_TLS_DTPREL_LO16, /* type */ |
629 | | 0, /* rightshift */ |
630 | | 4, /* size */ |
631 | | 16, /* bitsize */ |
632 | | false, /* pc_relative */ |
633 | | 0, /* bitpos */ |
634 | | complain_overflow_dont, /* complain_on_overflow */ |
635 | | _bfd_mips_elf_lo16_reloc, /* special_function */ |
636 | | "R_MIPS_TLS_DTPREL_LO16", /* name */ |
637 | | true, /* partial_inplace */ |
638 | | 0x0000ffff, /* src_mask */ |
639 | | 0x0000ffff, /* dst_mask */ |
640 | | false), /* pcrel_offset */ |
641 | | |
642 | | /* TLS thread pointer offset. */ |
643 | | HOWTO (R_MIPS_TLS_GOTTPREL, /* type */ |
644 | | 0, /* rightshift */ |
645 | | 4, /* size */ |
646 | | 16, /* bitsize */ |
647 | | false, /* pc_relative */ |
648 | | 0, /* bitpos */ |
649 | | complain_overflow_signed, /* complain_on_overflow */ |
650 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
651 | | "R_MIPS_TLS_GOTTPREL", /* name */ |
652 | | true, /* partial_inplace */ |
653 | | 0x0000ffff, /* src_mask */ |
654 | | 0x0000ffff, /* dst_mask */ |
655 | | false), /* pcrel_offset */ |
656 | | |
657 | | /* TLS IE dynamic relocations. */ |
658 | | HOWTO (R_MIPS_TLS_TPREL32, /* type */ |
659 | | 0, /* rightshift */ |
660 | | 4, /* size */ |
661 | | 32, /* bitsize */ |
662 | | false, /* pc_relative */ |
663 | | 0, /* bitpos */ |
664 | | complain_overflow_dont, /* complain_on_overflow */ |
665 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
666 | | "R_MIPS_TLS_TPREL32", /* name */ |
667 | | true, /* partial_inplace */ |
668 | | 0xffffffff, /* src_mask */ |
669 | | 0xffffffff, /* dst_mask */ |
670 | | false), /* pcrel_offset */ |
671 | | |
672 | | EMPTY_HOWTO (R_MIPS_TLS_TPREL64), |
673 | | |
674 | | /* TLS thread pointer offset. */ |
675 | | HOWTO (R_MIPS_TLS_TPREL_HI16, /* type */ |
676 | | 16, /* rightshift */ |
677 | | 4, /* size */ |
678 | | 16, /* bitsize */ |
679 | | false, /* pc_relative */ |
680 | | 0, /* bitpos */ |
681 | | complain_overflow_signed, /* complain_on_overflow */ |
682 | | _bfd_mips_elf_hi16_reloc, /* special_function */ |
683 | | "R_MIPS_TLS_TPREL_HI16", /* name */ |
684 | | true, /* partial_inplace */ |
685 | | 0x0000ffff, /* src_mask */ |
686 | | 0x0000ffff, /* dst_mask */ |
687 | | false), /* pcrel_offset */ |
688 | | |
689 | | /* TLS thread pointer offset. */ |
690 | | HOWTO (R_MIPS_TLS_TPREL_LO16, /* type */ |
691 | | 0, /* rightshift */ |
692 | | 4, /* size */ |
693 | | 16, /* bitsize */ |
694 | | false, /* pc_relative */ |
695 | | 0, /* bitpos */ |
696 | | complain_overflow_dont, /* complain_on_overflow */ |
697 | | _bfd_mips_elf_lo16_reloc, /* special_function */ |
698 | | "R_MIPS_TLS_TPREL_LO16", /* name */ |
699 | | true, /* partial_inplace */ |
700 | | 0x0000ffff, /* src_mask */ |
701 | | 0x0000ffff, /* dst_mask */ |
702 | | false), /* pcrel_offset */ |
703 | | |
704 | | /* 32 bit relocation with no addend. */ |
705 | | HOWTO (R_MIPS_GLOB_DAT, /* type */ |
706 | | 0, /* rightshift */ |
707 | | 4, /* size */ |
708 | | 32, /* bitsize */ |
709 | | false, /* pc_relative */ |
710 | | 0, /* bitpos */ |
711 | | complain_overflow_dont, /* complain_on_overflow */ |
712 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
713 | | "R_MIPS_GLOB_DAT", /* name */ |
714 | | false, /* partial_inplace */ |
715 | | 0x0, /* src_mask */ |
716 | | 0xffffffff, /* dst_mask */ |
717 | | false), /* pcrel_offset */ |
718 | | |
719 | | EMPTY_HOWTO (52), |
720 | | EMPTY_HOWTO (53), |
721 | | EMPTY_HOWTO (54), |
722 | | EMPTY_HOWTO (55), |
723 | | EMPTY_HOWTO (56), |
724 | | EMPTY_HOWTO (57), |
725 | | EMPTY_HOWTO (58), |
726 | | EMPTY_HOWTO (59), |
727 | | |
728 | | HOWTO (R_MIPS_PC21_S2, /* type */ |
729 | | 2, /* rightshift */ |
730 | | 4, /* size */ |
731 | | 21, /* bitsize */ |
732 | | true, /* pc_relative */ |
733 | | 0, /* bitpos */ |
734 | | complain_overflow_signed, /* complain_on_overflow */ |
735 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
736 | | "R_MIPS_PC21_S2", /* name */ |
737 | | true, /* partial_inplace */ |
738 | | 0x001fffff, /* src_mask */ |
739 | | 0x001fffff, /* dst_mask */ |
740 | | true), /* pcrel_offset */ |
741 | | |
742 | | HOWTO (R_MIPS_PC26_S2, /* type */ |
743 | | 2, /* rightshift */ |
744 | | 4, /* size */ |
745 | | 26, /* bitsize */ |
746 | | true, /* pc_relative */ |
747 | | 0, /* bitpos */ |
748 | | complain_overflow_signed, /* complain_on_overflow */ |
749 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
750 | | "R_MIPS_PC26_S2", /* name */ |
751 | | true, /* partial_inplace */ |
752 | | 0x03ffffff, /* src_mask */ |
753 | | 0x03ffffff, /* dst_mask */ |
754 | | true), /* pcrel_offset */ |
755 | | |
756 | | HOWTO (R_MIPS_PC18_S3, /* type */ |
757 | | 3, /* rightshift */ |
758 | | 4, /* size */ |
759 | | 18, /* bitsize */ |
760 | | true, /* pc_relative */ |
761 | | 0, /* bitpos */ |
762 | | complain_overflow_signed, /* complain_on_overflow */ |
763 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
764 | | "R_MIPS_PC18_S3", /* name */ |
765 | | true, /* partial_inplace */ |
766 | | 0x0003ffff, /* src_mask */ |
767 | | 0x0003ffff, /* dst_mask */ |
768 | | true), /* pcrel_offset */ |
769 | | |
770 | | HOWTO (R_MIPS_PC19_S2, /* type */ |
771 | | 2, /* rightshift */ |
772 | | 4, /* size */ |
773 | | 19, /* bitsize */ |
774 | | true, /* pc_relative */ |
775 | | 0, /* bitpos */ |
776 | | complain_overflow_signed, /* complain_on_overflow */ |
777 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
778 | | "R_MIPS_PC19_S2", /* name */ |
779 | | true, /* partial_inplace */ |
780 | | 0x0007ffff, /* src_mask */ |
781 | | 0x0007ffff, /* dst_mask */ |
782 | | true), /* pcrel_offset */ |
783 | | |
784 | | HOWTO (R_MIPS_PCHI16, /* type */ |
785 | | 16, /* rightshift */ |
786 | | 4, /* size */ |
787 | | 16, /* bitsize */ |
788 | | true, /* pc_relative */ |
789 | | 0, /* bitpos */ |
790 | | complain_overflow_signed, /* complain_on_overflow */ |
791 | | _bfd_mips_elf_hi16_reloc, /* special_function */ |
792 | | "R_MIPS_PCHI16", /* name */ |
793 | | true, /* partial_inplace */ |
794 | | 0x0000ffff, /* src_mask */ |
795 | | 0x0000ffff, /* dst_mask */ |
796 | | true), /* pcrel_offset */ |
797 | | |
798 | | HOWTO (R_MIPS_PCLO16, /* type */ |
799 | | 0, /* rightshift */ |
800 | | 4, /* size */ |
801 | | 16, /* bitsize */ |
802 | | true, /* pc_relative */ |
803 | | 0, /* bitpos */ |
804 | | complain_overflow_dont, /* complain_on_overflow */ |
805 | | _bfd_mips_elf_lo16_reloc, /* special_function */ |
806 | | "R_MIPS_PCLO16", /* name */ |
807 | | true, /* partial_inplace */ |
808 | | 0x0000ffff, /* src_mask */ |
809 | | 0x0000ffff, /* dst_mask */ |
810 | | true), /* pcrel_offset */ |
811 | | }; |
812 | | |
813 | | /* The relocation table used for SHT_RELA sections. */ |
814 | | |
815 | | static reloc_howto_type elf_mips_howto_table_rela[] = |
816 | | { |
817 | | /* No relocation. */ |
818 | | HOWTO (R_MIPS_NONE, /* type */ |
819 | | 0, /* rightshift */ |
820 | | 0, /* size */ |
821 | | 0, /* bitsize */ |
822 | | false, /* pc_relative */ |
823 | | 0, /* bitpos */ |
824 | | complain_overflow_dont, /* complain_on_overflow */ |
825 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
826 | | "R_MIPS_NONE", /* name */ |
827 | | false, /* partial_inplace */ |
828 | | 0, /* src_mask */ |
829 | | 0, /* dst_mask */ |
830 | | false), /* pcrel_offset */ |
831 | | |
832 | | /* 16 bit relocation. */ |
833 | | HOWTO (R_MIPS_16, /* type */ |
834 | | 0, /* rightshift */ |
835 | | 4, /* size */ |
836 | | 16, /* bitsize */ |
837 | | false, /* pc_relative */ |
838 | | 0, /* bitpos */ |
839 | | complain_overflow_signed, /* complain_on_overflow */ |
840 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
841 | | "R_MIPS_16", /* name */ |
842 | | false, /* partial_inplace */ |
843 | | 0, /* src_mask */ |
844 | | 0x0000ffff, /* dst_mask */ |
845 | | false), /* pcrel_offset */ |
846 | | |
847 | | /* 32 bit relocation. */ |
848 | | HOWTO (R_MIPS_32, /* type */ |
849 | | 0, /* rightshift */ |
850 | | 4, /* size */ |
851 | | 32, /* bitsize */ |
852 | | false, /* pc_relative */ |
853 | | 0, /* bitpos */ |
854 | | complain_overflow_dont, /* complain_on_overflow */ |
855 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
856 | | "R_MIPS_32", /* name */ |
857 | | false, /* partial_inplace */ |
858 | | 0, /* src_mask */ |
859 | | 0xffffffff, /* dst_mask */ |
860 | | false), /* pcrel_offset */ |
861 | | |
862 | | /* 32 bit symbol relative relocation. */ |
863 | | HOWTO (R_MIPS_REL32, /* type */ |
864 | | 0, /* rightshift */ |
865 | | 4, /* size */ |
866 | | 32, /* bitsize */ |
867 | | false, /* pc_relative */ |
868 | | 0, /* bitpos */ |
869 | | complain_overflow_dont, /* complain_on_overflow */ |
870 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
871 | | "R_MIPS_REL32", /* name */ |
872 | | false, /* partial_inplace */ |
873 | | 0, /* src_mask */ |
874 | | 0xffffffff, /* dst_mask */ |
875 | | false), /* pcrel_offset */ |
876 | | |
877 | | /* 26 bit jump address. */ |
878 | | HOWTO (R_MIPS_26, /* type */ |
879 | | 2, /* rightshift */ |
880 | | 4, /* size */ |
881 | | 26, /* bitsize */ |
882 | | false, /* pc_relative */ |
883 | | 0, /* bitpos */ |
884 | | complain_overflow_dont, /* complain_on_overflow */ |
885 | | /* This needs complex overflow |
886 | | detection, because the upper four |
887 | | bits must match the PC + 4. */ |
888 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
889 | | "R_MIPS_26", /* name */ |
890 | | false, /* partial_inplace */ |
891 | | 0, /* src_mask */ |
892 | | 0x03ffffff, /* dst_mask */ |
893 | | false), /* pcrel_offset */ |
894 | | |
895 | | /* High 16 bits of symbol value. */ |
896 | | HOWTO (R_MIPS_HI16, /* type */ |
897 | | 16, /* rightshift */ |
898 | | 4, /* size */ |
899 | | 16, /* bitsize */ |
900 | | false, /* pc_relative */ |
901 | | 0, /* bitpos */ |
902 | | complain_overflow_dont, /* complain_on_overflow */ |
903 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
904 | | "R_MIPS_HI16", /* name */ |
905 | | false, /* partial_inplace */ |
906 | | 0, /* src_mask */ |
907 | | 0x0000ffff, /* dst_mask */ |
908 | | false), /* pcrel_offset */ |
909 | | |
910 | | /* Low 16 bits of symbol value. */ |
911 | | HOWTO (R_MIPS_LO16, /* type */ |
912 | | 0, /* rightshift */ |
913 | | 4, /* size */ |
914 | | 16, /* bitsize */ |
915 | | false, /* pc_relative */ |
916 | | 0, /* bitpos */ |
917 | | complain_overflow_dont, /* complain_on_overflow */ |
918 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
919 | | "R_MIPS_LO16", /* name */ |
920 | | false, /* partial_inplace */ |
921 | | 0, /* src_mask */ |
922 | | 0x0000ffff, /* dst_mask */ |
923 | | false), /* pcrel_offset */ |
924 | | |
925 | | /* GP relative reference. */ |
926 | | HOWTO (R_MIPS_GPREL16, /* type */ |
927 | | 0, /* rightshift */ |
928 | | 4, /* size */ |
929 | | 16, /* bitsize */ |
930 | | false, /* pc_relative */ |
931 | | 0, /* bitpos */ |
932 | | complain_overflow_signed, /* complain_on_overflow */ |
933 | | _bfd_mips_elf32_gprel16_reloc, /* special_function */ |
934 | | "R_MIPS_GPREL16", /* name */ |
935 | | false, /* partial_inplace */ |
936 | | 0, /* src_mask */ |
937 | | 0x0000ffff, /* dst_mask */ |
938 | | false), /* pcrel_offset */ |
939 | | |
940 | | /* Reference to literal section. */ |
941 | | HOWTO (R_MIPS_LITERAL, /* type */ |
942 | | 0, /* rightshift */ |
943 | | 4, /* size */ |
944 | | 16, /* bitsize */ |
945 | | false, /* pc_relative */ |
946 | | 0, /* bitpos */ |
947 | | complain_overflow_signed, /* complain_on_overflow */ |
948 | | _bfd_mips_elf32_gprel16_reloc, /* special_function */ |
949 | | "R_MIPS_LITERAL", /* name */ |
950 | | false, /* partial_inplace */ |
951 | | 0, /* src_mask */ |
952 | | 0x0000ffff, /* dst_mask */ |
953 | | false), /* pcrel_offset */ |
954 | | |
955 | | /* Reference to global offset table. */ |
956 | | HOWTO (R_MIPS_GOT16, /* type */ |
957 | | 0, /* rightshift */ |
958 | | 4, /* size */ |
959 | | 16, /* bitsize */ |
960 | | false, /* pc_relative */ |
961 | | 0, /* bitpos */ |
962 | | complain_overflow_signed, /* complain_on_overflow */ |
963 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
964 | | "R_MIPS_GOT16", /* name */ |
965 | | false, /* partial_inplace */ |
966 | | 0, /* src_mask */ |
967 | | 0x0000ffff, /* dst_mask */ |
968 | | false), /* pcrel_offset */ |
969 | | |
970 | | /* 16 bit PC relative reference. Note that the ABI document has a typo |
971 | | and claims R_MIPS_PC16 to be not rightshifted, rendering it useless. |
972 | | We do the right thing here. */ |
973 | | HOWTO (R_MIPS_PC16, /* type */ |
974 | | 2, /* rightshift */ |
975 | | 4, /* size */ |
976 | | 16, /* bitsize */ |
977 | | true, /* pc_relative */ |
978 | | 0, /* bitpos */ |
979 | | complain_overflow_signed, /* complain_on_overflow */ |
980 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
981 | | "R_MIPS_PC16", /* name */ |
982 | | false, /* partial_inplace */ |
983 | | 0, /* src_mask */ |
984 | | 0x0000ffff, /* dst_mask */ |
985 | | true), /* pcrel_offset */ |
986 | | |
987 | | /* 16 bit call through global offset table. */ |
988 | | HOWTO (R_MIPS_CALL16, /* type */ |
989 | | 0, /* rightshift */ |
990 | | 4, /* size */ |
991 | | 16, /* bitsize */ |
992 | | false, /* pc_relative */ |
993 | | 0, /* bitpos */ |
994 | | complain_overflow_signed, /* complain_on_overflow */ |
995 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
996 | | "R_MIPS_CALL16", /* name */ |
997 | | false, /* partial_inplace */ |
998 | | 0, /* src_mask */ |
999 | | 0x0000ffff, /* dst_mask */ |
1000 | | false), /* pcrel_offset */ |
1001 | | |
1002 | | /* 32 bit GP relative reference. */ |
1003 | | HOWTO (R_MIPS_GPREL32, /* type */ |
1004 | | 0, /* rightshift */ |
1005 | | 4, /* size */ |
1006 | | 32, /* bitsize */ |
1007 | | false, /* pc_relative */ |
1008 | | 0, /* bitpos */ |
1009 | | complain_overflow_dont, /* complain_on_overflow */ |
1010 | | mips_elf_gprel32_reloc, /* special_function */ |
1011 | | "R_MIPS_GPREL32", /* name */ |
1012 | | false, /* partial_inplace */ |
1013 | | 0, /* src_mask */ |
1014 | | 0xffffffff, /* dst_mask */ |
1015 | | false), /* pcrel_offset */ |
1016 | | |
1017 | | EMPTY_HOWTO (13), |
1018 | | EMPTY_HOWTO (14), |
1019 | | EMPTY_HOWTO (15), |
1020 | | |
1021 | | /* A 5 bit shift field. */ |
1022 | | HOWTO (R_MIPS_SHIFT5, /* type */ |
1023 | | 0, /* rightshift */ |
1024 | | 4, /* size */ |
1025 | | 5, /* bitsize */ |
1026 | | false, /* pc_relative */ |
1027 | | 6, /* bitpos */ |
1028 | | complain_overflow_bitfield, /* complain_on_overflow */ |
1029 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1030 | | "R_MIPS_SHIFT5", /* name */ |
1031 | | false, /* partial_inplace */ |
1032 | | 0, /* src_mask */ |
1033 | | 0x000007c0, /* dst_mask */ |
1034 | | false), /* pcrel_offset */ |
1035 | | |
1036 | | /* A 6 bit shift field. */ |
1037 | | /* FIXME: This is not handled correctly; a special function is |
1038 | | needed to put the most significant bit in the right place. */ |
1039 | | HOWTO (R_MIPS_SHIFT6, /* type */ |
1040 | | 0, /* rightshift */ |
1041 | | 4, /* size */ |
1042 | | 6, /* bitsize */ |
1043 | | false, /* pc_relative */ |
1044 | | 6, /* bitpos */ |
1045 | | complain_overflow_bitfield, /* complain_on_overflow */ |
1046 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1047 | | "R_MIPS_SHIFT6", /* name */ |
1048 | | false, /* partial_inplace */ |
1049 | | 0, /* src_mask */ |
1050 | | 0x000007c4, /* dst_mask */ |
1051 | | false), /* pcrel_offset */ |
1052 | | |
1053 | | /* A 64 bit relocation. */ |
1054 | | HOWTO (R_MIPS_64, /* type */ |
1055 | | 0, /* rightshift */ |
1056 | | 8, /* size */ |
1057 | | 64, /* bitsize */ |
1058 | | false, /* pc_relative */ |
1059 | | 0, /* bitpos */ |
1060 | | complain_overflow_dont, /* complain_on_overflow */ |
1061 | | mips32_64bit_reloc, /* special_function */ |
1062 | | "R_MIPS_64", /* name */ |
1063 | | false, /* partial_inplace */ |
1064 | | 0, /* src_mask */ |
1065 | | MINUS_ONE, /* dst_mask */ |
1066 | | false), /* pcrel_offset */ |
1067 | | |
1068 | | /* Displacement in the global offset table. */ |
1069 | | HOWTO (R_MIPS_GOT_DISP, /* type */ |
1070 | | 0, /* rightshift */ |
1071 | | 4, /* size */ |
1072 | | 16, /* bitsize */ |
1073 | | false, /* pc_relative */ |
1074 | | 0, /* bitpos */ |
1075 | | complain_overflow_signed, /* complain_on_overflow */ |
1076 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1077 | | "R_MIPS_GOT_DISP", /* name */ |
1078 | | false, /* partial_inplace */ |
1079 | | 0, /* src_mask */ |
1080 | | 0x0000ffff, /* dst_mask */ |
1081 | | false), /* pcrel_offset */ |
1082 | | |
1083 | | /* Displacement to page pointer in the global offset table. */ |
1084 | | HOWTO (R_MIPS_GOT_PAGE, /* type */ |
1085 | | 0, /* rightshift */ |
1086 | | 4, /* size */ |
1087 | | 16, /* bitsize */ |
1088 | | false, /* pc_relative */ |
1089 | | 0, /* bitpos */ |
1090 | | complain_overflow_signed, /* complain_on_overflow */ |
1091 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1092 | | "R_MIPS_GOT_PAGE", /* name */ |
1093 | | false, /* partial_inplace */ |
1094 | | 0, /* src_mask */ |
1095 | | 0x0000ffff, /* dst_mask */ |
1096 | | false), /* pcrel_offset */ |
1097 | | |
1098 | | /* Offset from page pointer in the global offset table. */ |
1099 | | HOWTO (R_MIPS_GOT_OFST, /* type */ |
1100 | | 0, /* rightshift */ |
1101 | | 4, /* size */ |
1102 | | 16, /* bitsize */ |
1103 | | false, /* pc_relative */ |
1104 | | 0, /* bitpos */ |
1105 | | complain_overflow_signed, /* complain_on_overflow */ |
1106 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1107 | | "R_MIPS_GOT_OFST", /* name */ |
1108 | | false, /* partial_inplace */ |
1109 | | 0, /* src_mask */ |
1110 | | 0x0000ffff, /* dst_mask */ |
1111 | | false), /* pcrel_offset */ |
1112 | | |
1113 | | /* High 16 bits of displacement in global offset table. */ |
1114 | | HOWTO (R_MIPS_GOT_HI16, /* type */ |
1115 | | 16, /* rightshift */ |
1116 | | 4, /* size */ |
1117 | | 16, /* bitsize */ |
1118 | | false, /* pc_relative */ |
1119 | | 0, /* bitpos */ |
1120 | | complain_overflow_dont, /* complain_on_overflow */ |
1121 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1122 | | "R_MIPS_GOT_HI16", /* name */ |
1123 | | false, /* partial_inplace */ |
1124 | | 0, /* src_mask */ |
1125 | | 0x0000ffff, /* dst_mask */ |
1126 | | false), /* pcrel_offset */ |
1127 | | |
1128 | | /* Low 16 bits of displacement in global offset table. */ |
1129 | | HOWTO (R_MIPS_GOT_LO16, /* type */ |
1130 | | 0, /* rightshift */ |
1131 | | 4, /* size */ |
1132 | | 16, /* bitsize */ |
1133 | | false, /* pc_relative */ |
1134 | | 0, /* bitpos */ |
1135 | | complain_overflow_dont, /* complain_on_overflow */ |
1136 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1137 | | "R_MIPS_GOT_LO16", /* name */ |
1138 | | false, /* partial_inplace */ |
1139 | | 0, /* src_mask */ |
1140 | | 0x0000ffff, /* dst_mask */ |
1141 | | false), /* pcrel_offset */ |
1142 | | |
1143 | | /* 64 bit subtraction. Used in the N32 ABI. */ |
1144 | | HOWTO (R_MIPS_SUB, /* type */ |
1145 | | 0, /* rightshift */ |
1146 | | 8, /* size */ |
1147 | | 64, /* bitsize */ |
1148 | | false, /* pc_relative */ |
1149 | | 0, /* bitpos */ |
1150 | | complain_overflow_dont, /* complain_on_overflow */ |
1151 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1152 | | "R_MIPS_SUB", /* name */ |
1153 | | false, /* partial_inplace */ |
1154 | | 0, /* src_mask */ |
1155 | | MINUS_ONE, /* dst_mask */ |
1156 | | false), /* pcrel_offset */ |
1157 | | |
1158 | | /* Used to cause the linker to insert and delete instructions? */ |
1159 | | EMPTY_HOWTO (R_MIPS_INSERT_A), |
1160 | | EMPTY_HOWTO (R_MIPS_INSERT_B), |
1161 | | EMPTY_HOWTO (R_MIPS_DELETE), |
1162 | | |
1163 | | /* Get the higher value of a 64 bit addend. */ |
1164 | | HOWTO (R_MIPS_HIGHER, /* type */ |
1165 | | 0, /* rightshift */ |
1166 | | 4, /* size */ |
1167 | | 16, /* bitsize */ |
1168 | | false, /* pc_relative */ |
1169 | | 0, /* bitpos */ |
1170 | | complain_overflow_dont, /* complain_on_overflow */ |
1171 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1172 | | "R_MIPS_HIGHER", /* name */ |
1173 | | false, /* partial_inplace */ |
1174 | | 0, /* src_mask */ |
1175 | | 0x0000ffff, /* dst_mask */ |
1176 | | false), /* pcrel_offset */ |
1177 | | |
1178 | | /* Get the highest value of a 64 bit addend. */ |
1179 | | HOWTO (R_MIPS_HIGHEST, /* type */ |
1180 | | 0, /* rightshift */ |
1181 | | 4, /* size */ |
1182 | | 16, /* bitsize */ |
1183 | | false, /* pc_relative */ |
1184 | | 0, /* bitpos */ |
1185 | | complain_overflow_dont, /* complain_on_overflow */ |
1186 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1187 | | "R_MIPS_HIGHEST", /* name */ |
1188 | | false, /* partial_inplace */ |
1189 | | 0, /* src_mask */ |
1190 | | 0x0000ffff, /* dst_mask */ |
1191 | | false), /* pcrel_offset */ |
1192 | | |
1193 | | /* High 16 bits of displacement in global offset table. */ |
1194 | | HOWTO (R_MIPS_CALL_HI16, /* type */ |
1195 | | 0, /* rightshift */ |
1196 | | 4, /* size */ |
1197 | | 16, /* bitsize */ |
1198 | | false, /* pc_relative */ |
1199 | | 0, /* bitpos */ |
1200 | | complain_overflow_dont, /* complain_on_overflow */ |
1201 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1202 | | "R_MIPS_CALL_HI16", /* name */ |
1203 | | false, /* partial_inplace */ |
1204 | | 0, /* src_mask */ |
1205 | | 0x0000ffff, /* dst_mask */ |
1206 | | false), /* pcrel_offset */ |
1207 | | |
1208 | | /* Low 16 bits of displacement in global offset table. */ |
1209 | | HOWTO (R_MIPS_CALL_LO16, /* type */ |
1210 | | 0, /* rightshift */ |
1211 | | 4, /* size */ |
1212 | | 16, /* bitsize */ |
1213 | | false, /* pc_relative */ |
1214 | | 0, /* bitpos */ |
1215 | | complain_overflow_dont, /* complain_on_overflow */ |
1216 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1217 | | "R_MIPS_CALL_LO16", /* name */ |
1218 | | false, /* partial_inplace */ |
1219 | | 0, /* src_mask */ |
1220 | | 0x0000ffff, /* dst_mask */ |
1221 | | false), /* pcrel_offset */ |
1222 | | |
1223 | | /* Section displacement. */ |
1224 | | HOWTO (R_MIPS_SCN_DISP, /* type */ |
1225 | | 0, /* rightshift */ |
1226 | | 4, /* size */ |
1227 | | 32, /* bitsize */ |
1228 | | false, /* pc_relative */ |
1229 | | 0, /* bitpos */ |
1230 | | complain_overflow_dont, /* complain_on_overflow */ |
1231 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1232 | | "R_MIPS_SCN_DISP", /* name */ |
1233 | | false, /* partial_inplace */ |
1234 | | 0, /* src_mask */ |
1235 | | 0xffffffff, /* dst_mask */ |
1236 | | false), /* pcrel_offset */ |
1237 | | |
1238 | | EMPTY_HOWTO (R_MIPS_REL16), |
1239 | | EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE), |
1240 | | EMPTY_HOWTO (R_MIPS_PJUMP), |
1241 | | EMPTY_HOWTO (R_MIPS_RELGOT), |
1242 | | |
1243 | | /* Protected jump conversion. This is an optimization hint. No |
1244 | | relocation is required for correctness. */ |
1245 | | HOWTO (R_MIPS_JALR, /* type */ |
1246 | | 0, /* rightshift */ |
1247 | | 4, /* size */ |
1248 | | 32, /* bitsize */ |
1249 | | false, /* pc_relative */ |
1250 | | 0, /* bitpos */ |
1251 | | complain_overflow_dont, /* complain_on_overflow */ |
1252 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1253 | | "R_MIPS_JALR", /* name */ |
1254 | | false, /* partial_inplace */ |
1255 | | 0x00000000, /* src_mask */ |
1256 | | 0x00000000, /* dst_mask */ |
1257 | | false), /* pcrel_offset */ |
1258 | | |
1259 | | /* TLS GD/LD dynamic relocations. */ |
1260 | | HOWTO (R_MIPS_TLS_DTPMOD32, /* type */ |
1261 | | 0, /* rightshift */ |
1262 | | 4, /* size */ |
1263 | | 32, /* bitsize */ |
1264 | | false, /* pc_relative */ |
1265 | | 0, /* bitpos */ |
1266 | | complain_overflow_dont, /* complain_on_overflow */ |
1267 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1268 | | "R_MIPS_TLS_DTPMOD32", /* name */ |
1269 | | false, /* partial_inplace */ |
1270 | | 0, /* src_mask */ |
1271 | | 0xffffffff, /* dst_mask */ |
1272 | | false), /* pcrel_offset */ |
1273 | | |
1274 | | HOWTO (R_MIPS_TLS_DTPREL32, /* type */ |
1275 | | 0, /* rightshift */ |
1276 | | 4, /* size */ |
1277 | | 32, /* bitsize */ |
1278 | | false, /* pc_relative */ |
1279 | | 0, /* bitpos */ |
1280 | | complain_overflow_dont, /* complain_on_overflow */ |
1281 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1282 | | "R_MIPS_TLS_DTPREL32", /* name */ |
1283 | | false, /* partial_inplace */ |
1284 | | 0, /* src_mask */ |
1285 | | 0xffffffff, /* dst_mask */ |
1286 | | false), /* pcrel_offset */ |
1287 | | |
1288 | | EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64), |
1289 | | EMPTY_HOWTO (R_MIPS_TLS_DTPREL64), |
1290 | | |
1291 | | /* TLS general dynamic variable reference. */ |
1292 | | HOWTO (R_MIPS_TLS_GD, /* type */ |
1293 | | 0, /* rightshift */ |
1294 | | 4, /* size */ |
1295 | | 16, /* bitsize */ |
1296 | | false, /* pc_relative */ |
1297 | | 0, /* bitpos */ |
1298 | | complain_overflow_signed, /* complain_on_overflow */ |
1299 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1300 | | "R_MIPS_TLS_GD", /* name */ |
1301 | | false, /* partial_inplace */ |
1302 | | 0, /* src_mask */ |
1303 | | 0x0000ffff, /* dst_mask */ |
1304 | | false), /* pcrel_offset */ |
1305 | | |
1306 | | /* TLS local dynamic variable reference. */ |
1307 | | HOWTO (R_MIPS_TLS_LDM, /* type */ |
1308 | | 0, /* rightshift */ |
1309 | | 4, /* size */ |
1310 | | 16, /* bitsize */ |
1311 | | false, /* pc_relative */ |
1312 | | 0, /* bitpos */ |
1313 | | complain_overflow_signed, /* complain_on_overflow */ |
1314 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1315 | | "R_MIPS_TLS_LDM", /* name */ |
1316 | | false, /* partial_inplace */ |
1317 | | 0, /* src_mask */ |
1318 | | 0x0000ffff, /* dst_mask */ |
1319 | | false), /* pcrel_offset */ |
1320 | | |
1321 | | /* TLS local dynamic offset. */ |
1322 | | HOWTO (R_MIPS_TLS_DTPREL_HI16, /* type */ |
1323 | | 16, /* rightshift */ |
1324 | | 4, /* size */ |
1325 | | 16, /* bitsize */ |
1326 | | false, /* pc_relative */ |
1327 | | 0, /* bitpos */ |
1328 | | complain_overflow_signed, /* complain_on_overflow */ |
1329 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1330 | | "R_MIPS_TLS_DTPREL_HI16", /* name */ |
1331 | | false, /* partial_inplace */ |
1332 | | 0, /* src_mask */ |
1333 | | 0x0000ffff, /* dst_mask */ |
1334 | | false), /* pcrel_offset */ |
1335 | | |
1336 | | /* TLS local dynamic offset. */ |
1337 | | HOWTO (R_MIPS_TLS_DTPREL_LO16, /* type */ |
1338 | | 0, /* rightshift */ |
1339 | | 4, /* size */ |
1340 | | 16, /* bitsize */ |
1341 | | false, /* pc_relative */ |
1342 | | 0, /* bitpos */ |
1343 | | complain_overflow_dont, /* complain_on_overflow */ |
1344 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1345 | | "R_MIPS_TLS_DTPREL_LO16", /* name */ |
1346 | | false, /* partial_inplace */ |
1347 | | 0, /* src_mask */ |
1348 | | 0x0000ffff, /* dst_mask */ |
1349 | | false), /* pcrel_offset */ |
1350 | | |
1351 | | /* TLS thread pointer offset. */ |
1352 | | HOWTO (R_MIPS_TLS_GOTTPREL, /* type */ |
1353 | | 0, /* rightshift */ |
1354 | | 4, /* size */ |
1355 | | 16, /* bitsize */ |
1356 | | false, /* pc_relative */ |
1357 | | 0, /* bitpos */ |
1358 | | complain_overflow_signed, /* complain_on_overflow */ |
1359 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1360 | | "R_MIPS_TLS_GOTTPREL", /* name */ |
1361 | | false, /* partial_inplace */ |
1362 | | 0, /* src_mask */ |
1363 | | 0x0000ffff, /* dst_mask */ |
1364 | | false), /* pcrel_offset */ |
1365 | | |
1366 | | /* TLS IE dynamic relocations. */ |
1367 | | HOWTO (R_MIPS_TLS_TPREL32, /* type */ |
1368 | | 0, /* rightshift */ |
1369 | | 4, /* size */ |
1370 | | 32, /* bitsize */ |
1371 | | false, /* pc_relative */ |
1372 | | 0, /* bitpos */ |
1373 | | complain_overflow_dont, /* complain_on_overflow */ |
1374 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1375 | | "R_MIPS_TLS_TPREL32", /* name */ |
1376 | | false, /* partial_inplace */ |
1377 | | 0, /* src_mask */ |
1378 | | 0xffffffff, /* dst_mask */ |
1379 | | false), /* pcrel_offset */ |
1380 | | |
1381 | | EMPTY_HOWTO (R_MIPS_TLS_TPREL64), |
1382 | | |
1383 | | /* TLS thread pointer offset. */ |
1384 | | HOWTO (R_MIPS_TLS_TPREL_HI16, /* type */ |
1385 | | 16, /* rightshift */ |
1386 | | 4, /* size */ |
1387 | | 16, /* bitsize */ |
1388 | | false, /* pc_relative */ |
1389 | | 0, /* bitpos */ |
1390 | | complain_overflow_signed, /* complain_on_overflow */ |
1391 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1392 | | "R_MIPS_TLS_TPREL_HI16", /* name */ |
1393 | | false, /* partial_inplace */ |
1394 | | 0, /* src_mask */ |
1395 | | 0x0000ffff, /* dst_mask */ |
1396 | | false), /* pcrel_offset */ |
1397 | | |
1398 | | /* TLS thread pointer offset. */ |
1399 | | HOWTO (R_MIPS_TLS_TPREL_LO16, /* type */ |
1400 | | 0, /* rightshift */ |
1401 | | 4, /* size */ |
1402 | | 16, /* bitsize */ |
1403 | | false, /* pc_relative */ |
1404 | | 0, /* bitpos */ |
1405 | | complain_overflow_dont, /* complain_on_overflow */ |
1406 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1407 | | "R_MIPS_TLS_TPREL_LO16", /* name */ |
1408 | | false, /* partial_inplace */ |
1409 | | 0, /* src_mask */ |
1410 | | 0x0000ffff, /* dst_mask */ |
1411 | | false), /* pcrel_offset */ |
1412 | | |
1413 | | /* 32 bit relocation with no addend. */ |
1414 | | HOWTO (R_MIPS_GLOB_DAT, /* type */ |
1415 | | 0, /* rightshift */ |
1416 | | 4, /* size */ |
1417 | | 32, /* bitsize */ |
1418 | | false, /* pc_relative */ |
1419 | | 0, /* bitpos */ |
1420 | | complain_overflow_dont, /* complain_on_overflow */ |
1421 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1422 | | "R_MIPS_GLOB_DAT", /* name */ |
1423 | | false, /* partial_inplace */ |
1424 | | 0x0, /* src_mask */ |
1425 | | 0xffffffff, /* dst_mask */ |
1426 | | false), /* pcrel_offset */ |
1427 | | |
1428 | | EMPTY_HOWTO (52), |
1429 | | EMPTY_HOWTO (53), |
1430 | | EMPTY_HOWTO (54), |
1431 | | EMPTY_HOWTO (55), |
1432 | | EMPTY_HOWTO (56), |
1433 | | EMPTY_HOWTO (57), |
1434 | | EMPTY_HOWTO (58), |
1435 | | EMPTY_HOWTO (59), |
1436 | | |
1437 | | HOWTO (R_MIPS_PC21_S2, /* type */ |
1438 | | 2, /* rightshift */ |
1439 | | 4, /* size */ |
1440 | | 21, /* bitsize */ |
1441 | | true, /* pc_relative */ |
1442 | | 0, /* bitpos */ |
1443 | | complain_overflow_signed, /* complain_on_overflow */ |
1444 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1445 | | "R_MIPS_PC21_S2", /* name */ |
1446 | | false, /* partial_inplace */ |
1447 | | 0, /* src_mask */ |
1448 | | 0x001fffff, /* dst_mask */ |
1449 | | true), /* pcrel_offset */ |
1450 | | |
1451 | | HOWTO (R_MIPS_PC26_S2, /* type */ |
1452 | | 2, /* rightshift */ |
1453 | | 4, /* size */ |
1454 | | 26, /* bitsize */ |
1455 | | true, /* pc_relative */ |
1456 | | 0, /* bitpos */ |
1457 | | complain_overflow_signed, /* complain_on_overflow */ |
1458 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1459 | | "R_MIPS_PC26_S2", /* name */ |
1460 | | false, /* partial_inplace */ |
1461 | | 0, /* src_mask */ |
1462 | | 0x03ffffff, /* dst_mask */ |
1463 | | true), /* pcrel_offset */ |
1464 | | |
1465 | | HOWTO (R_MIPS_PC18_S3, /* type */ |
1466 | | 3, /* rightshift */ |
1467 | | 4, /* size */ |
1468 | | 18, /* bitsize */ |
1469 | | true, /* pc_relative */ |
1470 | | 0, /* bitpos */ |
1471 | | complain_overflow_signed, /* complain_on_overflow */ |
1472 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1473 | | "R_MIPS_PC18_S3", /* name */ |
1474 | | false, /* partial_inplace */ |
1475 | | 0, /* src_mask */ |
1476 | | 0x0003ffff, /* dst_mask */ |
1477 | | true), /* pcrel_offset */ |
1478 | | |
1479 | | HOWTO (R_MIPS_PC19_S2, /* type */ |
1480 | | 2, /* rightshift */ |
1481 | | 4, /* size */ |
1482 | | 19, /* bitsize */ |
1483 | | true, /* pc_relative */ |
1484 | | 0, /* bitpos */ |
1485 | | complain_overflow_signed, /* complain_on_overflow */ |
1486 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1487 | | "R_MIPS_PC19_S2", /* name */ |
1488 | | false, /* partial_inplace */ |
1489 | | 0, /* src_mask */ |
1490 | | 0x0007ffff, /* dst_mask */ |
1491 | | true), /* pcrel_offset */ |
1492 | | |
1493 | | HOWTO (R_MIPS_PCHI16, /* type */ |
1494 | | 16, /* rightshift */ |
1495 | | 4, /* size */ |
1496 | | 16, /* bitsize */ |
1497 | | true, /* pc_relative */ |
1498 | | 0, /* bitpos */ |
1499 | | complain_overflow_signed, /* complain_on_overflow */ |
1500 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1501 | | "R_MIPS_PCHI16", /* name */ |
1502 | | false, /* partial_inplace */ |
1503 | | 0, /* src_mask */ |
1504 | | 0x0000ffff, /* dst_mask */ |
1505 | | true), /* pcrel_offset */ |
1506 | | |
1507 | | HOWTO (R_MIPS_PCLO16, /* type */ |
1508 | | 0, /* rightshift */ |
1509 | | 4, /* size */ |
1510 | | 16, /* bitsize */ |
1511 | | true, /* pc_relative */ |
1512 | | 0, /* bitpos */ |
1513 | | complain_overflow_dont, /* complain_on_overflow */ |
1514 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1515 | | "R_MIPS_PCLO16", /* name */ |
1516 | | false, /* partial_inplace */ |
1517 | | 0, /* src_mask */ |
1518 | | 0x0000ffff, /* dst_mask */ |
1519 | | true), /* pcrel_offset */ |
1520 | | }; |
1521 | | |
1522 | | /* The reloc used for BFD_RELOC_CTOR when doing a 64 bit link. This |
1523 | | is a hack to make the linker think that we need 64 bit values. */ |
1524 | | static reloc_howto_type elf_mips_ctor64_howto = |
1525 | | HOWTO (R_MIPS_64, /* type */ |
1526 | | 0, /* rightshift */ |
1527 | | 8, /* size */ |
1528 | | 32, /* bitsize */ |
1529 | | false, /* pc_relative */ |
1530 | | 0, /* bitpos */ |
1531 | | complain_overflow_signed, /* complain_on_overflow */ |
1532 | | mips32_64bit_reloc, /* special_function */ |
1533 | | "R_MIPS_64", /* name */ |
1534 | | true, /* partial_inplace */ |
1535 | | 0xffffffff, /* src_mask */ |
1536 | | 0xffffffff, /* dst_mask */ |
1537 | | false); /* pcrel_offset */ |
1538 | | |
1539 | | static reloc_howto_type elf_mips16_howto_table_rel[] = |
1540 | | { |
1541 | | /* The reloc used for the mips16 jump instruction. */ |
1542 | | HOWTO (R_MIPS16_26, /* type */ |
1543 | | 2, /* rightshift */ |
1544 | | 4, /* size */ |
1545 | | 26, /* bitsize */ |
1546 | | false, /* pc_relative */ |
1547 | | 0, /* bitpos */ |
1548 | | complain_overflow_dont, /* complain_on_overflow */ |
1549 | | /* This needs complex overflow |
1550 | | detection, because the upper four |
1551 | | bits must match the PC. */ |
1552 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1553 | | "R_MIPS16_26", /* name */ |
1554 | | true, /* partial_inplace */ |
1555 | | 0x3ffffff, /* src_mask */ |
1556 | | 0x3ffffff, /* dst_mask */ |
1557 | | false), /* pcrel_offset */ |
1558 | | |
1559 | | /* The reloc used for the mips16 gprel instruction. */ |
1560 | | HOWTO (R_MIPS16_GPREL, /* type */ |
1561 | | 0, /* rightshift */ |
1562 | | 4, /* size */ |
1563 | | 16, /* bitsize */ |
1564 | | false, /* pc_relative */ |
1565 | | 0, /* bitpos */ |
1566 | | complain_overflow_signed, /* complain_on_overflow */ |
1567 | | mips16_gprel_reloc, /* special_function */ |
1568 | | "R_MIPS16_GPREL", /* name */ |
1569 | | true, /* partial_inplace */ |
1570 | | 0x0000ffff, /* src_mask */ |
1571 | | 0x0000ffff, /* dst_mask */ |
1572 | | false), /* pcrel_offset */ |
1573 | | |
1574 | | /* A MIPS16 reference to the global offset table. */ |
1575 | | HOWTO (R_MIPS16_GOT16, /* type */ |
1576 | | 0, /* rightshift */ |
1577 | | 4, /* size */ |
1578 | | 16, /* bitsize */ |
1579 | | false, /* pc_relative */ |
1580 | | 0, /* bitpos */ |
1581 | | complain_overflow_dont, /* complain_on_overflow */ |
1582 | | _bfd_mips_elf_got16_reloc, /* special_function */ |
1583 | | "R_MIPS16_GOT16", /* name */ |
1584 | | true, /* partial_inplace */ |
1585 | | 0x0000ffff, /* src_mask */ |
1586 | | 0x0000ffff, /* dst_mask */ |
1587 | | false), /* pcrel_offset */ |
1588 | | |
1589 | | /* A MIPS16 call through the global offset table. */ |
1590 | | HOWTO (R_MIPS16_CALL16, /* type */ |
1591 | | 0, /* rightshift */ |
1592 | | 4, /* size */ |
1593 | | 16, /* bitsize */ |
1594 | | false, /* pc_relative */ |
1595 | | 0, /* bitpos */ |
1596 | | complain_overflow_dont, /* complain_on_overflow */ |
1597 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1598 | | "R_MIPS16_CALL16", /* name */ |
1599 | | true, /* partial_inplace */ |
1600 | | 0x0000ffff, /* src_mask */ |
1601 | | 0x0000ffff, /* dst_mask */ |
1602 | | false), /* pcrel_offset */ |
1603 | | |
1604 | | /* MIPS16 high 16 bits of symbol value. */ |
1605 | | HOWTO (R_MIPS16_HI16, /* type */ |
1606 | | 16, /* rightshift */ |
1607 | | 4, /* size */ |
1608 | | 16, /* bitsize */ |
1609 | | false, /* pc_relative */ |
1610 | | 0, /* bitpos */ |
1611 | | complain_overflow_dont, /* complain_on_overflow */ |
1612 | | _bfd_mips_elf_hi16_reloc, /* special_function */ |
1613 | | "R_MIPS16_HI16", /* name */ |
1614 | | true, /* partial_inplace */ |
1615 | | 0x0000ffff, /* src_mask */ |
1616 | | 0x0000ffff, /* dst_mask */ |
1617 | | false), /* pcrel_offset */ |
1618 | | |
1619 | | /* MIPS16 low 16 bits of symbol value. */ |
1620 | | HOWTO (R_MIPS16_LO16, /* type */ |
1621 | | 0, /* rightshift */ |
1622 | | 4, /* size */ |
1623 | | 16, /* bitsize */ |
1624 | | false, /* pc_relative */ |
1625 | | 0, /* bitpos */ |
1626 | | complain_overflow_dont, /* complain_on_overflow */ |
1627 | | _bfd_mips_elf_lo16_reloc, /* special_function */ |
1628 | | "R_MIPS16_LO16", /* name */ |
1629 | | true, /* partial_inplace */ |
1630 | | 0x0000ffff, /* src_mask */ |
1631 | | 0x0000ffff, /* dst_mask */ |
1632 | | false), /* pcrel_offset */ |
1633 | | |
1634 | | /* MIPS16 TLS general dynamic variable reference. */ |
1635 | | HOWTO (R_MIPS16_TLS_GD, /* type */ |
1636 | | 0, /* rightshift */ |
1637 | | 4, /* size */ |
1638 | | 16, /* bitsize */ |
1639 | | false, /* pc_relative */ |
1640 | | 0, /* bitpos */ |
1641 | | complain_overflow_signed, /* complain_on_overflow */ |
1642 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1643 | | "R_MIPS16_TLS_GD", /* name */ |
1644 | | true, /* partial_inplace */ |
1645 | | 0x0000ffff, /* src_mask */ |
1646 | | 0x0000ffff, /* dst_mask */ |
1647 | | false), /* pcrel_offset */ |
1648 | | |
1649 | | /* MIPS16 TLS local dynamic variable reference. */ |
1650 | | HOWTO (R_MIPS16_TLS_LDM, /* type */ |
1651 | | 0, /* rightshift */ |
1652 | | 4, /* size */ |
1653 | | 16, /* bitsize */ |
1654 | | false, /* pc_relative */ |
1655 | | 0, /* bitpos */ |
1656 | | complain_overflow_signed, /* complain_on_overflow */ |
1657 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1658 | | "R_MIPS16_TLS_LDM", /* name */ |
1659 | | true, /* partial_inplace */ |
1660 | | 0x0000ffff, /* src_mask */ |
1661 | | 0x0000ffff, /* dst_mask */ |
1662 | | false), /* pcrel_offset */ |
1663 | | |
1664 | | /* MIPS16 TLS local dynamic offset. */ |
1665 | | HOWTO (R_MIPS16_TLS_DTPREL_HI16, /* type */ |
1666 | | 16, /* rightshift */ |
1667 | | 4, /* size */ |
1668 | | 16, /* bitsize */ |
1669 | | false, /* pc_relative */ |
1670 | | 0, /* bitpos */ |
1671 | | complain_overflow_signed, /* complain_on_overflow */ |
1672 | | _bfd_mips_elf_hi16_reloc, /* special_function */ |
1673 | | "R_MIPS16_TLS_DTPREL_HI16", /* name */ |
1674 | | true, /* partial_inplace */ |
1675 | | 0x0000ffff, /* src_mask */ |
1676 | | 0x0000ffff, /* dst_mask */ |
1677 | | false), /* pcrel_offset */ |
1678 | | |
1679 | | /* MIPS16 TLS local dynamic offset. */ |
1680 | | HOWTO (R_MIPS16_TLS_DTPREL_LO16, /* type */ |
1681 | | 0, /* rightshift */ |
1682 | | 4, /* size */ |
1683 | | 16, /* bitsize */ |
1684 | | false, /* pc_relative */ |
1685 | | 0, /* bitpos */ |
1686 | | complain_overflow_dont, /* complain_on_overflow */ |
1687 | | _bfd_mips_elf_lo16_reloc, /* special_function */ |
1688 | | "R_MIPS16_TLS_DTPREL_LO16", /* name */ |
1689 | | true, /* partial_inplace */ |
1690 | | 0x0000ffff, /* src_mask */ |
1691 | | 0x0000ffff, /* dst_mask */ |
1692 | | false), /* pcrel_offset */ |
1693 | | |
1694 | | /* MIPS16 TLS thread pointer offset. */ |
1695 | | HOWTO (R_MIPS16_TLS_GOTTPREL, /* type */ |
1696 | | 0, /* rightshift */ |
1697 | | 4, /* size */ |
1698 | | 16, /* bitsize */ |
1699 | | false, /* pc_relative */ |
1700 | | 0, /* bitpos */ |
1701 | | complain_overflow_signed, /* complain_on_overflow */ |
1702 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1703 | | "R_MIPS16_TLS_GOTTPREL", /* name */ |
1704 | | true, /* partial_inplace */ |
1705 | | 0x0000ffff, /* src_mask */ |
1706 | | 0x0000ffff, /* dst_mask */ |
1707 | | false), /* pcrel_offset */ |
1708 | | |
1709 | | /* MIPS16 TLS thread pointer offset. */ |
1710 | | HOWTO (R_MIPS16_TLS_TPREL_HI16, /* type */ |
1711 | | 16, /* rightshift */ |
1712 | | 4, /* size */ |
1713 | | 16, /* bitsize */ |
1714 | | false, /* pc_relative */ |
1715 | | 0, /* bitpos */ |
1716 | | complain_overflow_signed, /* complain_on_overflow */ |
1717 | | _bfd_mips_elf_hi16_reloc, /* special_function */ |
1718 | | "R_MIPS16_TLS_TPREL_HI16", /* name */ |
1719 | | true, /* partial_inplace */ |
1720 | | 0x0000ffff, /* src_mask */ |
1721 | | 0x0000ffff, /* dst_mask */ |
1722 | | false), /* pcrel_offset */ |
1723 | | |
1724 | | /* MIPS16 TLS thread pointer offset. */ |
1725 | | HOWTO (R_MIPS16_TLS_TPREL_LO16, /* type */ |
1726 | | 0, /* rightshift */ |
1727 | | 4, /* size */ |
1728 | | 16, /* bitsize */ |
1729 | | false, /* pc_relative */ |
1730 | | 0, /* bitpos */ |
1731 | | complain_overflow_dont, /* complain_on_overflow */ |
1732 | | _bfd_mips_elf_lo16_reloc, /* special_function */ |
1733 | | "R_MIPS16_TLS_TPREL_LO16", /* name */ |
1734 | | true, /* partial_inplace */ |
1735 | | 0x0000ffff, /* src_mask */ |
1736 | | 0x0000ffff, /* dst_mask */ |
1737 | | false), /* pcrel_offset */ |
1738 | | |
1739 | | /* MIPS16 16-bit PC-relative branch offset. */ |
1740 | | HOWTO (R_MIPS16_PC16_S1, /* type */ |
1741 | | 1, /* rightshift */ |
1742 | | 4, /* size */ |
1743 | | 16, /* bitsize */ |
1744 | | true, /* pc_relative */ |
1745 | | 0, /* bitpos */ |
1746 | | complain_overflow_signed, /* complain_on_overflow */ |
1747 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1748 | | "R_MIPS16_PC16_S1", /* name */ |
1749 | | true, /* partial_inplace */ |
1750 | | 0x0000ffff, /* src_mask */ |
1751 | | 0x0000ffff, /* dst_mask */ |
1752 | | true), /* pcrel_offset */ |
1753 | | }; |
1754 | | |
1755 | | static reloc_howto_type elf_mips16_howto_table_rela[] = |
1756 | | { |
1757 | | /* The reloc used for the mips16 jump instruction. */ |
1758 | | HOWTO (R_MIPS16_26, /* type */ |
1759 | | 2, /* rightshift */ |
1760 | | 4, /* size */ |
1761 | | 26, /* bitsize */ |
1762 | | false, /* pc_relative */ |
1763 | | 0, /* bitpos */ |
1764 | | complain_overflow_dont, /* complain_on_overflow */ |
1765 | | /* This needs complex overflow |
1766 | | detection, because the upper four |
1767 | | bits must match the PC. */ |
1768 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1769 | | "R_MIPS16_26", /* name */ |
1770 | | false, /* partial_inplace */ |
1771 | | 0, /* src_mask */ |
1772 | | 0x3ffffff, /* dst_mask */ |
1773 | | false), /* pcrel_offset */ |
1774 | | |
1775 | | /* The reloc used for the mips16 gprel instruction. */ |
1776 | | HOWTO (R_MIPS16_GPREL, /* type */ |
1777 | | 0, /* rightshift */ |
1778 | | 4, /* size */ |
1779 | | 16, /* bitsize */ |
1780 | | false, /* pc_relative */ |
1781 | | 0, /* bitpos */ |
1782 | | complain_overflow_signed, /* complain_on_overflow */ |
1783 | | mips16_gprel_reloc, /* special_function */ |
1784 | | "R_MIPS16_GPREL", /* name */ |
1785 | | false, /* partial_inplace */ |
1786 | | 0, /* src_mask */ |
1787 | | 0x0000ffff, /* dst_mask */ |
1788 | | false), /* pcrel_offset */ |
1789 | | |
1790 | | /* A MIPS16 reference to the global offset table. */ |
1791 | | HOWTO (R_MIPS16_GOT16, /* type */ |
1792 | | 0, /* rightshift */ |
1793 | | 4, /* size */ |
1794 | | 16, /* bitsize */ |
1795 | | false, /* pc_relative */ |
1796 | | 0, /* bitpos */ |
1797 | | complain_overflow_dont, /* complain_on_overflow */ |
1798 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1799 | | "R_MIPS16_GOT16", /* name */ |
1800 | | false, /* partial_inplace */ |
1801 | | 0, /* src_mask */ |
1802 | | 0x0000ffff, /* dst_mask */ |
1803 | | false), /* pcrel_offset */ |
1804 | | |
1805 | | /* A MIPS16 call through the global offset table. */ |
1806 | | HOWTO (R_MIPS16_CALL16, /* type */ |
1807 | | 0, /* rightshift */ |
1808 | | 4, /* size */ |
1809 | | 16, /* bitsize */ |
1810 | | false, /* pc_relative */ |
1811 | | 0, /* bitpos */ |
1812 | | complain_overflow_dont, /* complain_on_overflow */ |
1813 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1814 | | "R_MIPS16_CALL16", /* name */ |
1815 | | false, /* partial_inplace */ |
1816 | | 0, /* src_mask */ |
1817 | | 0x0000ffff, /* dst_mask */ |
1818 | | false), /* pcrel_offset */ |
1819 | | |
1820 | | /* MIPS16 high 16 bits of symbol value. */ |
1821 | | HOWTO (R_MIPS16_HI16, /* type */ |
1822 | | 16, /* rightshift */ |
1823 | | 4, /* size */ |
1824 | | 16, /* bitsize */ |
1825 | | false, /* pc_relative */ |
1826 | | 0, /* bitpos */ |
1827 | | complain_overflow_dont, /* complain_on_overflow */ |
1828 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1829 | | "R_MIPS16_HI16", /* name */ |
1830 | | false, /* partial_inplace */ |
1831 | | 0, /* src_mask */ |
1832 | | 0x0000ffff, /* dst_mask */ |
1833 | | false), /* pcrel_offset */ |
1834 | | |
1835 | | /* MIPS16 low 16 bits of symbol value. */ |
1836 | | HOWTO (R_MIPS16_LO16, /* type */ |
1837 | | 0, /* rightshift */ |
1838 | | 4, /* size */ |
1839 | | 16, /* bitsize */ |
1840 | | false, /* pc_relative */ |
1841 | | 0, /* bitpos */ |
1842 | | complain_overflow_dont, /* complain_on_overflow */ |
1843 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1844 | | "R_MIPS16_LO16", /* name */ |
1845 | | false, /* partial_inplace */ |
1846 | | 0, /* src_mask */ |
1847 | | 0x0000ffff, /* dst_mask */ |
1848 | | false), /* pcrel_offset */ |
1849 | | |
1850 | | /* MIPS16 TLS general dynamic variable reference. */ |
1851 | | HOWTO (R_MIPS16_TLS_GD, /* type */ |
1852 | | 0, /* rightshift */ |
1853 | | 4, /* size */ |
1854 | | 16, /* bitsize */ |
1855 | | false, /* pc_relative */ |
1856 | | 0, /* bitpos */ |
1857 | | complain_overflow_signed, /* complain_on_overflow */ |
1858 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1859 | | "R_MIPS16_TLS_GD", /* name */ |
1860 | | false, /* partial_inplace */ |
1861 | | 0, /* src_mask */ |
1862 | | 0x0000ffff, /* dst_mask */ |
1863 | | false), /* pcrel_offset */ |
1864 | | |
1865 | | /* MIPS16 TLS local dynamic variable reference. */ |
1866 | | HOWTO (R_MIPS16_TLS_LDM, /* type */ |
1867 | | 0, /* rightshift */ |
1868 | | 4, /* size */ |
1869 | | 16, /* bitsize */ |
1870 | | false, /* pc_relative */ |
1871 | | 0, /* bitpos */ |
1872 | | complain_overflow_signed, /* complain_on_overflow */ |
1873 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1874 | | "R_MIPS16_TLS_LDM", /* name */ |
1875 | | false, /* partial_inplace */ |
1876 | | 0, /* src_mask */ |
1877 | | 0x0000ffff, /* dst_mask */ |
1878 | | false), /* pcrel_offset */ |
1879 | | |
1880 | | /* MIPS16 TLS local dynamic offset. */ |
1881 | | HOWTO (R_MIPS16_TLS_DTPREL_HI16, /* type */ |
1882 | | 16, /* rightshift */ |
1883 | | 4, /* size */ |
1884 | | 16, /* bitsize */ |
1885 | | false, /* pc_relative */ |
1886 | | 0, /* bitpos */ |
1887 | | complain_overflow_signed, /* complain_on_overflow */ |
1888 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1889 | | "R_MIPS16_TLS_DTPREL_HI16", /* name */ |
1890 | | false, /* partial_inplace */ |
1891 | | 0, /* src_mask */ |
1892 | | 0x0000ffff, /* dst_mask */ |
1893 | | false), /* pcrel_offset */ |
1894 | | |
1895 | | /* MIPS16 TLS local dynamic offset. */ |
1896 | | HOWTO (R_MIPS16_TLS_DTPREL_LO16, /* type */ |
1897 | | 0, /* rightshift */ |
1898 | | 4, /* size */ |
1899 | | 16, /* bitsize */ |
1900 | | false, /* pc_relative */ |
1901 | | 0, /* bitpos */ |
1902 | | complain_overflow_dont, /* complain_on_overflow */ |
1903 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1904 | | "R_MIPS16_TLS_DTPREL_LO16", /* name */ |
1905 | | false, /* partial_inplace */ |
1906 | | 0, /* src_mask */ |
1907 | | 0x0000ffff, /* dst_mask */ |
1908 | | false), /* pcrel_offset */ |
1909 | | |
1910 | | /* MIPS16 TLS thread pointer offset. */ |
1911 | | HOWTO (R_MIPS16_TLS_GOTTPREL, /* type */ |
1912 | | 0, /* rightshift */ |
1913 | | 4, /* size */ |
1914 | | 16, /* bitsize */ |
1915 | | false, /* pc_relative */ |
1916 | | 0, /* bitpos */ |
1917 | | complain_overflow_signed, /* complain_on_overflow */ |
1918 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1919 | | "R_MIPS16_TLS_GOTTPREL", /* name */ |
1920 | | false, /* partial_inplace */ |
1921 | | 0, /* src_mask */ |
1922 | | 0x0000ffff, /* dst_mask */ |
1923 | | false), /* pcrel_offset */ |
1924 | | |
1925 | | /* MIPS16 TLS thread pointer offset. */ |
1926 | | HOWTO (R_MIPS16_TLS_TPREL_HI16, /* type */ |
1927 | | 16, /* rightshift */ |
1928 | | 4, /* size */ |
1929 | | 16, /* bitsize */ |
1930 | | false, /* pc_relative */ |
1931 | | 0, /* bitpos */ |
1932 | | complain_overflow_signed, /* complain_on_overflow */ |
1933 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1934 | | "R_MIPS16_TLS_TPREL_HI16", /* name */ |
1935 | | false, /* partial_inplace */ |
1936 | | 0, /* src_mask */ |
1937 | | 0x0000ffff, /* dst_mask */ |
1938 | | false), /* pcrel_offset */ |
1939 | | |
1940 | | /* MIPS16 TLS thread pointer offset. */ |
1941 | | HOWTO (R_MIPS16_TLS_TPREL_LO16, /* type */ |
1942 | | 0, /* rightshift */ |
1943 | | 4, /* size */ |
1944 | | 16, /* bitsize */ |
1945 | | false, /* pc_relative */ |
1946 | | 0, /* bitpos */ |
1947 | | complain_overflow_dont, /* complain_on_overflow */ |
1948 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1949 | | "R_MIPS16_TLS_TPREL_LO16", /* name */ |
1950 | | false, /* partial_inplace */ |
1951 | | 0, /* src_mask */ |
1952 | | 0x0000ffff, /* dst_mask */ |
1953 | | false), /* pcrel_offset */ |
1954 | | |
1955 | | /* MIPS16 16-bit PC-relative branch offset. */ |
1956 | | HOWTO (R_MIPS16_PC16_S1, /* type */ |
1957 | | 1, /* rightshift */ |
1958 | | 4, /* size */ |
1959 | | 16, /* bitsize */ |
1960 | | true, /* pc_relative */ |
1961 | | 0, /* bitpos */ |
1962 | | complain_overflow_signed, /* complain_on_overflow */ |
1963 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1964 | | "R_MIPS16_PC16_S1", /* name */ |
1965 | | false, /* partial_inplace */ |
1966 | | 0, /* src_mask */ |
1967 | | 0x0000ffff, /* dst_mask */ |
1968 | | true), /* pcrel_offset */ |
1969 | | }; |
1970 | | |
1971 | | static reloc_howto_type elf_micromips_howto_table_rel[] = |
1972 | | { |
1973 | | EMPTY_HOWTO (130), |
1974 | | EMPTY_HOWTO (131), |
1975 | | EMPTY_HOWTO (132), |
1976 | | |
1977 | | /* 26 bit jump address. */ |
1978 | | HOWTO (R_MICROMIPS_26_S1, /* type */ |
1979 | | 1, /* rightshift */ |
1980 | | 4, /* size */ |
1981 | | 26, /* bitsize */ |
1982 | | false, /* pc_relative */ |
1983 | | 0, /* bitpos */ |
1984 | | complain_overflow_dont, /* complain_on_overflow */ |
1985 | | /* This needs complex overflow |
1986 | | detection, because the upper four |
1987 | | bits must match the PC. */ |
1988 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
1989 | | "R_MICROMIPS_26_S1", /* name */ |
1990 | | true, /* partial_inplace */ |
1991 | | 0x3ffffff, /* src_mask */ |
1992 | | 0x3ffffff, /* dst_mask */ |
1993 | | false), /* pcrel_offset */ |
1994 | | |
1995 | | /* High 16 bits of symbol value. */ |
1996 | | HOWTO (R_MICROMIPS_HI16, /* type */ |
1997 | | 16, /* rightshift */ |
1998 | | 4, /* size */ |
1999 | | 16, /* bitsize */ |
2000 | | false, /* pc_relative */ |
2001 | | 0, /* bitpos */ |
2002 | | complain_overflow_dont, /* complain_on_overflow */ |
2003 | | _bfd_mips_elf_hi16_reloc, /* special_function */ |
2004 | | "R_MICROMIPS_HI16", /* name */ |
2005 | | true, /* partial_inplace */ |
2006 | | 0x0000ffff, /* src_mask */ |
2007 | | 0x0000ffff, /* dst_mask */ |
2008 | | false), /* pcrel_offset */ |
2009 | | |
2010 | | /* Low 16 bits of symbol value. */ |
2011 | | HOWTO (R_MICROMIPS_LO16, /* type */ |
2012 | | 0, /* rightshift */ |
2013 | | 4, /* size */ |
2014 | | 16, /* bitsize */ |
2015 | | false, /* pc_relative */ |
2016 | | 0, /* bitpos */ |
2017 | | complain_overflow_dont, /* complain_on_overflow */ |
2018 | | _bfd_mips_elf_lo16_reloc, /* special_function */ |
2019 | | "R_MICROMIPS_LO16", /* name */ |
2020 | | true, /* partial_inplace */ |
2021 | | 0x0000ffff, /* src_mask */ |
2022 | | 0x0000ffff, /* dst_mask */ |
2023 | | false), /* pcrel_offset */ |
2024 | | |
2025 | | /* GP relative reference. */ |
2026 | | HOWTO (R_MICROMIPS_GPREL16, /* type */ |
2027 | | 0, /* rightshift */ |
2028 | | 4, /* size */ |
2029 | | 16, /* bitsize */ |
2030 | | false, /* pc_relative */ |
2031 | | 0, /* bitpos */ |
2032 | | complain_overflow_signed, /* complain_on_overflow */ |
2033 | | _bfd_mips_elf32_gprel16_reloc, /* special_function */ |
2034 | | "R_MICROMIPS_GPREL16", /* name */ |
2035 | | true, /* partial_inplace */ |
2036 | | 0x0000ffff, /* src_mask */ |
2037 | | 0x0000ffff, /* dst_mask */ |
2038 | | false), /* pcrel_offset */ |
2039 | | |
2040 | | /* Reference to literal section. */ |
2041 | | HOWTO (R_MICROMIPS_LITERAL, /* type */ |
2042 | | 0, /* rightshift */ |
2043 | | 4, /* size */ |
2044 | | 16, /* bitsize */ |
2045 | | false, /* pc_relative */ |
2046 | | 0, /* bitpos */ |
2047 | | complain_overflow_signed, /* complain_on_overflow */ |
2048 | | _bfd_mips_elf32_gprel16_reloc, /* special_function */ |
2049 | | "R_MICROMIPS_LITERAL", /* name */ |
2050 | | true, /* partial_inplace */ |
2051 | | 0x0000ffff, /* src_mask */ |
2052 | | 0x0000ffff, /* dst_mask */ |
2053 | | false), /* pcrel_offset */ |
2054 | | |
2055 | | /* Reference to global offset table. */ |
2056 | | HOWTO (R_MICROMIPS_GOT16, /* type */ |
2057 | | 0, /* rightshift */ |
2058 | | 4, /* size */ |
2059 | | 16, /* bitsize */ |
2060 | | false, /* pc_relative */ |
2061 | | 0, /* bitpos */ |
2062 | | complain_overflow_signed, /* complain_on_overflow */ |
2063 | | _bfd_mips_elf_got16_reloc, /* special_function */ |
2064 | | "R_MICROMIPS_GOT16", /* name */ |
2065 | | true, /* partial_inplace */ |
2066 | | 0x0000ffff, /* src_mask */ |
2067 | | 0x0000ffff, /* dst_mask */ |
2068 | | false), /* pcrel_offset */ |
2069 | | |
2070 | | /* This is for microMIPS branches. */ |
2071 | | HOWTO (R_MICROMIPS_PC7_S1, /* type */ |
2072 | | 1, /* rightshift */ |
2073 | | 2, /* size */ |
2074 | | 7, /* bitsize */ |
2075 | | true, /* pc_relative */ |
2076 | | 0, /* bitpos */ |
2077 | | complain_overflow_signed, /* complain_on_overflow */ |
2078 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2079 | | "R_MICROMIPS_PC7_S1", /* name */ |
2080 | | true, /* partial_inplace */ |
2081 | | 0x0000007f, /* src_mask */ |
2082 | | 0x0000007f, /* dst_mask */ |
2083 | | true), /* pcrel_offset */ |
2084 | | |
2085 | | HOWTO (R_MICROMIPS_PC10_S1, /* type */ |
2086 | | 1, /* rightshift */ |
2087 | | 2, /* size */ |
2088 | | 10, /* bitsize */ |
2089 | | true, /* pc_relative */ |
2090 | | 0, /* bitpos */ |
2091 | | complain_overflow_signed, /* complain_on_overflow */ |
2092 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2093 | | "R_MICROMIPS_PC10_S1", /* name */ |
2094 | | true, /* partial_inplace */ |
2095 | | 0x000003ff, /* src_mask */ |
2096 | | 0x000003ff, /* dst_mask */ |
2097 | | true), /* pcrel_offset */ |
2098 | | |
2099 | | HOWTO (R_MICROMIPS_PC16_S1, /* type */ |
2100 | | 1, /* rightshift */ |
2101 | | 4, /* size */ |
2102 | | 16, /* bitsize */ |
2103 | | true, /* pc_relative */ |
2104 | | 0, /* bitpos */ |
2105 | | complain_overflow_signed, /* complain_on_overflow */ |
2106 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2107 | | "R_MICROMIPS_PC16_S1", /* name */ |
2108 | | true, /* partial_inplace */ |
2109 | | 0x0000ffff, /* src_mask */ |
2110 | | 0x0000ffff, /* dst_mask */ |
2111 | | true), /* pcrel_offset */ |
2112 | | |
2113 | | /* 16 bit call through global offset table. */ |
2114 | | HOWTO (R_MICROMIPS_CALL16, /* type */ |
2115 | | 0, /* rightshift */ |
2116 | | 4, /* size */ |
2117 | | 16, /* bitsize */ |
2118 | | false, /* pc_relative */ |
2119 | | 0, /* bitpos */ |
2120 | | complain_overflow_signed, /* complain_on_overflow */ |
2121 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2122 | | "R_MICROMIPS_CALL16", /* name */ |
2123 | | true, /* partial_inplace */ |
2124 | | 0x0000ffff, /* src_mask */ |
2125 | | 0x0000ffff, /* dst_mask */ |
2126 | | false), /* pcrel_offset */ |
2127 | | |
2128 | | EMPTY_HOWTO (143), |
2129 | | EMPTY_HOWTO (144), |
2130 | | |
2131 | | /* Displacement in the global offset table. */ |
2132 | | HOWTO (R_MICROMIPS_GOT_DISP, /* type */ |
2133 | | 0, /* rightshift */ |
2134 | | 4, /* size */ |
2135 | | 16, /* bitsize */ |
2136 | | false, /* pc_relative */ |
2137 | | 0, /* bitpos */ |
2138 | | complain_overflow_signed, /* complain_on_overflow */ |
2139 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2140 | | "R_MICROMIPS_GOT_DISP",/* name */ |
2141 | | true, /* partial_inplace */ |
2142 | | 0x0000ffff, /* src_mask */ |
2143 | | 0x0000ffff, /* dst_mask */ |
2144 | | false), /* pcrel_offset */ |
2145 | | |
2146 | | /* Displacement to page pointer in the global offset table. */ |
2147 | | HOWTO (R_MICROMIPS_GOT_PAGE, /* type */ |
2148 | | 0, /* rightshift */ |
2149 | | 4, /* size */ |
2150 | | 16, /* bitsize */ |
2151 | | false, /* pc_relative */ |
2152 | | 0, /* bitpos */ |
2153 | | complain_overflow_signed, /* complain_on_overflow */ |
2154 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2155 | | "R_MICROMIPS_GOT_PAGE",/* name */ |
2156 | | true, /* partial_inplace */ |
2157 | | 0x0000ffff, /* src_mask */ |
2158 | | 0x0000ffff, /* dst_mask */ |
2159 | | false), /* pcrel_offset */ |
2160 | | |
2161 | | /* Offset from page pointer in the global offset table. */ |
2162 | | HOWTO (R_MICROMIPS_GOT_OFST, /* type */ |
2163 | | 0, /* rightshift */ |
2164 | | 4, /* size */ |
2165 | | 16, /* bitsize */ |
2166 | | false, /* pc_relative */ |
2167 | | 0, /* bitpos */ |
2168 | | complain_overflow_signed, /* complain_on_overflow */ |
2169 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2170 | | "R_MICROMIPS_GOT_OFST",/* name */ |
2171 | | true, /* partial_inplace */ |
2172 | | 0x0000ffff, /* src_mask */ |
2173 | | 0x0000ffff, /* dst_mask */ |
2174 | | false), /* pcrel_offset */ |
2175 | | |
2176 | | /* High 16 bits of displacement in global offset table. */ |
2177 | | HOWTO (R_MICROMIPS_GOT_HI16, /* type */ |
2178 | | 16, /* rightshift */ |
2179 | | 4, /* size */ |
2180 | | 16, /* bitsize */ |
2181 | | false, /* pc_relative */ |
2182 | | 0, /* bitpos */ |
2183 | | complain_overflow_dont, /* complain_on_overflow */ |
2184 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2185 | | "R_MICROMIPS_GOT_HI16",/* name */ |
2186 | | true, /* partial_inplace */ |
2187 | | 0x0000ffff, /* src_mask */ |
2188 | | 0x0000ffff, /* dst_mask */ |
2189 | | false), /* pcrel_offset */ |
2190 | | |
2191 | | /* Low 16 bits of displacement in global offset table. */ |
2192 | | HOWTO (R_MICROMIPS_GOT_LO16, /* type */ |
2193 | | 0, /* rightshift */ |
2194 | | 4, /* size */ |
2195 | | 16, /* bitsize */ |
2196 | | false, /* pc_relative */ |
2197 | | 0, /* bitpos */ |
2198 | | complain_overflow_dont, /* complain_on_overflow */ |
2199 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2200 | | "R_MICROMIPS_GOT_LO16",/* name */ |
2201 | | true, /* partial_inplace */ |
2202 | | 0x0000ffff, /* src_mask */ |
2203 | | 0x0000ffff, /* dst_mask */ |
2204 | | false), /* pcrel_offset */ |
2205 | | |
2206 | | /* 64 bit subtraction. Used in the N32 ABI. */ |
2207 | | HOWTO (R_MICROMIPS_SUB, /* type */ |
2208 | | 0, /* rightshift */ |
2209 | | 8, /* size */ |
2210 | | 64, /* bitsize */ |
2211 | | false, /* pc_relative */ |
2212 | | 0, /* bitpos */ |
2213 | | complain_overflow_dont, /* complain_on_overflow */ |
2214 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2215 | | "R_MICROMIPS_SUB", /* name */ |
2216 | | true, /* partial_inplace */ |
2217 | | MINUS_ONE, /* src_mask */ |
2218 | | MINUS_ONE, /* dst_mask */ |
2219 | | false), /* pcrel_offset */ |
2220 | | |
2221 | | /* Get the higher value of a 64 bit addend. */ |
2222 | | HOWTO (R_MICROMIPS_HIGHER, /* type */ |
2223 | | 32, /* rightshift */ |
2224 | | 4, /* size */ |
2225 | | 16, /* bitsize */ |
2226 | | false, /* pc_relative */ |
2227 | | 0, /* bitpos */ |
2228 | | complain_overflow_dont, /* complain_on_overflow */ |
2229 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2230 | | "R_MICROMIPS_HIGHER", /* name */ |
2231 | | true, /* partial_inplace */ |
2232 | | 0x0000ffff, /* src_mask */ |
2233 | | 0x0000ffff, /* dst_mask */ |
2234 | | false), /* pcrel_offset */ |
2235 | | |
2236 | | /* Get the highest value of a 64 bit addend. */ |
2237 | | HOWTO (R_MICROMIPS_HIGHEST, /* type */ |
2238 | | 48, /* rightshift */ |
2239 | | 4, /* size */ |
2240 | | 16, /* bitsize */ |
2241 | | false, /* pc_relative */ |
2242 | | 0, /* bitpos */ |
2243 | | complain_overflow_dont, /* complain_on_overflow */ |
2244 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2245 | | "R_MICROMIPS_HIGHEST", /* name */ |
2246 | | true, /* partial_inplace */ |
2247 | | 0x0000ffff, /* src_mask */ |
2248 | | 0x0000ffff, /* dst_mask */ |
2249 | | false), /* pcrel_offset */ |
2250 | | |
2251 | | /* High 16 bits of displacement in global offset table. */ |
2252 | | HOWTO (R_MICROMIPS_CALL_HI16, /* type */ |
2253 | | 16, /* rightshift */ |
2254 | | 4, /* size */ |
2255 | | 16, /* bitsize */ |
2256 | | false, /* pc_relative */ |
2257 | | 0, /* bitpos */ |
2258 | | complain_overflow_dont, /* complain_on_overflow */ |
2259 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2260 | | "R_MICROMIPS_CALL_HI16",/* name */ |
2261 | | true, /* partial_inplace */ |
2262 | | 0x0000ffff, /* src_mask */ |
2263 | | 0x0000ffff, /* dst_mask */ |
2264 | | false), /* pcrel_offset */ |
2265 | | |
2266 | | /* Low 16 bits of displacement in global offset table. */ |
2267 | | HOWTO (R_MICROMIPS_CALL_LO16, /* type */ |
2268 | | 0, /* rightshift */ |
2269 | | 4, /* size */ |
2270 | | 16, /* bitsize */ |
2271 | | false, /* pc_relative */ |
2272 | | 0, /* bitpos */ |
2273 | | complain_overflow_dont, /* complain_on_overflow */ |
2274 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2275 | | "R_MICROMIPS_CALL_LO16",/* name */ |
2276 | | true, /* partial_inplace */ |
2277 | | 0x0000ffff, /* src_mask */ |
2278 | | 0x0000ffff, /* dst_mask */ |
2279 | | false), /* pcrel_offset */ |
2280 | | |
2281 | | /* Section displacement. */ |
2282 | | HOWTO (R_MICROMIPS_SCN_DISP, /* type */ |
2283 | | 0, /* rightshift */ |
2284 | | 4, /* size */ |
2285 | | 32, /* bitsize */ |
2286 | | false, /* pc_relative */ |
2287 | | 0, /* bitpos */ |
2288 | | complain_overflow_dont, /* complain_on_overflow */ |
2289 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2290 | | "R_MICROMIPS_SCN_DISP",/* name */ |
2291 | | true, /* partial_inplace */ |
2292 | | 0xffffffff, /* src_mask */ |
2293 | | 0xffffffff, /* dst_mask */ |
2294 | | false), /* pcrel_offset */ |
2295 | | |
2296 | | /* Protected jump conversion. This is an optimization hint. No |
2297 | | relocation is required for correctness. */ |
2298 | | HOWTO (R_MICROMIPS_JALR, /* type */ |
2299 | | 0, /* rightshift */ |
2300 | | 4, /* size */ |
2301 | | 32, /* bitsize */ |
2302 | | false, /* pc_relative */ |
2303 | | 0, /* bitpos */ |
2304 | | complain_overflow_dont, /* complain_on_overflow */ |
2305 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2306 | | "R_MICROMIPS_JALR", /* name */ |
2307 | | false, /* partial_inplace */ |
2308 | | 0x00000000, /* src_mask */ |
2309 | | 0x00000000, /* dst_mask */ |
2310 | | false), /* pcrel_offset */ |
2311 | | |
2312 | | /* Low 16 bits of symbol value. Note that the high 16 bits of symbol values |
2313 | | must be zero. This is used for relaxation. */ |
2314 | | HOWTO (R_MICROMIPS_HI0_LO16, /* type */ |
2315 | | 0, /* rightshift */ |
2316 | | 4, /* size */ |
2317 | | 16, /* bitsize */ |
2318 | | false, /* pc_relative */ |
2319 | | 0, /* bitpos */ |
2320 | | complain_overflow_dont, /* complain_on_overflow */ |
2321 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2322 | | "R_MICROMIPS_HI0_LO16",/* name */ |
2323 | | true, /* partial_inplace */ |
2324 | | 0x0000ffff, /* src_mask */ |
2325 | | 0x0000ffff, /* dst_mask */ |
2326 | | false), /* pcrel_offset */ |
2327 | | |
2328 | | EMPTY_HOWTO (158), |
2329 | | EMPTY_HOWTO (159), |
2330 | | EMPTY_HOWTO (160), |
2331 | | EMPTY_HOWTO (161), |
2332 | | |
2333 | | /* TLS general dynamic variable reference. */ |
2334 | | HOWTO (R_MICROMIPS_TLS_GD, /* type */ |
2335 | | 0, /* rightshift */ |
2336 | | 4, /* size */ |
2337 | | 16, /* bitsize */ |
2338 | | false, /* pc_relative */ |
2339 | | 0, /* bitpos */ |
2340 | | complain_overflow_signed, /* complain_on_overflow */ |
2341 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2342 | | "R_MICROMIPS_TLS_GD", /* name */ |
2343 | | true, /* partial_inplace */ |
2344 | | 0x0000ffff, /* src_mask */ |
2345 | | 0x0000ffff, /* dst_mask */ |
2346 | | false), /* pcrel_offset */ |
2347 | | |
2348 | | /* TLS local dynamic variable reference. */ |
2349 | | HOWTO (R_MICROMIPS_TLS_LDM, /* type */ |
2350 | | 0, /* rightshift */ |
2351 | | 4, /* size */ |
2352 | | 16, /* bitsize */ |
2353 | | false, /* pc_relative */ |
2354 | | 0, /* bitpos */ |
2355 | | complain_overflow_signed, /* complain_on_overflow */ |
2356 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2357 | | "R_MICROMIPS_TLS_LDM", /* name */ |
2358 | | true, /* partial_inplace */ |
2359 | | 0x0000ffff, /* src_mask */ |
2360 | | 0x0000ffff, /* dst_mask */ |
2361 | | false), /* pcrel_offset */ |
2362 | | |
2363 | | /* TLS local dynamic offset. */ |
2364 | | HOWTO (R_MICROMIPS_TLS_DTPREL_HI16, /* type */ |
2365 | | 16, /* rightshift */ |
2366 | | 4, /* size */ |
2367 | | 16, /* bitsize */ |
2368 | | false, /* pc_relative */ |
2369 | | 0, /* bitpos */ |
2370 | | complain_overflow_signed, /* complain_on_overflow */ |
2371 | | _bfd_mips_elf_hi16_reloc, /* special_function */ |
2372 | | "R_MICROMIPS_TLS_DTPREL_HI16", /* name */ |
2373 | | true, /* partial_inplace */ |
2374 | | 0x0000ffff, /* src_mask */ |
2375 | | 0x0000ffff, /* dst_mask */ |
2376 | | false), /* pcrel_offset */ |
2377 | | |
2378 | | /* TLS local dynamic offset. */ |
2379 | | HOWTO (R_MICROMIPS_TLS_DTPREL_LO16, /* type */ |
2380 | | 0, /* rightshift */ |
2381 | | 4, /* size */ |
2382 | | 16, /* bitsize */ |
2383 | | false, /* pc_relative */ |
2384 | | 0, /* bitpos */ |
2385 | | complain_overflow_dont, /* complain_on_overflow */ |
2386 | | _bfd_mips_elf_lo16_reloc, /* special_function */ |
2387 | | "R_MICROMIPS_TLS_DTPREL_LO16", /* name */ |
2388 | | true, /* partial_inplace */ |
2389 | | 0x0000ffff, /* src_mask */ |
2390 | | 0x0000ffff, /* dst_mask */ |
2391 | | false), /* pcrel_offset */ |
2392 | | |
2393 | | /* TLS thread pointer offset. */ |
2394 | | HOWTO (R_MICROMIPS_TLS_GOTTPREL, /* type */ |
2395 | | 0, /* rightshift */ |
2396 | | 4, /* size */ |
2397 | | 16, /* bitsize */ |
2398 | | false, /* pc_relative */ |
2399 | | 0, /* bitpos */ |
2400 | | complain_overflow_signed, /* complain_on_overflow */ |
2401 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2402 | | "R_MICROMIPS_TLS_GOTTPREL", /* name */ |
2403 | | true, /* partial_inplace */ |
2404 | | 0x0000ffff, /* src_mask */ |
2405 | | 0x0000ffff, /* dst_mask */ |
2406 | | false), /* pcrel_offset */ |
2407 | | |
2408 | | EMPTY_HOWTO (167), |
2409 | | EMPTY_HOWTO (168), |
2410 | | |
2411 | | /* TLS thread pointer offset. */ |
2412 | | HOWTO (R_MICROMIPS_TLS_TPREL_HI16, /* type */ |
2413 | | 16, /* rightshift */ |
2414 | | 4, /* size */ |
2415 | | 16, /* bitsize */ |
2416 | | false, /* pc_relative */ |
2417 | | 0, /* bitpos */ |
2418 | | complain_overflow_signed, /* complain_on_overflow */ |
2419 | | _bfd_mips_elf_hi16_reloc, /* special_function */ |
2420 | | "R_MICROMIPS_TLS_TPREL_HI16", /* name */ |
2421 | | true, /* partial_inplace */ |
2422 | | 0x0000ffff, /* src_mask */ |
2423 | | 0x0000ffff, /* dst_mask */ |
2424 | | false), /* pcrel_offset */ |
2425 | | |
2426 | | /* TLS thread pointer offset. */ |
2427 | | HOWTO (R_MICROMIPS_TLS_TPREL_LO16, /* type */ |
2428 | | 0, /* rightshift */ |
2429 | | 4, /* size */ |
2430 | | 16, /* bitsize */ |
2431 | | false, /* pc_relative */ |
2432 | | 0, /* bitpos */ |
2433 | | complain_overflow_dont, /* complain_on_overflow */ |
2434 | | _bfd_mips_elf_lo16_reloc, /* special_function */ |
2435 | | "R_MICROMIPS_TLS_TPREL_LO16", /* name */ |
2436 | | true, /* partial_inplace */ |
2437 | | 0x0000ffff, /* src_mask */ |
2438 | | 0x0000ffff, /* dst_mask */ |
2439 | | false), /* pcrel_offset */ |
2440 | | |
2441 | | EMPTY_HOWTO (171), |
2442 | | |
2443 | | /* GP- and PC-relative relocations. */ |
2444 | | HOWTO (R_MICROMIPS_GPREL7_S2, /* type */ |
2445 | | 2, /* rightshift */ |
2446 | | 2, /* size */ |
2447 | | 7, /* bitsize */ |
2448 | | false, /* pc_relative */ |
2449 | | 0, /* bitpos */ |
2450 | | complain_overflow_signed, /* complain_on_overflow */ |
2451 | | _bfd_mips_elf32_gprel16_reloc, /* special_function */ |
2452 | | "R_MICROMIPS_GPREL7_S2", /* name */ |
2453 | | true, /* partial_inplace */ |
2454 | | 0x0000007f, /* src_mask */ |
2455 | | 0x0000007f, /* dst_mask */ |
2456 | | false), /* pcrel_offset */ |
2457 | | |
2458 | | HOWTO (R_MICROMIPS_PC23_S2, /* type */ |
2459 | | 2, /* rightshift */ |
2460 | | 4, /* size */ |
2461 | | 23, /* bitsize */ |
2462 | | true, /* pc_relative */ |
2463 | | 0, /* bitpos */ |
2464 | | complain_overflow_signed, /* complain_on_overflow */ |
2465 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2466 | | "R_MICROMIPS_PC23_S2", /* name */ |
2467 | | true, /* partial_inplace */ |
2468 | | 0x007fffff, /* src_mask */ |
2469 | | 0x007fffff, /* dst_mask */ |
2470 | | true), /* pcrel_offset */ |
2471 | | }; |
2472 | | |
2473 | | static reloc_howto_type elf_micromips_howto_table_rela[] = |
2474 | | { |
2475 | | EMPTY_HOWTO (130), |
2476 | | EMPTY_HOWTO (131), |
2477 | | EMPTY_HOWTO (132), |
2478 | | |
2479 | | /* 26 bit jump address. */ |
2480 | | HOWTO (R_MICROMIPS_26_S1, /* type */ |
2481 | | 1, /* rightshift */ |
2482 | | 4, /* size */ |
2483 | | 26, /* bitsize */ |
2484 | | false, /* pc_relative */ |
2485 | | 0, /* bitpos */ |
2486 | | complain_overflow_dont, /* complain_on_overflow */ |
2487 | | /* This needs complex overflow |
2488 | | detection, because the upper four |
2489 | | bits must match the PC. */ |
2490 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2491 | | "R_MICROMIPS_26_S1", /* name */ |
2492 | | false, /* partial_inplace */ |
2493 | | 0, /* src_mask */ |
2494 | | 0x3ffffff, /* dst_mask */ |
2495 | | false), /* pcrel_offset */ |
2496 | | |
2497 | | /* High 16 bits of symbol value. */ |
2498 | | HOWTO (R_MICROMIPS_HI16, /* type */ |
2499 | | 16, /* rightshift */ |
2500 | | 4, /* size */ |
2501 | | 16, /* bitsize */ |
2502 | | false, /* pc_relative */ |
2503 | | 0, /* bitpos */ |
2504 | | complain_overflow_dont, /* complain_on_overflow */ |
2505 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2506 | | "R_MICROMIPS_HI16", /* name */ |
2507 | | false, /* partial_inplace */ |
2508 | | 0, /* src_mask */ |
2509 | | 0x0000ffff, /* dst_mask */ |
2510 | | false), /* pcrel_offset */ |
2511 | | |
2512 | | /* Low 16 bits of symbol value. */ |
2513 | | HOWTO (R_MICROMIPS_LO16, /* type */ |
2514 | | 0, /* rightshift */ |
2515 | | 4, /* size */ |
2516 | | 16, /* bitsize */ |
2517 | | false, /* pc_relative */ |
2518 | | 0, /* bitpos */ |
2519 | | complain_overflow_dont, /* complain_on_overflow */ |
2520 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2521 | | "R_MICROMIPS_LO16", /* name */ |
2522 | | false, /* partial_inplace */ |
2523 | | 0, /* src_mask */ |
2524 | | 0x0000ffff, /* dst_mask */ |
2525 | | false), /* pcrel_offset */ |
2526 | | |
2527 | | /* GP relative reference. */ |
2528 | | HOWTO (R_MICROMIPS_GPREL16, /* type */ |
2529 | | 0, /* rightshift */ |
2530 | | 4, /* size */ |
2531 | | 16, /* bitsize */ |
2532 | | false, /* pc_relative */ |
2533 | | 0, /* bitpos */ |
2534 | | complain_overflow_signed, /* complain_on_overflow */ |
2535 | | _bfd_mips_elf32_gprel16_reloc, /* special_function */ |
2536 | | "R_MICROMIPS_GPREL16", /* name */ |
2537 | | false, /* partial_inplace */ |
2538 | | 0, /* src_mask */ |
2539 | | 0x0000ffff, /* dst_mask */ |
2540 | | false), /* pcrel_offset */ |
2541 | | |
2542 | | /* Reference to literal section. */ |
2543 | | HOWTO (R_MICROMIPS_LITERAL, /* type */ |
2544 | | 0, /* rightshift */ |
2545 | | 4, /* size */ |
2546 | | 16, /* bitsize */ |
2547 | | false, /* pc_relative */ |
2548 | | 0, /* bitpos */ |
2549 | | complain_overflow_signed, /* complain_on_overflow */ |
2550 | | _bfd_mips_elf32_gprel16_reloc, /* special_function */ |
2551 | | "R_MICROMIPS_LITERAL", /* name */ |
2552 | | false, /* partial_inplace */ |
2553 | | 0, /* src_mask */ |
2554 | | 0x0000ffff, /* dst_mask */ |
2555 | | false), /* pcrel_offset */ |
2556 | | |
2557 | | /* Reference to global offset table. */ |
2558 | | HOWTO (R_MICROMIPS_GOT16, /* type */ |
2559 | | 0, /* rightshift */ |
2560 | | 4, /* size */ |
2561 | | 16, /* bitsize */ |
2562 | | false, /* pc_relative */ |
2563 | | 0, /* bitpos */ |
2564 | | complain_overflow_signed, /* complain_on_overflow */ |
2565 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2566 | | "R_MICROMIPS_GOT16", /* name */ |
2567 | | false, /* partial_inplace */ |
2568 | | 0, /* src_mask */ |
2569 | | 0x0000ffff, /* dst_mask */ |
2570 | | false), /* pcrel_offset */ |
2571 | | |
2572 | | /* This is for microMIPS branches. */ |
2573 | | HOWTO (R_MICROMIPS_PC7_S1, /* type */ |
2574 | | 1, /* rightshift */ |
2575 | | 2, /* size */ |
2576 | | 7, /* bitsize */ |
2577 | | true, /* pc_relative */ |
2578 | | 0, /* bitpos */ |
2579 | | complain_overflow_signed, /* complain_on_overflow */ |
2580 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2581 | | "R_MICROMIPS_PC7_S1", /* name */ |
2582 | | false, /* partial_inplace */ |
2583 | | 0, /* src_mask */ |
2584 | | 0x0000007f, /* dst_mask */ |
2585 | | true), /* pcrel_offset */ |
2586 | | |
2587 | | HOWTO (R_MICROMIPS_PC10_S1, /* type */ |
2588 | | 1, /* rightshift */ |
2589 | | 2, /* size */ |
2590 | | 10, /* bitsize */ |
2591 | | true, /* pc_relative */ |
2592 | | 0, /* bitpos */ |
2593 | | complain_overflow_signed, /* complain_on_overflow */ |
2594 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2595 | | "R_MICROMIPS_PC10_S1", /* name */ |
2596 | | false, /* partial_inplace */ |
2597 | | 0, /* src_mask */ |
2598 | | 0x000003ff, /* dst_mask */ |
2599 | | true), /* pcrel_offset */ |
2600 | | |
2601 | | HOWTO (R_MICROMIPS_PC16_S1, /* type */ |
2602 | | 1, /* rightshift */ |
2603 | | 4, /* size */ |
2604 | | 16, /* bitsize */ |
2605 | | true, /* pc_relative */ |
2606 | | 0, /* bitpos */ |
2607 | | complain_overflow_signed, /* complain_on_overflow */ |
2608 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2609 | | "R_MICROMIPS_PC16_S1", /* name */ |
2610 | | false, /* partial_inplace */ |
2611 | | 0, /* src_mask */ |
2612 | | 0x0000ffff, /* dst_mask */ |
2613 | | true), /* pcrel_offset */ |
2614 | | |
2615 | | /* 16 bit call through global offset table. */ |
2616 | | HOWTO (R_MICROMIPS_CALL16, /* type */ |
2617 | | 0, /* rightshift */ |
2618 | | 4, /* size */ |
2619 | | 16, /* bitsize */ |
2620 | | false, /* pc_relative */ |
2621 | | 0, /* bitpos */ |
2622 | | complain_overflow_signed, /* complain_on_overflow */ |
2623 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2624 | | "R_MICROMIPS_CALL16", /* name */ |
2625 | | false, /* partial_inplace */ |
2626 | | 0, /* src_mask */ |
2627 | | 0x0000ffff, /* dst_mask */ |
2628 | | false), /* pcrel_offset */ |
2629 | | |
2630 | | EMPTY_HOWTO (143), |
2631 | | EMPTY_HOWTO (144), |
2632 | | |
2633 | | /* Displacement in the global offset table. */ |
2634 | | HOWTO (R_MICROMIPS_GOT_DISP, /* type */ |
2635 | | 0, /* rightshift */ |
2636 | | 4, /* size */ |
2637 | | 16, /* bitsize */ |
2638 | | false, /* pc_relative */ |
2639 | | 0, /* bitpos */ |
2640 | | complain_overflow_signed, /* complain_on_overflow */ |
2641 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2642 | | "R_MICROMIPS_GOT_DISP",/* name */ |
2643 | | false, /* partial_inplace */ |
2644 | | 0, /* src_mask */ |
2645 | | 0x0000ffff, /* dst_mask */ |
2646 | | false), /* pcrel_offset */ |
2647 | | |
2648 | | /* Displacement to page pointer in the global offset table. */ |
2649 | | HOWTO (R_MICROMIPS_GOT_PAGE, /* type */ |
2650 | | 0, /* rightshift */ |
2651 | | 4, /* size */ |
2652 | | 16, /* bitsize */ |
2653 | | false, /* pc_relative */ |
2654 | | 0, /* bitpos */ |
2655 | | complain_overflow_signed, /* complain_on_overflow */ |
2656 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2657 | | "R_MICROMIPS_GOT_PAGE",/* name */ |
2658 | | false, /* partial_inplace */ |
2659 | | 0, /* src_mask */ |
2660 | | 0x0000ffff, /* dst_mask */ |
2661 | | false), /* pcrel_offset */ |
2662 | | |
2663 | | /* Offset from page pointer in the global offset table. */ |
2664 | | HOWTO (R_MICROMIPS_GOT_OFST, /* type */ |
2665 | | 0, /* rightshift */ |
2666 | | 4, /* size */ |
2667 | | 16, /* bitsize */ |
2668 | | false, /* pc_relative */ |
2669 | | 0, /* bitpos */ |
2670 | | complain_overflow_signed, /* complain_on_overflow */ |
2671 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2672 | | "R_MICROMIPS_GOT_OFST",/* name */ |
2673 | | false, /* partial_inplace */ |
2674 | | 0, /* src_mask */ |
2675 | | 0x0000ffff, /* dst_mask */ |
2676 | | false), /* pcrel_offset */ |
2677 | | |
2678 | | /* High 16 bits of displacement in global offset table. */ |
2679 | | HOWTO (R_MICROMIPS_GOT_HI16, /* type */ |
2680 | | 16, /* rightshift */ |
2681 | | 4, /* size */ |
2682 | | 16, /* bitsize */ |
2683 | | false, /* pc_relative */ |
2684 | | 0, /* bitpos */ |
2685 | | complain_overflow_dont, /* complain_on_overflow */ |
2686 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2687 | | "R_MICROMIPS_GOT_HI16",/* name */ |
2688 | | false, /* partial_inplace */ |
2689 | | 0, /* src_mask */ |
2690 | | 0x0000ffff, /* dst_mask */ |
2691 | | false), /* pcrel_offset */ |
2692 | | |
2693 | | /* Low 16 bits of displacement in global offset table. */ |
2694 | | HOWTO (R_MICROMIPS_GOT_LO16, /* type */ |
2695 | | 0, /* rightshift */ |
2696 | | 4, /* size */ |
2697 | | 16, /* bitsize */ |
2698 | | false, /* pc_relative */ |
2699 | | 0, /* bitpos */ |
2700 | | complain_overflow_dont, /* complain_on_overflow */ |
2701 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2702 | | "R_MICROMIPS_GOT_LO16",/* name */ |
2703 | | false, /* partial_inplace */ |
2704 | | 0, /* src_mask */ |
2705 | | 0x0000ffff, /* dst_mask */ |
2706 | | false), /* pcrel_offset */ |
2707 | | |
2708 | | /* 64 bit subtraction. Used in the N32 ABI. */ |
2709 | | HOWTO (R_MICROMIPS_SUB, /* type */ |
2710 | | 0, /* rightshift */ |
2711 | | 8, /* size */ |
2712 | | 64, /* bitsize */ |
2713 | | false, /* pc_relative */ |
2714 | | 0, /* bitpos */ |
2715 | | complain_overflow_dont, /* complain_on_overflow */ |
2716 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2717 | | "R_MICROMIPS_SUB", /* name */ |
2718 | | false, /* partial_inplace */ |
2719 | | 0, /* src_mask */ |
2720 | | MINUS_ONE, /* dst_mask */ |
2721 | | false), /* pcrel_offset */ |
2722 | | |
2723 | | /* Get the higher value of a 64 bit addend. */ |
2724 | | HOWTO (R_MICROMIPS_HIGHER, /* type */ |
2725 | | 32, /* rightshift */ |
2726 | | 4, /* size */ |
2727 | | 16, /* bitsize */ |
2728 | | false, /* pc_relative */ |
2729 | | 0, /* bitpos */ |
2730 | | complain_overflow_dont, /* complain_on_overflow */ |
2731 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2732 | | "R_MICROMIPS_HIGHER", /* name */ |
2733 | | false, /* partial_inplace */ |
2734 | | 0, /* src_mask */ |
2735 | | 0x0000ffff, /* dst_mask */ |
2736 | | false), /* pcrel_offset */ |
2737 | | |
2738 | | /* Get the highest value of a 64 bit addend. */ |
2739 | | HOWTO (R_MICROMIPS_HIGHEST, /* type */ |
2740 | | 48, /* rightshift */ |
2741 | | 4, /* size */ |
2742 | | 16, /* bitsize */ |
2743 | | false, /* pc_relative */ |
2744 | | 0, /* bitpos */ |
2745 | | complain_overflow_dont, /* complain_on_overflow */ |
2746 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2747 | | "R_MICROMIPS_HIGHEST", /* name */ |
2748 | | false, /* partial_inplace */ |
2749 | | 0, /* src_mask */ |
2750 | | 0x0000ffff, /* dst_mask */ |
2751 | | false), /* pcrel_offset */ |
2752 | | |
2753 | | /* High 16 bits of displacement in global offset table. */ |
2754 | | HOWTO (R_MICROMIPS_CALL_HI16, /* type */ |
2755 | | 16, /* rightshift */ |
2756 | | 4, /* size */ |
2757 | | 16, /* bitsize */ |
2758 | | false, /* pc_relative */ |
2759 | | 0, /* bitpos */ |
2760 | | complain_overflow_dont, /* complain_on_overflow */ |
2761 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2762 | | "R_MICROMIPS_CALL_HI16",/* name */ |
2763 | | false, /* partial_inplace */ |
2764 | | 0, /* src_mask */ |
2765 | | 0x0000ffff, /* dst_mask */ |
2766 | | false), /* pcrel_offset */ |
2767 | | |
2768 | | /* Low 16 bits of displacement in global offset table. */ |
2769 | | HOWTO (R_MICROMIPS_CALL_LO16, /* type */ |
2770 | | 0, /* rightshift */ |
2771 | | 4, /* size */ |
2772 | | 16, /* bitsize */ |
2773 | | false, /* pc_relative */ |
2774 | | 0, /* bitpos */ |
2775 | | complain_overflow_dont, /* complain_on_overflow */ |
2776 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2777 | | "R_MICROMIPS_CALL_LO16",/* name */ |
2778 | | false, /* partial_inplace */ |
2779 | | 0, /* src_mask */ |
2780 | | 0x0000ffff, /* dst_mask */ |
2781 | | false), /* pcrel_offset */ |
2782 | | |
2783 | | /* Section displacement. */ |
2784 | | HOWTO (R_MICROMIPS_SCN_DISP, /* type */ |
2785 | | 0, /* rightshift */ |
2786 | | 4, /* size */ |
2787 | | 32, /* bitsize */ |
2788 | | false, /* pc_relative */ |
2789 | | 0, /* bitpos */ |
2790 | | complain_overflow_dont, /* complain_on_overflow */ |
2791 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2792 | | "R_MICROMIPS_SCN_DISP", /* name */ |
2793 | | false, /* partial_inplace */ |
2794 | | 0, /* src_mask */ |
2795 | | 0xffffffff, /* dst_mask */ |
2796 | | false), /* pcrel_offset */ |
2797 | | |
2798 | | /* Protected jump conversion. This is an optimization hint. No |
2799 | | relocation is required for correctness. */ |
2800 | | HOWTO (R_MICROMIPS_JALR, /* type */ |
2801 | | 0, /* rightshift */ |
2802 | | 4, /* size */ |
2803 | | 32, /* bitsize */ |
2804 | | false, /* pc_relative */ |
2805 | | 0, /* bitpos */ |
2806 | | complain_overflow_dont, /* complain_on_overflow */ |
2807 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2808 | | "R_MICROMIPS_JALR", /* name */ |
2809 | | false, /* partial_inplace */ |
2810 | | 0, /* src_mask */ |
2811 | | 0x00000000, /* dst_mask */ |
2812 | | false), /* pcrel_offset */ |
2813 | | |
2814 | | /* Low 16 bits of symbol value. Note that the high 16 bits of symbol values |
2815 | | must be zero. This is used for relaxation. */ |
2816 | | HOWTO (R_MICROMIPS_HI0_LO16, /* type */ |
2817 | | 0, /* rightshift */ |
2818 | | 4, /* size */ |
2819 | | 16, /* bitsize */ |
2820 | | false, /* pc_relative */ |
2821 | | 0, /* bitpos */ |
2822 | | complain_overflow_dont, /* complain_on_overflow */ |
2823 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2824 | | "R_MICROMIPS_HI0_LO16",/* name */ |
2825 | | false, /* partial_inplace */ |
2826 | | 0, /* src_mask */ |
2827 | | 0x0000ffff, /* dst_mask */ |
2828 | | false), /* pcrel_offset */ |
2829 | | |
2830 | | EMPTY_HOWTO (158), |
2831 | | EMPTY_HOWTO (159), |
2832 | | EMPTY_HOWTO (160), |
2833 | | EMPTY_HOWTO (161), |
2834 | | |
2835 | | /* TLS general dynamic variable reference. */ |
2836 | | HOWTO (R_MICROMIPS_TLS_GD, /* type */ |
2837 | | 0, /* rightshift */ |
2838 | | 4, /* size */ |
2839 | | 16, /* bitsize */ |
2840 | | false, /* pc_relative */ |
2841 | | 0, /* bitpos */ |
2842 | | complain_overflow_signed, /* complain_on_overflow */ |
2843 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2844 | | "R_MICROMIPS_TLS_GD", /* name */ |
2845 | | false, /* partial_inplace */ |
2846 | | 0, /* src_mask */ |
2847 | | 0x0000ffff, /* dst_mask */ |
2848 | | false), /* pcrel_offset */ |
2849 | | |
2850 | | /* TLS local dynamic variable reference. */ |
2851 | | HOWTO (R_MICROMIPS_TLS_LDM, /* type */ |
2852 | | 0, /* rightshift */ |
2853 | | 4, /* size */ |
2854 | | 16, /* bitsize */ |
2855 | | false, /* pc_relative */ |
2856 | | 0, /* bitpos */ |
2857 | | complain_overflow_signed, /* complain_on_overflow */ |
2858 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2859 | | "R_MICROMIPS_TLS_LDM", /* name */ |
2860 | | false, /* partial_inplace */ |
2861 | | 0, /* src_mask */ |
2862 | | 0x0000ffff, /* dst_mask */ |
2863 | | false), /* pcrel_offset */ |
2864 | | |
2865 | | /* TLS local dynamic offset. */ |
2866 | | HOWTO (R_MICROMIPS_TLS_DTPREL_HI16, /* type */ |
2867 | | 16, /* rightshift */ |
2868 | | 4, /* size */ |
2869 | | 16, /* bitsize */ |
2870 | | false, /* pc_relative */ |
2871 | | 0, /* bitpos */ |
2872 | | complain_overflow_signed, /* complain_on_overflow */ |
2873 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2874 | | "R_MICROMIPS_TLS_DTPREL_HI16", /* name */ |
2875 | | false, /* partial_inplace */ |
2876 | | 0, /* src_mask */ |
2877 | | 0x0000ffff, /* dst_mask */ |
2878 | | false), /* pcrel_offset */ |
2879 | | |
2880 | | /* TLS local dynamic offset. */ |
2881 | | HOWTO (R_MICROMIPS_TLS_DTPREL_LO16, /* type */ |
2882 | | 0, /* rightshift */ |
2883 | | 4, /* size */ |
2884 | | 16, /* bitsize */ |
2885 | | false, /* pc_relative */ |
2886 | | 0, /* bitpos */ |
2887 | | complain_overflow_dont, /* complain_on_overflow */ |
2888 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2889 | | "R_MICROMIPS_TLS_DTPREL_LO16", /* name */ |
2890 | | false, /* partial_inplace */ |
2891 | | 0, /* src_mask */ |
2892 | | 0x0000ffff, /* dst_mask */ |
2893 | | false), /* pcrel_offset */ |
2894 | | |
2895 | | /* TLS thread pointer offset. */ |
2896 | | HOWTO (R_MICROMIPS_TLS_GOTTPREL, /* type */ |
2897 | | 0, /* rightshift */ |
2898 | | 4, /* size */ |
2899 | | 16, /* bitsize */ |
2900 | | false, /* pc_relative */ |
2901 | | 0, /* bitpos */ |
2902 | | complain_overflow_signed, /* complain_on_overflow */ |
2903 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2904 | | "R_MICROMIPS_TLS_GOTTPREL", /* name */ |
2905 | | false, /* partial_inplace */ |
2906 | | 0, /* src_mask */ |
2907 | | 0x0000ffff, /* dst_mask */ |
2908 | | false), /* pcrel_offset */ |
2909 | | |
2910 | | EMPTY_HOWTO (167), |
2911 | | EMPTY_HOWTO (168), |
2912 | | |
2913 | | /* TLS thread pointer offset. */ |
2914 | | HOWTO (R_MICROMIPS_TLS_TPREL_HI16, /* type */ |
2915 | | 16, /* rightshift */ |
2916 | | 4, /* size */ |
2917 | | 16, /* bitsize */ |
2918 | | false, /* pc_relative */ |
2919 | | 0, /* bitpos */ |
2920 | | complain_overflow_signed, /* complain_on_overflow */ |
2921 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2922 | | "R_MICROMIPS_TLS_TPREL_HI16", /* name */ |
2923 | | false, /* partial_inplace */ |
2924 | | 0, /* src_mask */ |
2925 | | 0x0000ffff, /* dst_mask */ |
2926 | | false), /* pcrel_offset */ |
2927 | | |
2928 | | /* TLS thread pointer offset. */ |
2929 | | HOWTO (R_MICROMIPS_TLS_TPREL_LO16, /* type */ |
2930 | | 0, /* rightshift */ |
2931 | | 4, /* size */ |
2932 | | 16, /* bitsize */ |
2933 | | false, /* pc_relative */ |
2934 | | 0, /* bitpos */ |
2935 | | complain_overflow_dont, /* complain_on_overflow */ |
2936 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2937 | | "R_MICROMIPS_TLS_TPREL_LO16", /* name */ |
2938 | | false, /* partial_inplace */ |
2939 | | 0, /* src_mask */ |
2940 | | 0x0000ffff, /* dst_mask */ |
2941 | | false), /* pcrel_offset */ |
2942 | | |
2943 | | EMPTY_HOWTO (171), |
2944 | | |
2945 | | /* GP- and PC-relative relocations. */ |
2946 | | HOWTO (R_MICROMIPS_GPREL7_S2, /* type */ |
2947 | | 2, /* rightshift */ |
2948 | | 2, /* size */ |
2949 | | 7, /* bitsize */ |
2950 | | false, /* pc_relative */ |
2951 | | 0, /* bitpos */ |
2952 | | complain_overflow_signed, /* complain_on_overflow */ |
2953 | | _bfd_mips_elf32_gprel16_reloc, /* special_function */ |
2954 | | "R_MICROMIPS_GPREL7_S2", /* name */ |
2955 | | false, /* partial_inplace */ |
2956 | | 0, /* src_mask */ |
2957 | | 0x0000007f, /* dst_mask */ |
2958 | | false), /* pcrel_offset */ |
2959 | | |
2960 | | HOWTO (R_MICROMIPS_PC23_S2, /* type */ |
2961 | | 2, /* rightshift */ |
2962 | | 4, /* size */ |
2963 | | 23, /* bitsize */ |
2964 | | true, /* pc_relative */ |
2965 | | 0, /* bitpos */ |
2966 | | complain_overflow_signed, /* complain_on_overflow */ |
2967 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2968 | | "R_MICROMIPS_PC23_S2", /* name */ |
2969 | | false, /* partial_inplace */ |
2970 | | 0, /* src_mask */ |
2971 | | 0x007fffff, /* dst_mask */ |
2972 | | true), /* pcrel_offset */ |
2973 | | }; |
2974 | | |
2975 | | /* 16 bit offset for pc-relative branches. */ |
2976 | | static reloc_howto_type elf_mips_gnu_rel16_s2 = |
2977 | | HOWTO (R_MIPS_GNU_REL16_S2, /* type */ |
2978 | | 2, /* rightshift */ |
2979 | | 4, /* size */ |
2980 | | 16, /* bitsize */ |
2981 | | true, /* pc_relative */ |
2982 | | 0, /* bitpos */ |
2983 | | complain_overflow_signed, /* complain_on_overflow */ |
2984 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
2985 | | "R_MIPS_GNU_REL16_S2", /* name */ |
2986 | | true, /* partial_inplace */ |
2987 | | 0xffff, /* src_mask */ |
2988 | | 0xffff, /* dst_mask */ |
2989 | | true); /* pcrel_offset */ |
2990 | | |
2991 | | /* 16 bit offset for pc-relative branches. */ |
2992 | | static reloc_howto_type elf_mips_gnu_rela16_s2 = |
2993 | | HOWTO (R_MIPS_GNU_REL16_S2, /* type */ |
2994 | | 2, /* rightshift */ |
2995 | | 4, /* size */ |
2996 | | 16, /* bitsize */ |
2997 | | true, /* pc_relative */ |
2998 | | 0, /* bitpos */ |
2999 | | complain_overflow_signed, /* complain_on_overflow */ |
3000 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
3001 | | "R_MIPS_GNU_REL16_S2", /* name */ |
3002 | | false, /* partial_inplace */ |
3003 | | 0, /* src_mask */ |
3004 | | 0x0000ffff, /* dst_mask */ |
3005 | | true); /* pcrel_offset */ |
3006 | | |
3007 | | /* 32 bit pc-relative. This was a GNU extension used by embedded-PIC. |
3008 | | It was co-opted by mips-linux for exception-handling data. GCC stopped |
3009 | | using it in May, 2004, then started using it again for compact unwind |
3010 | | tables. */ |
3011 | | static reloc_howto_type elf_mips_gnu_pcrel32 = |
3012 | | HOWTO (R_MIPS_PC32, /* type */ |
3013 | | 0, /* rightshift */ |
3014 | | 4, /* size */ |
3015 | | 32, /* bitsize */ |
3016 | | true, /* pc_relative */ |
3017 | | 0, /* bitpos */ |
3018 | | complain_overflow_signed, /* complain_on_overflow */ |
3019 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
3020 | | "R_MIPS_PC32", /* name */ |
3021 | | true, /* partial_inplace */ |
3022 | | 0xffffffff, /* src_mask */ |
3023 | | 0xffffffff, /* dst_mask */ |
3024 | | true); /* pcrel_offset */ |
3025 | | |
3026 | | /* GNU extension to record C++ vtable hierarchy */ |
3027 | | static reloc_howto_type elf_mips_gnu_vtinherit_howto = |
3028 | | HOWTO (R_MIPS_GNU_VTINHERIT, /* type */ |
3029 | | 0, /* rightshift */ |
3030 | | 4, /* size */ |
3031 | | 0, /* bitsize */ |
3032 | | false, /* pc_relative */ |
3033 | | 0, /* bitpos */ |
3034 | | complain_overflow_dont, /* complain_on_overflow */ |
3035 | | NULL, /* special_function */ |
3036 | | "R_MIPS_GNU_VTINHERIT", /* name */ |
3037 | | false, /* partial_inplace */ |
3038 | | 0, /* src_mask */ |
3039 | | 0, /* dst_mask */ |
3040 | | false); /* pcrel_offset */ |
3041 | | |
3042 | | /* GNU extension to record C++ vtable member usage */ |
3043 | | static reloc_howto_type elf_mips_gnu_vtentry_howto = |
3044 | | HOWTO (R_MIPS_GNU_VTENTRY, /* type */ |
3045 | | 0, /* rightshift */ |
3046 | | 4, /* size */ |
3047 | | 0, /* bitsize */ |
3048 | | false, /* pc_relative */ |
3049 | | 0, /* bitpos */ |
3050 | | complain_overflow_dont, /* complain_on_overflow */ |
3051 | | _bfd_elf_rel_vtable_reloc_fn, /* special_function */ |
3052 | | "R_MIPS_GNU_VTENTRY", /* name */ |
3053 | | false, /* partial_inplace */ |
3054 | | 0, /* src_mask */ |
3055 | | 0, /* dst_mask */ |
3056 | | false); /* pcrel_offset */ |
3057 | | |
3058 | | /* Originally a VxWorks extension, but now used for other systems too. */ |
3059 | | static reloc_howto_type elf_mips_copy_howto = |
3060 | | HOWTO (R_MIPS_COPY, /* type */ |
3061 | | 0, /* rightshift */ |
3062 | | 0, /* this one is variable size */ |
3063 | | 0, /* bitsize */ |
3064 | | false, /* pc_relative */ |
3065 | | 0, /* bitpos */ |
3066 | | complain_overflow_bitfield, /* complain_on_overflow */ |
3067 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
3068 | | "R_MIPS_COPY", /* name */ |
3069 | | false, /* partial_inplace */ |
3070 | | 0x0, /* src_mask */ |
3071 | | 0x0, /* dst_mask */ |
3072 | | false); /* pcrel_offset */ |
3073 | | |
3074 | | /* Originally a VxWorks extension, but now used for other systems too. */ |
3075 | | static reloc_howto_type elf_mips_jump_slot_howto = |
3076 | | HOWTO (R_MIPS_JUMP_SLOT, /* type */ |
3077 | | 0, /* rightshift */ |
3078 | | 4, /* size */ |
3079 | | 32, /* bitsize */ |
3080 | | false, /* pc_relative */ |
3081 | | 0, /* bitpos */ |
3082 | | complain_overflow_bitfield, /* complain_on_overflow */ |
3083 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
3084 | | "R_MIPS_JUMP_SLOT", /* name */ |
3085 | | false, /* partial_inplace */ |
3086 | | 0x0, /* src_mask */ |
3087 | | 0x0, /* dst_mask */ |
3088 | | false); /* pcrel_offset */ |
3089 | | |
3090 | | /* Used in EH tables. */ |
3091 | | static reloc_howto_type elf_mips_eh_howto = |
3092 | | HOWTO (R_MIPS_EH, /* type */ |
3093 | | 0, /* rightshift */ |
3094 | | 4, /* size */ |
3095 | | 32, /* bitsize */ |
3096 | | false, /* pc_relative */ |
3097 | | 0, /* bitpos */ |
3098 | | complain_overflow_signed, /* complain_on_overflow */ |
3099 | | _bfd_mips_elf_generic_reloc, /* special_function */ |
3100 | | "R_MIPS_EH", /* name */ |
3101 | | true, /* partial_inplace */ |
3102 | | 0xffffffff, /* src_mask */ |
3103 | | 0xffffffff, /* dst_mask */ |
3104 | | false); /* pcrel_offset */ |
3105 | | |
3106 | | /* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a |
3107 | | dangerous relocation. */ |
3108 | | |
3109 | | static bool |
3110 | | mips_elf_assign_gp (bfd *output_bfd, bfd_vma *pgp) |
3111 | 7 | { |
3112 | 7 | unsigned int count; |
3113 | 7 | asymbol **sym; |
3114 | 7 | unsigned int i; |
3115 | | |
3116 | | /* If we've already figured out what GP will be, just return it. */ |
3117 | 7 | *pgp = _bfd_get_gp_value (output_bfd); |
3118 | 7 | if (*pgp) |
3119 | 0 | return true; |
3120 | | |
3121 | 7 | count = bfd_get_symcount (output_bfd); |
3122 | 7 | sym = bfd_get_outsymbols (output_bfd); |
3123 | | |
3124 | | /* The linker script will have created a symbol named `_gp' with the |
3125 | | appropriate value. */ |
3126 | 7 | if (sym == NULL) |
3127 | 6 | i = count; |
3128 | 1 | else |
3129 | 1 | { |
3130 | 1 | for (i = 0; i < count; i++, sym++) |
3131 | 0 | { |
3132 | 0 | register const char *name; |
3133 | |
|
3134 | 0 | name = bfd_asymbol_name (*sym); |
3135 | 0 | if (*name == '_' && strcmp (name, "_gp") == 0) |
3136 | 0 | { |
3137 | 0 | *pgp = bfd_asymbol_value (*sym); |
3138 | 0 | _bfd_set_gp_value (output_bfd, *pgp); |
3139 | 0 | break; |
3140 | 0 | } |
3141 | 0 | } |
3142 | 1 | } |
3143 | | |
3144 | 7 | if (i >= count) |
3145 | 7 | { |
3146 | | /* Only get the error once. */ |
3147 | 7 | *pgp = 4; |
3148 | 7 | _bfd_set_gp_value (output_bfd, *pgp); |
3149 | 7 | return false; |
3150 | 7 | } |
3151 | | |
3152 | 0 | return true; |
3153 | 7 | } |
3154 | | |
3155 | | /* We have to figure out the gp value, so that we can adjust the |
3156 | | symbol value correctly. We look up the symbol _gp in the output |
3157 | | BFD. If we can't find it, we're stuck. We cache it in the ELF |
3158 | | target data. We don't need to adjust the symbol value for an |
3159 | | external symbol if we are producing relocatable output. */ |
3160 | | |
3161 | | static bfd_reloc_status_type |
3162 | | mips_elf_final_gp (bfd *output_bfd, asymbol *symbol, bool relocatable, |
3163 | | char **error_message, bfd_vma *pgp) |
3164 | 14 | { |
3165 | 14 | if (output_bfd == NULL) |
3166 | 0 | { |
3167 | 0 | *pgp = 0; |
3168 | 0 | return bfd_reloc_undefined; |
3169 | 0 | } |
3170 | | |
3171 | 14 | *pgp = _bfd_get_gp_value (output_bfd); |
3172 | 14 | if (*pgp == 0 |
3173 | 7 | && (! relocatable |
3174 | 0 | || (symbol->flags & BSF_SECTION_SYM) != 0)) |
3175 | 7 | { |
3176 | 7 | if (relocatable) |
3177 | 0 | { |
3178 | | /* Make up a value. */ |
3179 | 0 | *pgp = symbol->section->output_section->vma /*+ 0x4000*/; |
3180 | 0 | _bfd_set_gp_value (output_bfd, *pgp); |
3181 | 0 | } |
3182 | 7 | else if (!mips_elf_assign_gp (output_bfd, pgp)) |
3183 | 7 | { |
3184 | 7 | *error_message = |
3185 | 7 | (char *) _("GP relative relocation when _gp not defined"); |
3186 | 7 | return bfd_reloc_dangerous; |
3187 | 7 | } |
3188 | 7 | } |
3189 | | |
3190 | 7 | return bfd_reloc_ok; |
3191 | 14 | } |
3192 | | |
3193 | | /* Do a R_MIPS_GPREL16 relocation. This is a 16 bit value which must |
3194 | | become the offset from the gp register. This function also handles |
3195 | | R_MIPS_LITERAL relocations, although those can be handled more |
3196 | | cleverly because the entries in the .lit8 and .lit4 sections can be |
3197 | | merged. */ |
3198 | | |
3199 | | bfd_reloc_status_type |
3200 | | _bfd_mips_elf32_gprel16_reloc (bfd *abfd, arelent *reloc_entry, |
3201 | | asymbol *symbol, void *data, |
3202 | | asection *input_section, bfd *output_bfd, |
3203 | | char **error_message) |
3204 | 13 | { |
3205 | 13 | bool relocatable; |
3206 | 13 | bfd_reloc_status_type ret; |
3207 | 13 | bfd_byte *location; |
3208 | 13 | bfd_vma gp; |
3209 | | |
3210 | | /* R_MIPS_LITERAL/R_MICROMIPS_LITERAL relocations are defined for local |
3211 | | symbols only. */ |
3212 | 13 | if (literal_reloc_p (reloc_entry->howto->type) |
3213 | 12 | && output_bfd != NULL |
3214 | 0 | && (symbol->flags & BSF_SECTION_SYM) == 0 |
3215 | 0 | && (symbol->flags & BSF_LOCAL) != 0) |
3216 | 0 | { |
3217 | 0 | *error_message = (char *) |
3218 | 0 | _("literal relocation occurs for an external symbol"); |
3219 | 0 | return bfd_reloc_outofrange; |
3220 | 0 | } |
3221 | | |
3222 | 13 | if (output_bfd != NULL) |
3223 | 0 | relocatable = true; |
3224 | 13 | else |
3225 | 13 | { |
3226 | 13 | relocatable = false; |
3227 | 13 | output_bfd = input_section->output_section->owner; |
3228 | 13 | } |
3229 | | |
3230 | 13 | ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, |
3231 | 13 | &gp); |
3232 | 13 | if (ret != bfd_reloc_ok) |
3233 | 6 | return ret; |
3234 | | |
3235 | 7 | if (!_bfd_mips_reloc_offset_in_range (abfd, input_section, reloc_entry, |
3236 | 7 | check_shuffle)) |
3237 | 0 | return bfd_reloc_outofrange; |
3238 | | |
3239 | 7 | location = (bfd_byte *) data + reloc_entry->address; |
3240 | 7 | _bfd_mips_elf_reloc_unshuffle (abfd, reloc_entry->howto->type, false, |
3241 | 7 | location); |
3242 | 7 | ret = _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, |
3243 | 7 | input_section, relocatable, |
3244 | 7 | data, gp); |
3245 | 7 | _bfd_mips_elf_reloc_shuffle (abfd, reloc_entry->howto->type, !relocatable, |
3246 | 7 | location); |
3247 | | |
3248 | 7 | return ret; |
3249 | 7 | } |
3250 | | |
3251 | | /* Do a R_MIPS_GPREL32 relocation. This is a 32 bit value which must |
3252 | | become the offset from the gp register. */ |
3253 | | |
3254 | | static bfd_reloc_status_type |
3255 | | mips_elf_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, |
3256 | | void *data, asection *input_section, bfd *output_bfd, |
3257 | | char **error_message) |
3258 | 0 | { |
3259 | 0 | bool relocatable; |
3260 | 0 | bfd_reloc_status_type ret; |
3261 | 0 | bfd_vma gp; |
3262 | | |
3263 | | /* R_MIPS_GPREL32 relocations are defined for local symbols only. */ |
3264 | 0 | if (output_bfd != NULL |
3265 | 0 | && (symbol->flags & BSF_SECTION_SYM) == 0 |
3266 | 0 | && (symbol->flags & BSF_LOCAL) != 0) |
3267 | 0 | { |
3268 | 0 | *error_message = (char *) |
3269 | 0 | _("32bits gp relative relocation occurs for an external symbol"); |
3270 | 0 | return bfd_reloc_outofrange; |
3271 | 0 | } |
3272 | | |
3273 | 0 | if (output_bfd != NULL) |
3274 | 0 | relocatable = true; |
3275 | 0 | else |
3276 | 0 | { |
3277 | 0 | relocatable = false; |
3278 | 0 | output_bfd = input_section->output_section->owner; |
3279 | 0 | } |
3280 | |
|
3281 | 0 | ret = mips_elf_final_gp (output_bfd, symbol, relocatable, |
3282 | 0 | error_message, &gp); |
3283 | 0 | if (ret != bfd_reloc_ok) |
3284 | 0 | return ret; |
3285 | | |
3286 | 0 | return gprel32_with_gp (abfd, symbol, reloc_entry, input_section, |
3287 | 0 | relocatable, data, gp); |
3288 | 0 | } |
3289 | | |
3290 | | static bfd_reloc_status_type |
3291 | | gprel32_with_gp (bfd *abfd, asymbol *symbol, arelent *reloc_entry, |
3292 | | asection *input_section, bool relocatable, |
3293 | | void *data, bfd_vma gp) |
3294 | 0 | { |
3295 | 0 | bfd_vma relocation; |
3296 | 0 | bfd_vma val; |
3297 | |
|
3298 | 0 | if (bfd_is_com_section (symbol->section)) |
3299 | 0 | relocation = 0; |
3300 | 0 | else |
3301 | 0 | relocation = symbol->value; |
3302 | |
|
3303 | 0 | if (symbol->section->output_section != NULL) |
3304 | 0 | { |
3305 | 0 | relocation += symbol->section->output_section->vma; |
3306 | 0 | relocation += symbol->section->output_offset; |
3307 | 0 | } |
3308 | |
|
3309 | 0 | if (!_bfd_mips_reloc_offset_in_range (abfd, input_section, reloc_entry, |
3310 | 0 | check_inplace)) |
3311 | 0 | return bfd_reloc_outofrange; |
3312 | | |
3313 | | /* Set val to the offset into the section or symbol. */ |
3314 | 0 | val = reloc_entry->addend; |
3315 | |
|
3316 | 0 | if (reloc_entry->howto->partial_inplace) |
3317 | 0 | val += bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); |
3318 | | |
3319 | | /* Adjust val for the final section location and GP value. If we |
3320 | | are producing relocatable output, we don't want to do this for |
3321 | | an external symbol. */ |
3322 | 0 | if (! relocatable |
3323 | 0 | || (symbol->flags & BSF_SECTION_SYM) != 0) |
3324 | 0 | val += relocation - gp; |
3325 | |
|
3326 | 0 | if (reloc_entry->howto->partial_inplace) |
3327 | 0 | bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address); |
3328 | 0 | else |
3329 | 0 | reloc_entry->addend = val; |
3330 | |
|
3331 | 0 | if (relocatable) |
3332 | 0 | reloc_entry->address += input_section->output_offset; |
3333 | |
|
3334 | 0 | return bfd_reloc_ok; |
3335 | 0 | } |
3336 | | |
3337 | | /* Handle a 64 bit reloc in a 32 bit MIPS ELF file. These are |
3338 | | generated when addresses are 64 bits. The upper 32 bits are a simple |
3339 | | sign extension. */ |
3340 | | |
3341 | | static bfd_reloc_status_type |
3342 | | mips32_64bit_reloc (bfd *abfd, arelent *reloc_entry, |
3343 | | asymbol *symbol ATTRIBUTE_UNUSED, |
3344 | | void *data, asection *input_section, |
3345 | | bfd *output_bfd, char **error_message) |
3346 | 0 | { |
3347 | 0 | bfd_reloc_status_type r; |
3348 | 0 | arelent reloc32; |
3349 | 0 | unsigned long val; |
3350 | 0 | bfd_size_type addr; |
3351 | | |
3352 | | /* Do a normal 32 bit relocation on the lower 32 bits. */ |
3353 | 0 | reloc32 = *reloc_entry; |
3354 | 0 | if (bfd_big_endian (abfd)) |
3355 | 0 | reloc32.address += 4; |
3356 | 0 | reloc32.howto = &elf_mips_howto_table_rel[R_MIPS_32]; |
3357 | 0 | r = bfd_perform_relocation (abfd, &reloc32, data, input_section, |
3358 | 0 | output_bfd, error_message); |
3359 | | |
3360 | | /* Sign extend into the upper 32 bits. */ |
3361 | 0 | val = bfd_get_32 (abfd, (bfd_byte *) data + reloc32.address); |
3362 | 0 | if ((val & 0x80000000) != 0) |
3363 | 0 | val = 0xffffffff; |
3364 | 0 | else |
3365 | 0 | val = 0; |
3366 | 0 | addr = reloc_entry->address; |
3367 | 0 | if (bfd_little_endian (abfd)) |
3368 | 0 | addr += 4; |
3369 | 0 | bfd_put_32 (abfd, val, (bfd_byte *) data + addr); |
3370 | |
|
3371 | 0 | return r; |
3372 | 0 | } |
3373 | | |
3374 | | /* Handle a mips16 GP relative reloc. */ |
3375 | | |
3376 | | static bfd_reloc_status_type |
3377 | | mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, |
3378 | | void *data, asection *input_section, bfd *output_bfd, |
3379 | | char **error_message) |
3380 | 1 | { |
3381 | 1 | bool relocatable; |
3382 | 1 | bfd_reloc_status_type ret; |
3383 | 1 | bfd_byte *location; |
3384 | 1 | bfd_vma gp; |
3385 | | |
3386 | | /* If we're relocating, and this is an external symbol, we don't want |
3387 | | to change anything. */ |
3388 | 1 | if (output_bfd != NULL |
3389 | 0 | && (symbol->flags & BSF_SECTION_SYM) == 0 |
3390 | 0 | && (symbol->flags & BSF_LOCAL) != 0) |
3391 | 0 | { |
3392 | 0 | reloc_entry->address += input_section->output_offset; |
3393 | 0 | return bfd_reloc_ok; |
3394 | 0 | } |
3395 | | |
3396 | 1 | if (output_bfd != NULL) |
3397 | 0 | relocatable = true; |
3398 | 1 | else |
3399 | 1 | { |
3400 | 1 | relocatable = false; |
3401 | 1 | output_bfd = input_section->output_section->owner; |
3402 | 1 | } |
3403 | | |
3404 | 1 | ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, |
3405 | 1 | &gp); |
3406 | 1 | if (ret != bfd_reloc_ok) |
3407 | 1 | return ret; |
3408 | | |
3409 | 0 | if (!_bfd_mips_reloc_offset_in_range (abfd, input_section, reloc_entry, |
3410 | 0 | check_shuffle)) |
3411 | 0 | return bfd_reloc_outofrange; |
3412 | | |
3413 | 0 | location = (bfd_byte *) data + reloc_entry->address; |
3414 | 0 | _bfd_mips_elf_reloc_unshuffle (abfd, reloc_entry->howto->type, false, |
3415 | 0 | location); |
3416 | 0 | ret = _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, |
3417 | 0 | input_section, relocatable, |
3418 | 0 | data, gp); |
3419 | 0 | _bfd_mips_elf_reloc_shuffle (abfd, reloc_entry->howto->type, !relocatable, |
3420 | 0 | location); |
3421 | |
|
3422 | 0 | return ret; |
3423 | 0 | } |
3424 | | |
3425 | | /* A mapping from BFD reloc types to MIPS ELF reloc types. */ |
3426 | | |
3427 | | struct elf_reloc_map { |
3428 | | bfd_reloc_code_real_type bfd_val; |
3429 | | enum elf_mips_reloc_type elf_val; |
3430 | | }; |
3431 | | |
3432 | | static const struct elf_reloc_map mips_reloc_map[] = |
3433 | | { |
3434 | | { BFD_RELOC_NONE, R_MIPS_NONE }, |
3435 | | { BFD_RELOC_MIPS_16, R_MIPS_16 }, |
3436 | | { BFD_RELOC_32, R_MIPS_32 }, |
3437 | | /* There is no BFD reloc for R_MIPS_REL32. */ |
3438 | | { BFD_RELOC_64, R_MIPS_64 }, |
3439 | | { BFD_RELOC_MIPS_JMP, R_MIPS_26 }, |
3440 | | { BFD_RELOC_HI16_S, R_MIPS_HI16 }, |
3441 | | { BFD_RELOC_LO16, R_MIPS_LO16 }, |
3442 | | { BFD_RELOC_GPREL16, R_MIPS_GPREL16 }, |
3443 | | { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL }, |
3444 | | { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 }, |
3445 | | { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 }, |
3446 | | { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 }, |
3447 | | { BFD_RELOC_GPREL32, R_MIPS_GPREL32 }, |
3448 | | { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 }, |
3449 | | { BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 }, |
3450 | | { BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 }, |
3451 | | { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 }, |
3452 | | { BFD_RELOC_MIPS_SUB, R_MIPS_SUB }, |
3453 | | { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE }, |
3454 | | { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST }, |
3455 | | { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP }, |
3456 | | { BFD_RELOC_MIPS_JALR, R_MIPS_JALR }, |
3457 | | { BFD_RELOC_MIPS_TLS_DTPMOD32, R_MIPS_TLS_DTPMOD32 }, |
3458 | | { BFD_RELOC_MIPS_TLS_DTPREL32, R_MIPS_TLS_DTPREL32 }, |
3459 | | { BFD_RELOC_MIPS_TLS_DTPMOD64, R_MIPS_TLS_DTPMOD64 }, |
3460 | | { BFD_RELOC_MIPS_TLS_DTPREL64, R_MIPS_TLS_DTPREL64 }, |
3461 | | { BFD_RELOC_MIPS_TLS_GD, R_MIPS_TLS_GD }, |
3462 | | { BFD_RELOC_MIPS_TLS_LDM, R_MIPS_TLS_LDM }, |
3463 | | { BFD_RELOC_MIPS_TLS_DTPREL_HI16, R_MIPS_TLS_DTPREL_HI16 }, |
3464 | | { BFD_RELOC_MIPS_TLS_DTPREL_LO16, R_MIPS_TLS_DTPREL_LO16 }, |
3465 | | { BFD_RELOC_MIPS_TLS_GOTTPREL, R_MIPS_TLS_GOTTPREL }, |
3466 | | { BFD_RELOC_MIPS_TLS_TPREL32, R_MIPS_TLS_TPREL32 }, |
3467 | | { BFD_RELOC_MIPS_TLS_TPREL64, R_MIPS_TLS_TPREL64 }, |
3468 | | { BFD_RELOC_MIPS_TLS_TPREL_HI16, R_MIPS_TLS_TPREL_HI16 }, |
3469 | | { BFD_RELOC_MIPS_TLS_TPREL_LO16, R_MIPS_TLS_TPREL_LO16 }, |
3470 | | { BFD_RELOC_MIPS_21_PCREL_S2, R_MIPS_PC21_S2 }, |
3471 | | { BFD_RELOC_MIPS_26_PCREL_S2, R_MIPS_PC26_S2 }, |
3472 | | { BFD_RELOC_MIPS_18_PCREL_S3, R_MIPS_PC18_S3 }, |
3473 | | { BFD_RELOC_MIPS_19_PCREL_S2, R_MIPS_PC19_S2 }, |
3474 | | { BFD_RELOC_HI16_S_PCREL, R_MIPS_PCHI16 }, |
3475 | | { BFD_RELOC_LO16_PCREL, R_MIPS_PCLO16 } |
3476 | | }; |
3477 | | |
3478 | | static const struct elf_reloc_map mips16_reloc_map[] = |
3479 | | { |
3480 | | { BFD_RELOC_MIPS16_JMP, R_MIPS16_26 - R_MIPS16_min }, |
3481 | | { BFD_RELOC_MIPS16_GPREL, R_MIPS16_GPREL - R_MIPS16_min }, |
3482 | | { BFD_RELOC_MIPS16_GOT16, R_MIPS16_GOT16 - R_MIPS16_min }, |
3483 | | { BFD_RELOC_MIPS16_CALL16, R_MIPS16_CALL16 - R_MIPS16_min }, |
3484 | | { BFD_RELOC_MIPS16_HI16_S, R_MIPS16_HI16 - R_MIPS16_min }, |
3485 | | { BFD_RELOC_MIPS16_LO16, R_MIPS16_LO16 - R_MIPS16_min }, |
3486 | | { BFD_RELOC_MIPS16_TLS_GD, R_MIPS16_TLS_GD - R_MIPS16_min }, |
3487 | | { BFD_RELOC_MIPS16_TLS_LDM, R_MIPS16_TLS_LDM - R_MIPS16_min }, |
3488 | | { BFD_RELOC_MIPS16_TLS_DTPREL_HI16, |
3489 | | R_MIPS16_TLS_DTPREL_HI16 - R_MIPS16_min }, |
3490 | | { BFD_RELOC_MIPS16_TLS_DTPREL_LO16, |
3491 | | R_MIPS16_TLS_DTPREL_LO16 - R_MIPS16_min }, |
3492 | | { BFD_RELOC_MIPS16_TLS_GOTTPREL, R_MIPS16_TLS_GOTTPREL - R_MIPS16_min }, |
3493 | | { BFD_RELOC_MIPS16_TLS_TPREL_HI16, R_MIPS16_TLS_TPREL_HI16 - R_MIPS16_min }, |
3494 | | { BFD_RELOC_MIPS16_TLS_TPREL_LO16, R_MIPS16_TLS_TPREL_LO16 - R_MIPS16_min }, |
3495 | | { BFD_RELOC_MIPS16_16_PCREL_S1, R_MIPS16_PC16_S1 - R_MIPS16_min } |
3496 | | }; |
3497 | | |
3498 | | static const struct elf_reloc_map micromips_reloc_map[] = |
3499 | | { |
3500 | | { BFD_RELOC_MICROMIPS_JMP, R_MICROMIPS_26_S1 - R_MICROMIPS_min }, |
3501 | | { BFD_RELOC_MICROMIPS_HI16_S, R_MICROMIPS_HI16 - R_MICROMIPS_min }, |
3502 | | { BFD_RELOC_MICROMIPS_LO16, R_MICROMIPS_LO16 - R_MICROMIPS_min }, |
3503 | | { BFD_RELOC_MICROMIPS_GPREL16, R_MICROMIPS_GPREL16 - R_MICROMIPS_min }, |
3504 | | { BFD_RELOC_MICROMIPS_LITERAL, R_MICROMIPS_LITERAL - R_MICROMIPS_min }, |
3505 | | { BFD_RELOC_MICROMIPS_GOT16, R_MICROMIPS_GOT16 - R_MICROMIPS_min }, |
3506 | | { BFD_RELOC_MICROMIPS_7_PCREL_S1, R_MICROMIPS_PC7_S1 - R_MICROMIPS_min }, |
3507 | | { BFD_RELOC_MICROMIPS_10_PCREL_S1, R_MICROMIPS_PC10_S1 - R_MICROMIPS_min }, |
3508 | | { BFD_RELOC_MICROMIPS_16_PCREL_S1, R_MICROMIPS_PC16_S1 - R_MICROMIPS_min }, |
3509 | | { BFD_RELOC_MICROMIPS_CALL16, R_MICROMIPS_CALL16 - R_MICROMIPS_min }, |
3510 | | { BFD_RELOC_MICROMIPS_GOT_DISP, R_MICROMIPS_GOT_DISP - R_MICROMIPS_min }, |
3511 | | { BFD_RELOC_MICROMIPS_GOT_PAGE, R_MICROMIPS_GOT_PAGE - R_MICROMIPS_min }, |
3512 | | { BFD_RELOC_MICROMIPS_GOT_OFST, R_MICROMIPS_GOT_OFST - R_MICROMIPS_min }, |
3513 | | { BFD_RELOC_MICROMIPS_GOT_HI16, R_MICROMIPS_GOT_HI16 - R_MICROMIPS_min }, |
3514 | | { BFD_RELOC_MICROMIPS_GOT_LO16, R_MICROMIPS_GOT_LO16 - R_MICROMIPS_min }, |
3515 | | { BFD_RELOC_MICROMIPS_SUB, R_MICROMIPS_SUB - R_MICROMIPS_min }, |
3516 | | { BFD_RELOC_MICROMIPS_HIGHER, R_MICROMIPS_HIGHER - R_MICROMIPS_min }, |
3517 | | { BFD_RELOC_MICROMIPS_HIGHEST, R_MICROMIPS_HIGHEST - R_MICROMIPS_min }, |
3518 | | { BFD_RELOC_MICROMIPS_CALL_HI16, R_MICROMIPS_CALL_HI16 - R_MICROMIPS_min }, |
3519 | | { BFD_RELOC_MICROMIPS_CALL_LO16, R_MICROMIPS_CALL_LO16 - R_MICROMIPS_min }, |
3520 | | { BFD_RELOC_MICROMIPS_SCN_DISP, R_MICROMIPS_SCN_DISP - R_MICROMIPS_min }, |
3521 | | { BFD_RELOC_MICROMIPS_JALR, R_MICROMIPS_JALR - R_MICROMIPS_min }, |
3522 | | /* There is no BFD reloc for R_MICROMIPS_HI0_LO16. */ |
3523 | | { BFD_RELOC_MICROMIPS_TLS_GD, R_MICROMIPS_TLS_GD - R_MICROMIPS_min }, |
3524 | | { BFD_RELOC_MICROMIPS_TLS_LDM, R_MICROMIPS_TLS_LDM - R_MICROMIPS_min }, |
3525 | | { BFD_RELOC_MICROMIPS_TLS_DTPREL_HI16, |
3526 | | R_MICROMIPS_TLS_DTPREL_HI16 - R_MICROMIPS_min }, |
3527 | | { BFD_RELOC_MICROMIPS_TLS_DTPREL_LO16, |
3528 | | R_MICROMIPS_TLS_DTPREL_LO16 - R_MICROMIPS_min }, |
3529 | | { BFD_RELOC_MICROMIPS_TLS_GOTTPREL, |
3530 | | R_MICROMIPS_TLS_GOTTPREL - R_MICROMIPS_min }, |
3531 | | { BFD_RELOC_MICROMIPS_TLS_TPREL_HI16, |
3532 | | R_MICROMIPS_TLS_TPREL_HI16 - R_MICROMIPS_min }, |
3533 | | { BFD_RELOC_MICROMIPS_TLS_TPREL_LO16, |
3534 | | R_MICROMIPS_TLS_TPREL_LO16 - R_MICROMIPS_min }, |
3535 | | /* There is no BFD reloc for R_MICROMIPS_GPREL7_S2. */ |
3536 | | /* There is no BFD reloc for R_MICROMIPS_PC23_S2. */ |
3537 | | }; |
3538 | | |
3539 | | /* Given a BFD reloc type, return a howto structure. */ |
3540 | | |
3541 | | static reloc_howto_type * |
3542 | | mips_elf32_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code, |
3543 | | reloc_howto_type *howto_table, |
3544 | | reloc_howto_type *howto16_table, |
3545 | | reloc_howto_type *howto_micromips_table) |
3546 | 0 | { |
3547 | 0 | unsigned int i; |
3548 | |
|
3549 | 0 | for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map); |
3550 | 0 | i++) |
3551 | 0 | { |
3552 | 0 | if (mips_reloc_map[i].bfd_val == code) |
3553 | 0 | return &howto_table[(int) mips_reloc_map[i].elf_val]; |
3554 | 0 | } |
3555 | | |
3556 | 0 | for (i = 0; i < sizeof (mips16_reloc_map) / sizeof (struct elf_reloc_map); |
3557 | 0 | i++) |
3558 | 0 | { |
3559 | 0 | if (mips16_reloc_map[i].bfd_val == code) |
3560 | 0 | return &howto16_table[(int) mips16_reloc_map[i].elf_val]; |
3561 | 0 | } |
3562 | | |
3563 | 0 | for (i = 0; i < sizeof (micromips_reloc_map) / sizeof (struct elf_reloc_map); |
3564 | 0 | i++) |
3565 | 0 | { |
3566 | 0 | if (micromips_reloc_map[i].bfd_val == code) |
3567 | 0 | return &howto_micromips_table[(int) micromips_reloc_map[i].elf_val]; |
3568 | 0 | } |
3569 | | |
3570 | 0 | switch (code) |
3571 | 0 | { |
3572 | 0 | default: |
3573 | 0 | bfd_set_error (bfd_error_bad_value); |
3574 | 0 | return NULL; |
3575 | | |
3576 | 0 | case BFD_RELOC_CTOR: |
3577 | | /* We need to handle BFD_RELOC_CTOR specially. |
3578 | | Select the right relocation (R_MIPS_32 or R_MIPS_64) based on the |
3579 | | size of addresses of the ABI. */ |
3580 | 0 | if ((elf_elfheader (abfd)->e_flags & (EF_MIPS_ABI_O64 |
3581 | 0 | | EF_MIPS_ABI_EABI64)) != 0) |
3582 | 0 | return &elf_mips_ctor64_howto; |
3583 | 0 | else |
3584 | 0 | return &howto_table[(int) R_MIPS_32]; |
3585 | | |
3586 | 0 | case BFD_RELOC_VTABLE_INHERIT: |
3587 | 0 | return &elf_mips_gnu_vtinherit_howto; |
3588 | 0 | case BFD_RELOC_VTABLE_ENTRY: |
3589 | 0 | return &elf_mips_gnu_vtentry_howto; |
3590 | 0 | case BFD_RELOC_32_PCREL: |
3591 | 0 | return &elf_mips_gnu_pcrel32; |
3592 | 0 | case BFD_RELOC_COPY: |
3593 | 0 | return &elf_mips_copy_howto; |
3594 | 0 | case BFD_RELOC_JMP_SLOT: |
3595 | 0 | return &elf_mips_jump_slot_howto; |
3596 | 0 | case BFD_RELOC_MIPS_EH: |
3597 | 0 | return &elf_mips_eh_howto; |
3598 | 0 | } |
3599 | 0 | } |
3600 | | |
3601 | | /* Given a BFD reloc type, return a howto structure; REL wrapper. */ |
3602 | | |
3603 | | static reloc_howto_type * |
3604 | | mips_elf32_reloc_type_lookup_rel (bfd *abfd, bfd_reloc_code_real_type code) |
3605 | 0 | { |
3606 | 0 | return mips_elf32_reloc_type_lookup (abfd, code, |
3607 | 0 | elf_mips_howto_table_rel, |
3608 | 0 | elf_mips16_howto_table_rel, |
3609 | 0 | elf_micromips_howto_table_rel); |
3610 | 0 | } |
3611 | | |
3612 | | /* Given a BFD reloc type, return a howto structure; RELA wrapper. */ |
3613 | | |
3614 | | static reloc_howto_type * |
3615 | | mips_elf32_reloc_type_lookup_rela (bfd *abfd, bfd_reloc_code_real_type code) |
3616 | 0 | { |
3617 | 0 | return mips_elf32_reloc_type_lookup (abfd, code, |
3618 | 0 | elf_mips_howto_table_rela, |
3619 | 0 | elf_mips16_howto_table_rela, |
3620 | 0 | elf_micromips_howto_table_rela); |
3621 | 0 | } |
3622 | | |
3623 | | /* Given an ELF reloc name, return a howto structure. */ |
3624 | | |
3625 | | static reloc_howto_type * |
3626 | | mips_elf32_reloc_name_lookup (const char *r_name, |
3627 | | reloc_howto_type *howto_table, |
3628 | | size_t howto_table_size, |
3629 | | reloc_howto_type *howto16_table, |
3630 | | size_t howto16_table_size, |
3631 | | reloc_howto_type *howto_micromips_table, |
3632 | | size_t howto_micromips_table_size) |
3633 | 0 | { |
3634 | 0 | unsigned int i; |
3635 | |
|
3636 | 0 | for (i = 0; i < howto_table_size; i++) |
3637 | 0 | if (howto_table[i].name != NULL |
3638 | 0 | && strcasecmp (howto_table[i].name, r_name) == 0) |
3639 | 0 | return &howto_table[i]; |
3640 | | |
3641 | 0 | for (i = 0; i < howto16_table_size; i++) |
3642 | 0 | if (howto16_table[i].name != NULL |
3643 | 0 | && strcasecmp (howto16_table[i].name, r_name) == 0) |
3644 | 0 | return &howto16_table[i]; |
3645 | | |
3646 | 0 | for (i = 0; i < howto_micromips_table_size; i++) |
3647 | 0 | if (howto_micromips_table[i].name != NULL |
3648 | 0 | && strcasecmp (howto_micromips_table[i].name, r_name) == 0) |
3649 | 0 | return &howto_micromips_table[i]; |
3650 | | |
3651 | 0 | if (strcasecmp (elf_mips_gnu_pcrel32.name, r_name) == 0) |
3652 | 0 | return &elf_mips_gnu_pcrel32; |
3653 | 0 | if (strcasecmp (elf_mips_gnu_rel16_s2.name, r_name) == 0) |
3654 | 0 | return &elf_mips_gnu_rel16_s2; |
3655 | 0 | if (strcasecmp (elf_mips_gnu_vtinherit_howto.name, r_name) == 0) |
3656 | 0 | return &elf_mips_gnu_vtinherit_howto; |
3657 | 0 | if (strcasecmp (elf_mips_gnu_vtentry_howto.name, r_name) == 0) |
3658 | 0 | return &elf_mips_gnu_vtentry_howto; |
3659 | 0 | if (strcasecmp (elf_mips_copy_howto.name, r_name) == 0) |
3660 | 0 | return &elf_mips_copy_howto; |
3661 | 0 | if (strcasecmp (elf_mips_jump_slot_howto.name, r_name) == 0) |
3662 | 0 | return &elf_mips_jump_slot_howto; |
3663 | 0 | if (strcasecmp (elf_mips_eh_howto.name, r_name) == 0) |
3664 | 0 | return &elf_mips_eh_howto; |
3665 | | |
3666 | 0 | return NULL; |
3667 | 0 | } |
3668 | | |
3669 | | /* Given an ELF reloc name, return a howto structure; REL wrapper. */ |
3670 | | |
3671 | | static reloc_howto_type * |
3672 | | mips_elf32_reloc_name_lookup_rel (bfd *abfd ATTRIBUTE_UNUSED, |
3673 | | const char *r_name) |
3674 | 0 | { |
3675 | 0 | return |
3676 | 0 | mips_elf32_reloc_name_lookup (r_name, |
3677 | 0 | elf_mips_howto_table_rel, |
3678 | 0 | ARRAY_SIZE (elf_mips_howto_table_rel), |
3679 | 0 | elf_mips16_howto_table_rel, |
3680 | 0 | ARRAY_SIZE (elf_mips16_howto_table_rel), |
3681 | 0 | elf_micromips_howto_table_rel, |
3682 | 0 | ARRAY_SIZE (elf_micromips_howto_table_rel)); |
3683 | 0 | } |
3684 | | |
3685 | | /* Given an ELF reloc name, return a howto structure; RELA wrapper. */ |
3686 | | |
3687 | | static reloc_howto_type * |
3688 | | mips_elf32_reloc_name_lookup_rela (bfd *abfd ATTRIBUTE_UNUSED, |
3689 | | const char *r_name) |
3690 | 0 | { |
3691 | 0 | return |
3692 | 0 | mips_elf32_reloc_name_lookup (r_name, |
3693 | 0 | elf_mips_howto_table_rela, |
3694 | 0 | ARRAY_SIZE (elf_mips_howto_table_rela), |
3695 | 0 | elf_mips16_howto_table_rela, |
3696 | 0 | ARRAY_SIZE (elf_mips16_howto_table_rela), |
3697 | 0 | elf_micromips_howto_table_rela, |
3698 | 0 | ARRAY_SIZE (elf_micromips_howto_table_rela)); |
3699 | 0 | } |
3700 | | |
3701 | | /* Given an ELF reloc type, return a howto structure. */ |
3702 | | |
3703 | | static reloc_howto_type * |
3704 | | mips_elf32_rtype_to_howto (bfd *abfd, unsigned int r_type, bool rela_p) |
3705 | 70 | { |
3706 | 70 | reloc_howto_type *howto = NULL; |
3707 | | |
3708 | 70 | switch (r_type) |
3709 | 70 | { |
3710 | 0 | case R_MIPS_GNU_VTINHERIT: |
3711 | 0 | return &elf_mips_gnu_vtinherit_howto; |
3712 | 1 | case R_MIPS_GNU_VTENTRY: |
3713 | 1 | return &elf_mips_gnu_vtentry_howto; |
3714 | 0 | case R_MIPS_GNU_REL16_S2: |
3715 | 0 | return rela_p ? &elf_mips_gnu_rela16_s2 : &elf_mips_gnu_rel16_s2; |
3716 | 0 | case R_MIPS_PC32: |
3717 | 0 | return &elf_mips_gnu_pcrel32; |
3718 | 0 | case R_MIPS_COPY: |
3719 | 0 | return &elf_mips_copy_howto; |
3720 | 0 | case R_MIPS_JUMP_SLOT: |
3721 | 0 | return &elf_mips_jump_slot_howto; |
3722 | 3 | case R_MIPS_EH: |
3723 | 3 | return &elf_mips_eh_howto; |
3724 | 66 | default: |
3725 | 66 | if (r_type >= R_MICROMIPS_min && r_type < R_MICROMIPS_max) |
3726 | 7 | howto = (rela_p |
3727 | 7 | ? &elf_micromips_howto_table_rela[r_type - R_MICROMIPS_min] |
3728 | 7 | : &elf_micromips_howto_table_rel[r_type - R_MICROMIPS_min]); |
3729 | 66 | if (r_type >= R_MIPS16_min && r_type < R_MIPS16_max) |
3730 | 4 | howto = (rela_p |
3731 | 4 | ? &elf_mips16_howto_table_rela[r_type - R_MIPS16_min] |
3732 | 4 | : &elf_mips16_howto_table_rel[r_type - R_MIPS16_min]); |
3733 | 66 | if (r_type < R_MIPS_max) |
3734 | 45 | howto = (rela_p |
3735 | 45 | ? &elf_mips_howto_table_rela[r_type] |
3736 | 45 | : &elf_mips_howto_table_rel[r_type]); |
3737 | 66 | if (howto != NULL && howto->name != NULL) |
3738 | 55 | return howto; |
3739 | | |
3740 | 11 | _bfd_error_handler (_("%pB: unsupported relocation type %#x"), |
3741 | 11 | abfd, r_type); |
3742 | 11 | bfd_set_error (bfd_error_bad_value); |
3743 | 11 | return NULL; |
3744 | 70 | } |
3745 | 70 | } |
3746 | | |
3747 | | /* Given a MIPS Elf_Internal_Rela, fill in an arelent structure. */ |
3748 | | |
3749 | | static bool |
3750 | | mips_info_to_howto (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst, |
3751 | | bool rela_p) |
3752 | 70 | { |
3753 | 70 | unsigned int r_type; |
3754 | | |
3755 | 70 | r_type = ELF32_R_TYPE (dst->r_info); |
3756 | 70 | cache_ptr->howto = mips_elf32_rtype_to_howto (abfd, r_type, rela_p); |
3757 | | |
3758 | 70 | if (cache_ptr->howto == NULL) |
3759 | 11 | return false; |
3760 | | |
3761 | | /* The addend for a GPREL16 or LITERAL relocation comes from the GP |
3762 | | value for the object file. We get the addend now, rather than |
3763 | | when we do the relocation, because the symbol manipulations done |
3764 | | by the linker may cause us to lose track of the input BFD. */ |
3765 | 59 | if (((*cache_ptr->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0 |
3766 | 56 | && (gprel16_reloc_p (r_type) || literal_reloc_p (r_type))) |
3767 | 11 | cache_ptr->addend = elf_gp (abfd); |
3768 | | |
3769 | 59 | return true; |
3770 | 70 | } |
3771 | | |
3772 | | /* Given a MIPS Elf_Internal_Rela, fill in an arelent structure; |
3773 | | REL wrapper. */ |
3774 | | |
3775 | | static bool |
3776 | | mips_info_to_howto_rel (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst) |
3777 | 70 | { |
3778 | 70 | return mips_info_to_howto (abfd, cache_ptr, dst, false); |
3779 | 70 | } |
3780 | | |
3781 | | /* Given a MIPS Elf_Internal_Rela, fill in an arelent structure; |
3782 | | RELA wrapper. */ |
3783 | | |
3784 | | static bool |
3785 | | mips_info_to_howto_rela (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst) |
3786 | 0 | { |
3787 | 0 | return mips_info_to_howto (abfd, cache_ptr, dst, true); |
3788 | 0 | } |
3789 | | |
3790 | | /* Determine whether a symbol is global for the purposes of splitting |
3791 | | the symbol table into global symbols and local symbols. At least |
3792 | | on Irix 5, this split must be between section symbols and all other |
3793 | | symbols. On most ELF targets the split is between static symbols |
3794 | | and externally visible symbols. */ |
3795 | | |
3796 | | static bool |
3797 | | mips_elf_sym_is_global (bfd *abfd ATTRIBUTE_UNUSED, asymbol *sym) |
3798 | 0 | { |
3799 | 0 | if (SGI_COMPAT (abfd)) |
3800 | 0 | return (sym->flags & BSF_SECTION_SYM) == 0; |
3801 | 0 | else |
3802 | 0 | return ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE)) != 0 |
3803 | 0 | || bfd_is_und_section (bfd_asymbol_section (sym)) |
3804 | 0 | || bfd_is_com_section (bfd_asymbol_section (sym))); |
3805 | 0 | } |
3806 | | |
3807 | | /* Likewise, return TRUE if the symbol table split overall must be |
3808 | | between section symbols and all other symbols. */ |
3809 | | static bool |
3810 | | mips_elf32_elfsym_local_is_section (bfd *abfd) |
3811 | 0 | { |
3812 | 0 | return SGI_COMPAT (abfd); |
3813 | 0 | } |
3814 | | |
3815 | | /* Set the right machine number for a MIPS ELF file. */ |
3816 | | |
3817 | | static bool |
3818 | | mips_elf32_object_p (bfd *abfd) |
3819 | 3.12k | { |
3820 | 3.12k | unsigned long mach; |
3821 | | |
3822 | 3.12k | if (ABI_N32_P (abfd)) |
3823 | 1.26k | return false; |
3824 | | |
3825 | | /* Irix 5 and 6 are broken. Object file symbol tables are not always |
3826 | | sorted correctly such that local symbols precede global symbols, |
3827 | | and the sh_info field in the symbol table is not always right. */ |
3828 | 1.85k | if (SGI_COMPAT (abfd)) |
3829 | 660 | elf_bad_symtab (abfd) = true; |
3830 | | |
3831 | 1.85k | mach = _bfd_elf_mips_mach (elf_elfheader (abfd)->e_flags); |
3832 | 1.85k | bfd_default_set_arch_mach (abfd, bfd_arch_mips, mach); |
3833 | 1.85k | return true; |
3834 | 3.12k | } |
3835 | | |
3836 | | /* MIPS ELF local labels start with '$', not 'L'. */ |
3837 | | |
3838 | | static bool |
3839 | | mips_elf_is_local_label_name (bfd *abfd, const char *name) |
3840 | 0 | { |
3841 | 0 | if (name[0] == '$') |
3842 | 0 | return true; |
3843 | | |
3844 | | /* On Irix 6, the labels go back to starting with '.', so we accept |
3845 | | the generic ELF local label syntax as well. */ |
3846 | 0 | return _bfd_elf_is_local_label_name (abfd, name); |
3847 | 0 | } |
3848 | | |
3849 | | /* Support for core dump NOTE sections. */ |
3850 | | static bool |
3851 | | elf32_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) |
3852 | 13 | { |
3853 | 13 | int offset; |
3854 | 13 | unsigned int size; |
3855 | | |
3856 | 13 | switch (note->descsz) |
3857 | 13 | { |
3858 | 13 | default: |
3859 | 13 | return false; |
3860 | | |
3861 | 0 | case 256: /* Linux/MIPS */ |
3862 | | /* pr_cursig */ |
3863 | 0 | elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12); |
3864 | | |
3865 | | /* pr_pid */ |
3866 | 0 | elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24); |
3867 | | |
3868 | | /* pr_reg */ |
3869 | 0 | offset = 72; |
3870 | 0 | size = 180; |
3871 | |
|
3872 | 0 | break; |
3873 | 13 | } |
3874 | | |
3875 | | /* Make a ".reg/999" section. */ |
3876 | 0 | return _bfd_elfcore_make_pseudosection (abfd, ".reg", |
3877 | 0 | size, note->descpos + offset); |
3878 | 13 | } |
3879 | | |
3880 | | static bool |
3881 | | elf32_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) |
3882 | 9 | { |
3883 | 9 | switch (note->descsz) |
3884 | 9 | { |
3885 | 9 | default: |
3886 | 9 | return false; |
3887 | | |
3888 | 0 | case 128: /* Linux/MIPS elf_prpsinfo */ |
3889 | 0 | elf_tdata (abfd)->core->pid |
3890 | 0 | = bfd_get_32 (abfd, note->descdata + 16); |
3891 | 0 | elf_tdata (abfd)->core->program |
3892 | 0 | = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16); |
3893 | 0 | elf_tdata (abfd)->core->command |
3894 | 0 | = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80); |
3895 | 9 | } |
3896 | | |
3897 | | /* Note that for some reason, a spurious space is tacked |
3898 | | onto the end of the args in some (at least one anyway) |
3899 | | implementations, so strip it off if it exists. */ |
3900 | | |
3901 | 0 | { |
3902 | 0 | char *command = elf_tdata (abfd)->core->command; |
3903 | 0 | int n = strlen (command); |
3904 | |
|
3905 | 0 | if (0 < n && command[n - 1] == ' ') |
3906 | 0 | command[n - 1] = '\0'; |
3907 | 0 | } |
3908 | |
|
3909 | 0 | return true; |
3910 | 9 | } |
3911 | | |
3912 | | /* Write Linux core PRSTATUS note into core file. */ |
3913 | | |
3914 | | static char * |
3915 | | elf32_mips_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type, |
3916 | | ...) |
3917 | 0 | { |
3918 | 0 | switch (note_type) |
3919 | 0 | { |
3920 | 0 | default: |
3921 | 0 | return NULL; |
3922 | | |
3923 | 0 | case NT_PRPSINFO: |
3924 | 0 | BFD_FAIL (); |
3925 | 0 | return NULL; |
3926 | | |
3927 | 0 | case NT_PRSTATUS: |
3928 | 0 | { |
3929 | 0 | char data[256]; |
3930 | 0 | va_list ap; |
3931 | 0 | long pid; |
3932 | 0 | int cursig; |
3933 | 0 | const void *greg; |
3934 | |
|
3935 | 0 | va_start (ap, note_type); |
3936 | 0 | memset (data, 0, 72); |
3937 | 0 | pid = va_arg (ap, long); |
3938 | 0 | bfd_put_32 (abfd, pid, data + 24); |
3939 | 0 | cursig = va_arg (ap, int); |
3940 | 0 | bfd_put_16 (abfd, cursig, data + 12); |
3941 | 0 | greg = va_arg (ap, const void *); |
3942 | 0 | memcpy (data + 72, greg, 180); |
3943 | 0 | memset (data + 252, 0, 4); |
3944 | 0 | va_end (ap); |
3945 | 0 | return elfcore_write_note (abfd, buf, bufsiz, |
3946 | 0 | "CORE", note_type, data, sizeof (data)); |
3947 | 0 | } |
3948 | 0 | } |
3949 | 0 | } |
3950 | | |
3951 | | /* Remove the magic _gp_disp symbol from the symbol tables. */ |
3952 | | |
3953 | | static bool |
3954 | | elf32_mips_fixup_symbol (struct bfd_link_info *info, |
3955 | | struct elf_link_hash_entry *h) |
3956 | 0 | { |
3957 | 0 | if (strcmp (h->root.root.string, "_gp_disp") == 0) |
3958 | 0 | _bfd_elf_link_hash_hide_symbol (info, h, true); |
3959 | 0 | return true; |
3960 | 0 | } |
3961 | | |
3962 | | /* Depending on the target vector we generate some version of Irix |
3963 | | executables or "normal" MIPS ELF ABI executables. */ |
3964 | | static irix_compat_t |
3965 | | elf32_mips_irix_compat (bfd *abfd) |
3966 | 1.88k | { |
3967 | 1.88k | if ((abfd->xvec == &mips_elf32_be_vec) |
3968 | 1.67k | || (abfd->xvec == &mips_elf32_le_vec)) |
3969 | 673 | return ict_irix5; |
3970 | 1.21k | else |
3971 | 1.21k | return ict_none; |
3972 | 1.88k | } |
3973 | | |
3974 | | /* ECOFF swapping routines. These are used when dealing with the |
3975 | | .mdebug section, which is in the ECOFF debugging format. */ |
3976 | | static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { |
3977 | | /* Symbol table magic number. */ |
3978 | | magicSym, |
3979 | | /* Alignment of debugging information. E.g., 4. */ |
3980 | | 4, |
3981 | | /* Sizes of external symbolic information. */ |
3982 | | sizeof (struct hdr_ext), |
3983 | | sizeof (struct dnr_ext), |
3984 | | sizeof (struct pdr_ext), |
3985 | | sizeof (struct sym_ext), |
3986 | | sizeof (struct opt_ext), |
3987 | | sizeof (struct fdr_ext), |
3988 | | sizeof (struct rfd_ext), |
3989 | | sizeof (struct ext_ext), |
3990 | | /* Functions to swap in external symbolic data. */ |
3991 | | ecoff_swap_hdr_in, |
3992 | | ecoff_swap_dnr_in, |
3993 | | ecoff_swap_pdr_in, |
3994 | | ecoff_swap_sym_in, |
3995 | | ecoff_swap_opt_in, |
3996 | | ecoff_swap_fdr_in, |
3997 | | ecoff_swap_rfd_in, |
3998 | | ecoff_swap_ext_in, |
3999 | | _bfd_ecoff_swap_tir_in, |
4000 | | _bfd_ecoff_swap_rndx_in, |
4001 | | /* Functions to swap out external symbolic data. */ |
4002 | | ecoff_swap_hdr_out, |
4003 | | ecoff_swap_dnr_out, |
4004 | | ecoff_swap_pdr_out, |
4005 | | ecoff_swap_sym_out, |
4006 | | ecoff_swap_opt_out, |
4007 | | ecoff_swap_fdr_out, |
4008 | | ecoff_swap_rfd_out, |
4009 | | ecoff_swap_ext_out, |
4010 | | _bfd_ecoff_swap_tir_out, |
4011 | | _bfd_ecoff_swap_rndx_out, |
4012 | | /* Function to read in symbolic data. */ |
4013 | | _bfd_mips_elf_read_ecoff_info |
4014 | | }; |
4015 | | |
4016 | | #define ELF_ARCH bfd_arch_mips |
4017 | | #define ELF_TARGET_ID MIPS_ELF_DATA |
4018 | | #define ELF_MACHINE_CODE EM_MIPS |
4019 | | |
4020 | | #define elf_backend_collect true |
4021 | | #define elf_backend_type_change_ok true |
4022 | | #define elf_backend_can_gc_sections true |
4023 | | #define elf_backend_gc_mark_extra_sections \ |
4024 | | _bfd_mips_elf_gc_mark_extra_sections |
4025 | | #define elf_info_to_howto mips_info_to_howto_rela |
4026 | | #define elf_info_to_howto_rel mips_info_to_howto_rel |
4027 | | #define elf_backend_sym_is_global mips_elf_sym_is_global |
4028 | | #define elf_backend_object_p mips_elf32_object_p |
4029 | | #define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing |
4030 | | #define elf_backend_section_processing _bfd_mips_elf_section_processing |
4031 | | #define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr |
4032 | | #define elf_backend_fake_sections _bfd_mips_elf_fake_sections |
4033 | | #define elf_backend_section_from_bfd_section \ |
4034 | | _bfd_mips_elf_section_from_bfd_section |
4035 | | #define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook |
4036 | | #define elf_backend_link_output_symbol_hook \ |
4037 | | _bfd_mips_elf_link_output_symbol_hook |
4038 | | #define elf_backend_create_dynamic_sections \ |
4039 | | _bfd_mips_elf_create_dynamic_sections |
4040 | | #define elf_backend_check_relocs _bfd_mips_elf_check_relocs |
4041 | | #define elf_backend_merge_symbol_attribute \ |
4042 | | _bfd_mips_elf_merge_symbol_attribute |
4043 | | #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag |
4044 | | #define elf_backend_adjust_dynamic_symbol \ |
4045 | | _bfd_mips_elf_adjust_dynamic_symbol |
4046 | | #define elf_backend_late_size_sections _bfd_mips_elf_late_size_sections |
4047 | | #define elf_backend_init_index_section _bfd_elf_init_1_index_section |
4048 | | #define elf_backend_relocate_section _bfd_mips_elf_relocate_section |
4049 | | #define elf_backend_finish_dynamic_symbol \ |
4050 | | _bfd_mips_elf_finish_dynamic_symbol |
4051 | | #define elf_backend_finish_dynamic_sections \ |
4052 | | _bfd_mips_elf_finish_dynamic_sections |
4053 | | #define elf_backend_final_write_processing \ |
4054 | | _bfd_mips_elf_final_write_processing |
4055 | | #define elf_backend_additional_program_headers \ |
4056 | | _bfd_mips_elf_additional_program_headers |
4057 | | #define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map |
4058 | | #define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook |
4059 | | #define elf_backend_copy_indirect_symbol \ |
4060 | | _bfd_mips_elf_copy_indirect_symbol |
4061 | | #define elf_backend_hide_symbol _bfd_mips_elf_hide_symbol |
4062 | | #define elf_backend_fixup_symbol elf32_mips_fixup_symbol |
4063 | | #define elf_backend_grok_prstatus elf32_mips_grok_prstatus |
4064 | | #define elf_backend_grok_psinfo elf32_mips_grok_psinfo |
4065 | | #define elf_backend_ecoff_debug_swap &mips_elf32_ecoff_debug_swap |
4066 | | |
4067 | | #define elf_backend_got_header_size (4 * MIPS_RESERVED_GOTNO) |
4068 | | #define elf_backend_want_dynrelro 1 |
4069 | | #define elf_backend_may_use_rel_p 1 |
4070 | | #define elf_backend_may_use_rela_p 0 |
4071 | | #define elf_backend_default_use_rela_p 0 |
4072 | | #define elf_backend_sign_extend_vma true |
4073 | | #define elf_backend_plt_readonly 1 |
4074 | | |
4075 | | #define elf_backend_discard_info _bfd_mips_elf_discard_info |
4076 | | #define elf_backend_ignore_discarded_relocs \ |
4077 | | _bfd_mips_elf_ignore_discarded_relocs |
4078 | | #define elf_backend_write_section _bfd_mips_elf_write_section |
4079 | | #define elf_backend_elfsym_local_is_section \ |
4080 | | mips_elf32_elfsym_local_is_section |
4081 | | #define elf_backend_mips_irix_compat elf32_mips_irix_compat |
4082 | | #define elf_backend_mips_rtype_to_howto mips_elf32_rtype_to_howto |
4083 | | #define elf_backend_sort_relocs_p _bfd_mips_elf_sort_relocs_p |
4084 | | |
4085 | | #define bfd_elf32_bfd_is_local_label_name \ |
4086 | | mips_elf_is_local_label_name |
4087 | | #define bfd_elf32_bfd_reloc_type_lookup mips_elf32_reloc_type_lookup_rel |
4088 | | #define bfd_elf32_bfd_reloc_name_lookup mips_elf32_reloc_name_lookup_rel |
4089 | | #define bfd_elf32_bfd_is_target_special_symbol \ |
4090 | | _bfd_mips_elf_is_target_special_symbol |
4091 | | #define bfd_elf32_get_synthetic_symtab _bfd_mips_elf_get_synthetic_symtab |
4092 | | #define bfd_elf32_finalize_section_relocs \ |
4093 | | _bfd_mips_elf_finalize_section_relocs |
4094 | | #define bfd_elf32_find_nearest_line _bfd_mips_elf_find_nearest_line |
4095 | | #define bfd_elf32_find_nearest_line_with_alt \ |
4096 | | _bfd_mips_elf_find_nearest_line_with_alt |
4097 | | #define bfd_elf32_find_inliner_info _bfd_mips_elf_find_inliner_info |
4098 | | #define bfd_elf32_new_section_hook _bfd_mips_elf_new_section_hook |
4099 | | #define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents |
4100 | | #define bfd_elf32_bfd_get_relocated_section_contents \ |
4101 | | _bfd_elf_mips_get_relocated_section_contents |
4102 | | #define bfd_elf32_bfd_link_hash_table_create \ |
4103 | | _bfd_mips_elf_link_hash_table_create |
4104 | | #define bfd_elf32_bfd_final_link _bfd_mips_elf_final_link |
4105 | | #define bfd_elf32_bfd_merge_private_bfd_data \ |
4106 | | _bfd_mips_elf_merge_private_bfd_data |
4107 | | #define bfd_elf32_bfd_set_private_flags _bfd_mips_elf_set_private_flags |
4108 | | #define bfd_elf32_bfd_print_private_bfd_data \ |
4109 | | _bfd_mips_elf_print_private_bfd_data |
4110 | | #define bfd_elf32_bfd_relax_section _bfd_mips_elf_relax_section |
4111 | | #define bfd_elf32_mkobject _bfd_mips_elf_mkobject |
4112 | | #define bfd_elf32_bfd_free_cached_info _bfd_mips_elf_free_cached_info |
4113 | | |
4114 | | /* Support for SGI-ish mips targets. */ |
4115 | | #define TARGET_LITTLE_SYM mips_elf32_le_vec |
4116 | | #define TARGET_LITTLE_NAME "elf32-littlemips" |
4117 | | #define TARGET_BIG_SYM mips_elf32_be_vec |
4118 | | #define TARGET_BIG_NAME "elf32-bigmips" |
4119 | | |
4120 | | /* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses |
4121 | | a value of 0x1000, and we are compatible. */ |
4122 | | #define ELF_MAXPAGESIZE 0x1000 |
4123 | | #define ELF_COMMONPAGESIZE 0x1000 |
4124 | | |
4125 | | #include "elf32-target.h" |
4126 | | |
4127 | | /* Support for traditional mips targets. */ |
4128 | | #undef TARGET_LITTLE_SYM |
4129 | | #undef TARGET_LITTLE_NAME |
4130 | | #undef TARGET_BIG_SYM |
4131 | | #undef TARGET_BIG_NAME |
4132 | | |
4133 | | #undef ELF_MAXPAGESIZE |
4134 | | #undef ELF_COMMONPAGESIZE |
4135 | | |
4136 | | #define TARGET_LITTLE_SYM mips_elf32_trad_le_vec |
4137 | | #define TARGET_LITTLE_NAME "elf32-tradlittlemips" |
4138 | | #define TARGET_BIG_SYM mips_elf32_trad_be_vec |
4139 | | #define TARGET_BIG_NAME "elf32-tradbigmips" |
4140 | | |
4141 | | /* The MIPS ABI says at Page 5-1: |
4142 | | Virtual addresses and file offsets for MIPS segments are congruent |
4143 | | modulo 64 KByte (0x10000) or larger powers of 2. Because 64 KBytes |
4144 | | is the maximum page size, the files are suitable for paging |
4145 | | regardless of physical page size. */ |
4146 | | #define ELF_MAXPAGESIZE 0x10000 |
4147 | | #define ELF_COMMONPAGESIZE 0x1000 |
4148 | | #define elf32_bed elf32_tradbed |
4149 | | |
4150 | | #undef elf_backend_write_core_note |
4151 | | #define elf_backend_write_core_note elf32_mips_write_core_note |
4152 | | |
4153 | | /* Include the target file again for this target. */ |
4154 | | #include "elf32-target.h" |
4155 | | |
4156 | | /* FreeBSD support. */ |
4157 | | |
4158 | | #undef TARGET_LITTLE_SYM |
4159 | | #undef TARGET_LITTLE_NAME |
4160 | | #undef TARGET_BIG_SYM |
4161 | | #undef TARGET_BIG_NAME |
4162 | | |
4163 | | #define TARGET_LITTLE_SYM mips_elf32_tradfbsd_le_vec |
4164 | | #define TARGET_LITTLE_NAME "elf32-tradlittlemips-freebsd" |
4165 | | #define TARGET_BIG_SYM mips_elf32_tradfbsd_be_vec |
4166 | | #define TARGET_BIG_NAME "elf32-tradbigmips-freebsd" |
4167 | | |
4168 | | #undef ELF_OSABI |
4169 | | #define ELF_OSABI ELFOSABI_FREEBSD |
4170 | | #undef ELF_OSABI_EXACT |
4171 | | #define ELF_OSABI_EXACT 1 |
4172 | | |
4173 | | #undef elf32_bed |
4174 | | #define elf32_bed elf32_fbsd_tradbed |
4175 | | |
4176 | | #undef elf_backend_write_core_note |
4177 | | |
4178 | | #include "elf32-target.h" |
4179 | | /* Implement elf_backend_final_write_processing for VxWorks. */ |
4180 | | |
4181 | | static bool |
4182 | | mips_vxworks_final_write_processing (bfd *abfd) |
4183 | 0 | { |
4184 | 0 | _bfd_mips_final_write_processing (abfd); |
4185 | 0 | return elf_vxworks_final_write_processing (abfd); |
4186 | 0 | } |
4187 | | |
4188 | | #undef TARGET_LITTLE_SYM |
4189 | | #undef TARGET_LITTLE_NAME |
4190 | | #undef TARGET_BIG_SYM |
4191 | | #undef TARGET_BIG_NAME |
4192 | | |
4193 | | #undef ELF_MAXPAGESIZE |
4194 | | #undef ELF_COMMONPAGESIZE |
4195 | | |
4196 | | #define TARGET_LITTLE_SYM mips_elf32_vxworks_le_vec |
4197 | | #define TARGET_LITTLE_NAME "elf32-littlemips-vxworks" |
4198 | | #define TARGET_BIG_SYM mips_elf32_vxworks_be_vec |
4199 | | #define TARGET_BIG_NAME "elf32-bigmips-vxworks" |
4200 | | #undef ELF_OSABI |
4201 | | #undef ELF_OSABI_EXACT |
4202 | | |
4203 | | #undef elf32_bed |
4204 | | #define elf32_bed elf32_mips_vxworks_bed |
4205 | | |
4206 | | #define ELF_MAXPAGESIZE 0x1000 |
4207 | | #define ELF_COMMONPAGESIZE 0x1000 |
4208 | | |
4209 | | #undef ELF_TARGET_OS |
4210 | | #define ELF_TARGET_OS is_vxworks |
4211 | | |
4212 | | #undef elf_backend_want_got_plt |
4213 | | #define elf_backend_want_got_plt 1 |
4214 | | #undef elf_backend_want_plt_sym |
4215 | | #define elf_backend_want_plt_sym 1 |
4216 | | #undef elf_backend_may_use_rel_p |
4217 | | #define elf_backend_may_use_rel_p 0 |
4218 | | #undef elf_backend_may_use_rela_p |
4219 | | #define elf_backend_may_use_rela_p 1 |
4220 | | #undef elf_backend_default_use_rela_p |
4221 | | #define elf_backend_default_use_rela_p 1 |
4222 | | #undef elf_backend_got_header_size |
4223 | | #define elf_backend_got_header_size (4 * 3) |
4224 | | #undef elf_backend_dtrel_excludes_plt |
4225 | | #define elf_backend_dtrel_excludes_plt 1 |
4226 | | |
4227 | | #undef elf_backend_finish_dynamic_symbol |
4228 | | #define elf_backend_finish_dynamic_symbol \ |
4229 | | _bfd_mips_vxworks_finish_dynamic_symbol |
4230 | | #undef bfd_elf32_bfd_reloc_type_lookup |
4231 | | #define bfd_elf32_bfd_reloc_type_lookup \ |
4232 | | mips_elf32_reloc_type_lookup_rela |
4233 | | #undef bfd_elf32_bfd_reloc_name_lookup |
4234 | | #define bfd_elf32_bfd_reloc_name_lookup \ |
4235 | | mips_elf32_reloc_name_lookup_rela |
4236 | | #undef bfd_elf32_bfd_link_hash_table_create |
4237 | | #define bfd_elf32_bfd_link_hash_table_create \ |
4238 | | _bfd_mips_vxworks_link_hash_table_create |
4239 | | #undef elf_backend_add_symbol_hook |
4240 | | #define elf_backend_add_symbol_hook \ |
4241 | | elf_vxworks_add_symbol_hook |
4242 | | #undef elf_backend_link_output_symbol_hook |
4243 | | #define elf_backend_link_output_symbol_hook \ |
4244 | | elf_vxworks_link_output_symbol_hook |
4245 | | #undef elf_backend_emit_relocs |
4246 | | #define elf_backend_emit_relocs \ |
4247 | | elf_vxworks_emit_relocs |
4248 | | #undef elf_backend_final_write_processing |
4249 | | #define elf_backend_final_write_processing \ |
4250 | | mips_vxworks_final_write_processing |
4251 | | |
4252 | | #undef elf_backend_additional_program_headers |
4253 | | #undef elf_backend_modify_segment_map |
4254 | | #undef elf_backend_symbol_processing |
4255 | | /* NOTE: elf_backend_rela_normal is not defined for MIPS. */ |
4256 | | |
4257 | | #undef bfd_elf32_get_synthetic_symtab |
4258 | | |
4259 | | #include "elf32-target.h" |