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