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