]>
Commit | Line | Data |
---|---|---|
efcbd82c | 1 | /* MIPS-specific support for 32-bit ELF |
d87bef3a | 2 | Copyright (C) 1993-2023 Free Software Foundation, Inc. |
252b5132 RH |
3 | |
4 | Most of the information added by Ian Lance Taylor, Cygnus Support, | |
5 | <ian@cygnus.com>. | |
103186c6 MM |
6 | N32/64 ABI support added by Mark Mitchell, CodeSourcery, LLC. |
7 | <mark@codesourcery.com> | |
f7cb7d68 UC |
8 | Traditional MIPS targets support added by Koundinya.K, Dansk Data |
9 | Elektronik & Operations Research Group. <kk@ddeorg.soft.net> | |
252b5132 | 10 | |
cd123cb7 | 11 | This file is part of BFD, the Binary File Descriptor library. |
252b5132 | 12 | |
cd123cb7 NC |
13 | This program is free software; you can redistribute it and/or modify |
14 | it under the terms of the GNU General Public License as published by | |
15 | the Free Software Foundation; either version 3 of the License, or | |
16 | (at your option) any later version. | |
252b5132 | 17 | |
cd123cb7 NC |
18 | This program is distributed in the hope that it will be useful, |
19 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | GNU General Public License for more details. | |
22 | ||
23 | You should have received a copy of the GNU General Public License | |
24 | along with this program; if not, write to the Free Software | |
25 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | |
26 | MA 02110-1301, USA. */ | |
252b5132 | 27 | |
252b5132 RH |
28 | |
29 | /* This file handles MIPS ELF targets. SGI Irix 5 uses a slightly | |
30 | different MIPS ELF from other targets. This matters when linking. | |
31 | This file supports both, switching at runtime. */ | |
32 | ||
252b5132 | 33 | #include "sysdep.h" |
3db64b00 | 34 | #include "bfd.h" |
252b5132 RH |
35 | #include "libbfd.h" |
36 | #include "bfdlink.h" | |
37 | #include "genlink.h" | |
38 | #include "elf-bfd.h" | |
c6e90b02 | 39 | #include "elfxx-mips.h" |
252b5132 | 40 | #include "elf/mips.h" |
0a44bf69 | 41 | #include "elf-vxworks.h" |
252b5132 RH |
42 | |
43 | /* Get the ECOFF swapping routines. */ | |
44 | #include "coff/sym.h" | |
45 | #include "coff/symconst.h" | |
46 | #include "coff/internal.h" | |
47 | #include "coff/ecoff.h" | |
48 | #include "coff/mips.h" | |
23e2c83b | 49 | #define ECOFF_SIGNED_32 |
252b5132 RH |
50 | #include "ecoffswap.h" |
51 | ||
a7ebbfdf | 52 | static bfd_reloc_status_type gprel32_with_gp |
0a1b45a2 | 53 | (bfd *, asymbol *, arelent *, asection *, bool, void *, bfd_vma); |
c6e90b02 | 54 | static bfd_reloc_status_type mips_elf_gprel32_reloc |
11a2be4d | 55 | (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); |
252b5132 | 56 | static bfd_reloc_status_type mips32_64bit_reloc |
11a2be4d | 57 | (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); |
252b5132 | 58 | static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup |
11a2be4d | 59 | (bfd *, bfd_reloc_code_real_type); |
0a1b45a2 | 60 | static bool mips_info_to_howto_rel |
11a2be4d | 61 | (bfd *, arelent *, Elf_Internal_Rela *); |
0a1b45a2 | 62 | static bool mips_info_to_howto_rela |
11a2be4d | 63 | (bfd *, arelent *, Elf_Internal_Rela *); |
0a1b45a2 | 64 | static bool mips_elf_sym_is_global |
11a2be4d | 65 | (bfd *, asymbol *); |
0a1b45a2 | 66 | static bool mips_elf32_elfsym_local_is_section |
3f1b17bb | 67 | (bfd *); |
0a1b45a2 | 68 | static bool mips_elf32_object_p |
11a2be4d | 69 | (bfd *); |
0a1b45a2 | 70 | static bool mips_elf_is_local_label_name |
11a2be4d | 71 | (bfd *, const char *); |
252b5132 | 72 | static bfd_reloc_status_type mips16_gprel_reloc |
11a2be4d | 73 | (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); |
252b5132 | 74 | static bfd_reloc_status_type mips_elf_final_gp |
0a1b45a2 AM |
75 | (bfd *, asymbol *, bool, char **, bfd_vma *); |
76 | static bool mips_elf_assign_gp | |
11a2be4d | 77 | (bfd *, bfd_vma *); |
0a1b45a2 | 78 | static bool elf32_mips_grok_prstatus |
11a2be4d | 79 | (bfd *, Elf_Internal_Note *); |
0a1b45a2 | 80 | static bool elf32_mips_grok_psinfo |
11a2be4d | 81 | (bfd *, Elf_Internal_Note *); |
c6e90b02 | 82 | static irix_compat_t elf32_mips_irix_compat |
11a2be4d | 83 | (bfd *); |
252b5132 | 84 | |
6d00b590 AM |
85 | extern const bfd_target mips_elf32_be_vec; |
86 | extern const bfd_target mips_elf32_le_vec; | |
adb76a3e | 87 | |
a94a7c1c | 88 | /* Nonzero if ABFD is using the N32 ABI. */ |
a94a7c1c MM |
89 | #define ABI_N32_P(abfd) \ |
90 | ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0) | |
91 | ||
4e8a9624 | 92 | /* Whether we are trying to be compatible with IRIX at all. */ |
a94a7c1c | 93 | #define SGI_COMPAT(abfd) \ |
c6e90b02 | 94 | (elf32_mips_irix_compat (abfd) != ict_none) |
103186c6 | 95 | |
252b5132 RH |
96 | /* The number of local .got entries we reserve. */ |
97 | #define MIPS_RESERVED_GOTNO (2) | |
98 | ||
3f830999 MM |
99 | /* In case we're on a 32-bit machine, construct a 64-bit "-1" value |
100 | from smaller values. Start with zero, widen, *then* decrement. */ | |
101 | #define MINUS_ONE (((bfd_vma)0) - 1) | |
102 | ||
d75bc93d TS |
103 | /* The relocation table used for SHT_REL sections. */ |
104 | ||
105 | static reloc_howto_type elf_mips_howto_table_rel[] = | |
106 | { | |
107 | /* No relocation. */ | |
108 | HOWTO (R_MIPS_NONE, /* type */ | |
109 | 0, /* rightshift */ | |
c94cb026 | 110 | 0, /* size */ |
d75bc93d | 111 | 0, /* bitsize */ |
0a1b45a2 | 112 | false, /* pc_relative */ |
d75bc93d TS |
113 | 0, /* bitpos */ |
114 | complain_overflow_dont, /* complain_on_overflow */ | |
30ac9238 | 115 | _bfd_mips_elf_generic_reloc, /* special_function */ |
d75bc93d | 116 | "R_MIPS_NONE", /* name */ |
0a1b45a2 | 117 | false, /* partial_inplace */ |
d75bc93d TS |
118 | 0, /* src_mask */ |
119 | 0, /* dst_mask */ | |
0a1b45a2 | 120 | false), /* pcrel_offset */ |
d75bc93d TS |
121 | |
122 | /* 16 bit relocation. */ | |
123 | HOWTO (R_MIPS_16, /* type */ | |
124 | 0, /* rightshift */ | |
c94cb026 | 125 | 4, /* size */ |
d75bc93d | 126 | 16, /* bitsize */ |
0a1b45a2 | 127 | false, /* pc_relative */ |
d75bc93d TS |
128 | 0, /* bitpos */ |
129 | complain_overflow_signed, /* complain_on_overflow */ | |
30ac9238 | 130 | _bfd_mips_elf_generic_reloc, /* special_function */ |
d75bc93d | 131 | "R_MIPS_16", /* name */ |
0a1b45a2 | 132 | true, /* partial_inplace */ |
d75bc93d TS |
133 | 0x0000ffff, /* src_mask */ |
134 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 135 | false), /* pcrel_offset */ |
d75bc93d TS |
136 | |
137 | /* 32 bit relocation. */ | |
138 | HOWTO (R_MIPS_32, /* type */ | |
139 | 0, /* rightshift */ | |
c94cb026 | 140 | 4, /* size */ |
d75bc93d | 141 | 32, /* bitsize */ |
0a1b45a2 | 142 | false, /* pc_relative */ |
d75bc93d TS |
143 | 0, /* bitpos */ |
144 | complain_overflow_dont, /* complain_on_overflow */ | |
30ac9238 | 145 | _bfd_mips_elf_generic_reloc, /* special_function */ |
d75bc93d | 146 | "R_MIPS_32", /* name */ |
0a1b45a2 | 147 | true, /* partial_inplace */ |
d75bc93d TS |
148 | 0xffffffff, /* src_mask */ |
149 | 0xffffffff, /* dst_mask */ | |
0a1b45a2 | 150 | false), /* pcrel_offset */ |
d75bc93d TS |
151 | |
152 | /* 32 bit symbol relative relocation. */ | |
153 | HOWTO (R_MIPS_REL32, /* type */ | |
154 | 0, /* rightshift */ | |
c94cb026 | 155 | 4, /* size */ |
d75bc93d | 156 | 32, /* bitsize */ |
0a1b45a2 | 157 | false, /* pc_relative */ |
d75bc93d TS |
158 | 0, /* bitpos */ |
159 | complain_overflow_dont, /* complain_on_overflow */ | |
30ac9238 | 160 | _bfd_mips_elf_generic_reloc, /* special_function */ |
d75bc93d | 161 | "R_MIPS_REL32", /* name */ |
0a1b45a2 | 162 | true, /* partial_inplace */ |
d75bc93d TS |
163 | 0xffffffff, /* src_mask */ |
164 | 0xffffffff, /* dst_mask */ | |
0a1b45a2 | 165 | false), /* pcrel_offset */ |
d75bc93d TS |
166 | |
167 | /* 26 bit jump address. */ | |
168 | HOWTO (R_MIPS_26, /* type */ | |
169 | 2, /* rightshift */ | |
c94cb026 | 170 | 4, /* size */ |
d75bc93d | 171 | 26, /* bitsize */ |
0a1b45a2 | 172 | false, /* pc_relative */ |
d75bc93d TS |
173 | 0, /* bitpos */ |
174 | complain_overflow_dont, /* complain_on_overflow */ | |
07d6d2b8 | 175 | /* This needs complex overflow |
d75bc93d TS |
176 | detection, because the upper four |
177 | bits must match the PC + 4. */ | |
30ac9238 | 178 | _bfd_mips_elf_generic_reloc, /* special_function */ |
d75bc93d | 179 | "R_MIPS_26", /* name */ |
0a1b45a2 | 180 | true, /* partial_inplace */ |
d75bc93d TS |
181 | 0x03ffffff, /* src_mask */ |
182 | 0x03ffffff, /* dst_mask */ | |
0a1b45a2 | 183 | false), /* pcrel_offset */ |
d75bc93d TS |
184 | |
185 | /* High 16 bits of symbol value. */ | |
186 | HOWTO (R_MIPS_HI16, /* type */ | |
30ac9238 | 187 | 16, /* rightshift */ |
c94cb026 | 188 | 4, /* size */ |
d75bc93d | 189 | 16, /* bitsize */ |
0a1b45a2 | 190 | false, /* pc_relative */ |
d75bc93d TS |
191 | 0, /* bitpos */ |
192 | complain_overflow_dont, /* complain_on_overflow */ | |
30ac9238 | 193 | _bfd_mips_elf_hi16_reloc, /* special_function */ |
d75bc93d | 194 | "R_MIPS_HI16", /* name */ |
0a1b45a2 | 195 | true, /* partial_inplace */ |
d75bc93d TS |
196 | 0x0000ffff, /* src_mask */ |
197 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 198 | false), /* pcrel_offset */ |
d75bc93d TS |
199 | |
200 | /* Low 16 bits of symbol value. */ | |
201 | HOWTO (R_MIPS_LO16, /* type */ | |
202 | 0, /* rightshift */ | |
c94cb026 | 203 | 4, /* size */ |
d75bc93d | 204 | 16, /* bitsize */ |
0a1b45a2 | 205 | false, /* pc_relative */ |
d75bc93d TS |
206 | 0, /* bitpos */ |
207 | complain_overflow_dont, /* complain_on_overflow */ | |
30ac9238 | 208 | _bfd_mips_elf_lo16_reloc, /* special_function */ |
d75bc93d | 209 | "R_MIPS_LO16", /* name */ |
0a1b45a2 | 210 | true, /* partial_inplace */ |
d75bc93d TS |
211 | 0x0000ffff, /* src_mask */ |
212 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 213 | false), /* pcrel_offset */ |
d75bc93d TS |
214 | |
215 | /* GP relative reference. */ | |
216 | HOWTO (R_MIPS_GPREL16, /* type */ | |
217 | 0, /* rightshift */ | |
c94cb026 | 218 | 4, /* size */ |
d75bc93d | 219 | 16, /* bitsize */ |
0a1b45a2 | 220 | false, /* pc_relative */ |
d75bc93d TS |
221 | 0, /* bitpos */ |
222 | complain_overflow_signed, /* complain_on_overflow */ | |
c6e90b02 | 223 | _bfd_mips_elf32_gprel16_reloc, /* special_function */ |
d75bc93d | 224 | "R_MIPS_GPREL16", /* name */ |
0a1b45a2 | 225 | true, /* partial_inplace */ |
d75bc93d TS |
226 | 0x0000ffff, /* src_mask */ |
227 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 228 | false), /* pcrel_offset */ |
d75bc93d TS |
229 | |
230 | /* Reference to literal section. */ | |
231 | HOWTO (R_MIPS_LITERAL, /* type */ | |
232 | 0, /* rightshift */ | |
c94cb026 | 233 | 4, /* size */ |
d75bc93d | 234 | 16, /* bitsize */ |
0a1b45a2 | 235 | false, /* pc_relative */ |
d75bc93d TS |
236 | 0, /* bitpos */ |
237 | complain_overflow_signed, /* complain_on_overflow */ | |
c6e90b02 | 238 | _bfd_mips_elf32_gprel16_reloc, /* special_function */ |
d75bc93d | 239 | "R_MIPS_LITERAL", /* name */ |
0a1b45a2 | 240 | true, /* partial_inplace */ |
d75bc93d TS |
241 | 0x0000ffff, /* src_mask */ |
242 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 243 | false), /* pcrel_offset */ |
d75bc93d TS |
244 | |
245 | /* Reference to global offset table. */ | |
246 | HOWTO (R_MIPS_GOT16, /* type */ | |
247 | 0, /* rightshift */ | |
c94cb026 | 248 | 4, /* size */ |
d75bc93d | 249 | 16, /* bitsize */ |
0a1b45a2 | 250 | false, /* pc_relative */ |
d75bc93d TS |
251 | 0, /* bitpos */ |
252 | complain_overflow_signed, /* complain_on_overflow */ | |
30ac9238 | 253 | _bfd_mips_elf_got16_reloc, /* special_function */ |
d75bc93d | 254 | "R_MIPS_GOT16", /* name */ |
0a1b45a2 | 255 | true, /* partial_inplace */ |
d75bc93d TS |
256 | 0x0000ffff, /* src_mask */ |
257 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 258 | false), /* pcrel_offset */ |
d75bc93d | 259 | |
bad36eac DJ |
260 | /* 16 bit PC relative reference. Note that the ABI document has a typo |
261 | and claims R_MIPS_PC16 to be not rightshifted, rendering it useless. | |
262 | We do the right thing here. */ | |
d75bc93d | 263 | HOWTO (R_MIPS_PC16, /* type */ |
bad36eac | 264 | 2, /* rightshift */ |
c94cb026 | 265 | 4, /* size */ |
d75bc93d | 266 | 16, /* bitsize */ |
0a1b45a2 | 267 | true, /* pc_relative */ |
d75bc93d TS |
268 | 0, /* bitpos */ |
269 | complain_overflow_signed, /* complain_on_overflow */ | |
30ac9238 | 270 | _bfd_mips_elf_generic_reloc, /* special_function */ |
d75bc93d | 271 | "R_MIPS_PC16", /* name */ |
0a1b45a2 | 272 | true, /* partial_inplace */ |
d75bc93d TS |
273 | 0x0000ffff, /* src_mask */ |
274 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 275 | true), /* pcrel_offset */ |
d75bc93d TS |
276 | |
277 | /* 16 bit call through global offset table. */ | |
278 | HOWTO (R_MIPS_CALL16, /* type */ | |
279 | 0, /* rightshift */ | |
c94cb026 | 280 | 4, /* size */ |
d75bc93d | 281 | 16, /* bitsize */ |
0a1b45a2 | 282 | false, /* pc_relative */ |
d75bc93d TS |
283 | 0, /* bitpos */ |
284 | complain_overflow_signed, /* complain_on_overflow */ | |
30ac9238 | 285 | _bfd_mips_elf_generic_reloc, /* special_function */ |
d75bc93d | 286 | "R_MIPS_CALL16", /* name */ |
0a1b45a2 | 287 | true, /* partial_inplace */ |
d75bc93d TS |
288 | 0x0000ffff, /* src_mask */ |
289 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 290 | false), /* pcrel_offset */ |
d75bc93d TS |
291 | |
292 | /* 32 bit GP relative reference. */ | |
293 | HOWTO (R_MIPS_GPREL32, /* type */ | |
294 | 0, /* rightshift */ | |
c94cb026 | 295 | 4, /* size */ |
d75bc93d | 296 | 32, /* bitsize */ |
0a1b45a2 | 297 | false, /* pc_relative */ |
d75bc93d TS |
298 | 0, /* bitpos */ |
299 | complain_overflow_dont, /* complain_on_overflow */ | |
c6e90b02 | 300 | mips_elf_gprel32_reloc, /* special_function */ |
d75bc93d | 301 | "R_MIPS_GPREL32", /* name */ |
0a1b45a2 | 302 | true, /* partial_inplace */ |
d75bc93d TS |
303 | 0xffffffff, /* src_mask */ |
304 | 0xffffffff, /* dst_mask */ | |
0a1b45a2 | 305 | false), /* pcrel_offset */ |
d75bc93d TS |
306 | |
307 | /* The remaining relocs are defined on Irix 5, although they are | |
308 | not defined by the ABI. */ | |
309 | EMPTY_HOWTO (13), | |
310 | EMPTY_HOWTO (14), | |
311 | EMPTY_HOWTO (15), | |
312 | ||
313 | /* A 5 bit shift field. */ | |
314 | HOWTO (R_MIPS_SHIFT5, /* type */ | |
315 | 0, /* rightshift */ | |
c94cb026 | 316 | 4, /* size */ |
d75bc93d | 317 | 5, /* bitsize */ |
0a1b45a2 | 318 | false, /* pc_relative */ |
d75bc93d TS |
319 | 6, /* bitpos */ |
320 | complain_overflow_bitfield, /* complain_on_overflow */ | |
30ac9238 | 321 | _bfd_mips_elf_generic_reloc, /* special_function */ |
d75bc93d | 322 | "R_MIPS_SHIFT5", /* name */ |
0a1b45a2 | 323 | true, /* partial_inplace */ |
d75bc93d TS |
324 | 0x000007c0, /* src_mask */ |
325 | 0x000007c0, /* dst_mask */ | |
0a1b45a2 | 326 | false), /* pcrel_offset */ |
d75bc93d TS |
327 | |
328 | /* A 6 bit shift field. */ | |
329 | /* FIXME: This is not handled correctly; a special function is | |
330 | needed to put the most significant bit in the right place. */ | |
331 | HOWTO (R_MIPS_SHIFT6, /* type */ | |
332 | 0, /* rightshift */ | |
c94cb026 | 333 | 4, /* size */ |
d75bc93d | 334 | 6, /* bitsize */ |
0a1b45a2 | 335 | false, /* pc_relative */ |
d75bc93d TS |
336 | 6, /* bitpos */ |
337 | complain_overflow_bitfield, /* complain_on_overflow */ | |
30ac9238 | 338 | _bfd_mips_elf_generic_reloc, /* special_function */ |
d75bc93d | 339 | "R_MIPS_SHIFT6", /* name */ |
0a1b45a2 | 340 | true, /* partial_inplace */ |
d75bc93d TS |
341 | 0x000007c4, /* src_mask */ |
342 | 0x000007c4, /* dst_mask */ | |
0a1b45a2 | 343 | false), /* pcrel_offset */ |
d75bc93d TS |
344 | |
345 | /* A 64 bit relocation. */ | |
346 | HOWTO (R_MIPS_64, /* type */ | |
347 | 0, /* rightshift */ | |
c94cb026 | 348 | 8, /* size */ |
d75bc93d | 349 | 64, /* bitsize */ |
0a1b45a2 | 350 | false, /* pc_relative */ |
d75bc93d TS |
351 | 0, /* bitpos */ |
352 | complain_overflow_dont, /* complain_on_overflow */ | |
353 | mips32_64bit_reloc, /* special_function */ | |
354 | "R_MIPS_64", /* name */ | |
0a1b45a2 | 355 | true, /* partial_inplace */ |
d75bc93d TS |
356 | MINUS_ONE, /* src_mask */ |
357 | MINUS_ONE, /* dst_mask */ | |
0a1b45a2 | 358 | false), /* pcrel_offset */ |
d75bc93d TS |
359 | |
360 | /* Displacement in the global offset table. */ | |
361 | HOWTO (R_MIPS_GOT_DISP, /* type */ | |
362 | 0, /* rightshift */ | |
c94cb026 | 363 | 4, /* size */ |
d75bc93d | 364 | 16, /* bitsize */ |
0a1b45a2 | 365 | false, /* pc_relative */ |
d75bc93d TS |
366 | 0, /* bitpos */ |
367 | complain_overflow_signed, /* complain_on_overflow */ | |
30ac9238 | 368 | _bfd_mips_elf_generic_reloc, /* special_function */ |
d75bc93d | 369 | "R_MIPS_GOT_DISP", /* name */ |
0a1b45a2 | 370 | true, /* partial_inplace */ |
d75bc93d TS |
371 | 0x0000ffff, /* src_mask */ |
372 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 373 | false), /* pcrel_offset */ |
d75bc93d TS |
374 | |
375 | /* Displacement to page pointer in the global offset table. */ | |
376 | HOWTO (R_MIPS_GOT_PAGE, /* type */ | |
377 | 0, /* rightshift */ | |
c94cb026 | 378 | 4, /* size */ |
d75bc93d | 379 | 16, /* bitsize */ |
0a1b45a2 | 380 | false, /* pc_relative */ |
d75bc93d TS |
381 | 0, /* bitpos */ |
382 | complain_overflow_signed, /* complain_on_overflow */ | |
30ac9238 | 383 | _bfd_mips_elf_generic_reloc, /* special_function */ |
d75bc93d | 384 | "R_MIPS_GOT_PAGE", /* name */ |
0a1b45a2 | 385 | true, /* partial_inplace */ |
d75bc93d TS |
386 | 0x0000ffff, /* src_mask */ |
387 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 388 | false), /* pcrel_offset */ |
d75bc93d TS |
389 | |
390 | /* Offset from page pointer in the global offset table. */ | |
391 | HOWTO (R_MIPS_GOT_OFST, /* type */ | |
392 | 0, /* rightshift */ | |
c94cb026 | 393 | 4, /* size */ |
d75bc93d | 394 | 16, /* bitsize */ |
0a1b45a2 | 395 | false, /* pc_relative */ |
d75bc93d TS |
396 | 0, /* bitpos */ |
397 | complain_overflow_signed, /* complain_on_overflow */ | |
30ac9238 | 398 | _bfd_mips_elf_generic_reloc, /* special_function */ |
d75bc93d | 399 | "R_MIPS_GOT_OFST", /* name */ |
0a1b45a2 | 400 | true, /* partial_inplace */ |
d75bc93d TS |
401 | 0x0000ffff, /* src_mask */ |
402 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 403 | false), /* pcrel_offset */ |
d75bc93d TS |
404 | |
405 | /* High 16 bits of displacement in global offset table. */ | |
406 | HOWTO (R_MIPS_GOT_HI16, /* type */ | |
407 | 0, /* rightshift */ | |
c94cb026 | 408 | 4, /* size */ |
d75bc93d | 409 | 16, /* bitsize */ |
0a1b45a2 | 410 | false, /* pc_relative */ |
d75bc93d TS |
411 | 0, /* bitpos */ |
412 | complain_overflow_dont, /* complain_on_overflow */ | |
30ac9238 | 413 | _bfd_mips_elf_generic_reloc, /* special_function */ |
d75bc93d | 414 | "R_MIPS_GOT_HI16", /* name */ |
0a1b45a2 | 415 | true, /* partial_inplace */ |
d75bc93d TS |
416 | 0x0000ffff, /* src_mask */ |
417 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 418 | false), /* pcrel_offset */ |
d75bc93d TS |
419 | |
420 | /* Low 16 bits of displacement in global offset table. */ | |
421 | HOWTO (R_MIPS_GOT_LO16, /* type */ | |
422 | 0, /* rightshift */ | |
c94cb026 | 423 | 4, /* size */ |
d75bc93d | 424 | 16, /* bitsize */ |
0a1b45a2 | 425 | false, /* pc_relative */ |
d75bc93d TS |
426 | 0, /* bitpos */ |
427 | complain_overflow_dont, /* complain_on_overflow */ | |
30ac9238 | 428 | _bfd_mips_elf_generic_reloc, /* special_function */ |
d75bc93d | 429 | "R_MIPS_GOT_LO16", /* name */ |
0a1b45a2 | 430 | true, /* partial_inplace */ |
d75bc93d TS |
431 | 0x0000ffff, /* src_mask */ |
432 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 433 | false), /* pcrel_offset */ |
d75bc93d TS |
434 | |
435 | /* 64 bit subtraction. Used in the N32 ABI. */ | |
436 | HOWTO (R_MIPS_SUB, /* type */ | |
437 | 0, /* rightshift */ | |
c94cb026 | 438 | 8, /* size */ |
d75bc93d | 439 | 64, /* bitsize */ |
0a1b45a2 | 440 | false, /* pc_relative */ |
d75bc93d TS |
441 | 0, /* bitpos */ |
442 | complain_overflow_dont, /* complain_on_overflow */ | |
30ac9238 | 443 | _bfd_mips_elf_generic_reloc, /* special_function */ |
d75bc93d | 444 | "R_MIPS_SUB", /* name */ |
0a1b45a2 | 445 | true, /* partial_inplace */ |
d75bc93d TS |
446 | MINUS_ONE, /* src_mask */ |
447 | MINUS_ONE, /* dst_mask */ | |
0a1b45a2 | 448 | false), /* pcrel_offset */ |
d75bc93d TS |
449 | |
450 | /* Used to cause the linker to insert and delete instructions? */ | |
451 | EMPTY_HOWTO (R_MIPS_INSERT_A), | |
452 | EMPTY_HOWTO (R_MIPS_INSERT_B), | |
453 | EMPTY_HOWTO (R_MIPS_DELETE), | |
454 | ||
455 | /* Get the higher value of a 64 bit addend. */ | |
456 | HOWTO (R_MIPS_HIGHER, /* type */ | |
457 | 0, /* rightshift */ | |
c94cb026 | 458 | 4, /* size */ |
d75bc93d | 459 | 16, /* bitsize */ |
0a1b45a2 | 460 | false, /* pc_relative */ |
d75bc93d TS |
461 | 0, /* bitpos */ |
462 | complain_overflow_dont, /* complain_on_overflow */ | |
30ac9238 | 463 | _bfd_mips_elf_generic_reloc, /* special_function */ |
d75bc93d | 464 | "R_MIPS_HIGHER", /* name */ |
0a1b45a2 | 465 | true, /* partial_inplace */ |
d75bc93d TS |
466 | 0x0000ffff, /* src_mask */ |
467 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 468 | false), /* pcrel_offset */ |
d75bc93d TS |
469 | |
470 | /* Get the highest value of a 64 bit addend. */ | |
471 | HOWTO (R_MIPS_HIGHEST, /* type */ | |
472 | 0, /* rightshift */ | |
c94cb026 | 473 | 4, /* size */ |
d75bc93d | 474 | 16, /* bitsize */ |
0a1b45a2 | 475 | false, /* pc_relative */ |
d75bc93d TS |
476 | 0, /* bitpos */ |
477 | complain_overflow_dont, /* complain_on_overflow */ | |
30ac9238 | 478 | _bfd_mips_elf_generic_reloc, /* special_function */ |
d75bc93d | 479 | "R_MIPS_HIGHEST", /* name */ |
0a1b45a2 | 480 | true, /* partial_inplace */ |
d75bc93d TS |
481 | 0x0000ffff, /* src_mask */ |
482 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 483 | false), /* pcrel_offset */ |
d75bc93d TS |
484 | |
485 | /* High 16 bits of displacement in global offset table. */ | |
486 | HOWTO (R_MIPS_CALL_HI16, /* type */ | |
487 | 0, /* rightshift */ | |
c94cb026 | 488 | 4, /* size */ |
d75bc93d | 489 | 16, /* bitsize */ |
0a1b45a2 | 490 | false, /* pc_relative */ |
d75bc93d TS |
491 | 0, /* bitpos */ |
492 | complain_overflow_dont, /* complain_on_overflow */ | |
30ac9238 | 493 | _bfd_mips_elf_generic_reloc, /* special_function */ |
d75bc93d | 494 | "R_MIPS_CALL_HI16", /* name */ |
0a1b45a2 | 495 | true, /* partial_inplace */ |
d75bc93d TS |
496 | 0x0000ffff, /* src_mask */ |
497 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 498 | false), /* pcrel_offset */ |
d75bc93d TS |
499 | |
500 | /* Low 16 bits of displacement in global offset table. */ | |
501 | HOWTO (R_MIPS_CALL_LO16, /* type */ | |
502 | 0, /* rightshift */ | |
c94cb026 | 503 | 4, /* size */ |
d75bc93d | 504 | 16, /* bitsize */ |
0a1b45a2 | 505 | false, /* pc_relative */ |
d75bc93d TS |
506 | 0, /* bitpos */ |
507 | complain_overflow_dont, /* complain_on_overflow */ | |
30ac9238 | 508 | _bfd_mips_elf_generic_reloc, /* special_function */ |
d75bc93d | 509 | "R_MIPS_CALL_LO16", /* name */ |
0a1b45a2 | 510 | true, /* partial_inplace */ |
d75bc93d TS |
511 | 0x0000ffff, /* src_mask */ |
512 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 513 | false), /* pcrel_offset */ |
d75bc93d TS |
514 | |
515 | /* Section displacement. */ | |
516 | HOWTO (R_MIPS_SCN_DISP, /* type */ | |
517 | 0, /* rightshift */ | |
c94cb026 | 518 | 4, /* size */ |
d75bc93d | 519 | 32, /* bitsize */ |
0a1b45a2 | 520 | false, /* pc_relative */ |
d75bc93d TS |
521 | 0, /* bitpos */ |
522 | complain_overflow_dont, /* complain_on_overflow */ | |
30ac9238 | 523 | _bfd_mips_elf_generic_reloc, /* special_function */ |
d75bc93d | 524 | "R_MIPS_SCN_DISP", /* name */ |
0a1b45a2 | 525 | true, /* partial_inplace */ |
d75bc93d TS |
526 | 0xffffffff, /* src_mask */ |
527 | 0xffffffff, /* dst_mask */ | |
0a1b45a2 | 528 | false), /* pcrel_offset */ |
d75bc93d TS |
529 | |
530 | EMPTY_HOWTO (R_MIPS_REL16), | |
531 | EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE), | |
532 | EMPTY_HOWTO (R_MIPS_PJUMP), | |
533 | EMPTY_HOWTO (R_MIPS_RELGOT), | |
534 | ||
535 | /* Protected jump conversion. This is an optimization hint. No | |
536 | relocation is required for correctness. */ | |
07d6d2b8 | 537 | HOWTO (R_MIPS_JALR, /* type */ |
d75bc93d | 538 | 0, /* rightshift */ |
c94cb026 | 539 | 4, /* size */ |
d75bc93d | 540 | 32, /* bitsize */ |
0a1b45a2 | 541 | false, /* pc_relative */ |
d75bc93d TS |
542 | 0, /* bitpos */ |
543 | complain_overflow_dont, /* complain_on_overflow */ | |
30ac9238 | 544 | _bfd_mips_elf_generic_reloc, /* special_function */ |
07d6d2b8 | 545 | "R_MIPS_JALR", /* name */ |
0a1b45a2 | 546 | false, /* partial_inplace */ |
d75bc93d TS |
547 | 0x00000000, /* src_mask */ |
548 | 0x00000000, /* dst_mask */ | |
0a1b45a2 | 549 | false), /* pcrel_offset */ |
0f20cc35 DJ |
550 | |
551 | /* TLS GD/LD dynamic relocations. */ | |
552 | HOWTO (R_MIPS_TLS_DTPMOD32, /* type */ | |
553 | 0, /* rightshift */ | |
c94cb026 | 554 | 4, /* size */ |
0f20cc35 | 555 | 32, /* bitsize */ |
0a1b45a2 | 556 | false, /* pc_relative */ |
0f20cc35 DJ |
557 | 0, /* bitpos */ |
558 | complain_overflow_dont, /* complain_on_overflow */ | |
559 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
560 | "R_MIPS_TLS_DTPMOD32", /* name */ | |
0a1b45a2 | 561 | true, /* partial_inplace */ |
0f20cc35 DJ |
562 | 0xffffffff, /* src_mask */ |
563 | 0xffffffff, /* dst_mask */ | |
0a1b45a2 | 564 | false), /* pcrel_offset */ |
0f20cc35 DJ |
565 | |
566 | HOWTO (R_MIPS_TLS_DTPREL32, /* type */ | |
567 | 0, /* rightshift */ | |
c94cb026 | 568 | 4, /* size */ |
0f20cc35 | 569 | 32, /* bitsize */ |
0a1b45a2 | 570 | false, /* pc_relative */ |
0f20cc35 DJ |
571 | 0, /* bitpos */ |
572 | complain_overflow_dont, /* complain_on_overflow */ | |
573 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
574 | "R_MIPS_TLS_DTPREL32", /* name */ | |
0a1b45a2 | 575 | true, /* partial_inplace */ |
0f20cc35 DJ |
576 | 0xffffffff, /* src_mask */ |
577 | 0xffffffff, /* dst_mask */ | |
0a1b45a2 | 578 | false), /* pcrel_offset */ |
0f20cc35 DJ |
579 | |
580 | EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64), | |
581 | EMPTY_HOWTO (R_MIPS_TLS_DTPREL64), | |
582 | ||
583 | /* TLS general dynamic variable reference. */ | |
584 | HOWTO (R_MIPS_TLS_GD, /* type */ | |
585 | 0, /* rightshift */ | |
c94cb026 | 586 | 4, /* size */ |
0f20cc35 | 587 | 16, /* bitsize */ |
0a1b45a2 | 588 | false, /* pc_relative */ |
0f20cc35 DJ |
589 | 0, /* bitpos */ |
590 | complain_overflow_signed, /* complain_on_overflow */ | |
591 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
592 | "R_MIPS_TLS_GD", /* name */ | |
0a1b45a2 | 593 | true, /* partial_inplace */ |
0f20cc35 DJ |
594 | 0x0000ffff, /* src_mask */ |
595 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 596 | false), /* pcrel_offset */ |
0f20cc35 DJ |
597 | |
598 | /* TLS local dynamic variable reference. */ | |
599 | HOWTO (R_MIPS_TLS_LDM, /* type */ | |
600 | 0, /* rightshift */ | |
c94cb026 | 601 | 4, /* size */ |
0f20cc35 | 602 | 16, /* bitsize */ |
0a1b45a2 | 603 | false, /* pc_relative */ |
0f20cc35 DJ |
604 | 0, /* bitpos */ |
605 | complain_overflow_signed, /* complain_on_overflow */ | |
606 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
607 | "R_MIPS_TLS_LDM", /* name */ | |
0a1b45a2 | 608 | true, /* partial_inplace */ |
0f20cc35 DJ |
609 | 0x0000ffff, /* src_mask */ |
610 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 611 | false), /* pcrel_offset */ |
0f20cc35 DJ |
612 | |
613 | /* TLS local dynamic offset. */ | |
614 | HOWTO (R_MIPS_TLS_DTPREL_HI16, /* type */ | |
615 | 0, /* rightshift */ | |
c94cb026 | 616 | 4, /* size */ |
0f20cc35 | 617 | 16, /* bitsize */ |
0a1b45a2 | 618 | false, /* pc_relative */ |
0f20cc35 DJ |
619 | 0, /* bitpos */ |
620 | complain_overflow_signed, /* complain_on_overflow */ | |
621 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
622 | "R_MIPS_TLS_DTPREL_HI16", /* name */ | |
0a1b45a2 | 623 | true, /* partial_inplace */ |
0f20cc35 DJ |
624 | 0x0000ffff, /* src_mask */ |
625 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 626 | false), /* pcrel_offset */ |
0f20cc35 DJ |
627 | |
628 | /* TLS local dynamic offset. */ | |
629 | HOWTO (R_MIPS_TLS_DTPREL_LO16, /* type */ | |
630 | 0, /* rightshift */ | |
c94cb026 | 631 | 4, /* size */ |
0f20cc35 | 632 | 16, /* bitsize */ |
0a1b45a2 | 633 | false, /* pc_relative */ |
0f20cc35 DJ |
634 | 0, /* bitpos */ |
635 | complain_overflow_signed, /* complain_on_overflow */ | |
636 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
637 | "R_MIPS_TLS_DTPREL_LO16", /* name */ | |
0a1b45a2 | 638 | true, /* partial_inplace */ |
0f20cc35 DJ |
639 | 0x0000ffff, /* src_mask */ |
640 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 641 | false), /* pcrel_offset */ |
0f20cc35 DJ |
642 | |
643 | /* TLS thread pointer offset. */ | |
644 | HOWTO (R_MIPS_TLS_GOTTPREL, /* type */ | |
645 | 0, /* rightshift */ | |
c94cb026 | 646 | 4, /* size */ |
0f20cc35 | 647 | 16, /* bitsize */ |
0a1b45a2 | 648 | false, /* pc_relative */ |
0f20cc35 DJ |
649 | 0, /* bitpos */ |
650 | complain_overflow_signed, /* complain_on_overflow */ | |
651 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
652 | "R_MIPS_TLS_GOTTPREL", /* name */ | |
0a1b45a2 | 653 | true, /* partial_inplace */ |
0f20cc35 DJ |
654 | 0x0000ffff, /* src_mask */ |
655 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 656 | false), /* pcrel_offset */ |
0f20cc35 DJ |
657 | |
658 | /* TLS IE dynamic relocations. */ | |
659 | HOWTO (R_MIPS_TLS_TPREL32, /* type */ | |
660 | 0, /* rightshift */ | |
c94cb026 | 661 | 4, /* size */ |
0f20cc35 | 662 | 32, /* bitsize */ |
0a1b45a2 | 663 | false, /* pc_relative */ |
0f20cc35 DJ |
664 | 0, /* bitpos */ |
665 | complain_overflow_dont, /* complain_on_overflow */ | |
666 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
667 | "R_MIPS_TLS_TPREL32", /* name */ | |
0a1b45a2 | 668 | true, /* partial_inplace */ |
0f20cc35 DJ |
669 | 0xffffffff, /* src_mask */ |
670 | 0xffffffff, /* dst_mask */ | |
0a1b45a2 | 671 | false), /* pcrel_offset */ |
0f20cc35 DJ |
672 | |
673 | EMPTY_HOWTO (R_MIPS_TLS_TPREL64), | |
674 | ||
675 | /* TLS thread pointer offset. */ | |
676 | HOWTO (R_MIPS_TLS_TPREL_HI16, /* type */ | |
677 | 0, /* rightshift */ | |
c94cb026 | 678 | 4, /* size */ |
0f20cc35 | 679 | 16, /* bitsize */ |
0a1b45a2 | 680 | false, /* pc_relative */ |
0f20cc35 DJ |
681 | 0, /* bitpos */ |
682 | complain_overflow_signed, /* complain_on_overflow */ | |
683 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
684 | "R_MIPS_TLS_TPREL_HI16", /* name */ | |
0a1b45a2 | 685 | true, /* partial_inplace */ |
0f20cc35 DJ |
686 | 0x0000ffff, /* src_mask */ |
687 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 688 | false), /* pcrel_offset */ |
0f20cc35 DJ |
689 | |
690 | /* TLS thread pointer offset. */ | |
691 | HOWTO (R_MIPS_TLS_TPREL_LO16, /* type */ | |
692 | 0, /* rightshift */ | |
c94cb026 | 693 | 4, /* size */ |
0f20cc35 | 694 | 16, /* bitsize */ |
0a1b45a2 | 695 | false, /* pc_relative */ |
0f20cc35 DJ |
696 | 0, /* bitpos */ |
697 | complain_overflow_signed, /* complain_on_overflow */ | |
698 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
699 | "R_MIPS_TLS_TPREL_LO16", /* name */ | |
0a1b45a2 | 700 | true, /* partial_inplace */ |
0f20cc35 DJ |
701 | 0x0000ffff, /* src_mask */ |
702 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 703 | false), /* pcrel_offset */ |
165b93e7 RS |
704 | |
705 | /* 32 bit relocation with no addend. */ | |
706 | HOWTO (R_MIPS_GLOB_DAT, /* type */ | |
707 | 0, /* rightshift */ | |
c94cb026 | 708 | 4, /* size */ |
165b93e7 | 709 | 32, /* bitsize */ |
0a1b45a2 | 710 | false, /* pc_relative */ |
165b93e7 RS |
711 | 0, /* bitpos */ |
712 | complain_overflow_dont, /* complain_on_overflow */ | |
713 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
714 | "R_MIPS_GLOB_DAT", /* name */ | |
0a1b45a2 | 715 | false, /* partial_inplace */ |
165b93e7 RS |
716 | 0x0, /* src_mask */ |
717 | 0xffffffff, /* dst_mask */ | |
0a1b45a2 | 718 | false), /* pcrel_offset */ |
7361da2c AB |
719 | |
720 | EMPTY_HOWTO (52), | |
721 | EMPTY_HOWTO (53), | |
722 | EMPTY_HOWTO (54), | |
723 | EMPTY_HOWTO (55), | |
724 | EMPTY_HOWTO (56), | |
725 | EMPTY_HOWTO (57), | |
726 | EMPTY_HOWTO (58), | |
727 | EMPTY_HOWTO (59), | |
728 | ||
729 | HOWTO (R_MIPS_PC21_S2, /* type */ | |
730 | 2, /* rightshift */ | |
c94cb026 | 731 | 4, /* size */ |
7361da2c | 732 | 21, /* bitsize */ |
0a1b45a2 | 733 | true, /* pc_relative */ |
7361da2c AB |
734 | 0, /* bitpos */ |
735 | complain_overflow_signed, /* complain_on_overflow */ | |
736 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
737 | "R_MIPS_PC21_S2", /* name */ | |
0a1b45a2 | 738 | true, /* partial_inplace */ |
7361da2c AB |
739 | 0x001fffff, /* src_mask */ |
740 | 0x001fffff, /* dst_mask */ | |
0a1b45a2 | 741 | true), /* pcrel_offset */ |
7361da2c AB |
742 | |
743 | HOWTO (R_MIPS_PC26_S2, /* type */ | |
744 | 2, /* rightshift */ | |
c94cb026 | 745 | 4, /* size */ |
7361da2c | 746 | 26, /* bitsize */ |
0a1b45a2 | 747 | true, /* pc_relative */ |
7361da2c AB |
748 | 0, /* bitpos */ |
749 | complain_overflow_signed, /* complain_on_overflow */ | |
750 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
751 | "R_MIPS_PC26_S2", /* name */ | |
0a1b45a2 | 752 | true, /* partial_inplace */ |
7361da2c AB |
753 | 0x03ffffff, /* src_mask */ |
754 | 0x03ffffff, /* dst_mask */ | |
0a1b45a2 | 755 | true), /* pcrel_offset */ |
7361da2c AB |
756 | |
757 | HOWTO (R_MIPS_PC18_S3, /* type */ | |
758 | 3, /* rightshift */ | |
c94cb026 | 759 | 4, /* size */ |
7361da2c | 760 | 18, /* bitsize */ |
0a1b45a2 | 761 | true, /* pc_relative */ |
7361da2c AB |
762 | 0, /* bitpos */ |
763 | complain_overflow_signed, /* complain_on_overflow */ | |
764 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
765 | "R_MIPS_PC18_S3", /* name */ | |
0a1b45a2 | 766 | true, /* partial_inplace */ |
7361da2c AB |
767 | 0x0003ffff, /* src_mask */ |
768 | 0x0003ffff, /* dst_mask */ | |
0a1b45a2 | 769 | true), /* pcrel_offset */ |
7361da2c AB |
770 | |
771 | HOWTO (R_MIPS_PC19_S2, /* type */ | |
772 | 2, /* rightshift */ | |
c94cb026 | 773 | 4, /* size */ |
7361da2c | 774 | 19, /* bitsize */ |
0a1b45a2 | 775 | true, /* pc_relative */ |
7361da2c AB |
776 | 0, /* bitpos */ |
777 | complain_overflow_signed, /* complain_on_overflow */ | |
778 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
779 | "R_MIPS_PC19_S2", /* name */ | |
0a1b45a2 | 780 | true, /* partial_inplace */ |
7361da2c AB |
781 | 0x0007ffff, /* src_mask */ |
782 | 0x0007ffff, /* dst_mask */ | |
0a1b45a2 | 783 | true), /* pcrel_offset */ |
7361da2c AB |
784 | |
785 | HOWTO (R_MIPS_PCHI16, /* type */ | |
786 | 16, /* rightshift */ | |
c94cb026 | 787 | 4, /* size */ |
7361da2c | 788 | 16, /* bitsize */ |
0a1b45a2 | 789 | true, /* pc_relative */ |
7361da2c AB |
790 | 0, /* bitpos */ |
791 | complain_overflow_signed, /* complain_on_overflow */ | |
792 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
793 | "R_MIPS_PCHI16", /* name */ | |
0a1b45a2 | 794 | true, /* partial_inplace */ |
7361da2c AB |
795 | 0x0000ffff, /* src_mask */ |
796 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 797 | true), /* pcrel_offset */ |
7361da2c AB |
798 | |
799 | HOWTO (R_MIPS_PCLO16, /* type */ | |
800 | 0, /* rightshift */ | |
c94cb026 | 801 | 4, /* size */ |
7361da2c | 802 | 16, /* bitsize */ |
0a1b45a2 | 803 | true, /* pc_relative */ |
7361da2c AB |
804 | 0, /* bitpos */ |
805 | complain_overflow_dont, /* complain_on_overflow */ | |
806 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
807 | "R_MIPS_PCLO16", /* name */ | |
0a1b45a2 | 808 | true, /* partial_inplace */ |
7361da2c AB |
809 | 0x0000ffff, /* src_mask */ |
810 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 811 | true), /* pcrel_offset */ |
d75bc93d TS |
812 | }; |
813 | ||
c6e90b02 TS |
814 | /* The reloc used for BFD_RELOC_CTOR when doing a 64 bit link. This |
815 | is a hack to make the linker think that we need 64 bit values. */ | |
816 | static reloc_howto_type elf_mips_ctor64_howto = | |
817 | HOWTO (R_MIPS_64, /* type */ | |
252b5132 | 818 | 0, /* rightshift */ |
c94cb026 | 819 | 8, /* size */ |
252b5132 | 820 | 32, /* bitsize */ |
0a1b45a2 | 821 | false, /* pc_relative */ |
252b5132 | 822 | 0, /* bitpos */ |
c6e90b02 TS |
823 | complain_overflow_signed, /* complain_on_overflow */ |
824 | mips32_64bit_reloc, /* special_function */ | |
825 | "R_MIPS_64", /* name */ | |
0a1b45a2 | 826 | true, /* partial_inplace */ |
c6e90b02 | 827 | 0xffffffff, /* src_mask */ |
252b5132 | 828 | 0xffffffff, /* dst_mask */ |
0a1b45a2 | 829 | false); /* pcrel_offset */ |
252b5132 | 830 | |
d6f16593 MR |
831 | static reloc_howto_type elf_mips16_howto_table_rel[] = |
832 | { | |
833 | /* The reloc used for the mips16 jump instruction. */ | |
c6e90b02 | 834 | HOWTO (R_MIPS16_26, /* type */ |
252b5132 | 835 | 2, /* rightshift */ |
c94cb026 | 836 | 4, /* size */ |
252b5132 | 837 | 26, /* bitsize */ |
0a1b45a2 | 838 | false, /* pc_relative */ |
252b5132 RH |
839 | 0, /* bitpos */ |
840 | complain_overflow_dont, /* complain_on_overflow */ | |
07d6d2b8 | 841 | /* This needs complex overflow |
c6e90b02 TS |
842 | detection, because the upper four |
843 | bits must match the PC. */ | |
35d3d567 | 844 | _bfd_mips_elf_generic_reloc, /* special_function */ |
c6e90b02 | 845 | "R_MIPS16_26", /* name */ |
0a1b45a2 | 846 | true, /* partial_inplace */ |
c6e90b02 TS |
847 | 0x3ffffff, /* src_mask */ |
848 | 0x3ffffff, /* dst_mask */ | |
0a1b45a2 | 849 | false), /* pcrel_offset */ |
252b5132 | 850 | |
d6f16593 | 851 | /* The reloc used for the mips16 gprel instruction. */ |
c6e90b02 | 852 | HOWTO (R_MIPS16_GPREL, /* type */ |
252b5132 | 853 | 0, /* rightshift */ |
c94cb026 | 854 | 4, /* size */ |
252b5132 | 855 | 16, /* bitsize */ |
0a1b45a2 | 856 | false, /* pc_relative */ |
252b5132 | 857 | 0, /* bitpos */ |
c6e90b02 TS |
858 | complain_overflow_signed, /* complain_on_overflow */ |
859 | mips16_gprel_reloc, /* special_function */ | |
860 | "R_MIPS16_GPREL", /* name */ | |
0a1b45a2 | 861 | true, /* partial_inplace */ |
d6f16593 | 862 | 0x0000ffff, /* src_mask */ |
07d6d2b8 | 863 | 0x0000ffff, /* dst_mask */ |
0a1b45a2 | 864 | false), /* pcrel_offset */ |
d6f16593 | 865 | |
738e5348 RS |
866 | /* A MIPS16 reference to the global offset table. */ |
867 | HOWTO (R_MIPS16_GOT16, /* type */ | |
868 | 0, /* rightshift */ | |
c94cb026 | 869 | 4, /* size */ |
738e5348 | 870 | 16, /* bitsize */ |
0a1b45a2 | 871 | false, /* pc_relative */ |
738e5348 RS |
872 | 0, /* bitpos */ |
873 | complain_overflow_dont, /* complain_on_overflow */ | |
874 | _bfd_mips_elf_got16_reloc, /* special_function */ | |
875 | "R_MIPS16_GOT16", /* name */ | |
0a1b45a2 | 876 | true, /* partial_inplace */ |
738e5348 | 877 | 0x0000ffff, /* src_mask */ |
07d6d2b8 | 878 | 0x0000ffff, /* dst_mask */ |
0a1b45a2 | 879 | false), /* pcrel_offset */ |
d6f16593 | 880 | |
738e5348 RS |
881 | /* A MIPS16 call through the global offset table. */ |
882 | HOWTO (R_MIPS16_CALL16, /* type */ | |
883 | 0, /* rightshift */ | |
c94cb026 | 884 | 4, /* size */ |
738e5348 | 885 | 16, /* bitsize */ |
0a1b45a2 | 886 | false, /* pc_relative */ |
738e5348 RS |
887 | 0, /* bitpos */ |
888 | complain_overflow_dont, /* complain_on_overflow */ | |
889 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
890 | "R_MIPS16_CALL16", /* name */ | |
0a1b45a2 | 891 | true, /* partial_inplace */ |
738e5348 | 892 | 0x0000ffff, /* src_mask */ |
07d6d2b8 | 893 | 0x0000ffff, /* dst_mask */ |
0a1b45a2 | 894 | false), /* pcrel_offset */ |
d6f16593 MR |
895 | |
896 | /* MIPS16 high 16 bits of symbol value. */ | |
897 | HOWTO (R_MIPS16_HI16, /* type */ | |
898 | 16, /* rightshift */ | |
c94cb026 | 899 | 4, /* size */ |
d6f16593 | 900 | 16, /* bitsize */ |
0a1b45a2 | 901 | false, /* pc_relative */ |
d6f16593 MR |
902 | 0, /* bitpos */ |
903 | complain_overflow_dont, /* complain_on_overflow */ | |
904 | _bfd_mips_elf_hi16_reloc, /* special_function */ | |
905 | "R_MIPS16_HI16", /* name */ | |
0a1b45a2 | 906 | true, /* partial_inplace */ |
d6f16593 | 907 | 0x0000ffff, /* src_mask */ |
07d6d2b8 | 908 | 0x0000ffff, /* dst_mask */ |
0a1b45a2 | 909 | false), /* pcrel_offset */ |
d6f16593 MR |
910 | |
911 | /* MIPS16 low 16 bits of symbol value. */ | |
912 | HOWTO (R_MIPS16_LO16, /* type */ | |
913 | 0, /* rightshift */ | |
c94cb026 | 914 | 4, /* size */ |
d6f16593 | 915 | 16, /* bitsize */ |
0a1b45a2 | 916 | false, /* pc_relative */ |
d6f16593 MR |
917 | 0, /* bitpos */ |
918 | complain_overflow_dont, /* complain_on_overflow */ | |
919 | _bfd_mips_elf_lo16_reloc, /* special_function */ | |
920 | "R_MIPS16_LO16", /* name */ | |
0a1b45a2 | 921 | true, /* partial_inplace */ |
d6f16593 | 922 | 0x0000ffff, /* src_mask */ |
07d6d2b8 | 923 | 0x0000ffff, /* dst_mask */ |
0a1b45a2 | 924 | false), /* pcrel_offset */ |
d0f13682 CLT |
925 | |
926 | /* MIPS16 TLS general dynamic variable reference. */ | |
927 | HOWTO (R_MIPS16_TLS_GD, /* type */ | |
928 | 0, /* rightshift */ | |
c94cb026 | 929 | 4, /* size */ |
d0f13682 | 930 | 16, /* bitsize */ |
0a1b45a2 | 931 | false, /* pc_relative */ |
d0f13682 CLT |
932 | 0, /* bitpos */ |
933 | complain_overflow_signed, /* complain_on_overflow */ | |
934 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
935 | "R_MIPS16_TLS_GD", /* name */ | |
0a1b45a2 | 936 | true, /* partial_inplace */ |
d0f13682 CLT |
937 | 0x0000ffff, /* src_mask */ |
938 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 939 | false), /* pcrel_offset */ |
d0f13682 CLT |
940 | |
941 | /* MIPS16 TLS local dynamic variable reference. */ | |
942 | HOWTO (R_MIPS16_TLS_LDM, /* type */ | |
943 | 0, /* rightshift */ | |
c94cb026 | 944 | 4, /* size */ |
d0f13682 | 945 | 16, /* bitsize */ |
0a1b45a2 | 946 | false, /* pc_relative */ |
d0f13682 CLT |
947 | 0, /* bitpos */ |
948 | complain_overflow_signed, /* complain_on_overflow */ | |
949 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
950 | "R_MIPS16_TLS_LDM", /* name */ | |
0a1b45a2 | 951 | true, /* partial_inplace */ |
d0f13682 CLT |
952 | 0x0000ffff, /* src_mask */ |
953 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 954 | false), /* pcrel_offset */ |
d0f13682 CLT |
955 | |
956 | /* MIPS16 TLS local dynamic offset. */ | |
957 | HOWTO (R_MIPS16_TLS_DTPREL_HI16, /* type */ | |
958 | 0, /* rightshift */ | |
c94cb026 | 959 | 4, /* size */ |
d0f13682 | 960 | 16, /* bitsize */ |
0a1b45a2 | 961 | false, /* pc_relative */ |
d0f13682 CLT |
962 | 0, /* bitpos */ |
963 | complain_overflow_signed, /* complain_on_overflow */ | |
964 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
965 | "R_MIPS16_TLS_DTPREL_HI16", /* name */ | |
0a1b45a2 | 966 | true, /* partial_inplace */ |
d0f13682 CLT |
967 | 0x0000ffff, /* src_mask */ |
968 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 969 | false), /* pcrel_offset */ |
d0f13682 CLT |
970 | |
971 | /* MIPS16 TLS local dynamic offset. */ | |
972 | HOWTO (R_MIPS16_TLS_DTPREL_LO16, /* type */ | |
973 | 0, /* rightshift */ | |
c94cb026 | 974 | 4, /* size */ |
d0f13682 | 975 | 16, /* bitsize */ |
0a1b45a2 | 976 | false, /* pc_relative */ |
d0f13682 CLT |
977 | 0, /* bitpos */ |
978 | complain_overflow_signed, /* complain_on_overflow */ | |
979 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
980 | "R_MIPS16_TLS_DTPREL_LO16", /* name */ | |
0a1b45a2 | 981 | true, /* partial_inplace */ |
d0f13682 CLT |
982 | 0x0000ffff, /* src_mask */ |
983 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 984 | false), /* pcrel_offset */ |
d0f13682 CLT |
985 | |
986 | /* MIPS16 TLS thread pointer offset. */ | |
987 | HOWTO (R_MIPS16_TLS_GOTTPREL, /* type */ | |
988 | 0, /* rightshift */ | |
c94cb026 | 989 | 4, /* size */ |
d0f13682 | 990 | 16, /* bitsize */ |
0a1b45a2 | 991 | false, /* pc_relative */ |
d0f13682 CLT |
992 | 0, /* bitpos */ |
993 | complain_overflow_signed, /* complain_on_overflow */ | |
994 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
995 | "R_MIPS16_TLS_GOTTPREL", /* name */ | |
0a1b45a2 | 996 | true, /* partial_inplace */ |
d0f13682 CLT |
997 | 0x0000ffff, /* src_mask */ |
998 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 999 | false), /* pcrel_offset */ |
d0f13682 CLT |
1000 | |
1001 | /* MIPS16 TLS thread pointer offset. */ | |
1002 | HOWTO (R_MIPS16_TLS_TPREL_HI16, /* type */ | |
1003 | 0, /* rightshift */ | |
c94cb026 | 1004 | 4, /* size */ |
d0f13682 | 1005 | 16, /* bitsize */ |
0a1b45a2 | 1006 | false, /* pc_relative */ |
d0f13682 CLT |
1007 | 0, /* bitpos */ |
1008 | complain_overflow_signed, /* complain_on_overflow */ | |
1009 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1010 | "R_MIPS16_TLS_TPREL_HI16", /* name */ | |
0a1b45a2 | 1011 | true, /* partial_inplace */ |
d0f13682 CLT |
1012 | 0x0000ffff, /* src_mask */ |
1013 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1014 | false), /* pcrel_offset */ |
d0f13682 CLT |
1015 | |
1016 | /* MIPS16 TLS thread pointer offset. */ | |
1017 | HOWTO (R_MIPS16_TLS_TPREL_LO16, /* type */ | |
1018 | 0, /* rightshift */ | |
c94cb026 | 1019 | 4, /* size */ |
d0f13682 | 1020 | 16, /* bitsize */ |
0a1b45a2 | 1021 | false, /* pc_relative */ |
d0f13682 CLT |
1022 | 0, /* bitpos */ |
1023 | complain_overflow_signed, /* complain_on_overflow */ | |
1024 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1025 | "R_MIPS16_TLS_TPREL_LO16", /* name */ | |
0a1b45a2 | 1026 | true, /* partial_inplace */ |
d0f13682 CLT |
1027 | 0x0000ffff, /* src_mask */ |
1028 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1029 | false), /* pcrel_offset */ |
c9775dde MR |
1030 | |
1031 | /* MIPS16 16-bit PC-relative branch offset. */ | |
1032 | HOWTO (R_MIPS16_PC16_S1, /* type */ | |
1033 | 1, /* rightshift */ | |
c94cb026 | 1034 | 4, /* size */ |
c9775dde | 1035 | 16, /* bitsize */ |
0a1b45a2 | 1036 | true, /* pc_relative */ |
c9775dde MR |
1037 | 0, /* bitpos */ |
1038 | complain_overflow_signed, /* complain_on_overflow */ | |
1039 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1040 | "R_MIPS16_PC16_S1", /* name */ | |
0a1b45a2 | 1041 | true, /* partial_inplace */ |
c9775dde MR |
1042 | 0x0000ffff, /* src_mask */ |
1043 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1044 | true), /* pcrel_offset */ |
d6f16593 | 1045 | }; |
252b5132 | 1046 | |
df58fc94 RS |
1047 | static reloc_howto_type elf_micromips_howto_table_rel[] = |
1048 | { | |
1049 | EMPTY_HOWTO (130), | |
1050 | EMPTY_HOWTO (131), | |
1051 | EMPTY_HOWTO (132), | |
1052 | ||
1053 | /* 26 bit jump address. */ | |
1054 | HOWTO (R_MICROMIPS_26_S1, /* type */ | |
1055 | 1, /* rightshift */ | |
c94cb026 | 1056 | 4, /* size */ |
df58fc94 | 1057 | 26, /* bitsize */ |
0a1b45a2 | 1058 | false, /* pc_relative */ |
df58fc94 RS |
1059 | 0, /* bitpos */ |
1060 | complain_overflow_dont, /* complain_on_overflow */ | |
07d6d2b8 | 1061 | /* This needs complex overflow |
df58fc94 RS |
1062 | detection, because the upper four |
1063 | bits must match the PC. */ | |
1064 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1065 | "R_MICROMIPS_26_S1", /* name */ | |
0a1b45a2 | 1066 | true, /* partial_inplace */ |
df58fc94 RS |
1067 | 0x3ffffff, /* src_mask */ |
1068 | 0x3ffffff, /* dst_mask */ | |
0a1b45a2 | 1069 | false), /* pcrel_offset */ |
df58fc94 RS |
1070 | |
1071 | /* High 16 bits of symbol value. */ | |
1072 | HOWTO (R_MICROMIPS_HI16, /* type */ | |
1073 | 16, /* rightshift */ | |
c94cb026 | 1074 | 4, /* size */ |
df58fc94 | 1075 | 16, /* bitsize */ |
0a1b45a2 | 1076 | false, /* pc_relative */ |
df58fc94 RS |
1077 | 0, /* bitpos */ |
1078 | complain_overflow_dont, /* complain_on_overflow */ | |
1079 | _bfd_mips_elf_hi16_reloc, /* special_function */ | |
1080 | "R_MICROMIPS_HI16", /* name */ | |
0a1b45a2 | 1081 | true, /* partial_inplace */ |
df58fc94 RS |
1082 | 0x0000ffff, /* src_mask */ |
1083 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1084 | false), /* pcrel_offset */ |
df58fc94 RS |
1085 | |
1086 | /* Low 16 bits of symbol value. */ | |
1087 | HOWTO (R_MICROMIPS_LO16, /* type */ | |
1088 | 0, /* rightshift */ | |
c94cb026 | 1089 | 4, /* size */ |
df58fc94 | 1090 | 16, /* bitsize */ |
0a1b45a2 | 1091 | false, /* pc_relative */ |
df58fc94 RS |
1092 | 0, /* bitpos */ |
1093 | complain_overflow_dont, /* complain_on_overflow */ | |
1094 | _bfd_mips_elf_lo16_reloc, /* special_function */ | |
1095 | "R_MICROMIPS_LO16", /* name */ | |
0a1b45a2 | 1096 | true, /* partial_inplace */ |
df58fc94 RS |
1097 | 0x0000ffff, /* src_mask */ |
1098 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1099 | false), /* pcrel_offset */ |
df58fc94 RS |
1100 | |
1101 | /* GP relative reference. */ | |
1102 | HOWTO (R_MICROMIPS_GPREL16, /* type */ | |
1103 | 0, /* rightshift */ | |
c94cb026 | 1104 | 4, /* size */ |
df58fc94 | 1105 | 16, /* bitsize */ |
0a1b45a2 | 1106 | false, /* pc_relative */ |
df58fc94 RS |
1107 | 0, /* bitpos */ |
1108 | complain_overflow_signed, /* complain_on_overflow */ | |
1109 | _bfd_mips_elf32_gprel16_reloc, /* special_function */ | |
1110 | "R_MICROMIPS_GPREL16", /* name */ | |
0a1b45a2 | 1111 | true, /* partial_inplace */ |
df58fc94 RS |
1112 | 0x0000ffff, /* src_mask */ |
1113 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1114 | false), /* pcrel_offset */ |
df58fc94 RS |
1115 | |
1116 | /* Reference to literal section. */ | |
1117 | HOWTO (R_MICROMIPS_LITERAL, /* type */ | |
1118 | 0, /* rightshift */ | |
c94cb026 | 1119 | 4, /* size */ |
df58fc94 | 1120 | 16, /* bitsize */ |
0a1b45a2 | 1121 | false, /* pc_relative */ |
df58fc94 RS |
1122 | 0, /* bitpos */ |
1123 | complain_overflow_signed, /* complain_on_overflow */ | |
1124 | _bfd_mips_elf32_gprel16_reloc, /* special_function */ | |
1125 | "R_MICROMIPS_LITERAL", /* name */ | |
0a1b45a2 | 1126 | true, /* partial_inplace */ |
df58fc94 RS |
1127 | 0x0000ffff, /* src_mask */ |
1128 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1129 | false), /* pcrel_offset */ |
df58fc94 RS |
1130 | |
1131 | /* Reference to global offset table. */ | |
1132 | HOWTO (R_MICROMIPS_GOT16, /* type */ | |
1133 | 0, /* rightshift */ | |
c94cb026 | 1134 | 4, /* size */ |
df58fc94 | 1135 | 16, /* bitsize */ |
0a1b45a2 | 1136 | false, /* pc_relative */ |
df58fc94 RS |
1137 | 0, /* bitpos */ |
1138 | complain_overflow_signed, /* complain_on_overflow */ | |
1139 | _bfd_mips_elf_got16_reloc, /* special_function */ | |
1140 | "R_MICROMIPS_GOT16", /* name */ | |
0a1b45a2 | 1141 | true, /* partial_inplace */ |
df58fc94 RS |
1142 | 0x0000ffff, /* src_mask */ |
1143 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1144 | false), /* pcrel_offset */ |
df58fc94 RS |
1145 | |
1146 | /* This is for microMIPS branches. */ | |
1147 | HOWTO (R_MICROMIPS_PC7_S1, /* type */ | |
1148 | 1, /* rightshift */ | |
c94cb026 | 1149 | 2, /* size */ |
df58fc94 | 1150 | 7, /* bitsize */ |
0a1b45a2 | 1151 | true, /* pc_relative */ |
df58fc94 RS |
1152 | 0, /* bitpos */ |
1153 | complain_overflow_signed, /* complain_on_overflow */ | |
1154 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1155 | "R_MICROMIPS_PC7_S1", /* name */ | |
0a1b45a2 | 1156 | true, /* partial_inplace */ |
df58fc94 RS |
1157 | 0x0000007f, /* src_mask */ |
1158 | 0x0000007f, /* dst_mask */ | |
0a1b45a2 | 1159 | true), /* pcrel_offset */ |
df58fc94 RS |
1160 | |
1161 | HOWTO (R_MICROMIPS_PC10_S1, /* type */ | |
1162 | 1, /* rightshift */ | |
c94cb026 | 1163 | 2, /* size */ |
df58fc94 | 1164 | 10, /* bitsize */ |
0a1b45a2 | 1165 | true, /* pc_relative */ |
df58fc94 RS |
1166 | 0, /* bitpos */ |
1167 | complain_overflow_signed, /* complain_on_overflow */ | |
1168 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1169 | "R_MICROMIPS_PC10_S1", /* name */ | |
0a1b45a2 | 1170 | true, /* partial_inplace */ |
df58fc94 RS |
1171 | 0x000003ff, /* src_mask */ |
1172 | 0x000003ff, /* dst_mask */ | |
0a1b45a2 | 1173 | true), /* pcrel_offset */ |
df58fc94 RS |
1174 | |
1175 | HOWTO (R_MICROMIPS_PC16_S1, /* type */ | |
1176 | 1, /* rightshift */ | |
c94cb026 | 1177 | 4, /* size */ |
df58fc94 | 1178 | 16, /* bitsize */ |
0a1b45a2 | 1179 | true, /* pc_relative */ |
df58fc94 RS |
1180 | 0, /* bitpos */ |
1181 | complain_overflow_signed, /* complain_on_overflow */ | |
1182 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1183 | "R_MICROMIPS_PC16_S1", /* name */ | |
0a1b45a2 | 1184 | true, /* partial_inplace */ |
df58fc94 RS |
1185 | 0x0000ffff, /* src_mask */ |
1186 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1187 | true), /* pcrel_offset */ |
df58fc94 RS |
1188 | |
1189 | /* 16 bit call through global offset table. */ | |
1190 | HOWTO (R_MICROMIPS_CALL16, /* type */ | |
1191 | 0, /* rightshift */ | |
c94cb026 | 1192 | 4, /* size */ |
df58fc94 | 1193 | 16, /* bitsize */ |
0a1b45a2 | 1194 | false, /* pc_relative */ |
df58fc94 RS |
1195 | 0, /* bitpos */ |
1196 | complain_overflow_signed, /* complain_on_overflow */ | |
1197 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1198 | "R_MICROMIPS_CALL16", /* name */ | |
0a1b45a2 | 1199 | true, /* partial_inplace */ |
df58fc94 RS |
1200 | 0x0000ffff, /* src_mask */ |
1201 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1202 | false), /* pcrel_offset */ |
df58fc94 RS |
1203 | |
1204 | EMPTY_HOWTO (143), | |
1205 | EMPTY_HOWTO (144), | |
1206 | ||
1207 | /* Displacement in the global offset table. */ | |
1208 | HOWTO (R_MICROMIPS_GOT_DISP, /* type */ | |
1209 | 0, /* rightshift */ | |
c94cb026 | 1210 | 4, /* size */ |
df58fc94 | 1211 | 16, /* bitsize */ |
0a1b45a2 | 1212 | false, /* pc_relative */ |
df58fc94 RS |
1213 | 0, /* bitpos */ |
1214 | complain_overflow_signed, /* complain_on_overflow */ | |
1215 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1216 | "R_MICROMIPS_GOT_DISP",/* name */ | |
0a1b45a2 | 1217 | true, /* partial_inplace */ |
df58fc94 RS |
1218 | 0x0000ffff, /* src_mask */ |
1219 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1220 | false), /* pcrel_offset */ |
df58fc94 RS |
1221 | |
1222 | /* Displacement to page pointer in the global offset table. */ | |
1223 | HOWTO (R_MICROMIPS_GOT_PAGE, /* type */ | |
1224 | 0, /* rightshift */ | |
c94cb026 | 1225 | 4, /* size */ |
df58fc94 | 1226 | 16, /* bitsize */ |
0a1b45a2 | 1227 | false, /* pc_relative */ |
df58fc94 RS |
1228 | 0, /* bitpos */ |
1229 | complain_overflow_signed, /* complain_on_overflow */ | |
1230 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1231 | "R_MICROMIPS_GOT_PAGE",/* name */ | |
0a1b45a2 | 1232 | true, /* partial_inplace */ |
df58fc94 RS |
1233 | 0x0000ffff, /* src_mask */ |
1234 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1235 | false), /* pcrel_offset */ |
df58fc94 RS |
1236 | |
1237 | /* Offset from page pointer in the global offset table. */ | |
1238 | HOWTO (R_MICROMIPS_GOT_OFST, /* type */ | |
1239 | 0, /* rightshift */ | |
c94cb026 | 1240 | 4, /* size */ |
df58fc94 | 1241 | 16, /* bitsize */ |
0a1b45a2 | 1242 | false, /* pc_relative */ |
df58fc94 RS |
1243 | 0, /* bitpos */ |
1244 | complain_overflow_signed, /* complain_on_overflow */ | |
1245 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1246 | "R_MICROMIPS_GOT_OFST",/* name */ | |
0a1b45a2 | 1247 | true, /* partial_inplace */ |
df58fc94 RS |
1248 | 0x0000ffff, /* src_mask */ |
1249 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1250 | false), /* pcrel_offset */ |
df58fc94 RS |
1251 | |
1252 | /* High 16 bits of displacement in global offset table. */ | |
1253 | HOWTO (R_MICROMIPS_GOT_HI16, /* type */ | |
1254 | 0, /* rightshift */ | |
c94cb026 | 1255 | 4, /* size */ |
df58fc94 | 1256 | 16, /* bitsize */ |
0a1b45a2 | 1257 | false, /* pc_relative */ |
df58fc94 RS |
1258 | 0, /* bitpos */ |
1259 | complain_overflow_dont, /* complain_on_overflow */ | |
1260 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1261 | "R_MICROMIPS_GOT_HI16",/* name */ | |
0a1b45a2 | 1262 | true, /* partial_inplace */ |
df58fc94 RS |
1263 | 0x0000ffff, /* src_mask */ |
1264 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1265 | false), /* pcrel_offset */ |
df58fc94 RS |
1266 | |
1267 | /* Low 16 bits of displacement in global offset table. */ | |
1268 | HOWTO (R_MICROMIPS_GOT_LO16, /* type */ | |
1269 | 0, /* rightshift */ | |
c94cb026 | 1270 | 4, /* size */ |
df58fc94 | 1271 | 16, /* bitsize */ |
0a1b45a2 | 1272 | false, /* pc_relative */ |
df58fc94 RS |
1273 | 0, /* bitpos */ |
1274 | complain_overflow_dont, /* complain_on_overflow */ | |
1275 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1276 | "R_MICROMIPS_GOT_LO16",/* name */ | |
0a1b45a2 | 1277 | true, /* partial_inplace */ |
df58fc94 RS |
1278 | 0x0000ffff, /* src_mask */ |
1279 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1280 | false), /* pcrel_offset */ |
df58fc94 RS |
1281 | |
1282 | /* 64 bit subtraction. Used in the N32 ABI. */ | |
1283 | HOWTO (R_MICROMIPS_SUB, /* type */ | |
1284 | 0, /* rightshift */ | |
c94cb026 | 1285 | 8, /* size */ |
df58fc94 | 1286 | 64, /* bitsize */ |
0a1b45a2 | 1287 | false, /* pc_relative */ |
df58fc94 RS |
1288 | 0, /* bitpos */ |
1289 | complain_overflow_dont, /* complain_on_overflow */ | |
1290 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1291 | "R_MICROMIPS_SUB", /* name */ | |
0a1b45a2 | 1292 | true, /* partial_inplace */ |
df58fc94 RS |
1293 | MINUS_ONE, /* src_mask */ |
1294 | MINUS_ONE, /* dst_mask */ | |
0a1b45a2 | 1295 | false), /* pcrel_offset */ |
df58fc94 RS |
1296 | |
1297 | /* Get the higher value of a 64 bit addend. */ | |
1298 | HOWTO (R_MICROMIPS_HIGHER, /* type */ | |
1299 | 0, /* rightshift */ | |
c94cb026 | 1300 | 4, /* size */ |
df58fc94 | 1301 | 16, /* bitsize */ |
0a1b45a2 | 1302 | false, /* pc_relative */ |
df58fc94 RS |
1303 | 0, /* bitpos */ |
1304 | complain_overflow_dont, /* complain_on_overflow */ | |
1305 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1306 | "R_MICROMIPS_HIGHER", /* name */ | |
0a1b45a2 | 1307 | true, /* partial_inplace */ |
df58fc94 RS |
1308 | 0x0000ffff, /* src_mask */ |
1309 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1310 | false), /* pcrel_offset */ |
df58fc94 RS |
1311 | |
1312 | /* Get the highest value of a 64 bit addend. */ | |
1313 | HOWTO (R_MICROMIPS_HIGHEST, /* type */ | |
1314 | 0, /* rightshift */ | |
c94cb026 | 1315 | 4, /* size */ |
df58fc94 | 1316 | 16, /* bitsize */ |
0a1b45a2 | 1317 | false, /* pc_relative */ |
df58fc94 RS |
1318 | 0, /* bitpos */ |
1319 | complain_overflow_dont, /* complain_on_overflow */ | |
1320 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1321 | "R_MICROMIPS_HIGHEST", /* name */ | |
0a1b45a2 | 1322 | true, /* partial_inplace */ |
df58fc94 RS |
1323 | 0x0000ffff, /* src_mask */ |
1324 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1325 | false), /* pcrel_offset */ |
df58fc94 RS |
1326 | |
1327 | /* High 16 bits of displacement in global offset table. */ | |
1328 | HOWTO (R_MICROMIPS_CALL_HI16, /* type */ | |
1329 | 0, /* rightshift */ | |
c94cb026 | 1330 | 4, /* size */ |
df58fc94 | 1331 | 16, /* bitsize */ |
0a1b45a2 | 1332 | false, /* pc_relative */ |
df58fc94 RS |
1333 | 0, /* bitpos */ |
1334 | complain_overflow_dont, /* complain_on_overflow */ | |
1335 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1336 | "R_MICROMIPS_CALL_HI16",/* name */ | |
0a1b45a2 | 1337 | true, /* partial_inplace */ |
df58fc94 RS |
1338 | 0x0000ffff, /* src_mask */ |
1339 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1340 | false), /* pcrel_offset */ |
df58fc94 RS |
1341 | |
1342 | /* Low 16 bits of displacement in global offset table. */ | |
1343 | HOWTO (R_MICROMIPS_CALL_LO16, /* type */ | |
1344 | 0, /* rightshift */ | |
c94cb026 | 1345 | 4, /* size */ |
df58fc94 | 1346 | 16, /* bitsize */ |
0a1b45a2 | 1347 | false, /* pc_relative */ |
df58fc94 RS |
1348 | 0, /* bitpos */ |
1349 | complain_overflow_dont, /* complain_on_overflow */ | |
1350 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1351 | "R_MICROMIPS_CALL_LO16",/* name */ | |
0a1b45a2 | 1352 | true, /* partial_inplace */ |
df58fc94 RS |
1353 | 0x0000ffff, /* src_mask */ |
1354 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1355 | false), /* pcrel_offset */ |
df58fc94 RS |
1356 | |
1357 | /* Section displacement. */ | |
1358 | HOWTO (R_MICROMIPS_SCN_DISP, /* type */ | |
1359 | 0, /* rightshift */ | |
c94cb026 | 1360 | 4, /* size */ |
df58fc94 | 1361 | 32, /* bitsize */ |
0a1b45a2 | 1362 | false, /* pc_relative */ |
df58fc94 RS |
1363 | 0, /* bitpos */ |
1364 | complain_overflow_dont, /* complain_on_overflow */ | |
1365 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1366 | "R_MICROMIPS_SCN_DISP",/* name */ | |
0a1b45a2 | 1367 | true, /* partial_inplace */ |
df58fc94 RS |
1368 | 0xffffffff, /* src_mask */ |
1369 | 0xffffffff, /* dst_mask */ | |
0a1b45a2 | 1370 | false), /* pcrel_offset */ |
df58fc94 RS |
1371 | |
1372 | /* Protected jump conversion. This is an optimization hint. No | |
1373 | relocation is required for correctness. */ | |
1374 | HOWTO (R_MICROMIPS_JALR, /* type */ | |
1375 | 0, /* rightshift */ | |
c94cb026 | 1376 | 4, /* size */ |
df58fc94 | 1377 | 32, /* bitsize */ |
0a1b45a2 | 1378 | false, /* pc_relative */ |
df58fc94 RS |
1379 | 0, /* bitpos */ |
1380 | complain_overflow_dont, /* complain_on_overflow */ | |
1381 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1382 | "R_MICROMIPS_JALR", /* name */ | |
0a1b45a2 | 1383 | false, /* partial_inplace */ |
df58fc94 RS |
1384 | 0x00000000, /* src_mask */ |
1385 | 0x00000000, /* dst_mask */ | |
0a1b45a2 | 1386 | false), /* pcrel_offset */ |
df58fc94 RS |
1387 | |
1388 | /* Low 16 bits of symbol value. Note that the high 16 bits of symbol values | |
1389 | must be zero. This is used for relaxation. */ | |
1390 | HOWTO (R_MICROMIPS_HI0_LO16, /* type */ | |
1391 | 0, /* rightshift */ | |
c94cb026 | 1392 | 4, /* size */ |
df58fc94 | 1393 | 16, /* bitsize */ |
0a1b45a2 | 1394 | false, /* pc_relative */ |
df58fc94 RS |
1395 | 0, /* bitpos */ |
1396 | complain_overflow_dont, /* complain_on_overflow */ | |
1397 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1398 | "R_MICROMIPS_HI0_LO16",/* name */ | |
0a1b45a2 | 1399 | true, /* partial_inplace */ |
df58fc94 RS |
1400 | 0x0000ffff, /* src_mask */ |
1401 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1402 | false), /* pcrel_offset */ |
df58fc94 RS |
1403 | |
1404 | EMPTY_HOWTO (158), | |
1405 | EMPTY_HOWTO (159), | |
1406 | EMPTY_HOWTO (160), | |
1407 | EMPTY_HOWTO (161), | |
1408 | ||
1409 | /* TLS general dynamic variable reference. */ | |
1410 | HOWTO (R_MICROMIPS_TLS_GD, /* type */ | |
1411 | 0, /* rightshift */ | |
c94cb026 | 1412 | 4, /* size */ |
df58fc94 | 1413 | 16, /* bitsize */ |
0a1b45a2 | 1414 | false, /* pc_relative */ |
df58fc94 RS |
1415 | 0, /* bitpos */ |
1416 | complain_overflow_signed, /* complain_on_overflow */ | |
1417 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1418 | "R_MICROMIPS_TLS_GD", /* name */ | |
0a1b45a2 | 1419 | true, /* partial_inplace */ |
df58fc94 RS |
1420 | 0x0000ffff, /* src_mask */ |
1421 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1422 | false), /* pcrel_offset */ |
df58fc94 RS |
1423 | |
1424 | /* TLS local dynamic variable reference. */ | |
1425 | HOWTO (R_MICROMIPS_TLS_LDM, /* type */ | |
1426 | 0, /* rightshift */ | |
c94cb026 | 1427 | 4, /* size */ |
df58fc94 | 1428 | 16, /* bitsize */ |
0a1b45a2 | 1429 | false, /* pc_relative */ |
df58fc94 RS |
1430 | 0, /* bitpos */ |
1431 | complain_overflow_signed, /* complain_on_overflow */ | |
1432 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1433 | "R_MICROMIPS_TLS_LDM", /* name */ | |
0a1b45a2 | 1434 | true, /* partial_inplace */ |
df58fc94 RS |
1435 | 0x0000ffff, /* src_mask */ |
1436 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1437 | false), /* pcrel_offset */ |
df58fc94 RS |
1438 | |
1439 | /* TLS local dynamic offset. */ | |
1440 | HOWTO (R_MICROMIPS_TLS_DTPREL_HI16, /* type */ | |
1441 | 0, /* rightshift */ | |
c94cb026 | 1442 | 4, /* size */ |
df58fc94 | 1443 | 16, /* bitsize */ |
0a1b45a2 | 1444 | false, /* pc_relative */ |
df58fc94 RS |
1445 | 0, /* bitpos */ |
1446 | complain_overflow_signed, /* complain_on_overflow */ | |
1447 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1448 | "R_MICROMIPS_TLS_DTPREL_HI16", /* name */ | |
0a1b45a2 | 1449 | true, /* partial_inplace */ |
df58fc94 RS |
1450 | 0x0000ffff, /* src_mask */ |
1451 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1452 | false), /* pcrel_offset */ |
df58fc94 RS |
1453 | |
1454 | /* TLS local dynamic offset. */ | |
1455 | HOWTO (R_MICROMIPS_TLS_DTPREL_LO16, /* type */ | |
1456 | 0, /* rightshift */ | |
c94cb026 | 1457 | 4, /* size */ |
df58fc94 | 1458 | 16, /* bitsize */ |
0a1b45a2 | 1459 | false, /* pc_relative */ |
df58fc94 RS |
1460 | 0, /* bitpos */ |
1461 | complain_overflow_signed, /* complain_on_overflow */ | |
1462 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1463 | "R_MICROMIPS_TLS_DTPREL_LO16", /* name */ | |
0a1b45a2 | 1464 | true, /* partial_inplace */ |
df58fc94 RS |
1465 | 0x0000ffff, /* src_mask */ |
1466 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1467 | false), /* pcrel_offset */ |
df58fc94 RS |
1468 | |
1469 | /* TLS thread pointer offset. */ | |
1470 | HOWTO (R_MICROMIPS_TLS_GOTTPREL, /* type */ | |
1471 | 0, /* rightshift */ | |
c94cb026 | 1472 | 4, /* size */ |
df58fc94 | 1473 | 16, /* bitsize */ |
0a1b45a2 | 1474 | false, /* pc_relative */ |
df58fc94 RS |
1475 | 0, /* bitpos */ |
1476 | complain_overflow_signed, /* complain_on_overflow */ | |
1477 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1478 | "R_MICROMIPS_TLS_GOTTPREL", /* name */ | |
0a1b45a2 | 1479 | true, /* partial_inplace */ |
df58fc94 RS |
1480 | 0x0000ffff, /* src_mask */ |
1481 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1482 | false), /* pcrel_offset */ |
df58fc94 RS |
1483 | |
1484 | EMPTY_HOWTO (167), | |
1485 | EMPTY_HOWTO (168), | |
1486 | ||
1487 | /* TLS thread pointer offset. */ | |
1488 | HOWTO (R_MICROMIPS_TLS_TPREL_HI16, /* type */ | |
1489 | 0, /* rightshift */ | |
c94cb026 | 1490 | 4, /* size */ |
df58fc94 | 1491 | 16, /* bitsize */ |
0a1b45a2 | 1492 | false, /* pc_relative */ |
df58fc94 RS |
1493 | 0, /* bitpos */ |
1494 | complain_overflow_signed, /* complain_on_overflow */ | |
1495 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1496 | "R_MICROMIPS_TLS_TPREL_HI16", /* name */ | |
0a1b45a2 | 1497 | true, /* partial_inplace */ |
df58fc94 RS |
1498 | 0x0000ffff, /* src_mask */ |
1499 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1500 | false), /* pcrel_offset */ |
df58fc94 RS |
1501 | |
1502 | /* TLS thread pointer offset. */ | |
1503 | HOWTO (R_MICROMIPS_TLS_TPREL_LO16, /* type */ | |
1504 | 0, /* rightshift */ | |
c94cb026 | 1505 | 4, /* size */ |
df58fc94 | 1506 | 16, /* bitsize */ |
0a1b45a2 | 1507 | false, /* pc_relative */ |
df58fc94 RS |
1508 | 0, /* bitpos */ |
1509 | complain_overflow_signed, /* complain_on_overflow */ | |
1510 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1511 | "R_MICROMIPS_TLS_TPREL_LO16", /* name */ | |
0a1b45a2 | 1512 | true, /* partial_inplace */ |
df58fc94 RS |
1513 | 0x0000ffff, /* src_mask */ |
1514 | 0x0000ffff, /* dst_mask */ | |
0a1b45a2 | 1515 | false), /* pcrel_offset */ |
df58fc94 RS |
1516 | |
1517 | EMPTY_HOWTO (171), | |
1518 | ||
1519 | /* GP- and PC-relative relocations. */ | |
1520 | HOWTO (R_MICROMIPS_GPREL7_S2, /* type */ | |
1521 | 2, /* rightshift */ | |
c94cb026 | 1522 | 2, /* size */ |
df58fc94 | 1523 | 7, /* bitsize */ |
0a1b45a2 | 1524 | false, /* pc_relative */ |
df58fc94 RS |
1525 | 0, /* bitpos */ |
1526 | complain_overflow_signed, /* complain_on_overflow */ | |
1527 | _bfd_mips_elf32_gprel16_reloc, /* special_function */ | |
1528 | "R_MICROMIPS_GPREL7_S2", /* name */ | |
0a1b45a2 | 1529 | true, /* partial_inplace */ |
df58fc94 RS |
1530 | 0x0000007f, /* src_mask */ |
1531 | 0x0000007f, /* dst_mask */ | |
0a1b45a2 | 1532 | false), /* pcrel_offset */ |
df58fc94 RS |
1533 | |
1534 | HOWTO (R_MICROMIPS_PC23_S2, /* type */ | |
1535 | 2, /* rightshift */ | |
c94cb026 | 1536 | 4, /* size */ |
df58fc94 | 1537 | 23, /* bitsize */ |
0a1b45a2 | 1538 | true, /* pc_relative */ |
df58fc94 RS |
1539 | 0, /* bitpos */ |
1540 | complain_overflow_signed, /* complain_on_overflow */ | |
1541 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1542 | "R_MICROMIPS_PC23_S2", /* name */ | |
0a1b45a2 | 1543 | true, /* partial_inplace */ |
df58fc94 RS |
1544 | 0x007fffff, /* src_mask */ |
1545 | 0x007fffff, /* dst_mask */ | |
0a1b45a2 | 1546 | true), /* pcrel_offset */ |
df58fc94 RS |
1547 | }; |
1548 | ||
c6e90b02 TS |
1549 | /* 16 bit offset for pc-relative branches. */ |
1550 | static reloc_howto_type elf_mips_gnu_rel16_s2 = | |
1551 | HOWTO (R_MIPS_GNU_REL16_S2, /* type */ | |
1552 | 2, /* rightshift */ | |
c94cb026 | 1553 | 4, /* size */ |
252b5132 | 1554 | 16, /* bitsize */ |
0a1b45a2 | 1555 | true, /* pc_relative */ |
252b5132 RH |
1556 | 0, /* bitpos */ |
1557 | complain_overflow_signed, /* complain_on_overflow */ | |
30ac9238 | 1558 | _bfd_mips_elf_generic_reloc, /* special_function */ |
c6e90b02 | 1559 | "R_MIPS_GNU_REL16_S2", /* name */ |
0a1b45a2 | 1560 | true, /* partial_inplace */ |
c6e90b02 TS |
1561 | 0xffff, /* src_mask */ |
1562 | 0xffff, /* dst_mask */ | |
0a1b45a2 | 1563 | true); /* pcrel_offset */ |
252b5132 | 1564 | |
092dcd75 | 1565 | /* 32 bit pc-relative. This was a GNU extension used by embedded-PIC. |
0c9663cb MR |
1566 | It was co-opted by mips-linux for exception-handling data. GCC stopped |
1567 | using it in May, 2004, then started using it again for compact unwind | |
1568 | tables. */ | |
092dcd75 CD |
1569 | static reloc_howto_type elf_mips_gnu_pcrel32 = |
1570 | HOWTO (R_MIPS_PC32, /* type */ | |
1571 | 0, /* rightshift */ | |
c94cb026 | 1572 | 4, /* size */ |
092dcd75 | 1573 | 32, /* bitsize */ |
0a1b45a2 | 1574 | true, /* pc_relative */ |
092dcd75 CD |
1575 | 0, /* bitpos */ |
1576 | complain_overflow_signed, /* complain_on_overflow */ | |
1577 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1578 | "R_MIPS_PC32", /* name */ | |
0a1b45a2 | 1579 | true, /* partial_inplace */ |
092dcd75 CD |
1580 | 0xffffffff, /* src_mask */ |
1581 | 0xffffffff, /* dst_mask */ | |
0a1b45a2 | 1582 | true); /* pcrel_offset */ |
092dcd75 | 1583 | |
c6e90b02 TS |
1584 | /* GNU extension to record C++ vtable hierarchy */ |
1585 | static reloc_howto_type elf_mips_gnu_vtinherit_howto = | |
1586 | HOWTO (R_MIPS_GNU_VTINHERIT, /* type */ | |
252b5132 | 1587 | 0, /* rightshift */ |
c94cb026 | 1588 | 4, /* size */ |
c6e90b02 | 1589 | 0, /* bitsize */ |
0a1b45a2 | 1590 | false, /* pc_relative */ |
252b5132 | 1591 | 0, /* bitpos */ |
c6e90b02 TS |
1592 | complain_overflow_dont, /* complain_on_overflow */ |
1593 | NULL, /* special_function */ | |
1594 | "R_MIPS_GNU_VTINHERIT", /* name */ | |
0a1b45a2 | 1595 | false, /* partial_inplace */ |
d75bc93d | 1596 | 0, /* src_mask */ |
c6e90b02 | 1597 | 0, /* dst_mask */ |
0a1b45a2 | 1598 | false); /* pcrel_offset */ |
252b5132 | 1599 | |
c6e90b02 TS |
1600 | /* GNU extension to record C++ vtable member usage */ |
1601 | static reloc_howto_type elf_mips_gnu_vtentry_howto = | |
1602 | HOWTO (R_MIPS_GNU_VTENTRY, /* type */ | |
252b5132 | 1603 | 0, /* rightshift */ |
c94cb026 | 1604 | 4, /* size */ |
c6e90b02 | 1605 | 0, /* bitsize */ |
0a1b45a2 | 1606 | false, /* pc_relative */ |
252b5132 RH |
1607 | 0, /* bitpos */ |
1608 | complain_overflow_dont, /* complain_on_overflow */ | |
c6e90b02 TS |
1609 | _bfd_elf_rel_vtable_reloc_fn, /* special_function */ |
1610 | "R_MIPS_GNU_VTENTRY", /* name */ | |
0a1b45a2 | 1611 | false, /* partial_inplace */ |
d75bc93d | 1612 | 0, /* src_mask */ |
c6e90b02 | 1613 | 0, /* dst_mask */ |
0a1b45a2 | 1614 | false); /* pcrel_offset */ |
252b5132 | 1615 | |
861fb55a DJ |
1616 | /* Originally a VxWorks extension, but now used for other systems too. */ |
1617 | static reloc_howto_type elf_mips_copy_howto = | |
1618 | HOWTO (R_MIPS_COPY, /* type */ | |
1619 | 0, /* rightshift */ | |
5d0feb98 | 1620 | 0, /* this one is variable size */ |
861fb55a | 1621 | 0, /* bitsize */ |
0a1b45a2 | 1622 | false, /* pc_relative */ |
861fb55a DJ |
1623 | 0, /* bitpos */ |
1624 | complain_overflow_bitfield, /* complain_on_overflow */ | |
d150b1a2 | 1625 | _bfd_mips_elf_generic_reloc, /* special_function */ |
861fb55a | 1626 | "R_MIPS_COPY", /* name */ |
0a1b45a2 | 1627 | false, /* partial_inplace */ |
07d6d2b8 AM |
1628 | 0x0, /* src_mask */ |
1629 | 0x0, /* dst_mask */ | |
0a1b45a2 | 1630 | false); /* pcrel_offset */ |
861fb55a DJ |
1631 | |
1632 | /* Originally a VxWorks extension, but now used for other systems too. */ | |
1633 | static reloc_howto_type elf_mips_jump_slot_howto = | |
1634 | HOWTO (R_MIPS_JUMP_SLOT, /* type */ | |
1635 | 0, /* rightshift */ | |
c94cb026 | 1636 | 4, /* size */ |
861fb55a | 1637 | 32, /* bitsize */ |
0a1b45a2 | 1638 | false, /* pc_relative */ |
861fb55a DJ |
1639 | 0, /* bitpos */ |
1640 | complain_overflow_bitfield, /* complain_on_overflow */ | |
d150b1a2 | 1641 | _bfd_mips_elf_generic_reloc, /* special_function */ |
861fb55a | 1642 | "R_MIPS_JUMP_SLOT", /* name */ |
0a1b45a2 | 1643 | false, /* partial_inplace */ |
07d6d2b8 AM |
1644 | 0x0, /* src_mask */ |
1645 | 0x0, /* dst_mask */ | |
0a1b45a2 | 1646 | false); /* pcrel_offset */ |
861fb55a | 1647 | |
067ec077 CM |
1648 | /* Used in EH tables. */ |
1649 | static reloc_howto_type elf_mips_eh_howto = | |
1650 | HOWTO (R_MIPS_EH, /* type */ | |
1651 | 0, /* rightshift */ | |
c94cb026 | 1652 | 4, /* size */ |
067ec077 | 1653 | 32, /* bitsize */ |
0a1b45a2 | 1654 | false, /* pc_relative */ |
067ec077 CM |
1655 | 0, /* bitpos */ |
1656 | complain_overflow_signed, /* complain_on_overflow */ | |
1657 | _bfd_mips_elf_generic_reloc, /* special_function */ | |
1658 | "R_MIPS_EH", /* name */ | |
0a1b45a2 | 1659 | true, /* partial_inplace */ |
067ec077 | 1660 | 0xffffffff, /* src_mask */ |
07d6d2b8 | 1661 | 0xffffffff, /* dst_mask */ |
0a1b45a2 | 1662 | false); /* pcrel_offset */ |
067ec077 | 1663 | |
b34976b6 | 1664 | /* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a |
c6e90b02 | 1665 | dangerous relocation. */ |
252b5132 | 1666 | |
0a1b45a2 | 1667 | static bool |
11a2be4d | 1668 | mips_elf_assign_gp (bfd *output_bfd, bfd_vma *pgp) |
252b5132 | 1669 | { |
c6e90b02 TS |
1670 | unsigned int count; |
1671 | asymbol **sym; | |
1672 | unsigned int i; | |
e92d460e | 1673 | |
c6e90b02 TS |
1674 | /* If we've already figured out what GP will be, just return it. */ |
1675 | *pgp = _bfd_get_gp_value (output_bfd); | |
1676 | if (*pgp) | |
0a1b45a2 | 1677 | return true; |
c6e90b02 TS |
1678 | |
1679 | count = bfd_get_symcount (output_bfd); | |
1680 | sym = bfd_get_outsymbols (output_bfd); | |
252b5132 | 1681 | |
c6e90b02 TS |
1682 | /* The linker script will have created a symbol named `_gp' with the |
1683 | appropriate value. */ | |
11a2be4d | 1684 | if (sym == NULL) |
c6e90b02 TS |
1685 | i = count; |
1686 | else | |
252b5132 | 1687 | { |
c6e90b02 TS |
1688 | for (i = 0; i < count; i++, sym++) |
1689 | { | |
1690 | register const char *name; | |
1691 | ||
1692 | name = bfd_asymbol_name (*sym); | |
1693 | if (*name == '_' && strcmp (name, "_gp") == 0) | |
1694 | { | |
1695 | *pgp = bfd_asymbol_value (*sym); | |
1696 | _bfd_set_gp_value (output_bfd, *pgp); | |
1697 | break; | |
1698 | } | |
1699 | } | |
252b5132 RH |
1700 | } |
1701 | ||
c6e90b02 | 1702 | if (i >= count) |
252b5132 | 1703 | { |
c6e90b02 TS |
1704 | /* Only get the error once. */ |
1705 | *pgp = 4; | |
1706 | _bfd_set_gp_value (output_bfd, *pgp); | |
0a1b45a2 | 1707 | return false; |
252b5132 RH |
1708 | } |
1709 | ||
0a1b45a2 | 1710 | return true; |
252b5132 RH |
1711 | } |
1712 | ||
c6e90b02 TS |
1713 | /* We have to figure out the gp value, so that we can adjust the |
1714 | symbol value correctly. We look up the symbol _gp in the output | |
1715 | BFD. If we can't find it, we're stuck. We cache it in the ELF | |
1716 | target data. We don't need to adjust the symbol value for an | |
1049f94e | 1717 | external symbol if we are producing relocatable output. */ |
252b5132 | 1718 | |
c6e90b02 | 1719 | static bfd_reloc_status_type |
0a1b45a2 | 1720 | mips_elf_final_gp (bfd *output_bfd, asymbol *symbol, bool relocatable, |
11a2be4d | 1721 | char **error_message, bfd_vma *pgp) |
252b5132 | 1722 | { |
6b8b24bb | 1723 | if (output_bfd == NULL) |
252b5132 | 1724 | { |
c6e90b02 TS |
1725 | *pgp = 0; |
1726 | return bfd_reloc_undefined; | |
252b5132 RH |
1727 | } |
1728 | ||
c6e90b02 TS |
1729 | *pgp = _bfd_get_gp_value (output_bfd); |
1730 | if (*pgp == 0 | |
1049f94e | 1731 | && (! relocatable |
c6e90b02 | 1732 | || (symbol->flags & BSF_SECTION_SYM) != 0)) |
252b5132 | 1733 | { |
1049f94e | 1734 | if (relocatable) |
252b5132 | 1735 | { |
c6e90b02 | 1736 | /* Make up a value. */ |
453f5985 | 1737 | *pgp = symbol->section->output_section->vma /*+ 0x4000*/; |
c6e90b02 | 1738 | _bfd_set_gp_value (output_bfd, *pgp); |
252b5132 | 1739 | } |
c6e90b02 | 1740 | else if (!mips_elf_assign_gp (output_bfd, pgp)) |
252b5132 | 1741 | { |
c6e90b02 TS |
1742 | *error_message = |
1743 | (char *) _("GP relative relocation when _gp not defined"); | |
1744 | return bfd_reloc_dangerous; | |
252b5132 | 1745 | } |
252b5132 RH |
1746 | } |
1747 | ||
c6e90b02 TS |
1748 | return bfd_reloc_ok; |
1749 | } | |
252b5132 | 1750 | |
c6e90b02 TS |
1751 | /* Do a R_MIPS_GPREL16 relocation. This is a 16 bit value which must |
1752 | become the offset from the gp register. This function also handles | |
1753 | R_MIPS_LITERAL relocations, although those can be handled more | |
1754 | cleverly because the entries in the .lit8 and .lit4 sections can be | |
1755 | merged. */ | |
252b5132 | 1756 | |
c6e90b02 | 1757 | bfd_reloc_status_type |
11a2be4d RS |
1758 | _bfd_mips_elf32_gprel16_reloc (bfd *abfd, arelent *reloc_entry, |
1759 | asymbol *symbol, void *data, | |
1760 | asection *input_section, bfd *output_bfd, | |
1761 | char **error_message) | |
c6e90b02 | 1762 | { |
0a1b45a2 | 1763 | bool relocatable; |
c6e90b02 | 1764 | bfd_reloc_status_type ret; |
df58fc94 | 1765 | bfd_byte *location; |
c6e90b02 | 1766 | bfd_vma gp; |
252b5132 | 1767 | |
df58fc94 RS |
1768 | /* R_MIPS_LITERAL/R_MICROMIPS_LITERAL relocations are defined for local |
1769 | symbols only. */ | |
1770 | if (literal_reloc_p (reloc_entry->howto->type) | |
254f0426 MR |
1771 | && output_bfd != NULL |
1772 | && (symbol->flags & BSF_SECTION_SYM) == 0 | |
1773 | && (symbol->flags & BSF_LOCAL) != 0) | |
1774 | { | |
1775 | *error_message = (char *) | |
1776 | _("literal relocation occurs for an external symbol"); | |
1777 | return bfd_reloc_outofrange; | |
1778 | } | |
1779 | ||
11a2be4d | 1780 | if (output_bfd != NULL) |
0a1b45a2 | 1781 | relocatable = true; |
c6e90b02 TS |
1782 | else |
1783 | { | |
0a1b45a2 | 1784 | relocatable = false; |
0613c330 | 1785 | output_bfd = input_section->output_section->owner; |
c6e90b02 | 1786 | } |
252b5132 | 1787 | |
1049f94e | 1788 | ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, |
c6e90b02 TS |
1789 | &gp); |
1790 | if (ret != bfd_reloc_ok) | |
1791 | return ret; | |
252b5132 | 1792 | |
73425813 AM |
1793 | if (!_bfd_mips_reloc_offset_in_range (abfd, input_section, reloc_entry, |
1794 | check_shuffle)) | |
1795 | return bfd_reloc_outofrange; | |
1796 | ||
df58fc94 | 1797 | location = (bfd_byte *) data + reloc_entry->address; |
0a1b45a2 | 1798 | _bfd_mips_elf_reloc_unshuffle (abfd, reloc_entry->howto->type, false, |
df58fc94 RS |
1799 | location); |
1800 | ret = _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, | |
1801 | input_section, relocatable, | |
1802 | data, gp); | |
1803 | _bfd_mips_elf_reloc_shuffle (abfd, reloc_entry->howto->type, !relocatable, | |
1804 | location); | |
1805 | ||
1806 | return ret; | |
c6e90b02 | 1807 | } |
252b5132 | 1808 | |
cb7394f2 TS |
1809 | /* Do a R_MIPS_GPREL32 relocation. This is a 32 bit value which must |
1810 | become the offset from the gp register. */ | |
252b5132 | 1811 | |
c6e90b02 | 1812 | static bfd_reloc_status_type |
11a2be4d RS |
1813 | mips_elf_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, |
1814 | void *data, asection *input_section, bfd *output_bfd, | |
1815 | char **error_message) | |
c6e90b02 | 1816 | { |
0a1b45a2 | 1817 | bool relocatable; |
c6e90b02 TS |
1818 | bfd_reloc_status_type ret; |
1819 | bfd_vma gp; | |
252b5132 | 1820 | |
765f2ef6 MR |
1821 | /* R_MIPS_GPREL32 relocations are defined for local symbols only. */ |
1822 | if (output_bfd != NULL | |
1823 | && (symbol->flags & BSF_SECTION_SYM) == 0 | |
1824 | && (symbol->flags & BSF_LOCAL) != 0) | |
1825 | { | |
1826 | *error_message = (char *) | |
1827 | _("32bits gp relative relocation occurs for an external symbol"); | |
1828 | return bfd_reloc_outofrange; | |
1829 | } | |
1830 | ||
11a2be4d | 1831 | if (output_bfd != NULL) |
0a1b45a2 | 1832 | relocatable = true; |
c6e90b02 TS |
1833 | else |
1834 | { | |
0a1b45a2 | 1835 | relocatable = false; |
0613c330 | 1836 | output_bfd = input_section->output_section->owner; |
c6e90b02 | 1837 | } |
252b5132 | 1838 | |
1049f94e | 1839 | ret = mips_elf_final_gp (output_bfd, symbol, relocatable, |
a7ebbfdf TS |
1840 | error_message, &gp); |
1841 | if (ret != bfd_reloc_ok) | |
1842 | return ret; | |
1843 | ||
c6e90b02 | 1844 | return gprel32_with_gp (abfd, symbol, reloc_entry, input_section, |
1049f94e | 1845 | relocatable, data, gp); |
c6e90b02 | 1846 | } |
252b5132 | 1847 | |
c6e90b02 | 1848 | static bfd_reloc_status_type |
11a2be4d | 1849 | gprel32_with_gp (bfd *abfd, asymbol *symbol, arelent *reloc_entry, |
0a1b45a2 | 1850 | asection *input_section, bool relocatable, |
11a2be4d | 1851 | void *data, bfd_vma gp) |
c6e90b02 TS |
1852 | { |
1853 | bfd_vma relocation; | |
a7ebbfdf | 1854 | bfd_vma val; |
252b5132 | 1855 | |
c6e90b02 TS |
1856 | if (bfd_is_com_section (symbol->section)) |
1857 | relocation = 0; | |
1858 | else | |
1859 | relocation = symbol->value; | |
252b5132 | 1860 | |
c6e90b02 TS |
1861 | relocation += symbol->section->output_section->vma; |
1862 | relocation += symbol->section->output_offset; | |
252b5132 | 1863 | |
73425813 AM |
1864 | if (!_bfd_mips_reloc_offset_in_range (abfd, input_section, reloc_entry, |
1865 | check_inplace)) | |
c6e90b02 | 1866 | return bfd_reloc_outofrange; |
252b5132 | 1867 | |
c6e90b02 | 1868 | /* Set val to the offset into the section or symbol. */ |
a7ebbfdf TS |
1869 | val = reloc_entry->addend; |
1870 | ||
1871 | if (reloc_entry->howto->partial_inplace) | |
1872 | val += bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); | |
252b5132 | 1873 | |
c6e90b02 | 1874 | /* Adjust val for the final section location and GP value. If we |
1049f94e | 1875 | are producing relocatable output, we don't want to do this for |
c6e90b02 | 1876 | an external symbol. */ |
1049f94e | 1877 | if (! relocatable |
c6e90b02 TS |
1878 | || (symbol->flags & BSF_SECTION_SYM) != 0) |
1879 | val += relocation - gp; | |
252b5132 | 1880 | |
a7ebbfdf TS |
1881 | if (reloc_entry->howto->partial_inplace) |
1882 | bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address); | |
1883 | else | |
1884 | reloc_entry->addend = val; | |
c6142e5d | 1885 | |
1049f94e | 1886 | if (relocatable) |
c6e90b02 | 1887 | reloc_entry->address += input_section->output_offset; |
252b5132 | 1888 | |
c6e90b02 | 1889 | return bfd_reloc_ok; |
252b5132 RH |
1890 | } |
1891 | ||
c6e90b02 TS |
1892 | /* Handle a 64 bit reloc in a 32 bit MIPS ELF file. These are |
1893 | generated when addresses are 64 bits. The upper 32 bits are a simple | |
1894 | sign extension. */ | |
7403cb63 | 1895 | |
c6e90b02 | 1896 | static bfd_reloc_status_type |
30ac9238 RS |
1897 | mips32_64bit_reloc (bfd *abfd, arelent *reloc_entry, |
1898 | asymbol *symbol ATTRIBUTE_UNUSED, | |
1899 | void *data, asection *input_section, | |
1900 | bfd *output_bfd, char **error_message) | |
7403cb63 | 1901 | { |
c6e90b02 TS |
1902 | bfd_reloc_status_type r; |
1903 | arelent reloc32; | |
1904 | unsigned long val; | |
1905 | bfd_size_type addr; | |
7403cb63 | 1906 | |
c6e90b02 TS |
1907 | /* Do a normal 32 bit relocation on the lower 32 bits. */ |
1908 | reloc32 = *reloc_entry; | |
1909 | if (bfd_big_endian (abfd)) | |
1910 | reloc32.address += 4; | |
1911 | reloc32.howto = &elf_mips_howto_table_rel[R_MIPS_32]; | |
1912 | r = bfd_perform_relocation (abfd, &reloc32, data, input_section, | |
1913 | output_bfd, error_message); | |
be3ccd9c | 1914 | |
c6e90b02 TS |
1915 | /* Sign extend into the upper 32 bits. */ |
1916 | val = bfd_get_32 (abfd, (bfd_byte *) data + reloc32.address); | |
1917 | if ((val & 0x80000000) != 0) | |
1918 | val = 0xffffffff; | |
1919 | else | |
1920 | val = 0; | |
1921 | addr = reloc_entry->address; | |
1922 | if (bfd_little_endian (abfd)) | |
1923 | addr += 4; | |
11a2be4d | 1924 | bfd_put_32 (abfd, val, (bfd_byte *) data + addr); |
c6e90b02 TS |
1925 | |
1926 | return r; | |
7403cb63 MM |
1927 | } |
1928 | ||
c6e90b02 | 1929 | /* Handle a mips16 GP relative reloc. */ |
252b5132 | 1930 | |
c6e90b02 | 1931 | static bfd_reloc_status_type |
11a2be4d RS |
1932 | mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, |
1933 | void *data, asection *input_section, bfd *output_bfd, | |
1934 | char **error_message) | |
c6e90b02 | 1935 | { |
0a1b45a2 | 1936 | bool relocatable; |
c6e90b02 | 1937 | bfd_reloc_status_type ret; |
d6f16593 | 1938 | bfd_byte *location; |
c6e90b02 | 1939 | bfd_vma gp; |
252b5132 | 1940 | |
a7ebbfdf TS |
1941 | /* If we're relocating, and this is an external symbol, we don't want |
1942 | to change anything. */ | |
c6e90b02 TS |
1943 | if (output_bfd != NULL |
1944 | && (symbol->flags & BSF_SECTION_SYM) == 0 | |
a7ebbfdf | 1945 | && (symbol->flags & BSF_LOCAL) != 0) |
c6e90b02 TS |
1946 | { |
1947 | reloc_entry->address += input_section->output_offset; | |
1948 | return bfd_reloc_ok; | |
1949 | } | |
252b5132 | 1950 | |
c6e90b02 | 1951 | if (output_bfd != NULL) |
0a1b45a2 | 1952 | relocatable = true; |
c6e90b02 TS |
1953 | else |
1954 | { | |
0a1b45a2 | 1955 | relocatable = false; |
0613c330 | 1956 | output_bfd = input_section->output_section->owner; |
252b5132 RH |
1957 | } |
1958 | ||
1049f94e | 1959 | ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, |
c6e90b02 TS |
1960 | &gp); |
1961 | if (ret != bfd_reloc_ok) | |
1962 | return ret; | |
252b5132 | 1963 | |
73425813 AM |
1964 | if (!_bfd_mips_reloc_offset_in_range (abfd, input_section, reloc_entry, |
1965 | check_shuffle)) | |
1966 | return bfd_reloc_outofrange; | |
1967 | ||
d6f16593 | 1968 | location = (bfd_byte *) data + reloc_entry->address; |
0a1b45a2 | 1969 | _bfd_mips_elf_reloc_unshuffle (abfd, reloc_entry->howto->type, false, |
df58fc94 | 1970 | location); |
d6f16593 MR |
1971 | ret = _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, |
1972 | input_section, relocatable, | |
1973 | data, gp); | |
df58fc94 RS |
1974 | _bfd_mips_elf_reloc_shuffle (abfd, reloc_entry->howto->type, !relocatable, |
1975 | location); | |
a7ebbfdf | 1976 | |
d6f16593 | 1977 | return ret; |
c6e90b02 | 1978 | } |
7403cb63 | 1979 | |
c6e90b02 | 1980 | /* A mapping from BFD reloc types to MIPS ELF reloc types. */ |
252b5132 | 1981 | |
c6e90b02 | 1982 | struct elf_reloc_map { |
cb7394f2 TS |
1983 | bfd_reloc_code_real_type bfd_val; |
1984 | enum elf_mips_reloc_type elf_val; | |
c6e90b02 | 1985 | }; |
252b5132 | 1986 | |
c6e90b02 TS |
1987 | static const struct elf_reloc_map mips_reloc_map[] = |
1988 | { | |
28458e7e | 1989 | { BFD_RELOC_NONE, R_MIPS_NONE }, |
d712f276 | 1990 | { BFD_RELOC_MIPS_16, R_MIPS_16 }, |
c6e90b02 | 1991 | { BFD_RELOC_32, R_MIPS_32 }, |
cb7394f2 | 1992 | /* There is no BFD reloc for R_MIPS_REL32. */ |
c6e90b02 TS |
1993 | { BFD_RELOC_64, R_MIPS_64 }, |
1994 | { BFD_RELOC_MIPS_JMP, R_MIPS_26 }, | |
1995 | { BFD_RELOC_HI16_S, R_MIPS_HI16 }, | |
1996 | { BFD_RELOC_LO16, R_MIPS_LO16 }, | |
1997 | { BFD_RELOC_GPREL16, R_MIPS_GPREL16 }, | |
1998 | { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL }, | |
1999 | { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 }, | |
bad36eac | 2000 | { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 }, |
c6e90b02 TS |
2001 | { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 }, |
2002 | { BFD_RELOC_GPREL32, R_MIPS_GPREL32 }, | |
2003 | { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 }, | |
2004 | { BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 }, | |
2005 | { BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 }, | |
2006 | { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 }, | |
2007 | { BFD_RELOC_MIPS_SUB, R_MIPS_SUB }, | |
2008 | { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE }, | |
2009 | { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST }, | |
0f20cc35 | 2010 | { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP }, |
cd8d5a82 | 2011 | { BFD_RELOC_MIPS_JALR, R_MIPS_JALR }, |
0f20cc35 DJ |
2012 | { BFD_RELOC_MIPS_TLS_DTPMOD32, R_MIPS_TLS_DTPMOD32 }, |
2013 | { BFD_RELOC_MIPS_TLS_DTPREL32, R_MIPS_TLS_DTPREL32 }, | |
2014 | { BFD_RELOC_MIPS_TLS_DTPMOD64, R_MIPS_TLS_DTPMOD64 }, | |
2015 | { BFD_RELOC_MIPS_TLS_DTPREL64, R_MIPS_TLS_DTPREL64 }, | |
2016 | { BFD_RELOC_MIPS_TLS_GD, R_MIPS_TLS_GD }, | |
2017 | { BFD_RELOC_MIPS_TLS_LDM, R_MIPS_TLS_LDM }, | |
2018 | { BFD_RELOC_MIPS_TLS_DTPREL_HI16, R_MIPS_TLS_DTPREL_HI16 }, | |
2019 | { BFD_RELOC_MIPS_TLS_DTPREL_LO16, R_MIPS_TLS_DTPREL_LO16 }, | |
2020 | { BFD_RELOC_MIPS_TLS_GOTTPREL, R_MIPS_TLS_GOTTPREL }, | |
2021 | { BFD_RELOC_MIPS_TLS_TPREL32, R_MIPS_TLS_TPREL32 }, | |
2022 | { BFD_RELOC_MIPS_TLS_TPREL64, R_MIPS_TLS_TPREL64 }, | |
2023 | { BFD_RELOC_MIPS_TLS_TPREL_HI16, R_MIPS_TLS_TPREL_HI16 }, | |
7361da2c AB |
2024 | { BFD_RELOC_MIPS_TLS_TPREL_LO16, R_MIPS_TLS_TPREL_LO16 }, |
2025 | { BFD_RELOC_MIPS_21_PCREL_S2, R_MIPS_PC21_S2 }, | |
2026 | { BFD_RELOC_MIPS_26_PCREL_S2, R_MIPS_PC26_S2 }, | |
2027 | { BFD_RELOC_MIPS_18_PCREL_S3, R_MIPS_PC18_S3 }, | |
2028 | { BFD_RELOC_MIPS_19_PCREL_S2, R_MIPS_PC19_S2 }, | |
2029 | { BFD_RELOC_HI16_S_PCREL, R_MIPS_PCHI16 }, | |
2030 | { BFD_RELOC_LO16_PCREL, R_MIPS_PCLO16 } | |
c6e90b02 | 2031 | }; |
252b5132 | 2032 | |
d6f16593 MR |
2033 | static const struct elf_reloc_map mips16_reloc_map[] = |
2034 | { | |
2035 | { BFD_RELOC_MIPS16_JMP, R_MIPS16_26 - R_MIPS16_min }, | |
2036 | { BFD_RELOC_MIPS16_GPREL, R_MIPS16_GPREL - R_MIPS16_min }, | |
738e5348 RS |
2037 | { BFD_RELOC_MIPS16_GOT16, R_MIPS16_GOT16 - R_MIPS16_min }, |
2038 | { BFD_RELOC_MIPS16_CALL16, R_MIPS16_CALL16 - R_MIPS16_min }, | |
d6f16593 MR |
2039 | { BFD_RELOC_MIPS16_HI16_S, R_MIPS16_HI16 - R_MIPS16_min }, |
2040 | { BFD_RELOC_MIPS16_LO16, R_MIPS16_LO16 - R_MIPS16_min }, | |
d0f13682 CLT |
2041 | { BFD_RELOC_MIPS16_TLS_GD, R_MIPS16_TLS_GD - R_MIPS16_min }, |
2042 | { BFD_RELOC_MIPS16_TLS_LDM, R_MIPS16_TLS_LDM - R_MIPS16_min }, | |
2043 | { BFD_RELOC_MIPS16_TLS_DTPREL_HI16, | |
2044 | R_MIPS16_TLS_DTPREL_HI16 - R_MIPS16_min }, | |
2045 | { BFD_RELOC_MIPS16_TLS_DTPREL_LO16, | |
2046 | R_MIPS16_TLS_DTPREL_LO16 - R_MIPS16_min }, | |
2047 | { BFD_RELOC_MIPS16_TLS_GOTTPREL, R_MIPS16_TLS_GOTTPREL - R_MIPS16_min }, | |
2048 | { BFD_RELOC_MIPS16_TLS_TPREL_HI16, R_MIPS16_TLS_TPREL_HI16 - R_MIPS16_min }, | |
c9775dde MR |
2049 | { BFD_RELOC_MIPS16_TLS_TPREL_LO16, R_MIPS16_TLS_TPREL_LO16 - R_MIPS16_min }, |
2050 | { BFD_RELOC_MIPS16_16_PCREL_S1, R_MIPS16_PC16_S1 - R_MIPS16_min } | |
d6f16593 MR |
2051 | }; |
2052 | ||
df58fc94 RS |
2053 | static const struct elf_reloc_map micromips_reloc_map[] = |
2054 | { | |
2055 | { BFD_RELOC_MICROMIPS_JMP, R_MICROMIPS_26_S1 - R_MICROMIPS_min }, | |
2056 | { BFD_RELOC_MICROMIPS_HI16_S, R_MICROMIPS_HI16 - R_MICROMIPS_min }, | |
2057 | { BFD_RELOC_MICROMIPS_LO16, R_MICROMIPS_LO16 - R_MICROMIPS_min }, | |
2058 | { BFD_RELOC_MICROMIPS_GPREL16, R_MICROMIPS_GPREL16 - R_MICROMIPS_min }, | |
2059 | { BFD_RELOC_MICROMIPS_LITERAL, R_MICROMIPS_LITERAL - R_MICROMIPS_min }, | |
2060 | { BFD_RELOC_MICROMIPS_GOT16, R_MICROMIPS_GOT16 - R_MICROMIPS_min }, | |
2061 | { BFD_RELOC_MICROMIPS_7_PCREL_S1, R_MICROMIPS_PC7_S1 - R_MICROMIPS_min }, | |
2062 | { BFD_RELOC_MICROMIPS_10_PCREL_S1, R_MICROMIPS_PC10_S1 - R_MICROMIPS_min }, | |
2063 | { BFD_RELOC_MICROMIPS_16_PCREL_S1, R_MICROMIPS_PC16_S1 - R_MICROMIPS_min }, | |
2064 | { BFD_RELOC_MICROMIPS_CALL16, R_MICROMIPS_CALL16 - R_MICROMIPS_min }, | |
2065 | { BFD_RELOC_MICROMIPS_GOT_DISP, R_MICROMIPS_GOT_DISP - R_MICROMIPS_min }, | |
2066 | { BFD_RELOC_MICROMIPS_GOT_PAGE, R_MICROMIPS_GOT_PAGE - R_MICROMIPS_min }, | |
2067 | { BFD_RELOC_MICROMIPS_GOT_OFST, R_MICROMIPS_GOT_OFST - R_MICROMIPS_min }, | |
2068 | { BFD_RELOC_MICROMIPS_GOT_HI16, R_MICROMIPS_GOT_HI16 - R_MICROMIPS_min }, | |
2069 | { BFD_RELOC_MICROMIPS_GOT_LO16, R_MICROMIPS_GOT_LO16 - R_MICROMIPS_min }, | |
2070 | { BFD_RELOC_MICROMIPS_SUB, R_MICROMIPS_SUB - R_MICROMIPS_min }, | |
2071 | { BFD_RELOC_MICROMIPS_HIGHER, R_MICROMIPS_HIGHER - R_MICROMIPS_min }, | |
2072 | { BFD_RELOC_MICROMIPS_HIGHEST, R_MICROMIPS_HIGHEST - R_MICROMIPS_min }, | |
2073 | { BFD_RELOC_MICROMIPS_CALL_HI16, R_MICROMIPS_CALL_HI16 - R_MICROMIPS_min }, | |
2074 | { BFD_RELOC_MICROMIPS_CALL_LO16, R_MICROMIPS_CALL_LO16 - R_MICROMIPS_min }, | |
2075 | { BFD_RELOC_MICROMIPS_SCN_DISP, R_MICROMIPS_SCN_DISP - R_MICROMIPS_min }, | |
2076 | { BFD_RELOC_MICROMIPS_JALR, R_MICROMIPS_JALR - R_MICROMIPS_min }, | |
2077 | /* There is no BFD reloc for R_MICROMIPS_HI0_LO16. */ | |
2078 | { BFD_RELOC_MICROMIPS_TLS_GD, R_MICROMIPS_TLS_GD - R_MICROMIPS_min }, | |
2079 | { BFD_RELOC_MICROMIPS_TLS_LDM, R_MICROMIPS_TLS_LDM - R_MICROMIPS_min }, | |
2080 | { BFD_RELOC_MICROMIPS_TLS_DTPREL_HI16, | |
2081 | R_MICROMIPS_TLS_DTPREL_HI16 - R_MICROMIPS_min }, | |
2082 | { BFD_RELOC_MICROMIPS_TLS_DTPREL_LO16, | |
2083 | R_MICROMIPS_TLS_DTPREL_LO16 - R_MICROMIPS_min }, | |
2084 | { BFD_RELOC_MICROMIPS_TLS_GOTTPREL, | |
2085 | R_MICROMIPS_TLS_GOTTPREL - R_MICROMIPS_min }, | |
2086 | { BFD_RELOC_MICROMIPS_TLS_TPREL_HI16, | |
2087 | R_MICROMIPS_TLS_TPREL_HI16 - R_MICROMIPS_min }, | |
2088 | { BFD_RELOC_MICROMIPS_TLS_TPREL_LO16, | |
2089 | R_MICROMIPS_TLS_TPREL_LO16 - R_MICROMIPS_min }, | |
2090 | /* There is no BFD reloc for R_MICROMIPS_GPREL7_S2. */ | |
2091 | /* There is no BFD reloc for R_MICROMIPS_PC23_S2. */ | |
2092 | }; | |
2093 | ||
c6e90b02 | 2094 | /* Given a BFD reloc type, return a howto structure. */ |
252b5132 | 2095 | |
c6e90b02 | 2096 | static reloc_howto_type * |
11a2be4d | 2097 | bfd_elf32_bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) |
252b5132 | 2098 | { |
c6e90b02 | 2099 | unsigned int i; |
cb7394f2 | 2100 | reloc_howto_type *howto_table = elf_mips_howto_table_rel; |
d6f16593 | 2101 | reloc_howto_type *howto16_table = elf_mips16_howto_table_rel; |
df58fc94 | 2102 | reloc_howto_type *howto_micromips_table = elf_micromips_howto_table_rel; |
252b5132 | 2103 | |
cb7394f2 TS |
2104 | for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map); |
2105 | i++) | |
252b5132 | 2106 | { |
cb7394f2 TS |
2107 | if (mips_reloc_map[i].bfd_val == code) |
2108 | return &howto_table[(int) mips_reloc_map[i].elf_val]; | |
252b5132 RH |
2109 | } |
2110 | ||
d6f16593 MR |
2111 | for (i = 0; i < sizeof (mips16_reloc_map) / sizeof (struct elf_reloc_map); |
2112 | i++) | |
2113 | { | |
2114 | if (mips16_reloc_map[i].bfd_val == code) | |
2115 | return &howto16_table[(int) mips16_reloc_map[i].elf_val]; | |
2116 | } | |
2117 | ||
df58fc94 RS |
2118 | for (i = 0; i < sizeof (micromips_reloc_map) / sizeof (struct elf_reloc_map); |
2119 | i++) | |
2120 | { | |
2121 | if (micromips_reloc_map[i].bfd_val == code) | |
2122 | return &howto_micromips_table[(int) micromips_reloc_map[i].elf_val]; | |
2123 | } | |
2124 | ||
c6e90b02 | 2125 | switch (code) |
252b5132 | 2126 | { |
c6e90b02 TS |
2127 | default: |
2128 | bfd_set_error (bfd_error_bad_value); | |
2129 | return NULL; | |
252b5132 | 2130 | |
c6e90b02 TS |
2131 | case BFD_RELOC_CTOR: |
2132 | /* We need to handle BFD_RELOC_CTOR specially. | |
2133 | Select the right relocation (R_MIPS_32 or R_MIPS_64) based on the | |
69931e60 AO |
2134 | size of addresses of the ABI. */ |
2135 | if ((elf_elfheader (abfd)->e_flags & (E_MIPS_ABI_O64 | |
2136 | | E_MIPS_ABI_EABI64)) != 0) | |
c6e90b02 | 2137 | return &elf_mips_ctor64_howto; |
69931e60 AO |
2138 | else |
2139 | return &howto_table[(int) R_MIPS_32]; | |
252b5132 | 2140 | |
c6e90b02 TS |
2141 | case BFD_RELOC_VTABLE_INHERIT: |
2142 | return &elf_mips_gnu_vtinherit_howto; | |
2143 | case BFD_RELOC_VTABLE_ENTRY: | |
2144 | return &elf_mips_gnu_vtentry_howto; | |
092dcd75 CD |
2145 | case BFD_RELOC_32_PCREL: |
2146 | return &elf_mips_gnu_pcrel32; | |
861fb55a DJ |
2147 | case BFD_RELOC_MIPS_COPY: |
2148 | return &elf_mips_copy_howto; | |
2149 | case BFD_RELOC_MIPS_JUMP_SLOT: | |
2150 | return &elf_mips_jump_slot_howto; | |
067ec077 CM |
2151 | case BFD_RELOC_MIPS_EH: |
2152 | return &elf_mips_eh_howto; | |
c6e90b02 TS |
2153 | } |
2154 | } | |
252b5132 | 2155 | |
157090f7 AM |
2156 | static reloc_howto_type * |
2157 | bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, | |
2158 | const char *r_name) | |
2159 | { | |
2160 | unsigned int i; | |
2161 | ||
2162 | for (i = 0; | |
2163 | i < (sizeof (elf_mips_howto_table_rel) | |
2164 | / sizeof (elf_mips_howto_table_rel[0])); | |
2165 | i++) | |
2166 | if (elf_mips_howto_table_rel[i].name != NULL | |
2167 | && strcasecmp (elf_mips_howto_table_rel[i].name, r_name) == 0) | |
2168 | return &elf_mips_howto_table_rel[i]; | |
2169 | ||
2170 | for (i = 0; | |
2171 | i < (sizeof (elf_mips16_howto_table_rel) | |
2172 | / sizeof (elf_mips16_howto_table_rel[0])); | |
2173 | i++) | |
2174 | if (elf_mips16_howto_table_rel[i].name != NULL | |
2175 | && strcasecmp (elf_mips16_howto_table_rel[i].name, r_name) == 0) | |
2176 | return &elf_mips16_howto_table_rel[i]; | |
2177 | ||
df58fc94 RS |
2178 | for (i = 0; |
2179 | i < (sizeof (elf_micromips_howto_table_rel) | |
2180 | / sizeof (elf_micromips_howto_table_rel[0])); | |
2181 | i++) | |
2182 | if (elf_micromips_howto_table_rel[i].name != NULL | |
2183 | && strcasecmp (elf_micromips_howto_table_rel[i].name, r_name) == 0) | |
2184 | return &elf_micromips_howto_table_rel[i]; | |
2185 | ||
157090f7 AM |
2186 | if (strcasecmp (elf_mips_gnu_pcrel32.name, r_name) == 0) |
2187 | return &elf_mips_gnu_pcrel32; | |
2188 | if (strcasecmp (elf_mips_gnu_rel16_s2.name, r_name) == 0) | |
2189 | return &elf_mips_gnu_rel16_s2; | |
2190 | if (strcasecmp (elf_mips_gnu_vtinherit_howto.name, r_name) == 0) | |
2191 | return &elf_mips_gnu_vtinherit_howto; | |
2192 | if (strcasecmp (elf_mips_gnu_vtentry_howto.name, r_name) == 0) | |
2193 | return &elf_mips_gnu_vtentry_howto; | |
861fb55a DJ |
2194 | if (strcasecmp (elf_mips_copy_howto.name, r_name) == 0) |
2195 | return &elf_mips_copy_howto; | |
2196 | if (strcasecmp (elf_mips_jump_slot_howto.name, r_name) == 0) | |
2197 | return &elf_mips_jump_slot_howto; | |
067ec077 CM |
2198 | if (strcasecmp (elf_mips_eh_howto.name, r_name) == 0) |
2199 | return &elf_mips_eh_howto; | |
157090f7 AM |
2200 | |
2201 | return NULL; | |
2202 | } | |
2203 | ||
947216bf | 2204 | /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */ |
252b5132 | 2205 | |
c6e90b02 | 2206 | static reloc_howto_type * |
0aa13fee AM |
2207 | mips_elf32_rtype_to_howto (bfd *abfd, |
2208 | unsigned int r_type, | |
0a1b45a2 | 2209 | bool rela_p ATTRIBUTE_UNUSED) |
c6e90b02 | 2210 | { |
7ed6f92a MR |
2211 | reloc_howto_type *howto = NULL; |
2212 | ||
c6e90b02 TS |
2213 | switch (r_type) |
2214 | { | |
c6e90b02 TS |
2215 | case R_MIPS_GNU_VTINHERIT: |
2216 | return &elf_mips_gnu_vtinherit_howto; | |
c6e90b02 TS |
2217 | case R_MIPS_GNU_VTENTRY: |
2218 | return &elf_mips_gnu_vtentry_howto; | |
c6e90b02 TS |
2219 | case R_MIPS_GNU_REL16_S2: |
2220 | return &elf_mips_gnu_rel16_s2; | |
092dcd75 CD |
2221 | case R_MIPS_PC32: |
2222 | return &elf_mips_gnu_pcrel32; | |
861fb55a DJ |
2223 | case R_MIPS_COPY: |
2224 | return &elf_mips_copy_howto; | |
2225 | case R_MIPS_JUMP_SLOT: | |
2226 | return &elf_mips_jump_slot_howto; | |
067ec077 CM |
2227 | case R_MIPS_EH: |
2228 | return &elf_mips_eh_howto; | |
c6e90b02 | 2229 | default: |
df58fc94 | 2230 | if (r_type >= R_MICROMIPS_min && r_type < R_MICROMIPS_max) |
7ed6f92a | 2231 | howto = &elf_micromips_howto_table_rel[r_type - R_MICROMIPS_min]; |
d6f16593 | 2232 | if (r_type >= R_MIPS16_min && r_type < R_MIPS16_max) |
7ed6f92a MR |
2233 | howto = &elf_mips16_howto_table_rel[r_type - R_MIPS16_min]; |
2234 | if (r_type < R_MIPS_max) | |
2235 | howto = &elf_mips_howto_table_rel[r_type]; | |
2236 | if (howto != NULL && howto->name != NULL) | |
2237 | return howto; | |
2238 | ||
2239 | _bfd_error_handler (_("%pB: unsupported relocation type %#x"), | |
2240 | abfd, r_type); | |
2241 | bfd_set_error (bfd_error_bad_value); | |
2242 | return NULL; | |
c6e90b02 TS |
2243 | } |
2244 | } | |
252b5132 | 2245 | |
947216bf | 2246 | /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */ |
252b5132 | 2247 | |
0a1b45a2 | 2248 | static bool |
11a2be4d | 2249 | mips_info_to_howto_rel (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst) |
c6e90b02 TS |
2250 | { |
2251 | unsigned int r_type; | |
252b5132 | 2252 | |
c6e90b02 | 2253 | r_type = ELF32_R_TYPE (dst->r_info); |
0a1b45a2 | 2254 | cache_ptr->howto = mips_elf32_rtype_to_howto (abfd, r_type, false); |
75def2ab | 2255 | |
f3185997 | 2256 | if (cache_ptr->howto == NULL) |
0a1b45a2 | 2257 | return false; |
252b5132 | 2258 | |
c6e90b02 TS |
2259 | /* The addend for a GPREL16 or LITERAL relocation comes from the GP |
2260 | value for the object file. We get the addend now, rather than | |
2261 | when we do the relocation, because the symbol manipulations done | |
2262 | by the linker may cause us to lose track of the input BFD. */ | |
2263 | if (((*cache_ptr->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0 | |
df58fc94 | 2264 | && (gprel16_reloc_p (r_type) || literal_reloc_p (r_type))) |
c6e90b02 | 2265 | cache_ptr->addend = elf_gp (abfd); |
f3185997 | 2266 | |
0a1b45a2 | 2267 | return true; |
c6e90b02 | 2268 | } |
5499724a | 2269 | |
947216bf | 2270 | /* Given a MIPS Elf_Internal_Rela, fill in an arelent structure. */ |
252b5132 | 2271 | |
0a1b45a2 | 2272 | static bool |
11a2be4d | 2273 | mips_info_to_howto_rela (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst) |
c6e90b02 | 2274 | { |
f3185997 | 2275 | return mips_info_to_howto_rel (abfd, cache_ptr, dst); |
252b5132 | 2276 | |
c6e90b02 | 2277 | /* If we ever need to do any extra processing with dst->r_addend |
947216bf | 2278 | (the field omitted in an Elf_Internal_Rel) we can do it here. */ |
c6e90b02 TS |
2279 | } |
2280 | \f | |
2281 | /* Determine whether a symbol is global for the purposes of splitting | |
2282 | the symbol table into global symbols and local symbols. At least | |
2283 | on Irix 5, this split must be between section symbols and all other | |
2284 | symbols. On most ELF targets the split is between static symbols | |
2285 | and externally visible symbols. */ | |
252b5132 | 2286 | |
0a1b45a2 | 2287 | static bool |
11a2be4d | 2288 | mips_elf_sym_is_global (bfd *abfd ATTRIBUTE_UNUSED, asymbol *sym) |
c6e90b02 TS |
2289 | { |
2290 | if (SGI_COMPAT (abfd)) | |
2291 | return (sym->flags & BSF_SECTION_SYM) == 0; | |
2292 | else | |
e47bf690 | 2293 | return ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE)) != 0 |
e6f7f6d1 AM |
2294 | || bfd_is_und_section (bfd_asymbol_section (sym)) |
2295 | || bfd_is_com_section (bfd_asymbol_section (sym))); | |
c6e90b02 | 2296 | } |
3f1b17bb MR |
2297 | |
2298 | /* Likewise, return TRUE if the symbol table split overall must be | |
2299 | between section symbols and all other symbols. */ | |
0a1b45a2 | 2300 | static bool |
3f1b17bb MR |
2301 | mips_elf32_elfsym_local_is_section (bfd *abfd) |
2302 | { | |
2303 | return SGI_COMPAT (abfd); | |
2304 | } | |
c6e90b02 TS |
2305 | \f |
2306 | /* Set the right machine number for a MIPS ELF file. */ | |
7403cb63 | 2307 | |
0a1b45a2 | 2308 | static bool |
11a2be4d | 2309 | mips_elf32_object_p (bfd *abfd) |
c6e90b02 TS |
2310 | { |
2311 | unsigned long mach; | |
103186c6 | 2312 | |
dd2bed3a | 2313 | if (ABI_N32_P (abfd)) |
0a1b45a2 | 2314 | return false; |
dd2bed3a | 2315 | |
c6e90b02 TS |
2316 | /* Irix 5 and 6 are broken. Object file symbol tables are not always |
2317 | sorted correctly such that local symbols precede global symbols, | |
2318 | and the sh_info field in the symbol table is not always right. */ | |
2319 | if (SGI_COMPAT (abfd)) | |
0a1b45a2 | 2320 | elf_bad_symtab (abfd) = true; |
103186c6 | 2321 | |
c6e90b02 TS |
2322 | mach = _bfd_elf_mips_mach (elf_elfheader (abfd)->e_flags); |
2323 | bfd_default_set_arch_mach (abfd, bfd_arch_mips, mach); | |
0a1b45a2 | 2324 | return true; |
c6e90b02 TS |
2325 | } |
2326 | \f | |
2327 | /* MIPS ELF local labels start with '$', not 'L'. */ | |
252b5132 | 2328 | |
0a1b45a2 | 2329 | static bool |
11a2be4d | 2330 | mips_elf_is_local_label_name (bfd *abfd, const char *name) |
c6e90b02 TS |
2331 | { |
2332 | if (name[0] == '$') | |
0a1b45a2 | 2333 | return true; |
252b5132 | 2334 | |
c6e90b02 TS |
2335 | /* On Irix 6, the labels go back to starting with '.', so we accept |
2336 | the generic ELF local label syntax as well. */ | |
2337 | return _bfd_elf_is_local_label_name (abfd, name); | |
252b5132 RH |
2338 | } |
2339 | \f | |
c6e90b02 | 2340 | /* Support for core dump NOTE sections. */ |
0a1b45a2 | 2341 | static bool |
11a2be4d | 2342 | elf32_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) |
bb0082d6 AM |
2343 | { |
2344 | int offset; | |
eea6121a | 2345 | unsigned int size; |
bb0082d6 AM |
2346 | |
2347 | switch (note->descsz) | |
2348 | { | |
2349 | default: | |
0a1b45a2 | 2350 | return false; |
bb0082d6 AM |
2351 | |
2352 | case 256: /* Linux/MIPS */ | |
2353 | /* pr_cursig */ | |
228e534f | 2354 | elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12); |
bb0082d6 AM |
2355 | |
2356 | /* pr_pid */ | |
228e534f | 2357 | elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24); |
bb0082d6 AM |
2358 | |
2359 | /* pr_reg */ | |
2360 | offset = 72; | |
eea6121a | 2361 | size = 180; |
bb0082d6 AM |
2362 | |
2363 | break; | |
2364 | } | |
2365 | ||
2366 | /* Make a ".reg/999" section. */ | |
936e320b | 2367 | return _bfd_elfcore_make_pseudosection (abfd, ".reg", |
eea6121a | 2368 | size, note->descpos + offset); |
bb0082d6 AM |
2369 | } |
2370 | ||
0a1b45a2 | 2371 | static bool |
11a2be4d | 2372 | elf32_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) |
bb0082d6 AM |
2373 | { |
2374 | switch (note->descsz) | |
2375 | { | |
2376 | default: | |
0a1b45a2 | 2377 | return false; |
bb0082d6 AM |
2378 | |
2379 | case 128: /* Linux/MIPS elf_prpsinfo */ | |
c9ec0e89 DT |
2380 | elf_tdata (abfd)->core->pid |
2381 | = bfd_get_32 (abfd, note->descdata + 16); | |
228e534f | 2382 | elf_tdata (abfd)->core->program |
bb0082d6 | 2383 | = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16); |
228e534f | 2384 | elf_tdata (abfd)->core->command |
bb0082d6 AM |
2385 | = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80); |
2386 | } | |
2387 | ||
2388 | /* Note that for some reason, a spurious space is tacked | |
2389 | onto the end of the args in some (at least one anyway) | |
2390 | implementations, so strip it off if it exists. */ | |
2391 | ||
2392 | { | |
228e534f | 2393 | char *command = elf_tdata (abfd)->core->command; |
bb0082d6 AM |
2394 | int n = strlen (command); |
2395 | ||
2396 | if (0 < n && command[n - 1] == ' ') | |
2397 | command[n - 1] = '\0'; | |
2398 | } | |
2399 | ||
0a1b45a2 | 2400 | return true; |
bb0082d6 | 2401 | } |
9031cb4a DT |
2402 | |
2403 | /* Write Linux core PRSTATUS note into core file. */ | |
2404 | ||
2405 | static char * | |
2406 | elf32_mips_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type, | |
2407 | ...) | |
2408 | { | |
2409 | switch (note_type) | |
2410 | { | |
2411 | default: | |
2412 | return NULL; | |
2413 | ||
2414 | case NT_PRPSINFO: | |
2415 | BFD_FAIL (); | |
2416 | return NULL; | |
2417 | ||
2418 | case NT_PRSTATUS: | |
2419 | { | |
2420 | char data[256]; | |
2421 | va_list ap; | |
2422 | long pid; | |
2423 | int cursig; | |
2424 | const void *greg; | |
2425 | ||
2426 | va_start (ap, note_type); | |
2427 | memset (data, 0, 72); | |
2428 | pid = va_arg (ap, long); | |
2429 | bfd_put_32 (abfd, pid, data + 24); | |
2430 | cursig = va_arg (ap, int); | |
2431 | bfd_put_16 (abfd, cursig, data + 12); | |
2432 | greg = va_arg (ap, const void *); | |
2433 | memcpy (data + 72, greg, 180); | |
2434 | memset (data + 252, 0, 4); | |
2435 | va_end (ap); | |
2436 | return elfcore_write_note (abfd, buf, bufsiz, | |
2437 | "CORE", note_type, data, sizeof (data)); | |
2438 | } | |
2439 | } | |
2440 | } | |
3be08ea4 SA |
2441 | |
2442 | /* Remove the magic _gp_disp symbol from the symbol tables. */ | |
2443 | ||
0a1b45a2 | 2444 | static bool |
3be08ea4 SA |
2445 | elf32_mips_fixup_symbol (struct bfd_link_info *info, |
2446 | struct elf_link_hash_entry *h) | |
2447 | { | |
2448 | if (strcmp (h->root.root.string, "_gp_disp") == 0) | |
0a1b45a2 AM |
2449 | _bfd_elf_link_hash_hide_symbol (info, h, true); |
2450 | return true; | |
3be08ea4 | 2451 | } |
bb0082d6 | 2452 | \f |
c6e90b02 TS |
2453 | /* Depending on the target vector we generate some version of Irix |
2454 | executables or "normal" MIPS ELF ABI executables. */ | |
2455 | static irix_compat_t | |
11a2be4d | 2456 | elf32_mips_irix_compat (bfd *abfd) |
c6e90b02 | 2457 | { |
6d00b590 AM |
2458 | if ((abfd->xvec == &mips_elf32_be_vec) |
2459 | || (abfd->xvec == &mips_elf32_le_vec)) | |
c6e90b02 | 2460 | return ict_irix5; |
cb7394f2 TS |
2461 | else |
2462 | return ict_none; | |
c6e90b02 | 2463 | } |
73d074b4 | 2464 | \f |
252b5132 RH |
2465 | /* ECOFF swapping routines. These are used when dealing with the |
2466 | .mdebug section, which is in the ECOFF debugging format. */ | |
be3ccd9c | 2467 | static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { |
252b5132 RH |
2468 | /* Symbol table magic number. */ |
2469 | magicSym, | |
2470 | /* Alignment of debugging information. E.g., 4. */ | |
2471 | 4, | |
2472 | /* Sizes of external symbolic information. */ | |
2473 | sizeof (struct hdr_ext), | |
2474 | sizeof (struct dnr_ext), | |
2475 | sizeof (struct pdr_ext), | |
2476 | sizeof (struct sym_ext), | |
2477 | sizeof (struct opt_ext), | |
2478 | sizeof (struct fdr_ext), | |
2479 | sizeof (struct rfd_ext), | |
2480 | sizeof (struct ext_ext), | |
2481 | /* Functions to swap in external symbolic data. */ | |
2482 | ecoff_swap_hdr_in, | |
2483 | ecoff_swap_dnr_in, | |
2484 | ecoff_swap_pdr_in, | |
2485 | ecoff_swap_sym_in, | |
2486 | ecoff_swap_opt_in, | |
2487 | ecoff_swap_fdr_in, | |
2488 | ecoff_swap_rfd_in, | |
2489 | ecoff_swap_ext_in, | |
2490 | _bfd_ecoff_swap_tir_in, | |
2491 | _bfd_ecoff_swap_rndx_in, | |
2492 | /* Functions to swap out external symbolic data. */ | |
2493 | ecoff_swap_hdr_out, | |
2494 | ecoff_swap_dnr_out, | |
2495 | ecoff_swap_pdr_out, | |
2496 | ecoff_swap_sym_out, | |
2497 | ecoff_swap_opt_out, | |
2498 | ecoff_swap_fdr_out, | |
2499 | ecoff_swap_rfd_out, | |
2500 | ecoff_swap_ext_out, | |
2501 | _bfd_ecoff_swap_tir_out, | |
2502 | _bfd_ecoff_swap_rndx_out, | |
2503 | /* Function to read in symbolic data. */ | |
2504 | _bfd_mips_elf_read_ecoff_info | |
2505 | }; | |
2506 | \f | |
252b5132 | 2507 | #define ELF_ARCH bfd_arch_mips |
ae95ffa6 | 2508 | #define ELF_TARGET_ID MIPS_ELF_DATA |
252b5132 RH |
2509 | #define ELF_MACHINE_CODE EM_MIPS |
2510 | ||
0a1b45a2 AM |
2511 | #define elf_backend_collect true |
2512 | #define elf_backend_type_change_ok true | |
2513 | #define elf_backend_can_gc_sections true | |
351cdf24 MF |
2514 | #define elf_backend_gc_mark_extra_sections \ |
2515 | _bfd_mips_elf_gc_mark_extra_sections | |
3f830999 | 2516 | #define elf_info_to_howto mips_info_to_howto_rela |
252b5132 RH |
2517 | #define elf_info_to_howto_rel mips_info_to_howto_rel |
2518 | #define elf_backend_sym_is_global mips_elf_sym_is_global | |
c6e90b02 | 2519 | #define elf_backend_object_p mips_elf32_object_p |
d75bc93d TS |
2520 | #define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing |
2521 | #define elf_backend_section_processing _bfd_mips_elf_section_processing | |
103186c6 | 2522 | #define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr |
252b5132 RH |
2523 | #define elf_backend_fake_sections _bfd_mips_elf_fake_sections |
2524 | #define elf_backend_section_from_bfd_section \ | |
2525 | _bfd_mips_elf_section_from_bfd_section | |
103186c6 | 2526 | #define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook |
d75bc93d TS |
2527 | #define elf_backend_link_output_symbol_hook \ |
2528 | _bfd_mips_elf_link_output_symbol_hook | |
103186c6 MM |
2529 | #define elf_backend_create_dynamic_sections \ |
2530 | _bfd_mips_elf_create_dynamic_sections | |
2531 | #define elf_backend_check_relocs _bfd_mips_elf_check_relocs | |
8992f0d7 TS |
2532 | #define elf_backend_merge_symbol_attribute \ |
2533 | _bfd_mips_elf_merge_symbol_attribute | |
ad9563d6 | 2534 | #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag |
103186c6 MM |
2535 | #define elf_backend_adjust_dynamic_symbol \ |
2536 | _bfd_mips_elf_adjust_dynamic_symbol | |
2537 | #define elf_backend_always_size_sections \ | |
2538 | _bfd_mips_elf_always_size_sections | |
2539 | #define elf_backend_size_dynamic_sections \ | |
2540 | _bfd_mips_elf_size_dynamic_sections | |
74541ad4 | 2541 | #define elf_backend_init_index_section _bfd_elf_init_1_index_section |
103186c6 | 2542 | #define elf_backend_relocate_section _bfd_mips_elf_relocate_section |
103186c6 MM |
2543 | #define elf_backend_finish_dynamic_symbol \ |
2544 | _bfd_mips_elf_finish_dynamic_symbol | |
2545 | #define elf_backend_finish_dynamic_sections \ | |
2546 | _bfd_mips_elf_finish_dynamic_sections | |
d75bc93d TS |
2547 | #define elf_backend_final_write_processing \ |
2548 | _bfd_mips_elf_final_write_processing | |
2549 | #define elf_backend_additional_program_headers \ | |
2550 | _bfd_mips_elf_additional_program_headers | |
2551 | #define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map | |
103186c6 | 2552 | #define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook |
8a20f077 UC |
2553 | #define elf_backend_copy_indirect_symbol \ |
2554 | _bfd_mips_elf_copy_indirect_symbol | |
47275900 | 2555 | #define elf_backend_hide_symbol _bfd_mips_elf_hide_symbol |
3be08ea4 | 2556 | #define elf_backend_fixup_symbol elf32_mips_fixup_symbol |
c6e90b02 TS |
2557 | #define elf_backend_grok_prstatus elf32_mips_grok_prstatus |
2558 | #define elf_backend_grok_psinfo elf32_mips_grok_psinfo | |
d75bc93d TS |
2559 | #define elf_backend_ecoff_debug_swap &mips_elf32_ecoff_debug_swap |
2560 | ||
2561 | #define elf_backend_got_header_size (4 * MIPS_RESERVED_GOTNO) | |
5474d94f | 2562 | #define elf_backend_want_dynrelro 1 |
d75bc93d TS |
2563 | #define elf_backend_may_use_rel_p 1 |
2564 | #define elf_backend_may_use_rela_p 0 | |
2565 | #define elf_backend_default_use_rela_p 0 | |
0a1b45a2 | 2566 | #define elf_backend_sign_extend_vma true |
861fb55a | 2567 | #define elf_backend_plt_readonly 1 |
b305ef96 | 2568 | |
d01414a5 | 2569 | #define elf_backend_discard_info _bfd_mips_elf_discard_info |
73d074b4 | 2570 | #define elf_backend_ignore_discarded_relocs \ |
53bfd6b4 | 2571 | _bfd_mips_elf_ignore_discarded_relocs |
20163277 | 2572 | #define elf_backend_write_section _bfd_mips_elf_write_section |
3f1b17bb MR |
2573 | #define elf_backend_elfsym_local_is_section \ |
2574 | mips_elf32_elfsym_local_is_section | |
c6e90b02 TS |
2575 | #define elf_backend_mips_irix_compat elf32_mips_irix_compat |
2576 | #define elf_backend_mips_rtype_to_howto mips_elf32_rtype_to_howto | |
28dbcedc AM |
2577 | #define elf_backend_sort_relocs_p _bfd_mips_elf_sort_relocs_p |
2578 | ||
252b5132 RH |
2579 | #define bfd_elf32_bfd_is_local_label_name \ |
2580 | mips_elf_is_local_label_name | |
df58fc94 RS |
2581 | #define bfd_elf32_bfd_is_target_special_symbol \ |
2582 | _bfd_mips_elf_is_target_special_symbol | |
1bbce132 | 2583 | #define bfd_elf32_get_synthetic_symtab _bfd_mips_elf_get_synthetic_symtab |
252b5132 | 2584 | #define bfd_elf32_find_nearest_line _bfd_mips_elf_find_nearest_line |
6e7a29c7 AM |
2585 | #define bfd_elf32_find_nearest_line_with_alt \ |
2586 | _bfd_mips_elf_find_nearest_line_with_alt | |
4ab527b0 | 2587 | #define bfd_elf32_find_inliner_info _bfd_mips_elf_find_inliner_info |
f0abc2a1 | 2588 | #define bfd_elf32_new_section_hook _bfd_mips_elf_new_section_hook |
252b5132 | 2589 | #define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents |
c6e90b02 TS |
2590 | #define bfd_elf32_bfd_get_relocated_section_contents \ |
2591 | _bfd_elf_mips_get_relocated_section_contents | |
252b5132 | 2592 | #define bfd_elf32_bfd_link_hash_table_create \ |
103186c6 MM |
2593 | _bfd_mips_elf_link_hash_table_create |
2594 | #define bfd_elf32_bfd_final_link _bfd_mips_elf_final_link | |
252b5132 RH |
2595 | #define bfd_elf32_bfd_merge_private_bfd_data \ |
2596 | _bfd_mips_elf_merge_private_bfd_data | |
2597 | #define bfd_elf32_bfd_set_private_flags _bfd_mips_elf_set_private_flags | |
2598 | #define bfd_elf32_bfd_print_private_bfd_data \ | |
2599 | _bfd_mips_elf_print_private_bfd_data | |
df58fc94 | 2600 | #define bfd_elf32_bfd_relax_section _bfd_mips_elf_relax_section |
6ae68ba3 | 2601 | #define bfd_elf32_mkobject _bfd_mips_elf_mkobject |
ba75d1c5 | 2602 | #define bfd_elf32_free_cached_info _bfd_mips_elf_free_cached_info |
e364195d | 2603 | |
d75bc93d | 2604 | /* Support for SGI-ish mips targets. */ |
6d00b590 | 2605 | #define TARGET_LITTLE_SYM mips_elf32_le_vec |
d75bc93d | 2606 | #define TARGET_LITTLE_NAME "elf32-littlemips" |
6d00b590 | 2607 | #define TARGET_BIG_SYM mips_elf32_be_vec |
d75bc93d TS |
2608 | #define TARGET_BIG_NAME "elf32-bigmips" |
2609 | ||
4301eeb1 MR |
2610 | /* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses |
2611 | a value of 0x1000, and we are compatible. */ | |
2612 | #define ELF_MAXPAGESIZE 0x1000 | |
24718e3b | 2613 | #define ELF_COMMONPAGESIZE 0x1000 |
4301eeb1 | 2614 | |
d75bc93d | 2615 | #include "elf32-target.h" |
e364195d | 2616 | |
d75bc93d | 2617 | /* Support for traditional mips targets. */ |
e364195d UC |
2618 | #undef TARGET_LITTLE_SYM |
2619 | #undef TARGET_LITTLE_NAME | |
2620 | #undef TARGET_BIG_SYM | |
2621 | #undef TARGET_BIG_NAME | |
2622 | ||
4301eeb1 | 2623 | #undef ELF_MAXPAGESIZE |
7fd91fe0 | 2624 | #undef ELF_COMMONPAGESIZE |
4301eeb1 | 2625 | |
07d6d2b8 AM |
2626 | #define TARGET_LITTLE_SYM mips_elf32_trad_le_vec |
2627 | #define TARGET_LITTLE_NAME "elf32-tradlittlemips" | |
2628 | #define TARGET_BIG_SYM mips_elf32_trad_be_vec | |
2629 | #define TARGET_BIG_NAME "elf32-tradbigmips" | |
e364195d | 2630 | |
7fd91fe0 TS |
2631 | /* The MIPS ABI says at Page 5-1: |
2632 | Virtual addresses and file offsets for MIPS segments are congruent | |
2633 | modulo 64 KByte (0x10000) or larger powers of 2. Because 64 KBytes | |
2634 | is the maximum page size, the files are suitable for paging | |
2635 | regardless of physical page size. */ | |
4301eeb1 | 2636 | #define ELF_MAXPAGESIZE 0x10000 |
7fd91fe0 | 2637 | #define ELF_COMMONPAGESIZE 0x1000 |
4301eeb1 MR |
2638 | #define elf32_bed elf32_tradbed |
2639 | ||
9031cb4a DT |
2640 | #undef elf_backend_write_core_note |
2641 | #define elf_backend_write_core_note elf32_mips_write_core_note | |
2642 | ||
c6e90b02 | 2643 | /* Include the target file again for this target. */ |
e364195d | 2644 | #include "elf32-target.h" |
0a44bf69 | 2645 | |
aeffff67 RS |
2646 | /* FreeBSD support. */ |
2647 | ||
2648 | #undef TARGET_LITTLE_SYM | |
2649 | #undef TARGET_LITTLE_NAME | |
2650 | #undef TARGET_BIG_SYM | |
2651 | #undef TARGET_BIG_NAME | |
2652 | ||
6d00b590 | 2653 | #define TARGET_LITTLE_SYM mips_elf32_tradfbsd_le_vec |
aeffff67 | 2654 | #define TARGET_LITTLE_NAME "elf32-tradlittlemips-freebsd" |
6d00b590 | 2655 | #define TARGET_BIG_SYM mips_elf32_tradfbsd_be_vec |
aeffff67 RS |
2656 | #define TARGET_BIG_NAME "elf32-tradbigmips-freebsd" |
2657 | ||
2658 | #undef ELF_OSABI | |
2659 | #define ELF_OSABI ELFOSABI_FREEBSD | |
2660 | ||
aeffff67 RS |
2661 | #undef elf32_bed |
2662 | #define elf32_bed elf32_fbsd_tradbed | |
2663 | ||
9031cb4a DT |
2664 | #undef elf_backend_write_core_note |
2665 | ||
aeffff67 | 2666 | #include "elf32-target.h" |
0a44bf69 RS |
2667 | /* Implement elf_backend_final_write_processing for VxWorks. */ |
2668 | ||
0a1b45a2 | 2669 | static bool |
cc364be6 | 2670 | mips_vxworks_final_write_processing (bfd *abfd) |
0a44bf69 | 2671 | { |
cc364be6 AM |
2672 | _bfd_mips_final_write_processing (abfd); |
2673 | return elf_vxworks_final_write_processing (abfd); | |
0a44bf69 RS |
2674 | } |
2675 | ||
2676 | #undef TARGET_LITTLE_SYM | |
2677 | #undef TARGET_LITTLE_NAME | |
2678 | #undef TARGET_BIG_SYM | |
2679 | #undef TARGET_BIG_NAME | |
2680 | ||
7fd91fe0 TS |
2681 | #undef ELF_MAXPAGESIZE |
2682 | #undef ELF_COMMONPAGESIZE | |
2683 | ||
07d6d2b8 AM |
2684 | #define TARGET_LITTLE_SYM mips_elf32_vxworks_le_vec |
2685 | #define TARGET_LITTLE_NAME "elf32-littlemips-vxworks" | |
2686 | #define TARGET_BIG_SYM mips_elf32_vxworks_be_vec | |
2687 | #define TARGET_BIG_NAME "elf32-bigmips-vxworks" | |
91ea67ca | 2688 | #undef ELF_OSABI |
0a44bf69 RS |
2689 | |
2690 | #undef elf32_bed | |
2691 | #define elf32_bed elf32_mips_vxworks_bed | |
2692 | ||
0a44bf69 | 2693 | #define ELF_MAXPAGESIZE 0x1000 |
7fd91fe0 | 2694 | #define ELF_COMMONPAGESIZE 0x1000 |
0a44bf69 | 2695 | |
90c14f0c L |
2696 | #undef ELF_TARGET_OS |
2697 | #define ELF_TARGET_OS is_vxworks | |
2698 | ||
0a44bf69 RS |
2699 | #undef elf_backend_want_got_plt |
2700 | #define elf_backend_want_got_plt 1 | |
2701 | #undef elf_backend_want_plt_sym | |
2702 | #define elf_backend_want_plt_sym 1 | |
0a44bf69 RS |
2703 | #undef elf_backend_may_use_rel_p |
2704 | #define elf_backend_may_use_rel_p 0 | |
2705 | #undef elf_backend_may_use_rela_p | |
2706 | #define elf_backend_may_use_rela_p 1 | |
2707 | #undef elf_backend_default_use_rela_p | |
2708 | #define elf_backend_default_use_rela_p 1 | |
2709 | #undef elf_backend_got_header_size | |
2710 | #define elf_backend_got_header_size (4 * 3) | |
64f52338 AM |
2711 | #undef elf_backend_dtrel_excludes_plt |
2712 | #define elf_backend_dtrel_excludes_plt 1 | |
861fb55a | 2713 | |
0a44bf69 RS |
2714 | #undef elf_backend_finish_dynamic_symbol |
2715 | #define elf_backend_finish_dynamic_symbol \ | |
2716 | _bfd_mips_vxworks_finish_dynamic_symbol | |
2717 | #undef bfd_elf32_bfd_link_hash_table_create | |
2718 | #define bfd_elf32_bfd_link_hash_table_create \ | |
2719 | _bfd_mips_vxworks_link_hash_table_create | |
2720 | #undef elf_backend_add_symbol_hook | |
2721 | #define elf_backend_add_symbol_hook \ | |
2722 | elf_vxworks_add_symbol_hook | |
2723 | #undef elf_backend_link_output_symbol_hook | |
2724 | #define elf_backend_link_output_symbol_hook \ | |
2725 | elf_vxworks_link_output_symbol_hook | |
2726 | #undef elf_backend_emit_relocs | |
2727 | #define elf_backend_emit_relocs \ | |
2728 | elf_vxworks_emit_relocs | |
2729 | #undef elf_backend_final_write_processing | |
2730 | #define elf_backend_final_write_processing \ | |
2731 | mips_vxworks_final_write_processing | |
2732 | ||
2733 | #undef elf_backend_additional_program_headers | |
2734 | #undef elf_backend_modify_segment_map | |
2735 | #undef elf_backend_symbol_processing | |
2736 | /* NOTE: elf_backend_rela_normal is not defined for MIPS. */ | |
2737 | ||
1bbce132 MR |
2738 | #undef bfd_elf32_get_synthetic_symtab |
2739 | ||
0a44bf69 | 2740 | #include "elf32-target.h" |