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