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