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