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