elfn32-mips.c revision 1.1 1 1.1 christos /* MIPS-specific support for 32-bit ELF
2 1.1 christos Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
3 1.1 christos 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
4 1.1 christos
5 1.1 christos Most of the information added by Ian Lance Taylor, Cygnus Support,
6 1.1 christos <ian (at) cygnus.com>.
7 1.1 christos N32/64 ABI support added by Mark Mitchell, CodeSourcery, LLC.
8 1.1 christos <mark (at) codesourcery.com>
9 1.1 christos Traditional MIPS targets support added by Koundinya.K, Dansk Data
10 1.1 christos Elektronik & Operations Research Group. <kk (at) ddeorg.soft.net>
11 1.1 christos
12 1.1 christos This file is part of BFD, the Binary File Descriptor library.
13 1.1 christos
14 1.1 christos This program is free software; you can redistribute it and/or modify
15 1.1 christos it under the terms of the GNU General Public License as published by
16 1.1 christos the Free Software Foundation; either version 3 of the License, or
17 1.1 christos (at your option) any later version.
18 1.1 christos
19 1.1 christos This program is distributed in the hope that it will be useful,
20 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of
21 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 1.1 christos GNU General Public License for more details.
23 1.1 christos
24 1.1 christos You should have received a copy of the GNU General Public License
25 1.1 christos along with this program; if not, write to the Free Software
26 1.1 christos Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
27 1.1 christos MA 02110-1301, USA. */
28 1.1 christos
29 1.1 christos
30 1.1 christos /* This file handles MIPS ELF targets. SGI Irix 5 uses a slightly
31 1.1 christos different MIPS ELF from other targets. This matters when linking.
32 1.1 christos This file supports both, switching at runtime. */
33 1.1 christos
34 1.1 christos #include "sysdep.h"
35 1.1 christos #include "bfd.h"
36 1.1 christos #include "libbfd.h"
37 1.1 christos #include "bfdlink.h"
38 1.1 christos #include "genlink.h"
39 1.1 christos #include "elf-bfd.h"
40 1.1 christos #include "elfxx-mips.h"
41 1.1 christos #include "elf/mips.h"
42 1.1 christos
43 1.1 christos /* Get the ECOFF swapping routines. */
44 1.1 christos #include "coff/sym.h"
45 1.1 christos #include "coff/symconst.h"
46 1.1 christos #include "coff/internal.h"
47 1.1 christos #include "coff/ecoff.h"
48 1.1 christos #include "coff/mips.h"
49 1.1 christos #define ECOFF_SIGNED_32
50 1.1 christos #include "ecoffswap.h"
51 1.1 christos
52 1.1 christos static bfd_boolean mips_elf_assign_gp
53 1.1 christos (bfd *, bfd_vma *);
54 1.1 christos static bfd_reloc_status_type mips_elf_final_gp
55 1.1 christos (bfd *, asymbol *, bfd_boolean, char **, bfd_vma *);
56 1.1 christos static bfd_reloc_status_type mips_elf_gprel16_reloc
57 1.1 christos (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
58 1.1 christos static bfd_reloc_status_type mips_elf_literal_reloc
59 1.1 christos (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
60 1.1 christos static bfd_reloc_status_type mips_elf_gprel32_reloc
61 1.1 christos (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
62 1.1 christos static bfd_reloc_status_type gprel32_with_gp
63 1.1 christos (bfd *, asymbol *, arelent *, asection *, bfd_boolean, void *, bfd_vma);
64 1.1 christos static bfd_reloc_status_type mips_elf_shift6_reloc
65 1.1 christos (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
66 1.1 christos static bfd_reloc_status_type mips16_gprel_reloc
67 1.1 christos (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
68 1.1 christos static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
69 1.1 christos (bfd *, bfd_reloc_code_real_type);
70 1.1 christos static reloc_howto_type *mips_elf_n32_rtype_to_howto
71 1.1 christos (unsigned int, bfd_boolean);
72 1.1 christos static void mips_info_to_howto_rel
73 1.1 christos (bfd *, arelent *, Elf_Internal_Rela *);
74 1.1 christos static void mips_info_to_howto_rela
75 1.1 christos (bfd *, arelent *, Elf_Internal_Rela *);
76 1.1 christos static bfd_boolean mips_elf_sym_is_global
77 1.1 christos (bfd *, asymbol *);
78 1.1 christos static bfd_boolean mips_elf_n32_object_p
79 1.1 christos (bfd *);
80 1.1 christos static bfd_boolean elf32_mips_grok_prstatus
81 1.1 christos (bfd *, Elf_Internal_Note *);
82 1.1 christos static bfd_boolean elf32_mips_grok_psinfo
83 1.1 christos (bfd *, Elf_Internal_Note *);
84 1.1 christos static bfd_boolean mips_elf_n32_is_local_label_name
85 1.1 christos (bfd *, const char *);
86 1.1 christos static irix_compat_t elf_n32_mips_irix_compat
87 1.1 christos (bfd *);
88 1.1 christos
89 1.1 christos extern const bfd_target bfd_elf32_nbigmips_vec;
90 1.1 christos extern const bfd_target bfd_elf32_nlittlemips_vec;
91 1.1 christos
92 1.1 christos /* Nonzero if ABFD is using the N32 ABI. */
93 1.1 christos #define ABI_N32_P(abfd) \
94 1.1 christos ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0)
95 1.1 christos
96 1.1 christos /* Whether we are trying to be compatible with IRIX at all. */
97 1.1 christos #define SGI_COMPAT(abfd) \
98 1.1 christos (elf_n32_mips_irix_compat (abfd) != ict_none)
99 1.1 christos
100 1.1 christos /* The number of local .got entries we reserve. */
101 1.1 christos #define MIPS_RESERVED_GOTNO (2)
102 1.1 christos
103 1.1 christos /* In case we're on a 32-bit machine, construct a 64-bit "-1" value
104 1.1 christos from smaller values. Start with zero, widen, *then* decrement. */
105 1.1 christos #define MINUS_ONE (((bfd_vma)0) - 1)
106 1.1 christos
107 1.1 christos /* The relocation table used for SHT_REL sections. */
108 1.1 christos
109 1.1 christos static reloc_howto_type elf_mips_howto_table_rel[] =
110 1.1 christos {
111 1.1 christos /* No relocation. */
112 1.1 christos HOWTO (R_MIPS_NONE, /* type */
113 1.1 christos 0, /* rightshift */
114 1.1 christos 0, /* size (0 = byte, 1 = short, 2 = long) */
115 1.1 christos 0, /* bitsize */
116 1.1 christos FALSE, /* pc_relative */
117 1.1 christos 0, /* bitpos */
118 1.1 christos complain_overflow_dont, /* complain_on_overflow */
119 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
120 1.1 christos "R_MIPS_NONE", /* name */
121 1.1 christos FALSE, /* partial_inplace */
122 1.1 christos 0, /* src_mask */
123 1.1 christos 0, /* dst_mask */
124 1.1 christos FALSE), /* pcrel_offset */
125 1.1 christos
126 1.1 christos /* 16 bit relocation. */
127 1.1 christos HOWTO (R_MIPS_16, /* type */
128 1.1 christos 0, /* rightshift */
129 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
130 1.1 christos 16, /* bitsize */
131 1.1 christos FALSE, /* pc_relative */
132 1.1 christos 0, /* bitpos */
133 1.1 christos complain_overflow_signed, /* complain_on_overflow */
134 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
135 1.1 christos "R_MIPS_16", /* name */
136 1.1 christos TRUE, /* partial_inplace */
137 1.1 christos 0x0000ffff, /* src_mask */
138 1.1 christos 0x0000ffff, /* dst_mask */
139 1.1 christos FALSE), /* pcrel_offset */
140 1.1 christos
141 1.1 christos /* 32 bit relocation. */
142 1.1 christos HOWTO (R_MIPS_32, /* type */
143 1.1 christos 0, /* rightshift */
144 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
145 1.1 christos 32, /* bitsize */
146 1.1 christos FALSE, /* pc_relative */
147 1.1 christos 0, /* bitpos */
148 1.1 christos complain_overflow_dont, /* complain_on_overflow */
149 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
150 1.1 christos "R_MIPS_32", /* name */
151 1.1 christos TRUE, /* partial_inplace */
152 1.1 christos 0xffffffff, /* src_mask */
153 1.1 christos 0xffffffff, /* dst_mask */
154 1.1 christos FALSE), /* pcrel_offset */
155 1.1 christos
156 1.1 christos /* 32 bit symbol relative relocation. */
157 1.1 christos HOWTO (R_MIPS_REL32, /* type */
158 1.1 christos 0, /* rightshift */
159 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
160 1.1 christos 32, /* bitsize */
161 1.1 christos FALSE, /* pc_relative */
162 1.1 christos 0, /* bitpos */
163 1.1 christos complain_overflow_dont, /* complain_on_overflow */
164 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
165 1.1 christos "R_MIPS_REL32", /* name */
166 1.1 christos TRUE, /* partial_inplace */
167 1.1 christos 0xffffffff, /* src_mask */
168 1.1 christos 0xffffffff, /* dst_mask */
169 1.1 christos FALSE), /* pcrel_offset */
170 1.1 christos
171 1.1 christos /* 26 bit jump address. */
172 1.1 christos HOWTO (R_MIPS_26, /* type */
173 1.1 christos 2, /* rightshift */
174 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
175 1.1 christos 26, /* bitsize */
176 1.1 christos FALSE, /* pc_relative */
177 1.1 christos 0, /* bitpos */
178 1.1 christos complain_overflow_dont, /* complain_on_overflow */
179 1.1 christos /* This needs complex overflow
180 1.1 christos detection, because the upper four
181 1.1 christos bits must match the PC + 4. */
182 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
183 1.1 christos "R_MIPS_26", /* name */
184 1.1 christos TRUE, /* partial_inplace */
185 1.1 christos 0x03ffffff, /* src_mask */
186 1.1 christos 0x03ffffff, /* dst_mask */
187 1.1 christos FALSE), /* pcrel_offset */
188 1.1 christos
189 1.1 christos /* R_MIPS_HI16 and R_MIPS_LO16 are unsupported for NewABI REL.
190 1.1 christos However, the native IRIX6 tools use them, so we try our best. */
191 1.1 christos
192 1.1 christos /* High 16 bits of symbol value. */
193 1.1 christos HOWTO (R_MIPS_HI16, /* type */
194 1.1 christos 16, /* rightshift */
195 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
196 1.1 christos 16, /* bitsize */
197 1.1 christos FALSE, /* pc_relative */
198 1.1 christos 0, /* bitpos */
199 1.1 christos complain_overflow_dont, /* complain_on_overflow */
200 1.1 christos _bfd_mips_elf_hi16_reloc, /* special_function */
201 1.1 christos "R_MIPS_HI16", /* name */
202 1.1 christos TRUE, /* partial_inplace */
203 1.1 christos 0x0000ffff, /* src_mask */
204 1.1 christos 0x0000ffff, /* dst_mask */
205 1.1 christos FALSE), /* pcrel_offset */
206 1.1 christos
207 1.1 christos /* Low 16 bits of symbol value. */
208 1.1 christos HOWTO (R_MIPS_LO16, /* type */
209 1.1 christos 0, /* rightshift */
210 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
211 1.1 christos 16, /* bitsize */
212 1.1 christos FALSE, /* pc_relative */
213 1.1 christos 0, /* bitpos */
214 1.1 christos complain_overflow_dont, /* complain_on_overflow */
215 1.1 christos _bfd_mips_elf_lo16_reloc, /* special_function */
216 1.1 christos "R_MIPS_LO16", /* name */
217 1.1 christos TRUE, /* partial_inplace */
218 1.1 christos 0x0000ffff, /* src_mask */
219 1.1 christos 0x0000ffff, /* dst_mask */
220 1.1 christos FALSE), /* pcrel_offset */
221 1.1 christos
222 1.1 christos /* GP relative reference. */
223 1.1 christos HOWTO (R_MIPS_GPREL16, /* type */
224 1.1 christos 0, /* rightshift */
225 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
226 1.1 christos 16, /* bitsize */
227 1.1 christos FALSE, /* pc_relative */
228 1.1 christos 0, /* bitpos */
229 1.1 christos complain_overflow_signed, /* complain_on_overflow */
230 1.1 christos mips_elf_gprel16_reloc, /* special_function */
231 1.1 christos "R_MIPS_GPREL16", /* name */
232 1.1 christos TRUE, /* partial_inplace */
233 1.1 christos 0x0000ffff, /* src_mask */
234 1.1 christos 0x0000ffff, /* dst_mask */
235 1.1 christos FALSE), /* pcrel_offset */
236 1.1 christos
237 1.1 christos /* Reference to literal section. */
238 1.1 christos HOWTO (R_MIPS_LITERAL, /* type */
239 1.1 christos 0, /* rightshift */
240 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
241 1.1 christos 16, /* bitsize */
242 1.1 christos FALSE, /* pc_relative */
243 1.1 christos 0, /* bitpos */
244 1.1 christos complain_overflow_signed, /* complain_on_overflow */
245 1.1 christos mips_elf_literal_reloc, /* special_function */
246 1.1 christos "R_MIPS_LITERAL", /* name */
247 1.1 christos TRUE, /* partial_inplace */
248 1.1 christos 0x0000ffff, /* src_mask */
249 1.1 christos 0x0000ffff, /* dst_mask */
250 1.1 christos FALSE), /* pcrel_offset */
251 1.1 christos
252 1.1 christos /* Reference to global offset table. */
253 1.1 christos HOWTO (R_MIPS_GOT16, /* type */
254 1.1 christos 0, /* rightshift */
255 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
256 1.1 christos 16, /* bitsize */
257 1.1 christos FALSE, /* pc_relative */
258 1.1 christos 0, /* bitpos */
259 1.1 christos complain_overflow_signed, /* complain_on_overflow */
260 1.1 christos _bfd_mips_elf_got16_reloc, /* special_function */
261 1.1 christos "R_MIPS_GOT16", /* name */
262 1.1 christos TRUE, /* partial_inplace */
263 1.1 christos 0x0000ffff, /* src_mask */
264 1.1 christos 0x0000ffff, /* dst_mask */
265 1.1 christos FALSE), /* pcrel_offset */
266 1.1 christos
267 1.1 christos /* 16 bit PC relative reference. Note that the ABI document has a typo
268 1.1 christos and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
269 1.1 christos We do the right thing here. */
270 1.1 christos HOWTO (R_MIPS_PC16, /* type */
271 1.1 christos 2, /* rightshift */
272 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
273 1.1 christos 16, /* bitsize */
274 1.1 christos TRUE, /* pc_relative */
275 1.1 christos 0, /* bitpos */
276 1.1 christos complain_overflow_signed, /* complain_on_overflow */
277 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
278 1.1 christos "R_MIPS_PC16", /* name */
279 1.1 christos TRUE, /* partial_inplace */
280 1.1 christos 0x0000ffff, /* src_mask */
281 1.1 christos 0x0000ffff, /* dst_mask */
282 1.1 christos TRUE), /* pcrel_offset */
283 1.1 christos
284 1.1 christos /* 16 bit call through global offset table. */
285 1.1 christos HOWTO (R_MIPS_CALL16, /* type */
286 1.1 christos 0, /* rightshift */
287 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
288 1.1 christos 16, /* bitsize */
289 1.1 christos FALSE, /* pc_relative */
290 1.1 christos 0, /* bitpos */
291 1.1 christos complain_overflow_signed, /* complain_on_overflow */
292 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
293 1.1 christos "R_MIPS_CALL16", /* name */
294 1.1 christos TRUE, /* partial_inplace */
295 1.1 christos 0x0000ffff, /* src_mask */
296 1.1 christos 0x0000ffff, /* dst_mask */
297 1.1 christos FALSE), /* pcrel_offset */
298 1.1 christos
299 1.1 christos /* 32 bit GP relative reference. */
300 1.1 christos HOWTO (R_MIPS_GPREL32, /* type */
301 1.1 christos 0, /* rightshift */
302 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
303 1.1 christos 32, /* bitsize */
304 1.1 christos FALSE, /* pc_relative */
305 1.1 christos 0, /* bitpos */
306 1.1 christos complain_overflow_dont, /* complain_on_overflow */
307 1.1 christos mips_elf_gprel32_reloc, /* special_function */
308 1.1 christos "R_MIPS_GPREL32", /* name */
309 1.1 christos TRUE, /* partial_inplace */
310 1.1 christos 0xffffffff, /* src_mask */
311 1.1 christos 0xffffffff, /* dst_mask */
312 1.1 christos FALSE), /* pcrel_offset */
313 1.1 christos
314 1.1 christos /* The remaining relocs are defined on Irix 5, although they are
315 1.1 christos not defined by the ABI. */
316 1.1 christos EMPTY_HOWTO (13),
317 1.1 christos EMPTY_HOWTO (14),
318 1.1 christos EMPTY_HOWTO (15),
319 1.1 christos
320 1.1 christos /* A 5 bit shift field. */
321 1.1 christos HOWTO (R_MIPS_SHIFT5, /* type */
322 1.1 christos 0, /* rightshift */
323 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
324 1.1 christos 5, /* bitsize */
325 1.1 christos FALSE, /* pc_relative */
326 1.1 christos 6, /* bitpos */
327 1.1 christos complain_overflow_bitfield, /* complain_on_overflow */
328 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
329 1.1 christos "R_MIPS_SHIFT5", /* name */
330 1.1 christos TRUE, /* partial_inplace */
331 1.1 christos 0x000007c0, /* src_mask */
332 1.1 christos 0x000007c0, /* dst_mask */
333 1.1 christos FALSE), /* pcrel_offset */
334 1.1 christos
335 1.1 christos /* A 6 bit shift field. */
336 1.1 christos HOWTO (R_MIPS_SHIFT6, /* type */
337 1.1 christos 0, /* rightshift */
338 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
339 1.1 christos 6, /* bitsize */
340 1.1 christos FALSE, /* pc_relative */
341 1.1 christos 6, /* bitpos */
342 1.1 christos complain_overflow_bitfield, /* complain_on_overflow */
343 1.1 christos mips_elf_shift6_reloc, /* special_function */
344 1.1 christos "R_MIPS_SHIFT6", /* name */
345 1.1 christos TRUE, /* partial_inplace */
346 1.1 christos 0x000007c4, /* src_mask */
347 1.1 christos 0x000007c4, /* dst_mask */
348 1.1 christos FALSE), /* pcrel_offset */
349 1.1 christos
350 1.1 christos /* A 64 bit relocation. */
351 1.1 christos HOWTO (R_MIPS_64, /* type */
352 1.1 christos 0, /* rightshift */
353 1.1 christos 4, /* size (0 = byte, 1 = short, 2 = long) */
354 1.1 christos 64, /* bitsize */
355 1.1 christos FALSE, /* pc_relative */
356 1.1 christos 0, /* bitpos */
357 1.1 christos complain_overflow_dont, /* complain_on_overflow */
358 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
359 1.1 christos "R_MIPS_64", /* name */
360 1.1 christos TRUE, /* partial_inplace */
361 1.1 christos MINUS_ONE, /* src_mask */
362 1.1 christos MINUS_ONE, /* dst_mask */
363 1.1 christos FALSE), /* pcrel_offset */
364 1.1 christos
365 1.1 christos /* Displacement in the global offset table. */
366 1.1 christos HOWTO (R_MIPS_GOT_DISP, /* type */
367 1.1 christos 0, /* rightshift */
368 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
369 1.1 christos 16, /* bitsize */
370 1.1 christos FALSE, /* pc_relative */
371 1.1 christos 0, /* bitpos */
372 1.1 christos complain_overflow_signed, /* complain_on_overflow */
373 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
374 1.1 christos "R_MIPS_GOT_DISP", /* name */
375 1.1 christos TRUE, /* partial_inplace */
376 1.1 christos 0x0000ffff, /* src_mask */
377 1.1 christos 0x0000ffff, /* dst_mask */
378 1.1 christos FALSE), /* pcrel_offset */
379 1.1 christos
380 1.1 christos /* Displacement to page pointer in the global offset table. */
381 1.1 christos HOWTO (R_MIPS_GOT_PAGE, /* type */
382 1.1 christos 0, /* rightshift */
383 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
384 1.1 christos 16, /* bitsize */
385 1.1 christos FALSE, /* pc_relative */
386 1.1 christos 0, /* bitpos */
387 1.1 christos complain_overflow_signed, /* complain_on_overflow */
388 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
389 1.1 christos "R_MIPS_GOT_PAGE", /* name */
390 1.1 christos TRUE, /* partial_inplace */
391 1.1 christos 0x0000ffff, /* src_mask */
392 1.1 christos 0x0000ffff, /* dst_mask */
393 1.1 christos FALSE), /* pcrel_offset */
394 1.1 christos
395 1.1 christos /* Offset from page pointer in the global offset table. */
396 1.1 christos HOWTO (R_MIPS_GOT_OFST, /* type */
397 1.1 christos 0, /* rightshift */
398 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
399 1.1 christos 16, /* bitsize */
400 1.1 christos FALSE, /* pc_relative */
401 1.1 christos 0, /* bitpos */
402 1.1 christos complain_overflow_signed, /* complain_on_overflow */
403 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
404 1.1 christos "R_MIPS_GOT_OFST", /* name */
405 1.1 christos TRUE, /* partial_inplace */
406 1.1 christos 0x0000ffff, /* src_mask */
407 1.1 christos 0x0000ffff, /* dst_mask */
408 1.1 christos FALSE), /* pcrel_offset */
409 1.1 christos
410 1.1 christos /* High 16 bits of displacement in global offset table. */
411 1.1 christos HOWTO (R_MIPS_GOT_HI16, /* type */
412 1.1 christos 0, /* rightshift */
413 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
414 1.1 christos 16, /* bitsize */
415 1.1 christos FALSE, /* pc_relative */
416 1.1 christos 0, /* bitpos */
417 1.1 christos complain_overflow_dont, /* complain_on_overflow */
418 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
419 1.1 christos "R_MIPS_GOT_HI16", /* name */
420 1.1 christos TRUE, /* partial_inplace */
421 1.1 christos 0x0000ffff, /* src_mask */
422 1.1 christos 0x0000ffff, /* dst_mask */
423 1.1 christos FALSE), /* pcrel_offset */
424 1.1 christos
425 1.1 christos /* Low 16 bits of displacement in global offset table. */
426 1.1 christos HOWTO (R_MIPS_GOT_LO16, /* type */
427 1.1 christos 0, /* rightshift */
428 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
429 1.1 christos 16, /* bitsize */
430 1.1 christos FALSE, /* pc_relative */
431 1.1 christos 0, /* bitpos */
432 1.1 christos complain_overflow_dont, /* complain_on_overflow */
433 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
434 1.1 christos "R_MIPS_GOT_LO16", /* name */
435 1.1 christos TRUE, /* partial_inplace */
436 1.1 christos 0x0000ffff, /* src_mask */
437 1.1 christos 0x0000ffff, /* dst_mask */
438 1.1 christos FALSE), /* pcrel_offset */
439 1.1 christos
440 1.1 christos /* 64 bit subtraction. */
441 1.1 christos HOWTO (R_MIPS_SUB, /* type */
442 1.1 christos 0, /* rightshift */
443 1.1 christos 4, /* size (0 = byte, 1 = short, 2 = long) */
444 1.1 christos 64, /* bitsize */
445 1.1 christos FALSE, /* pc_relative */
446 1.1 christos 0, /* bitpos */
447 1.1 christos complain_overflow_dont, /* complain_on_overflow */
448 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
449 1.1 christos "R_MIPS_SUB", /* name */
450 1.1 christos TRUE, /* partial_inplace */
451 1.1 christos MINUS_ONE, /* src_mask */
452 1.1 christos MINUS_ONE, /* dst_mask */
453 1.1 christos FALSE), /* pcrel_offset */
454 1.1 christos
455 1.1 christos /* Insert the addend as an instruction. */
456 1.1 christos /* FIXME: Not handled correctly. */
457 1.1 christos HOWTO (R_MIPS_INSERT_A, /* type */
458 1.1 christos 0, /* rightshift */
459 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
460 1.1 christos 32, /* bitsize */
461 1.1 christos FALSE, /* pc_relative */
462 1.1 christos 0, /* bitpos */
463 1.1 christos complain_overflow_dont, /* complain_on_overflow */
464 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
465 1.1 christos "R_MIPS_INSERT_A", /* name */
466 1.1 christos TRUE, /* partial_inplace */
467 1.1 christos 0xffffffff, /* src_mask */
468 1.1 christos 0xffffffff, /* dst_mask */
469 1.1 christos FALSE), /* pcrel_offset */
470 1.1 christos
471 1.1 christos /* Insert the addend as an instruction, and change all relocations
472 1.1 christos to refer to the old instruction at the address. */
473 1.1 christos /* FIXME: Not handled correctly. */
474 1.1 christos HOWTO (R_MIPS_INSERT_B, /* type */
475 1.1 christos 0, /* rightshift */
476 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
477 1.1 christos 32, /* 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_INSERT_B", /* name */
483 1.1 christos TRUE, /* partial_inplace */
484 1.1 christos 0xffffffff, /* src_mask */
485 1.1 christos 0xffffffff, /* dst_mask */
486 1.1 christos FALSE), /* pcrel_offset */
487 1.1 christos
488 1.1 christos /* Delete a 32 bit instruction. */
489 1.1 christos /* FIXME: Not handled correctly. */
490 1.1 christos HOWTO (R_MIPS_DELETE, /* 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_DELETE", /* 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 /* The MIPS ELF64 ABI Draft wants us to support these for REL relocations.
505 1.1 christos We don't, because
506 1.1 christos a) It means building the addend from a R_MIPS_HIGHEST/R_MIPS_HIGHER/
507 1.1 christos R_MIPS_HI16/R_MIPS_LO16 sequence with varying ordering, using
508 1.1 christos fallable heuristics.
509 1.1 christos b) No other NewABI toolchain actually emits such relocations. */
510 1.1 christos EMPTY_HOWTO (R_MIPS_HIGHER),
511 1.1 christos EMPTY_HOWTO (R_MIPS_HIGHEST),
512 1.1 christos
513 1.1 christos /* High 16 bits of displacement in global offset table. */
514 1.1 christos HOWTO (R_MIPS_CALL_HI16, /* type */
515 1.1 christos 0, /* rightshift */
516 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
517 1.1 christos 16, /* bitsize */
518 1.1 christos FALSE, /* pc_relative */
519 1.1 christos 0, /* bitpos */
520 1.1 christos complain_overflow_dont, /* complain_on_overflow */
521 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
522 1.1 christos "R_MIPS_CALL_HI16", /* name */
523 1.1 christos TRUE, /* partial_inplace */
524 1.1 christos 0x0000ffff, /* src_mask */
525 1.1 christos 0x0000ffff, /* dst_mask */
526 1.1 christos FALSE), /* pcrel_offset */
527 1.1 christos
528 1.1 christos /* Low 16 bits of displacement in global offset table. */
529 1.1 christos HOWTO (R_MIPS_CALL_LO16, /* type */
530 1.1 christos 0, /* rightshift */
531 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
532 1.1 christos 16, /* bitsize */
533 1.1 christos FALSE, /* pc_relative */
534 1.1 christos 0, /* bitpos */
535 1.1 christos complain_overflow_dont, /* complain_on_overflow */
536 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
537 1.1 christos "R_MIPS_CALL_LO16", /* name */
538 1.1 christos TRUE, /* partial_inplace */
539 1.1 christos 0x0000ffff, /* src_mask */
540 1.1 christos 0x0000ffff, /* dst_mask */
541 1.1 christos FALSE), /* pcrel_offset */
542 1.1 christos
543 1.1 christos /* Section displacement. */
544 1.1 christos HOWTO (R_MIPS_SCN_DISP, /* type */
545 1.1 christos 0, /* rightshift */
546 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
547 1.1 christos 32, /* bitsize */
548 1.1 christos FALSE, /* pc_relative */
549 1.1 christos 0, /* bitpos */
550 1.1 christos complain_overflow_dont, /* complain_on_overflow */
551 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
552 1.1 christos "R_MIPS_SCN_DISP", /* name */
553 1.1 christos TRUE, /* partial_inplace */
554 1.1 christos 0xffffffff, /* src_mask */
555 1.1 christos 0xffffffff, /* dst_mask */
556 1.1 christos FALSE), /* pcrel_offset */
557 1.1 christos
558 1.1 christos HOWTO (R_MIPS_REL16, /* type */
559 1.1 christos 0, /* rightshift */
560 1.1 christos 1, /* size (0 = byte, 1 = short, 2 = long) */
561 1.1 christos 16, /* bitsize */
562 1.1 christos FALSE, /* pc_relative */
563 1.1 christos 0, /* bitpos */
564 1.1 christos complain_overflow_signed, /* complain_on_overflow */
565 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
566 1.1 christos "R_MIPS_REL16", /* name */
567 1.1 christos TRUE, /* partial_inplace */
568 1.1 christos 0xffff, /* src_mask */
569 1.1 christos 0xffff, /* dst_mask */
570 1.1 christos FALSE), /* pcrel_offset */
571 1.1 christos
572 1.1 christos /* These two are obsolete. */
573 1.1 christos EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
574 1.1 christos EMPTY_HOWTO (R_MIPS_PJUMP),
575 1.1 christos
576 1.1 christos /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
577 1.1 christos It must be used for multigot GOT's (and only there). */
578 1.1 christos HOWTO (R_MIPS_RELGOT, /* type */
579 1.1 christos 0, /* rightshift */
580 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
581 1.1 christos 32, /* bitsize */
582 1.1 christos FALSE, /* pc_relative */
583 1.1 christos 0, /* bitpos */
584 1.1 christos complain_overflow_dont, /* complain_on_overflow */
585 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
586 1.1 christos "R_MIPS_RELGOT", /* name */
587 1.1 christos TRUE, /* partial_inplace */
588 1.1 christos 0xffffffff, /* src_mask */
589 1.1 christos 0xffffffff, /* dst_mask */
590 1.1 christos FALSE), /* pcrel_offset */
591 1.1 christos
592 1.1 christos /* Protected jump conversion. This is an optimization hint. No
593 1.1 christos relocation is required for correctness. */
594 1.1 christos HOWTO (R_MIPS_JALR, /* type */
595 1.1 christos 0, /* rightshift */
596 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
597 1.1 christos 32, /* bitsize */
598 1.1 christos FALSE, /* pc_relative */
599 1.1 christos 0, /* bitpos */
600 1.1 christos complain_overflow_dont, /* complain_on_overflow */
601 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
602 1.1 christos "R_MIPS_JALR", /* name */
603 1.1 christos FALSE, /* partial_inplace */
604 1.1 christos 0x00000000, /* src_mask */
605 1.1 christos 0x00000000, /* dst_mask */
606 1.1 christos FALSE), /* pcrel_offset */
607 1.1 christos
608 1.1 christos /* TLS GD/LD dynamic relocations. */
609 1.1 christos HOWTO (R_MIPS_TLS_DTPMOD32, /* type */
610 1.1 christos 0, /* rightshift */
611 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
612 1.1 christos 32, /* bitsize */
613 1.1 christos FALSE, /* pc_relative */
614 1.1 christos 0, /* bitpos */
615 1.1 christos complain_overflow_dont, /* complain_on_overflow */
616 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
617 1.1 christos "R_MIPS_TLS_DTPMOD32", /* name */
618 1.1 christos TRUE, /* partial_inplace */
619 1.1 christos 0xffffffff, /* src_mask */
620 1.1 christos 0xffffffff, /* dst_mask */
621 1.1 christos FALSE), /* pcrel_offset */
622 1.1 christos
623 1.1 christos HOWTO (R_MIPS_TLS_DTPREL32, /* type */
624 1.1 christos 0, /* rightshift */
625 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
626 1.1 christos 32, /* bitsize */
627 1.1 christos FALSE, /* pc_relative */
628 1.1 christos 0, /* bitpos */
629 1.1 christos complain_overflow_dont, /* complain_on_overflow */
630 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
631 1.1 christos "R_MIPS_TLS_DTPREL32", /* name */
632 1.1 christos TRUE, /* partial_inplace */
633 1.1 christos 0xffffffff, /* src_mask */
634 1.1 christos 0xffffffff, /* dst_mask */
635 1.1 christos FALSE), /* pcrel_offset */
636 1.1 christos
637 1.1 christos EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64),
638 1.1 christos EMPTY_HOWTO (R_MIPS_TLS_DTPREL64),
639 1.1 christos
640 1.1 christos /* TLS general dynamic variable reference. */
641 1.1 christos HOWTO (R_MIPS_TLS_GD, /* type */
642 1.1 christos 0, /* rightshift */
643 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
644 1.1 christos 16, /* bitsize */
645 1.1 christos FALSE, /* pc_relative */
646 1.1 christos 0, /* bitpos */
647 1.1 christos complain_overflow_signed, /* complain_on_overflow */
648 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
649 1.1 christos "R_MIPS_TLS_GD", /* name */
650 1.1 christos TRUE, /* partial_inplace */
651 1.1 christos 0x0000ffff, /* src_mask */
652 1.1 christos 0x0000ffff, /* dst_mask */
653 1.1 christos FALSE), /* pcrel_offset */
654 1.1 christos
655 1.1 christos /* TLS local dynamic variable reference. */
656 1.1 christos HOWTO (R_MIPS_TLS_LDM, /* type */
657 1.1 christos 0, /* rightshift */
658 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
659 1.1 christos 16, /* bitsize */
660 1.1 christos FALSE, /* pc_relative */
661 1.1 christos 0, /* bitpos */
662 1.1 christos complain_overflow_signed, /* complain_on_overflow */
663 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
664 1.1 christos "R_MIPS_TLS_LDM", /* name */
665 1.1 christos TRUE, /* partial_inplace */
666 1.1 christos 0x0000ffff, /* src_mask */
667 1.1 christos 0x0000ffff, /* dst_mask */
668 1.1 christos FALSE), /* pcrel_offset */
669 1.1 christos
670 1.1 christos /* TLS local dynamic offset. */
671 1.1 christos HOWTO (R_MIPS_TLS_DTPREL_HI16, /* type */
672 1.1 christos 0, /* rightshift */
673 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
674 1.1 christos 16, /* bitsize */
675 1.1 christos FALSE, /* pc_relative */
676 1.1 christos 0, /* bitpos */
677 1.1 christos complain_overflow_signed, /* complain_on_overflow */
678 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
679 1.1 christos "R_MIPS_TLS_DTPREL_HI16", /* name */
680 1.1 christos TRUE, /* partial_inplace */
681 1.1 christos 0x0000ffff, /* src_mask */
682 1.1 christos 0x0000ffff, /* dst_mask */
683 1.1 christos FALSE), /* pcrel_offset */
684 1.1 christos
685 1.1 christos /* TLS local dynamic offset. */
686 1.1 christos HOWTO (R_MIPS_TLS_DTPREL_LO16, /* type */
687 1.1 christos 0, /* rightshift */
688 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
689 1.1 christos 16, /* bitsize */
690 1.1 christos FALSE, /* pc_relative */
691 1.1 christos 0, /* bitpos */
692 1.1 christos complain_overflow_signed, /* complain_on_overflow */
693 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
694 1.1 christos "R_MIPS_TLS_DTPREL_LO16", /* name */
695 1.1 christos TRUE, /* partial_inplace */
696 1.1 christos 0x0000ffff, /* src_mask */
697 1.1 christos 0x0000ffff, /* dst_mask */
698 1.1 christos FALSE), /* pcrel_offset */
699 1.1 christos
700 1.1 christos /* TLS thread pointer offset. */
701 1.1 christos HOWTO (R_MIPS_TLS_GOTTPREL, /* type */
702 1.1 christos 0, /* rightshift */
703 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
704 1.1 christos 16, /* bitsize */
705 1.1 christos FALSE, /* pc_relative */
706 1.1 christos 0, /* bitpos */
707 1.1 christos complain_overflow_signed, /* complain_on_overflow */
708 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
709 1.1 christos "R_MIPS_TLS_GOTTPREL", /* name */
710 1.1 christos TRUE, /* partial_inplace */
711 1.1 christos 0x0000ffff, /* src_mask */
712 1.1 christos 0x0000ffff, /* dst_mask */
713 1.1 christos FALSE), /* pcrel_offset */
714 1.1 christos
715 1.1 christos /* TLS IE dynamic relocations. */
716 1.1 christos HOWTO (R_MIPS_TLS_TPREL32, /* type */
717 1.1 christos 0, /* rightshift */
718 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
719 1.1 christos 32, /* bitsize */
720 1.1 christos FALSE, /* pc_relative */
721 1.1 christos 0, /* bitpos */
722 1.1 christos complain_overflow_dont, /* complain_on_overflow */
723 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
724 1.1 christos "R_MIPS_TLS_TPREL32", /* name */
725 1.1 christos TRUE, /* partial_inplace */
726 1.1 christos 0xffffffff, /* src_mask */
727 1.1 christos 0xffffffff, /* dst_mask */
728 1.1 christos FALSE), /* pcrel_offset */
729 1.1 christos
730 1.1 christos EMPTY_HOWTO (R_MIPS_TLS_TPREL64),
731 1.1 christos
732 1.1 christos /* TLS thread pointer offset. */
733 1.1 christos HOWTO (R_MIPS_TLS_TPREL_HI16, /* type */
734 1.1 christos 0, /* rightshift */
735 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
736 1.1 christos 16, /* bitsize */
737 1.1 christos FALSE, /* pc_relative */
738 1.1 christos 0, /* bitpos */
739 1.1 christos complain_overflow_signed, /* complain_on_overflow */
740 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
741 1.1 christos "R_MIPS_TLS_TPREL_HI16", /* name */
742 1.1 christos TRUE, /* partial_inplace */
743 1.1 christos 0x0000ffff, /* src_mask */
744 1.1 christos 0x0000ffff, /* dst_mask */
745 1.1 christos FALSE), /* pcrel_offset */
746 1.1 christos
747 1.1 christos /* TLS thread pointer offset. */
748 1.1 christos HOWTO (R_MIPS_TLS_TPREL_LO16, /* type */
749 1.1 christos 0, /* rightshift */
750 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
751 1.1 christos 16, /* bitsize */
752 1.1 christos FALSE, /* pc_relative */
753 1.1 christos 0, /* bitpos */
754 1.1 christos complain_overflow_signed, /* complain_on_overflow */
755 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
756 1.1 christos "R_MIPS_TLS_TPREL_LO16", /* name */
757 1.1 christos TRUE, /* partial_inplace */
758 1.1 christos 0x0000ffff, /* src_mask */
759 1.1 christos 0x0000ffff, /* dst_mask */
760 1.1 christos FALSE), /* pcrel_offset */
761 1.1 christos
762 1.1 christos /* 32 bit relocation with no addend. */
763 1.1 christos HOWTO (R_MIPS_GLOB_DAT, /* type */
764 1.1 christos 0, /* rightshift */
765 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
766 1.1 christos 32, /* bitsize */
767 1.1 christos FALSE, /* pc_relative */
768 1.1 christos 0, /* bitpos */
769 1.1 christos complain_overflow_dont, /* complain_on_overflow */
770 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
771 1.1 christos "R_MIPS_GLOB_DAT", /* name */
772 1.1 christos FALSE, /* partial_inplace */
773 1.1 christos 0x0, /* src_mask */
774 1.1 christos 0xffffffff, /* dst_mask */
775 1.1 christos FALSE), /* pcrel_offset */
776 1.1 christos };
777 1.1 christos
778 1.1 christos /* The relocation table used for SHT_RELA sections. */
779 1.1 christos
780 1.1 christos static reloc_howto_type elf_mips_howto_table_rela[] =
781 1.1 christos {
782 1.1 christos /* No relocation. */
783 1.1 christos HOWTO (R_MIPS_NONE, /* type */
784 1.1 christos 0, /* rightshift */
785 1.1 christos 0, /* size (0 = byte, 1 = short, 2 = long) */
786 1.1 christos 0, /* bitsize */
787 1.1 christos FALSE, /* pc_relative */
788 1.1 christos 0, /* bitpos */
789 1.1 christos complain_overflow_dont, /* complain_on_overflow */
790 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
791 1.1 christos "R_MIPS_NONE", /* name */
792 1.1 christos FALSE, /* partial_inplace */
793 1.1 christos 0, /* src_mask */
794 1.1 christos 0, /* dst_mask */
795 1.1 christos FALSE), /* pcrel_offset */
796 1.1 christos
797 1.1 christos /* 16 bit relocation. */
798 1.1 christos HOWTO (R_MIPS_16, /* type */
799 1.1 christos 0, /* rightshift */
800 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
801 1.1 christos 16, /* bitsize */
802 1.1 christos FALSE, /* pc_relative */
803 1.1 christos 0, /* bitpos */
804 1.1 christos complain_overflow_signed, /* complain_on_overflow */
805 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
806 1.1 christos "R_MIPS_16", /* name */
807 1.1 christos FALSE, /* partial_inplace */
808 1.1 christos 0, /* src_mask */
809 1.1 christos 0x0000, /* dst_mask */
810 1.1 christos FALSE), /* pcrel_offset */
811 1.1 christos
812 1.1 christos /* 32 bit relocation. */
813 1.1 christos HOWTO (R_MIPS_32, /* type */
814 1.1 christos 0, /* rightshift */
815 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
816 1.1 christos 32, /* bitsize */
817 1.1 christos FALSE, /* pc_relative */
818 1.1 christos 0, /* bitpos */
819 1.1 christos complain_overflow_dont, /* complain_on_overflow */
820 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
821 1.1 christos "R_MIPS_32", /* name */
822 1.1 christos FALSE, /* partial_inplace */
823 1.1 christos 0, /* src_mask */
824 1.1 christos 0xffffffff, /* dst_mask */
825 1.1 christos FALSE), /* pcrel_offset */
826 1.1 christos
827 1.1 christos /* 32 bit symbol relative relocation. */
828 1.1 christos HOWTO (R_MIPS_REL32, /* type */
829 1.1 christos 0, /* rightshift */
830 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
831 1.1 christos 32, /* bitsize */
832 1.1 christos FALSE, /* pc_relative */
833 1.1 christos 0, /* bitpos */
834 1.1 christos complain_overflow_dont, /* complain_on_overflow */
835 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
836 1.1 christos "R_MIPS_REL32", /* name */
837 1.1 christos FALSE, /* partial_inplace */
838 1.1 christos 0, /* src_mask */
839 1.1 christos 0xffffffff, /* dst_mask */
840 1.1 christos FALSE), /* pcrel_offset */
841 1.1 christos
842 1.1 christos /* 26 bit jump address. */
843 1.1 christos HOWTO (R_MIPS_26, /* type */
844 1.1 christos 2, /* rightshift */
845 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
846 1.1 christos 26, /* bitsize */
847 1.1 christos FALSE, /* pc_relative */
848 1.1 christos 0, /* bitpos */
849 1.1 christos complain_overflow_dont, /* complain_on_overflow */
850 1.1 christos /* This needs complex overflow
851 1.1 christos detection, because the upper 36
852 1.1 christos bits must match the PC + 4. */
853 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
854 1.1 christos "R_MIPS_26", /* name */
855 1.1 christos FALSE, /* partial_inplace */
856 1.1 christos 0, /* src_mask */
857 1.1 christos 0x03ffffff, /* dst_mask */
858 1.1 christos FALSE), /* pcrel_offset */
859 1.1 christos
860 1.1 christos /* High 16 bits of symbol value. */
861 1.1 christos HOWTO (R_MIPS_HI16, /* type */
862 1.1 christos 0, /* rightshift */
863 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
864 1.1 christos 16, /* bitsize */
865 1.1 christos FALSE, /* pc_relative */
866 1.1 christos 0, /* bitpos */
867 1.1 christos complain_overflow_dont, /* complain_on_overflow */
868 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
869 1.1 christos "R_MIPS_HI16", /* name */
870 1.1 christos FALSE, /* partial_inplace */
871 1.1 christos 0, /* src_mask */
872 1.1 christos 0x0000ffff, /* dst_mask */
873 1.1 christos FALSE), /* pcrel_offset */
874 1.1 christos
875 1.1 christos /* Low 16 bits of symbol value. */
876 1.1 christos HOWTO (R_MIPS_LO16, /* type */
877 1.1 christos 0, /* rightshift */
878 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
879 1.1 christos 16, /* bitsize */
880 1.1 christos FALSE, /* pc_relative */
881 1.1 christos 0, /* bitpos */
882 1.1 christos complain_overflow_dont, /* complain_on_overflow */
883 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
884 1.1 christos "R_MIPS_LO16", /* name */
885 1.1 christos FALSE, /* partial_inplace */
886 1.1 christos 0, /* src_mask */
887 1.1 christos 0x0000ffff, /* dst_mask */
888 1.1 christos FALSE), /* pcrel_offset */
889 1.1 christos
890 1.1 christos /* GP relative reference. */
891 1.1 christos HOWTO (R_MIPS_GPREL16, /* type */
892 1.1 christos 0, /* rightshift */
893 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
894 1.1 christos 16, /* bitsize */
895 1.1 christos FALSE, /* pc_relative */
896 1.1 christos 0, /* bitpos */
897 1.1 christos complain_overflow_signed, /* complain_on_overflow */
898 1.1 christos mips_elf_gprel16_reloc, /* special_function */
899 1.1 christos "R_MIPS_GPREL16", /* name */
900 1.1 christos FALSE, /* partial_inplace */
901 1.1 christos 0, /* src_mask */
902 1.1 christos 0x0000ffff, /* dst_mask */
903 1.1 christos FALSE), /* pcrel_offset */
904 1.1 christos
905 1.1 christos /* Reference to literal section. */
906 1.1 christos HOWTO (R_MIPS_LITERAL, /* type */
907 1.1 christos 0, /* rightshift */
908 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
909 1.1 christos 16, /* bitsize */
910 1.1 christos FALSE, /* pc_relative */
911 1.1 christos 0, /* bitpos */
912 1.1 christos complain_overflow_signed, /* complain_on_overflow */
913 1.1 christos mips_elf_literal_reloc, /* special_function */
914 1.1 christos "R_MIPS_LITERAL", /* name */
915 1.1 christos FALSE, /* partial_inplace */
916 1.1 christos 0, /* src_mask */
917 1.1 christos 0x0000ffff, /* dst_mask */
918 1.1 christos FALSE), /* pcrel_offset */
919 1.1 christos
920 1.1 christos /* Reference to global offset table. */
921 1.1 christos HOWTO (R_MIPS_GOT16, /* type */
922 1.1 christos 0, /* rightshift */
923 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
924 1.1 christos 16, /* bitsize */
925 1.1 christos FALSE, /* pc_relative */
926 1.1 christos 0, /* bitpos */
927 1.1 christos complain_overflow_signed, /* complain_on_overflow */
928 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
929 1.1 christos "R_MIPS_GOT16", /* name */
930 1.1 christos FALSE, /* partial_inplace */
931 1.1 christos 0, /* src_mask */
932 1.1 christos 0x0000ffff, /* dst_mask */
933 1.1 christos FALSE), /* pcrel_offset */
934 1.1 christos
935 1.1 christos /* 16 bit PC relative reference. Note that the ABI document has a typo
936 1.1 christos and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
937 1.1 christos We do the right thing here. */
938 1.1 christos HOWTO (R_MIPS_PC16, /* type */
939 1.1 christos 2, /* rightshift */
940 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
941 1.1 christos 16, /* bitsize */
942 1.1 christos TRUE, /* pc_relative */
943 1.1 christos 0, /* bitpos */
944 1.1 christos complain_overflow_signed, /* complain_on_overflow */
945 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
946 1.1 christos "R_MIPS_PC16", /* name */
947 1.1 christos FALSE, /* partial_inplace */
948 1.1 christos 0, /* src_mask */
949 1.1 christos 0x0000ffff, /* dst_mask */
950 1.1 christos TRUE), /* pcrel_offset */
951 1.1 christos
952 1.1 christos /* 16 bit call through global offset table. */
953 1.1 christos HOWTO (R_MIPS_CALL16, /* type */
954 1.1 christos 0, /* rightshift */
955 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
956 1.1 christos 16, /* bitsize */
957 1.1 christos FALSE, /* pc_relative */
958 1.1 christos 0, /* bitpos */
959 1.1 christos complain_overflow_signed, /* complain_on_overflow */
960 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
961 1.1 christos "R_MIPS_CALL16", /* name */
962 1.1 christos FALSE, /* partial_inplace */
963 1.1 christos 0, /* src_mask */
964 1.1 christos 0x0000ffff, /* dst_mask */
965 1.1 christos FALSE), /* pcrel_offset */
966 1.1 christos
967 1.1 christos /* 32 bit GP relative reference. */
968 1.1 christos HOWTO (R_MIPS_GPREL32, /* type */
969 1.1 christos 0, /* rightshift */
970 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
971 1.1 christos 32, /* bitsize */
972 1.1 christos FALSE, /* pc_relative */
973 1.1 christos 0, /* bitpos */
974 1.1 christos complain_overflow_dont, /* complain_on_overflow */
975 1.1 christos mips_elf_gprel32_reloc, /* special_function */
976 1.1 christos "R_MIPS_GPREL32", /* name */
977 1.1 christos FALSE, /* partial_inplace */
978 1.1 christos 0, /* src_mask */
979 1.1 christos 0xffffffff, /* dst_mask */
980 1.1 christos FALSE), /* pcrel_offset */
981 1.1 christos
982 1.1 christos EMPTY_HOWTO (13),
983 1.1 christos EMPTY_HOWTO (14),
984 1.1 christos EMPTY_HOWTO (15),
985 1.1 christos
986 1.1 christos /* A 5 bit shift field. */
987 1.1 christos HOWTO (R_MIPS_SHIFT5, /* type */
988 1.1 christos 0, /* rightshift */
989 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
990 1.1 christos 5, /* bitsize */
991 1.1 christos FALSE, /* pc_relative */
992 1.1 christos 6, /* bitpos */
993 1.1 christos complain_overflow_bitfield, /* complain_on_overflow */
994 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
995 1.1 christos "R_MIPS_SHIFT5", /* name */
996 1.1 christos FALSE, /* partial_inplace */
997 1.1 christos 0, /* src_mask */
998 1.1 christos 0x000007c0, /* dst_mask */
999 1.1 christos FALSE), /* pcrel_offset */
1000 1.1 christos
1001 1.1 christos /* A 6 bit shift field. */
1002 1.1 christos HOWTO (R_MIPS_SHIFT6, /* type */
1003 1.1 christos 0, /* rightshift */
1004 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1005 1.1 christos 6, /* bitsize */
1006 1.1 christos FALSE, /* pc_relative */
1007 1.1 christos 6, /* bitpos */
1008 1.1 christos complain_overflow_bitfield, /* complain_on_overflow */
1009 1.1 christos mips_elf_shift6_reloc, /* special_function */
1010 1.1 christos "R_MIPS_SHIFT6", /* name */
1011 1.1 christos FALSE, /* partial_inplace */
1012 1.1 christos 0, /* src_mask */
1013 1.1 christos 0x000007c4, /* dst_mask */
1014 1.1 christos FALSE), /* pcrel_offset */
1015 1.1 christos
1016 1.1 christos /* 64 bit relocation. */
1017 1.1 christos HOWTO (R_MIPS_64, /* type */
1018 1.1 christos 0, /* rightshift */
1019 1.1 christos 4, /* size (0 = byte, 1 = short, 2 = long) */
1020 1.1 christos 64, /* bitsize */
1021 1.1 christos FALSE, /* pc_relative */
1022 1.1 christos 0, /* bitpos */
1023 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1024 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1025 1.1 christos "R_MIPS_64", /* name */
1026 1.1 christos FALSE, /* partial_inplace */
1027 1.1 christos 0, /* src_mask */
1028 1.1 christos MINUS_ONE, /* dst_mask */
1029 1.1 christos FALSE), /* pcrel_offset */
1030 1.1 christos
1031 1.1 christos /* Displacement in the global offset table. */
1032 1.1 christos HOWTO (R_MIPS_GOT_DISP, /* type */
1033 1.1 christos 0, /* rightshift */
1034 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1035 1.1 christos 16, /* bitsize */
1036 1.1 christos FALSE, /* pc_relative */
1037 1.1 christos 0, /* bitpos */
1038 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1039 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1040 1.1 christos "R_MIPS_GOT_DISP", /* name */
1041 1.1 christos FALSE, /* partial_inplace */
1042 1.1 christos 0, /* src_mask */
1043 1.1 christos 0x0000ffff, /* dst_mask */
1044 1.1 christos FALSE), /* pcrel_offset */
1045 1.1 christos
1046 1.1 christos /* Displacement to page pointer in the global offset table. */
1047 1.1 christos HOWTO (R_MIPS_GOT_PAGE, /* type */
1048 1.1 christos 0, /* rightshift */
1049 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1050 1.1 christos 16, /* bitsize */
1051 1.1 christos FALSE, /* pc_relative */
1052 1.1 christos 0, /* bitpos */
1053 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1054 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1055 1.1 christos "R_MIPS_GOT_PAGE", /* name */
1056 1.1 christos FALSE, /* partial_inplace */
1057 1.1 christos 0, /* src_mask */
1058 1.1 christos 0x0000ffff, /* dst_mask */
1059 1.1 christos FALSE), /* pcrel_offset */
1060 1.1 christos
1061 1.1 christos /* Offset from page pointer in the global offset table. */
1062 1.1 christos HOWTO (R_MIPS_GOT_OFST, /* type */
1063 1.1 christos 0, /* rightshift */
1064 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1065 1.1 christos 16, /* bitsize */
1066 1.1 christos FALSE, /* pc_relative */
1067 1.1 christos 0, /* bitpos */
1068 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1069 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1070 1.1 christos "R_MIPS_GOT_OFST", /* name */
1071 1.1 christos FALSE, /* partial_inplace */
1072 1.1 christos 0, /* src_mask */
1073 1.1 christos 0x0000ffff, /* dst_mask */
1074 1.1 christos FALSE), /* pcrel_offset */
1075 1.1 christos
1076 1.1 christos /* High 16 bits of displacement in global offset table. */
1077 1.1 christos HOWTO (R_MIPS_GOT_HI16, /* type */
1078 1.1 christos 0, /* rightshift */
1079 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1080 1.1 christos 16, /* bitsize */
1081 1.1 christos FALSE, /* pc_relative */
1082 1.1 christos 0, /* bitpos */
1083 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1084 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1085 1.1 christos "R_MIPS_GOT_HI16", /* name */
1086 1.1 christos FALSE, /* partial_inplace */
1087 1.1 christos 0, /* src_mask */
1088 1.1 christos 0x0000ffff, /* dst_mask */
1089 1.1 christos FALSE), /* pcrel_offset */
1090 1.1 christos
1091 1.1 christos /* Low 16 bits of displacement in global offset table. */
1092 1.1 christos HOWTO (R_MIPS_GOT_LO16, /* type */
1093 1.1 christos 0, /* rightshift */
1094 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1095 1.1 christos 16, /* bitsize */
1096 1.1 christos FALSE, /* pc_relative */
1097 1.1 christos 0, /* bitpos */
1098 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1099 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1100 1.1 christos "R_MIPS_GOT_LO16", /* name */
1101 1.1 christos FALSE, /* partial_inplace */
1102 1.1 christos 0, /* src_mask */
1103 1.1 christos 0x0000ffff, /* dst_mask */
1104 1.1 christos FALSE), /* pcrel_offset */
1105 1.1 christos
1106 1.1 christos /* 64 bit subtraction. */
1107 1.1 christos HOWTO (R_MIPS_SUB, /* type */
1108 1.1 christos 0, /* rightshift */
1109 1.1 christos 4, /* size (0 = byte, 1 = short, 2 = long) */
1110 1.1 christos 64, /* bitsize */
1111 1.1 christos FALSE, /* pc_relative */
1112 1.1 christos 0, /* bitpos */
1113 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1114 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1115 1.1 christos "R_MIPS_SUB", /* name */
1116 1.1 christos FALSE, /* partial_inplace */
1117 1.1 christos 0, /* src_mask */
1118 1.1 christos MINUS_ONE, /* dst_mask */
1119 1.1 christos FALSE), /* pcrel_offset */
1120 1.1 christos
1121 1.1 christos /* Insert the addend as an instruction. */
1122 1.1 christos /* FIXME: Not handled correctly. */
1123 1.1 christos HOWTO (R_MIPS_INSERT_A, /* type */
1124 1.1 christos 0, /* rightshift */
1125 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1126 1.1 christos 32, /* bitsize */
1127 1.1 christos FALSE, /* pc_relative */
1128 1.1 christos 0, /* bitpos */
1129 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1130 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1131 1.1 christos "R_MIPS_INSERT_A", /* name */
1132 1.1 christos FALSE, /* partial_inplace */
1133 1.1 christos 0, /* src_mask */
1134 1.1 christos 0xffffffff, /* dst_mask */
1135 1.1 christos FALSE), /* pcrel_offset */
1136 1.1 christos
1137 1.1 christos /* Insert the addend as an instruction, and change all relocations
1138 1.1 christos to refer to the old instruction at the address. */
1139 1.1 christos /* FIXME: Not handled correctly. */
1140 1.1 christos HOWTO (R_MIPS_INSERT_B, /* type */
1141 1.1 christos 0, /* rightshift */
1142 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1143 1.1 christos 32, /* bitsize */
1144 1.1 christos FALSE, /* pc_relative */
1145 1.1 christos 0, /* bitpos */
1146 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1147 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1148 1.1 christos "R_MIPS_INSERT_B", /* name */
1149 1.1 christos FALSE, /* partial_inplace */
1150 1.1 christos 0, /* src_mask */
1151 1.1 christos 0xffffffff, /* dst_mask */
1152 1.1 christos FALSE), /* pcrel_offset */
1153 1.1 christos
1154 1.1 christos /* Delete a 32 bit instruction. */
1155 1.1 christos /* FIXME: Not handled correctly. */
1156 1.1 christos HOWTO (R_MIPS_DELETE, /* type */
1157 1.1 christos 0, /* rightshift */
1158 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1159 1.1 christos 32, /* bitsize */
1160 1.1 christos FALSE, /* pc_relative */
1161 1.1 christos 0, /* bitpos */
1162 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1163 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1164 1.1 christos "R_MIPS_DELETE", /* name */
1165 1.1 christos FALSE, /* partial_inplace */
1166 1.1 christos 0, /* src_mask */
1167 1.1 christos 0xffffffff, /* dst_mask */
1168 1.1 christos FALSE), /* pcrel_offset */
1169 1.1 christos
1170 1.1 christos /* Get the higher value of a 64 bit addend. */
1171 1.1 christos HOWTO (R_MIPS_HIGHER, /* type */
1172 1.1 christos 0, /* rightshift */
1173 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1174 1.1 christos 16, /* bitsize */
1175 1.1 christos FALSE, /* pc_relative */
1176 1.1 christos 0, /* bitpos */
1177 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1178 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1179 1.1 christos "R_MIPS_HIGHER", /* name */
1180 1.1 christos FALSE, /* partial_inplace */
1181 1.1 christos 0, /* src_mask */
1182 1.1 christos 0x0000ffff, /* dst_mask */
1183 1.1 christos FALSE), /* pcrel_offset */
1184 1.1 christos
1185 1.1 christos /* Get the highest value of a 64 bit addend. */
1186 1.1 christos HOWTO (R_MIPS_HIGHEST, /* type */
1187 1.1 christos 0, /* rightshift */
1188 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1189 1.1 christos 16, /* bitsize */
1190 1.1 christos FALSE, /* pc_relative */
1191 1.1 christos 0, /* bitpos */
1192 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1193 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1194 1.1 christos "R_MIPS_HIGHEST", /* name */
1195 1.1 christos FALSE, /* partial_inplace */
1196 1.1 christos 0, /* src_mask */
1197 1.1 christos 0x0000ffff, /* dst_mask */
1198 1.1 christos FALSE), /* pcrel_offset */
1199 1.1 christos
1200 1.1 christos /* High 16 bits of displacement in global offset table. */
1201 1.1 christos HOWTO (R_MIPS_CALL_HI16, /* type */
1202 1.1 christos 0, /* rightshift */
1203 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1204 1.1 christos 16, /* bitsize */
1205 1.1 christos FALSE, /* pc_relative */
1206 1.1 christos 0, /* bitpos */
1207 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1208 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1209 1.1 christos "R_MIPS_CALL_HI16", /* name */
1210 1.1 christos FALSE, /* partial_inplace */
1211 1.1 christos 0, /* src_mask */
1212 1.1 christos 0x0000ffff, /* dst_mask */
1213 1.1 christos FALSE), /* pcrel_offset */
1214 1.1 christos
1215 1.1 christos /* Low 16 bits of displacement in global offset table. */
1216 1.1 christos HOWTO (R_MIPS_CALL_LO16, /* type */
1217 1.1 christos 0, /* rightshift */
1218 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1219 1.1 christos 16, /* bitsize */
1220 1.1 christos FALSE, /* pc_relative */
1221 1.1 christos 0, /* bitpos */
1222 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1223 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1224 1.1 christos "R_MIPS_CALL_LO16", /* name */
1225 1.1 christos FALSE, /* partial_inplace */
1226 1.1 christos 0, /* src_mask */
1227 1.1 christos 0x0000ffff, /* dst_mask */
1228 1.1 christos FALSE), /* pcrel_offset */
1229 1.1 christos
1230 1.1 christos /* Section displacement, used by an associated event location section. */
1231 1.1 christos HOWTO (R_MIPS_SCN_DISP, /* type */
1232 1.1 christos 0, /* rightshift */
1233 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1234 1.1 christos 32, /* bitsize */
1235 1.1 christos FALSE, /* pc_relative */
1236 1.1 christos 0, /* bitpos */
1237 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1238 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1239 1.1 christos "R_MIPS_SCN_DISP", /* name */
1240 1.1 christos FALSE, /* partial_inplace */
1241 1.1 christos 0, /* src_mask */
1242 1.1 christos 0xffffffff, /* dst_mask */
1243 1.1 christos FALSE), /* pcrel_offset */
1244 1.1 christos
1245 1.1 christos /* 16 bit relocation. */
1246 1.1 christos HOWTO (R_MIPS_REL16, /* type */
1247 1.1 christos 0, /* rightshift */
1248 1.1 christos 1, /* size (0 = byte, 1 = short, 2 = long) */
1249 1.1 christos 16, /* bitsize */
1250 1.1 christos FALSE, /* pc_relative */
1251 1.1 christos 0, /* bitpos */
1252 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1253 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1254 1.1 christos "R_MIPS_REL16", /* name */
1255 1.1 christos FALSE, /* partial_inplace */
1256 1.1 christos 0, /* src_mask */
1257 1.1 christos 0xffff, /* dst_mask */
1258 1.1 christos FALSE), /* pcrel_offset */
1259 1.1 christos
1260 1.1 christos /* These two are obsolete. */
1261 1.1 christos EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
1262 1.1 christos EMPTY_HOWTO (R_MIPS_PJUMP),
1263 1.1 christos
1264 1.1 christos /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
1265 1.1 christos It must be used for multigot GOT's (and only there). */
1266 1.1 christos HOWTO (R_MIPS_RELGOT, /* type */
1267 1.1 christos 0, /* rightshift */
1268 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1269 1.1 christos 32, /* bitsize */
1270 1.1 christos FALSE, /* pc_relative */
1271 1.1 christos 0, /* bitpos */
1272 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1273 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1274 1.1 christos "R_MIPS_RELGOT", /* name */
1275 1.1 christos FALSE, /* partial_inplace */
1276 1.1 christos 0, /* src_mask */
1277 1.1 christos 0xffffffff, /* dst_mask */
1278 1.1 christos FALSE), /* pcrel_offset */
1279 1.1 christos
1280 1.1 christos /* Protected jump conversion. This is an optimization hint. No
1281 1.1 christos relocation is required for correctness. */
1282 1.1 christos HOWTO (R_MIPS_JALR, /* type */
1283 1.1 christos 0, /* rightshift */
1284 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1285 1.1 christos 32, /* bitsize */
1286 1.1 christos FALSE, /* pc_relative */
1287 1.1 christos 0, /* bitpos */
1288 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1289 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1290 1.1 christos "R_MIPS_JALR", /* name */
1291 1.1 christos FALSE, /* partial_inplace */
1292 1.1 christos 0, /* src_mask */
1293 1.1 christos 0, /* dst_mask */
1294 1.1 christos FALSE), /* pcrel_offset */
1295 1.1 christos
1296 1.1 christos /* TLS GD/LD dynamic relocations. */
1297 1.1 christos HOWTO (R_MIPS_TLS_DTPMOD32, /* type */
1298 1.1 christos 0, /* rightshift */
1299 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1300 1.1 christos 32, /* bitsize */
1301 1.1 christos FALSE, /* pc_relative */
1302 1.1 christos 0, /* bitpos */
1303 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1304 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1305 1.1 christos "R_MIPS_TLS_DTPMOD32", /* name */
1306 1.1 christos FALSE, /* partial_inplace */
1307 1.1 christos 0, /* src_mask */
1308 1.1 christos 0xffffffff, /* dst_mask */
1309 1.1 christos FALSE), /* pcrel_offset */
1310 1.1 christos
1311 1.1 christos HOWTO (R_MIPS_TLS_DTPREL32, /* type */
1312 1.1 christos 0, /* rightshift */
1313 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1314 1.1 christos 32, /* bitsize */
1315 1.1 christos FALSE, /* pc_relative */
1316 1.1 christos 0, /* bitpos */
1317 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1318 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1319 1.1 christos "R_MIPS_TLS_DTPREL32", /* name */
1320 1.1 christos FALSE, /* partial_inplace */
1321 1.1 christos 0, /* src_mask */
1322 1.1 christos 0xffffffff, /* dst_mask */
1323 1.1 christos FALSE), /* pcrel_offset */
1324 1.1 christos
1325 1.1 christos EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64),
1326 1.1 christos EMPTY_HOWTO (R_MIPS_TLS_DTPREL64),
1327 1.1 christos
1328 1.1 christos /* TLS general dynamic variable reference. */
1329 1.1 christos HOWTO (R_MIPS_TLS_GD, /* type */
1330 1.1 christos 0, /* rightshift */
1331 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1332 1.1 christos 16, /* bitsize */
1333 1.1 christos FALSE, /* pc_relative */
1334 1.1 christos 0, /* bitpos */
1335 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1336 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1337 1.1 christos "R_MIPS_TLS_GD", /* name */
1338 1.1 christos FALSE, /* partial_inplace */
1339 1.1 christos 0, /* src_mask */
1340 1.1 christos 0x0000ffff, /* dst_mask */
1341 1.1 christos FALSE), /* pcrel_offset */
1342 1.1 christos
1343 1.1 christos /* TLS local dynamic variable reference. */
1344 1.1 christos HOWTO (R_MIPS_TLS_LDM, /* type */
1345 1.1 christos 0, /* rightshift */
1346 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1347 1.1 christos 16, /* bitsize */
1348 1.1 christos FALSE, /* pc_relative */
1349 1.1 christos 0, /* bitpos */
1350 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1351 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1352 1.1 christos "R_MIPS_TLS_LDM", /* name */
1353 1.1 christos FALSE, /* partial_inplace */
1354 1.1 christos 0, /* src_mask */
1355 1.1 christos 0x0000ffff, /* dst_mask */
1356 1.1 christos FALSE), /* pcrel_offset */
1357 1.1 christos
1358 1.1 christos /* TLS local dynamic offset. */
1359 1.1 christos HOWTO (R_MIPS_TLS_DTPREL_HI16, /* type */
1360 1.1 christos 0, /* rightshift */
1361 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1362 1.1 christos 16, /* bitsize */
1363 1.1 christos FALSE, /* pc_relative */
1364 1.1 christos 0, /* bitpos */
1365 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1366 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1367 1.1 christos "R_MIPS_TLS_DTPREL_HI16", /* name */
1368 1.1 christos FALSE, /* partial_inplace */
1369 1.1 christos 0, /* src_mask */
1370 1.1 christos 0x0000ffff, /* dst_mask */
1371 1.1 christos FALSE), /* pcrel_offset */
1372 1.1 christos
1373 1.1 christos /* TLS local dynamic offset. */
1374 1.1 christos HOWTO (R_MIPS_TLS_DTPREL_LO16, /* type */
1375 1.1 christos 0, /* rightshift */
1376 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1377 1.1 christos 16, /* bitsize */
1378 1.1 christos FALSE, /* pc_relative */
1379 1.1 christos 0, /* bitpos */
1380 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1381 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1382 1.1 christos "R_MIPS_TLS_DTPREL_LO16", /* name */
1383 1.1 christos FALSE, /* partial_inplace */
1384 1.1 christos 0, /* src_mask */
1385 1.1 christos 0x0000ffff, /* dst_mask */
1386 1.1 christos FALSE), /* pcrel_offset */
1387 1.1 christos
1388 1.1 christos /* TLS thread pointer offset. */
1389 1.1 christos HOWTO (R_MIPS_TLS_GOTTPREL, /* type */
1390 1.1 christos 0, /* rightshift */
1391 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1392 1.1 christos 16, /* bitsize */
1393 1.1 christos FALSE, /* pc_relative */
1394 1.1 christos 0, /* bitpos */
1395 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1396 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1397 1.1 christos "R_MIPS_TLS_GOTTPREL", /* name */
1398 1.1 christos FALSE, /* partial_inplace */
1399 1.1 christos 0, /* src_mask */
1400 1.1 christos 0x0000ffff, /* dst_mask */
1401 1.1 christos FALSE), /* pcrel_offset */
1402 1.1 christos
1403 1.1 christos /* TLS IE dynamic relocations. */
1404 1.1 christos HOWTO (R_MIPS_TLS_TPREL32, /* type */
1405 1.1 christos 0, /* rightshift */
1406 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1407 1.1 christos 32, /* bitsize */
1408 1.1 christos FALSE, /* pc_relative */
1409 1.1 christos 0, /* bitpos */
1410 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1411 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1412 1.1 christos "R_MIPS_TLS_TPREL32", /* name */
1413 1.1 christos FALSE, /* partial_inplace */
1414 1.1 christos 0, /* src_mask */
1415 1.1 christos 0xffffffff, /* dst_mask */
1416 1.1 christos FALSE), /* pcrel_offset */
1417 1.1 christos
1418 1.1 christos EMPTY_HOWTO (R_MIPS_TLS_TPREL64),
1419 1.1 christos
1420 1.1 christos /* TLS thread pointer offset. */
1421 1.1 christos HOWTO (R_MIPS_TLS_TPREL_HI16, /* type */
1422 1.1 christos 0, /* rightshift */
1423 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1424 1.1 christos 16, /* bitsize */
1425 1.1 christos FALSE, /* pc_relative */
1426 1.1 christos 0, /* bitpos */
1427 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1428 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1429 1.1 christos "R_MIPS_TLS_TPREL_HI16", /* name */
1430 1.1 christos FALSE, /* partial_inplace */
1431 1.1 christos 0, /* src_mask */
1432 1.1 christos 0x0000ffff, /* dst_mask */
1433 1.1 christos FALSE), /* pcrel_offset */
1434 1.1 christos
1435 1.1 christos /* TLS thread pointer offset. */
1436 1.1 christos HOWTO (R_MIPS_TLS_TPREL_LO16, /* type */
1437 1.1 christos 0, /* rightshift */
1438 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1439 1.1 christos 16, /* bitsize */
1440 1.1 christos FALSE, /* pc_relative */
1441 1.1 christos 0, /* bitpos */
1442 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1443 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1444 1.1 christos "R_MIPS_TLS_TPREL_LO16", /* name */
1445 1.1 christos FALSE, /* partial_inplace */
1446 1.1 christos 0, /* src_mask */
1447 1.1 christos 0x0000ffff, /* dst_mask */
1448 1.1 christos FALSE), /* pcrel_offset */
1449 1.1 christos
1450 1.1 christos /* 32 bit relocation with no addend. */
1451 1.1 christos HOWTO (R_MIPS_GLOB_DAT, /* type */
1452 1.1 christos 0, /* rightshift */
1453 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1454 1.1 christos 32, /* bitsize */
1455 1.1 christos FALSE, /* pc_relative */
1456 1.1 christos 0, /* bitpos */
1457 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1458 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1459 1.1 christos "R_MIPS_GLOB_DAT", /* name */
1460 1.1 christos FALSE, /* partial_inplace */
1461 1.1 christos 0x0, /* src_mask */
1462 1.1 christos 0xffffffff, /* dst_mask */
1463 1.1 christos FALSE), /* pcrel_offset */
1464 1.1 christos };
1465 1.1 christos
1466 1.1 christos static reloc_howto_type elf_mips16_howto_table_rel[] =
1467 1.1 christos {
1468 1.1 christos /* The reloc used for the mips16 jump instruction. */
1469 1.1 christos HOWTO (R_MIPS16_26, /* type */
1470 1.1 christos 2, /* rightshift */
1471 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1472 1.1 christos 26, /* bitsize */
1473 1.1 christos FALSE, /* pc_relative */
1474 1.1 christos 0, /* bitpos */
1475 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1476 1.1 christos /* This needs complex overflow
1477 1.1 christos detection, because the upper four
1478 1.1 christos bits must match the PC. */
1479 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1480 1.1 christos "R_MIPS16_26", /* name */
1481 1.1 christos TRUE, /* partial_inplace */
1482 1.1 christos 0x3ffffff, /* src_mask */
1483 1.1 christos 0x3ffffff, /* dst_mask */
1484 1.1 christos FALSE), /* pcrel_offset */
1485 1.1 christos
1486 1.1 christos /* The reloc used for the mips16 gprel instruction. */
1487 1.1 christos HOWTO (R_MIPS16_GPREL, /* type */
1488 1.1 christos 0, /* rightshift */
1489 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1490 1.1 christos 16, /* bitsize */
1491 1.1 christos FALSE, /* pc_relative */
1492 1.1 christos 0, /* bitpos */
1493 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1494 1.1 christos mips16_gprel_reloc, /* special_function */
1495 1.1 christos "R_MIPS16_GPREL", /* name */
1496 1.1 christos TRUE, /* partial_inplace */
1497 1.1 christos 0x0000ffff, /* src_mask */
1498 1.1 christos 0x0000ffff, /* dst_mask */
1499 1.1 christos FALSE), /* pcrel_offset */
1500 1.1 christos
1501 1.1 christos /* A MIPS16 reference to the global offset table. */
1502 1.1 christos HOWTO (R_MIPS16_GOT16, /* type */
1503 1.1 christos 0, /* rightshift */
1504 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1505 1.1 christos 16, /* bitsize */
1506 1.1 christos FALSE, /* pc_relative */
1507 1.1 christos 0, /* bitpos */
1508 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1509 1.1 christos _bfd_mips_elf_got16_reloc, /* special_function */
1510 1.1 christos "R_MIPS16_GOT16", /* name */
1511 1.1 christos TRUE, /* partial_inplace */
1512 1.1 christos 0x0000ffff, /* src_mask */
1513 1.1 christos 0x0000ffff, /* dst_mask */
1514 1.1 christos FALSE), /* pcrel_offset */
1515 1.1 christos
1516 1.1 christos /* A MIPS16 call through the global offset table. */
1517 1.1 christos HOWTO (R_MIPS16_CALL16, /* type */
1518 1.1 christos 0, /* rightshift */
1519 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1520 1.1 christos 16, /* bitsize */
1521 1.1 christos FALSE, /* pc_relative */
1522 1.1 christos 0, /* bitpos */
1523 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1524 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1525 1.1 christos "R_MIPS16_CALL16", /* name */
1526 1.1 christos TRUE, /* partial_inplace */
1527 1.1 christos 0x0000ffff, /* src_mask */
1528 1.1 christos 0x0000ffff, /* dst_mask */
1529 1.1 christos FALSE), /* pcrel_offset */
1530 1.1 christos
1531 1.1 christos /* MIPS16 high 16 bits of symbol value. */
1532 1.1 christos HOWTO (R_MIPS16_HI16, /* type */
1533 1.1 christos 16, /* rightshift */
1534 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1535 1.1 christos 16, /* 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_hi16_reloc, /* special_function */
1540 1.1 christos "R_MIPS16_HI16", /* name */
1541 1.1 christos TRUE, /* partial_inplace */
1542 1.1 christos 0x0000ffff, /* src_mask */
1543 1.1 christos 0x0000ffff, /* dst_mask */
1544 1.1 christos FALSE), /* pcrel_offset */
1545 1.1 christos
1546 1.1 christos /* MIPS16 low 16 bits of symbol value. */
1547 1.1 christos HOWTO (R_MIPS16_LO16, /* 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_dont, /* complain_on_overflow */
1554 1.1 christos _bfd_mips_elf_lo16_reloc, /* special_function */
1555 1.1 christos "R_MIPS16_LO16", /* name */
1556 1.1 christos TRUE, /* partial_inplace */
1557 1.1 christos 0x0000ffff, /* src_mask */
1558 1.1 christos 0x0000ffff, /* dst_mask */
1559 1.1 christos FALSE), /* pcrel_offset */
1560 1.1 christos
1561 1.1 christos /* MIPS16 TLS general dynamic variable reference. */
1562 1.1 christos HOWTO (R_MIPS16_TLS_GD, /* 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_MIPS16_TLS_GD", /* name */
1571 1.1 christos TRUE, /* partial_inplace */
1572 1.1 christos 0x0000ffff, /* src_mask */
1573 1.1 christos 0x0000ffff, /* dst_mask */
1574 1.1 christos FALSE), /* pcrel_offset */
1575 1.1 christos
1576 1.1 christos /* MIPS16 TLS local dynamic variable reference. */
1577 1.1 christos HOWTO (R_MIPS16_TLS_LDM, /* type */
1578 1.1 christos 0, /* rightshift */
1579 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1580 1.1 christos 16, /* bitsize */
1581 1.1 christos FALSE, /* pc_relative */
1582 1.1 christos 0, /* bitpos */
1583 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1584 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1585 1.1 christos "R_MIPS16_TLS_LDM", /* name */
1586 1.1 christos TRUE, /* partial_inplace */
1587 1.1 christos 0x0000ffff, /* src_mask */
1588 1.1 christos 0x0000ffff, /* dst_mask */
1589 1.1 christos FALSE), /* pcrel_offset */
1590 1.1 christos
1591 1.1 christos /* MIPS16 TLS local dynamic offset. */
1592 1.1 christos HOWTO (R_MIPS16_TLS_DTPREL_HI16, /* type */
1593 1.1 christos 0, /* rightshift */
1594 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1595 1.1 christos 16, /* bitsize */
1596 1.1 christos FALSE, /* pc_relative */
1597 1.1 christos 0, /* bitpos */
1598 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1599 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1600 1.1 christos "R_MIPS16_TLS_DTPREL_HI16", /* name */
1601 1.1 christos TRUE, /* partial_inplace */
1602 1.1 christos 0x0000ffff, /* src_mask */
1603 1.1 christos 0x0000ffff, /* dst_mask */
1604 1.1 christos FALSE), /* pcrel_offset */
1605 1.1 christos
1606 1.1 christos /* MIPS16 TLS local dynamic offset. */
1607 1.1 christos HOWTO (R_MIPS16_TLS_DTPREL_LO16, /* type */
1608 1.1 christos 0, /* rightshift */
1609 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1610 1.1 christos 16, /* bitsize */
1611 1.1 christos FALSE, /* pc_relative */
1612 1.1 christos 0, /* bitpos */
1613 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1614 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1615 1.1 christos "R_MIPS16_TLS_DTPREL_LO16", /* name */
1616 1.1 christos TRUE, /* partial_inplace */
1617 1.1 christos 0x0000ffff, /* src_mask */
1618 1.1 christos 0x0000ffff, /* dst_mask */
1619 1.1 christos FALSE), /* pcrel_offset */
1620 1.1 christos
1621 1.1 christos /* MIPS16 TLS thread pointer offset. */
1622 1.1 christos HOWTO (R_MIPS16_TLS_GOTTPREL, /* type */
1623 1.1 christos 0, /* rightshift */
1624 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1625 1.1 christos 16, /* bitsize */
1626 1.1 christos FALSE, /* pc_relative */
1627 1.1 christos 0, /* bitpos */
1628 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1629 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1630 1.1 christos "R_MIPS16_TLS_GOTTPREL", /* name */
1631 1.1 christos TRUE, /* partial_inplace */
1632 1.1 christos 0x0000ffff, /* src_mask */
1633 1.1 christos 0x0000ffff, /* dst_mask */
1634 1.1 christos FALSE), /* pcrel_offset */
1635 1.1 christos
1636 1.1 christos /* MIPS16 TLS thread pointer offset. */
1637 1.1 christos HOWTO (R_MIPS16_TLS_TPREL_HI16, /* type */
1638 1.1 christos 0, /* rightshift */
1639 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1640 1.1 christos 16, /* bitsize */
1641 1.1 christos FALSE, /* pc_relative */
1642 1.1 christos 0, /* bitpos */
1643 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1644 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1645 1.1 christos "R_MIPS16_TLS_TPREL_HI16", /* name */
1646 1.1 christos TRUE, /* partial_inplace */
1647 1.1 christos 0x0000ffff, /* src_mask */
1648 1.1 christos 0x0000ffff, /* dst_mask */
1649 1.1 christos FALSE), /* pcrel_offset */
1650 1.1 christos
1651 1.1 christos /* MIPS16 TLS thread pointer offset. */
1652 1.1 christos HOWTO (R_MIPS16_TLS_TPREL_LO16, /* type */
1653 1.1 christos 0, /* rightshift */
1654 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1655 1.1 christos 16, /* bitsize */
1656 1.1 christos FALSE, /* pc_relative */
1657 1.1 christos 0, /* bitpos */
1658 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1659 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1660 1.1 christos "R_MIPS16_TLS_TPREL_LO16", /* name */
1661 1.1 christos TRUE, /* partial_inplace */
1662 1.1 christos 0x0000ffff, /* src_mask */
1663 1.1 christos 0x0000ffff, /* dst_mask */
1664 1.1 christos FALSE), /* pcrel_offset */
1665 1.1 christos };
1666 1.1 christos
1667 1.1 christos static reloc_howto_type elf_mips16_howto_table_rela[] =
1668 1.1 christos {
1669 1.1 christos /* The reloc used for the mips16 jump instruction. */
1670 1.1 christos HOWTO (R_MIPS16_26, /* type */
1671 1.1 christos 2, /* rightshift */
1672 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1673 1.1 christos 26, /* bitsize */
1674 1.1 christos FALSE, /* pc_relative */
1675 1.1 christos 0, /* bitpos */
1676 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1677 1.1 christos /* This needs complex overflow
1678 1.1 christos detection, because the upper four
1679 1.1 christos bits must match the PC. */
1680 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1681 1.1 christos "R_MIPS16_26", /* name */
1682 1.1 christos FALSE, /* partial_inplace */
1683 1.1 christos 0, /* src_mask */
1684 1.1 christos 0x3ffffff, /* dst_mask */
1685 1.1 christos FALSE), /* pcrel_offset */
1686 1.1 christos
1687 1.1 christos /* The reloc used for the mips16 gprel instruction. */
1688 1.1 christos HOWTO (R_MIPS16_GPREL, /* type */
1689 1.1 christos 0, /* rightshift */
1690 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1691 1.1 christos 16, /* bitsize */
1692 1.1 christos FALSE, /* pc_relative */
1693 1.1 christos 0, /* bitpos */
1694 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1695 1.1 christos mips16_gprel_reloc, /* special_function */
1696 1.1 christos "R_MIPS16_GPREL", /* name */
1697 1.1 christos FALSE, /* partial_inplace */
1698 1.1 christos 0, /* src_mask */
1699 1.1 christos 0x0000ffff, /* dst_mask */
1700 1.1 christos FALSE), /* pcrel_offset */
1701 1.1 christos
1702 1.1 christos /* A MIPS16 reference to the global offset table. */
1703 1.1 christos HOWTO (R_MIPS16_GOT16, /* type */
1704 1.1 christos 0, /* rightshift */
1705 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1706 1.1 christos 16, /* bitsize */
1707 1.1 christos FALSE, /* pc_relative */
1708 1.1 christos 0, /* bitpos */
1709 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1710 1.1 christos _bfd_mips_elf_got16_reloc, /* special_function */
1711 1.1 christos "R_MIPS16_GOT16", /* name */
1712 1.1 christos FALSE, /* partial_inplace */
1713 1.1 christos 0, /* src_mask */
1714 1.1 christos 0x0000ffff, /* dst_mask */
1715 1.1 christos FALSE), /* pcrel_offset */
1716 1.1 christos
1717 1.1 christos /* A MIPS16 call through the global offset table. */
1718 1.1 christos HOWTO (R_MIPS16_CALL16, /* type */
1719 1.1 christos 0, /* rightshift */
1720 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1721 1.1 christos 16, /* bitsize */
1722 1.1 christos FALSE, /* pc_relative */
1723 1.1 christos 0, /* bitpos */
1724 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1725 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1726 1.1 christos "R_MIPS16_CALL16", /* name */
1727 1.1 christos FALSE, /* partial_inplace */
1728 1.1 christos 0, /* src_mask */
1729 1.1 christos 0x0000ffff, /* dst_mask */
1730 1.1 christos FALSE), /* pcrel_offset */
1731 1.1 christos
1732 1.1 christos /* MIPS16 high 16 bits of symbol value. */
1733 1.1 christos HOWTO (R_MIPS16_HI16, /* type */
1734 1.1 christos 16, /* rightshift */
1735 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1736 1.1 christos 16, /* bitsize */
1737 1.1 christos FALSE, /* pc_relative */
1738 1.1 christos 0, /* bitpos */
1739 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1740 1.1 christos _bfd_mips_elf_hi16_reloc, /* special_function */
1741 1.1 christos "R_MIPS16_HI16", /* name */
1742 1.1 christos FALSE, /* partial_inplace */
1743 1.1 christos 0, /* src_mask */
1744 1.1 christos 0x0000ffff, /* dst_mask */
1745 1.1 christos FALSE), /* pcrel_offset */
1746 1.1 christos
1747 1.1 christos /* MIPS16 low 16 bits of symbol value. */
1748 1.1 christos HOWTO (R_MIPS16_LO16, /* type */
1749 1.1 christos 0, /* rightshift */
1750 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1751 1.1 christos 16, /* bitsize */
1752 1.1 christos FALSE, /* pc_relative */
1753 1.1 christos 0, /* bitpos */
1754 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1755 1.1 christos _bfd_mips_elf_lo16_reloc, /* special_function */
1756 1.1 christos "R_MIPS16_LO16", /* name */
1757 1.1 christos FALSE, /* partial_inplace */
1758 1.1 christos 0, /* src_mask */
1759 1.1 christos 0x0000ffff, /* dst_mask */
1760 1.1 christos FALSE), /* pcrel_offset */
1761 1.1 christos
1762 1.1 christos /* MIPS16 TLS general dynamic variable reference. */
1763 1.1 christos HOWTO (R_MIPS16_TLS_GD, /* type */
1764 1.1 christos 0, /* rightshift */
1765 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1766 1.1 christos 16, /* bitsize */
1767 1.1 christos FALSE, /* pc_relative */
1768 1.1 christos 0, /* bitpos */
1769 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1770 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1771 1.1 christos "R_MIPS16_TLS_GD", /* name */
1772 1.1 christos FALSE, /* partial_inplace */
1773 1.1 christos 0, /* src_mask */
1774 1.1 christos 0x0000ffff, /* dst_mask */
1775 1.1 christos FALSE), /* pcrel_offset */
1776 1.1 christos
1777 1.1 christos /* MIPS16 TLS local dynamic variable reference. */
1778 1.1 christos HOWTO (R_MIPS16_TLS_LDM, /* type */
1779 1.1 christos 0, /* rightshift */
1780 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1781 1.1 christos 16, /* bitsize */
1782 1.1 christos FALSE, /* pc_relative */
1783 1.1 christos 0, /* bitpos */
1784 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1785 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1786 1.1 christos "R_MIPS16_TLS_LDM", /* name */
1787 1.1 christos FALSE, /* partial_inplace */
1788 1.1 christos 0, /* src_mask */
1789 1.1 christos 0x0000ffff, /* dst_mask */
1790 1.1 christos FALSE), /* pcrel_offset */
1791 1.1 christos
1792 1.1 christos /* MIPS16 TLS local dynamic offset. */
1793 1.1 christos HOWTO (R_MIPS16_TLS_DTPREL_HI16, /* type */
1794 1.1 christos 0, /* rightshift */
1795 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1796 1.1 christos 16, /* bitsize */
1797 1.1 christos FALSE, /* pc_relative */
1798 1.1 christos 0, /* bitpos */
1799 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1800 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1801 1.1 christos "R_MIPS16_TLS_DTPREL_HI16", /* name */
1802 1.1 christos FALSE, /* partial_inplace */
1803 1.1 christos 0, /* src_mask */
1804 1.1 christos 0x0000ffff, /* dst_mask */
1805 1.1 christos FALSE), /* pcrel_offset */
1806 1.1 christos
1807 1.1 christos /* MIPS16 TLS local dynamic offset. */
1808 1.1 christos HOWTO (R_MIPS16_TLS_DTPREL_LO16, /* type */
1809 1.1 christos 0, /* rightshift */
1810 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1811 1.1 christos 16, /* bitsize */
1812 1.1 christos FALSE, /* pc_relative */
1813 1.1 christos 0, /* bitpos */
1814 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1815 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1816 1.1 christos "R_MIPS16_TLS_DTPREL_LO16", /* name */
1817 1.1 christos FALSE, /* partial_inplace */
1818 1.1 christos 0, /* src_mask */
1819 1.1 christos 0x0000ffff, /* dst_mask */
1820 1.1 christos FALSE), /* pcrel_offset */
1821 1.1 christos
1822 1.1 christos /* MIPS16 TLS thread pointer offset. */
1823 1.1 christos HOWTO (R_MIPS16_TLS_GOTTPREL, /* type */
1824 1.1 christos 0, /* rightshift */
1825 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1826 1.1 christos 16, /* bitsize */
1827 1.1 christos FALSE, /* pc_relative */
1828 1.1 christos 0, /* bitpos */
1829 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1830 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1831 1.1 christos "R_MIPS16_TLS_GOTTPREL", /* name */
1832 1.1 christos FALSE, /* partial_inplace */
1833 1.1 christos 0, /* src_mask */
1834 1.1 christos 0x0000ffff, /* dst_mask */
1835 1.1 christos FALSE), /* pcrel_offset */
1836 1.1 christos
1837 1.1 christos /* MIPS16 TLS thread pointer offset. */
1838 1.1 christos HOWTO (R_MIPS16_TLS_TPREL_HI16, /* type */
1839 1.1 christos 0, /* rightshift */
1840 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1841 1.1 christos 16, /* bitsize */
1842 1.1 christos FALSE, /* pc_relative */
1843 1.1 christos 0, /* bitpos */
1844 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1845 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1846 1.1 christos "R_MIPS16_TLS_TPREL_HI16", /* name */
1847 1.1 christos FALSE, /* partial_inplace */
1848 1.1 christos 0, /* src_mask */
1849 1.1 christos 0x0000ffff, /* dst_mask */
1850 1.1 christos FALSE), /* pcrel_offset */
1851 1.1 christos
1852 1.1 christos /* MIPS16 TLS thread pointer offset. */
1853 1.1 christos HOWTO (R_MIPS16_TLS_TPREL_LO16, /* type */
1854 1.1 christos 0, /* rightshift */
1855 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1856 1.1 christos 16, /* bitsize */
1857 1.1 christos FALSE, /* pc_relative */
1858 1.1 christos 0, /* bitpos */
1859 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1860 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1861 1.1 christos "R_MIPS16_TLS_TPREL_LO16", /* name */
1862 1.1 christos FALSE, /* partial_inplace */
1863 1.1 christos 0, /* src_mask */
1864 1.1 christos 0x0000ffff, /* dst_mask */
1865 1.1 christos FALSE), /* pcrel_offset */
1866 1.1 christos };
1867 1.1 christos
1868 1.1 christos static reloc_howto_type elf_micromips_howto_table_rel[] =
1869 1.1 christos {
1870 1.1 christos EMPTY_HOWTO (130),
1871 1.1 christos EMPTY_HOWTO (131),
1872 1.1 christos EMPTY_HOWTO (132),
1873 1.1 christos
1874 1.1 christos /* 26 bit jump address. */
1875 1.1 christos HOWTO (R_MICROMIPS_26_S1, /* type */
1876 1.1 christos 1, /* rightshift */
1877 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1878 1.1 christos 26, /* bitsize */
1879 1.1 christos FALSE, /* pc_relative */
1880 1.1 christos 0, /* bitpos */
1881 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1882 1.1 christos /* This needs complex overflow
1883 1.1 christos detection, because the upper four
1884 1.1 christos bits must match the PC. */
1885 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1886 1.1 christos "R_MICROMIPS_26_S1", /* name */
1887 1.1 christos TRUE, /* partial_inplace */
1888 1.1 christos 0x3ffffff, /* src_mask */
1889 1.1 christos 0x3ffffff, /* dst_mask */
1890 1.1 christos FALSE), /* pcrel_offset */
1891 1.1 christos
1892 1.1 christos /* High 16 bits of symbol value. */
1893 1.1 christos HOWTO (R_MICROMIPS_HI16, /* type */
1894 1.1 christos 16, /* rightshift */
1895 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1896 1.1 christos 16, /* bitsize */
1897 1.1 christos FALSE, /* pc_relative */
1898 1.1 christos 0, /* bitpos */
1899 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1900 1.1 christos _bfd_mips_elf_hi16_reloc, /* special_function */
1901 1.1 christos "R_MICROMIPS_HI16", /* name */
1902 1.1 christos TRUE, /* partial_inplace */
1903 1.1 christos 0x0000ffff, /* src_mask */
1904 1.1 christos 0x0000ffff, /* dst_mask */
1905 1.1 christos FALSE), /* pcrel_offset */
1906 1.1 christos
1907 1.1 christos /* Low 16 bits of symbol value. */
1908 1.1 christos HOWTO (R_MICROMIPS_LO16, /* type */
1909 1.1 christos 0, /* rightshift */
1910 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1911 1.1 christos 16, /* bitsize */
1912 1.1 christos FALSE, /* pc_relative */
1913 1.1 christos 0, /* bitpos */
1914 1.1 christos complain_overflow_dont, /* complain_on_overflow */
1915 1.1 christos _bfd_mips_elf_lo16_reloc, /* special_function */
1916 1.1 christos "R_MICROMIPS_LO16", /* name */
1917 1.1 christos TRUE, /* partial_inplace */
1918 1.1 christos 0x0000ffff, /* src_mask */
1919 1.1 christos 0x0000ffff, /* dst_mask */
1920 1.1 christos FALSE), /* pcrel_offset */
1921 1.1 christos
1922 1.1 christos /* GP relative reference. */
1923 1.1 christos HOWTO (R_MICROMIPS_GPREL16, /* 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 _bfd_mips_elf32_gprel16_reloc, /* special_function */
1931 1.1 christos "R_MICROMIPS_GPREL16", /* name */
1932 1.1 christos TRUE, /* partial_inplace */
1933 1.1 christos 0x0000ffff, /* src_mask */
1934 1.1 christos 0x0000ffff, /* dst_mask */
1935 1.1 christos FALSE), /* pcrel_offset */
1936 1.1 christos
1937 1.1 christos /* Reference to literal section. */
1938 1.1 christos HOWTO (R_MICROMIPS_LITERAL, /* 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_signed, /* complain_on_overflow */
1945 1.1 christos _bfd_mips_elf32_gprel16_reloc, /* special_function */
1946 1.1 christos "R_MICROMIPS_LITERAL", /* name */
1947 1.1 christos TRUE, /* partial_inplace */
1948 1.1 christos 0x0000ffff, /* src_mask */
1949 1.1 christos 0x0000ffff, /* dst_mask */
1950 1.1 christos FALSE), /* pcrel_offset */
1951 1.1 christos
1952 1.1 christos /* Reference to global offset table. */
1953 1.1 christos HOWTO (R_MICROMIPS_GOT16, /* 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_signed, /* complain_on_overflow */
1960 1.1 christos _bfd_mips_elf_got16_reloc, /* special_function */
1961 1.1 christos "R_MICROMIPS_GOT16", /* name */
1962 1.1 christos TRUE, /* partial_inplace */
1963 1.1 christos 0x0000ffff, /* src_mask */
1964 1.1 christos 0x0000ffff, /* dst_mask */
1965 1.1 christos FALSE), /* pcrel_offset */
1966 1.1 christos
1967 1.1 christos /* This is for microMIPS branches. */
1968 1.1 christos HOWTO (R_MICROMIPS_PC7_S1, /* type */
1969 1.1 christos 1, /* rightshift */
1970 1.1 christos 1, /* size (0 = byte, 1 = short, 2 = long) */
1971 1.1 christos 7, /* bitsize */
1972 1.1 christos TRUE, /* pc_relative */
1973 1.1 christos 0, /* bitpos */
1974 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1975 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1976 1.1 christos "R_MICROMIPS_PC7_S1", /* name */
1977 1.1 christos TRUE, /* partial_inplace */
1978 1.1 christos 0x0000007f, /* src_mask */
1979 1.1 christos 0x0000007f, /* dst_mask */
1980 1.1 christos TRUE), /* pcrel_offset */
1981 1.1 christos
1982 1.1 christos HOWTO (R_MICROMIPS_PC10_S1, /* type */
1983 1.1 christos 1, /* rightshift */
1984 1.1 christos 1, /* size (0 = byte, 1 = short, 2 = long) */
1985 1.1 christos 10, /* bitsize */
1986 1.1 christos TRUE, /* pc_relative */
1987 1.1 christos 0, /* bitpos */
1988 1.1 christos complain_overflow_signed, /* complain_on_overflow */
1989 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
1990 1.1 christos "R_MICROMIPS_PC10_S1", /* name */
1991 1.1 christos TRUE, /* partial_inplace */
1992 1.1 christos 0x000003ff, /* src_mask */
1993 1.1 christos 0x000003ff, /* dst_mask */
1994 1.1 christos TRUE), /* pcrel_offset */
1995 1.1 christos
1996 1.1 christos HOWTO (R_MICROMIPS_PC16_S1, /* type */
1997 1.1 christos 1, /* rightshift */
1998 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
1999 1.1 christos 16, /* bitsize */
2000 1.1 christos TRUE, /* pc_relative */
2001 1.1 christos 0, /* bitpos */
2002 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2003 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2004 1.1 christos "R_MICROMIPS_PC16_S1", /* name */
2005 1.1 christos TRUE, /* partial_inplace */
2006 1.1 christos 0x0000ffff, /* src_mask */
2007 1.1 christos 0x0000ffff, /* dst_mask */
2008 1.1 christos TRUE), /* pcrel_offset */
2009 1.1 christos
2010 1.1 christos /* 16 bit call through global offset table. */
2011 1.1 christos HOWTO (R_MICROMIPS_CALL16, /* type */
2012 1.1 christos 0, /* rightshift */
2013 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2014 1.1 christos 16, /* bitsize */
2015 1.1 christos FALSE, /* pc_relative */
2016 1.1 christos 0, /* bitpos */
2017 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2018 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2019 1.1 christos "R_MICROMIPS_CALL16", /* name */
2020 1.1 christos TRUE, /* partial_inplace */
2021 1.1 christos 0x0000ffff, /* src_mask */
2022 1.1 christos 0x0000ffff, /* dst_mask */
2023 1.1 christos FALSE), /* pcrel_offset */
2024 1.1 christos
2025 1.1 christos EMPTY_HOWTO (143),
2026 1.1 christos EMPTY_HOWTO (144),
2027 1.1 christos
2028 1.1 christos /* Displacement in the global offset table. */
2029 1.1 christos HOWTO (R_MICROMIPS_GOT_DISP, /* type */
2030 1.1 christos 0, /* rightshift */
2031 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2032 1.1 christos 16, /* bitsize */
2033 1.1 christos FALSE, /* pc_relative */
2034 1.1 christos 0, /* bitpos */
2035 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2036 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2037 1.1 christos "R_MICROMIPS_GOT_DISP",/* name */
2038 1.1 christos TRUE, /* partial_inplace */
2039 1.1 christos 0x0000ffff, /* src_mask */
2040 1.1 christos 0x0000ffff, /* dst_mask */
2041 1.1 christos FALSE), /* pcrel_offset */
2042 1.1 christos
2043 1.1 christos /* Displacement to page pointer in the global offset table. */
2044 1.1 christos HOWTO (R_MICROMIPS_GOT_PAGE, /* type */
2045 1.1 christos 0, /* rightshift */
2046 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2047 1.1 christos 16, /* bitsize */
2048 1.1 christos FALSE, /* pc_relative */
2049 1.1 christos 0, /* bitpos */
2050 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2051 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2052 1.1 christos "R_MICROMIPS_GOT_PAGE",/* name */
2053 1.1 christos TRUE, /* partial_inplace */
2054 1.1 christos 0x0000ffff, /* src_mask */
2055 1.1 christos 0x0000ffff, /* dst_mask */
2056 1.1 christos FALSE), /* pcrel_offset */
2057 1.1 christos
2058 1.1 christos /* Offset from page pointer in the global offset table. */
2059 1.1 christos HOWTO (R_MICROMIPS_GOT_OFST, /* type */
2060 1.1 christos 0, /* rightshift */
2061 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2062 1.1 christos 16, /* bitsize */
2063 1.1 christos FALSE, /* pc_relative */
2064 1.1 christos 0, /* bitpos */
2065 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2066 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2067 1.1 christos "R_MICROMIPS_GOT_OFST",/* name */
2068 1.1 christos TRUE, /* partial_inplace */
2069 1.1 christos 0x0000ffff, /* src_mask */
2070 1.1 christos 0x0000ffff, /* dst_mask */
2071 1.1 christos FALSE), /* pcrel_offset */
2072 1.1 christos
2073 1.1 christos /* High 16 bits of displacement in global offset table. */
2074 1.1 christos HOWTO (R_MICROMIPS_GOT_HI16, /* type */
2075 1.1 christos 0, /* rightshift */
2076 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2077 1.1 christos 16, /* bitsize */
2078 1.1 christos FALSE, /* pc_relative */
2079 1.1 christos 0, /* bitpos */
2080 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2081 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2082 1.1 christos "R_MICROMIPS_GOT_HI16",/* name */
2083 1.1 christos TRUE, /* partial_inplace */
2084 1.1 christos 0x0000ffff, /* src_mask */
2085 1.1 christos 0x0000ffff, /* dst_mask */
2086 1.1 christos FALSE), /* pcrel_offset */
2087 1.1 christos
2088 1.1 christos /* Low 16 bits of displacement in global offset table. */
2089 1.1 christos HOWTO (R_MICROMIPS_GOT_LO16, /* type */
2090 1.1 christos 0, /* rightshift */
2091 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2092 1.1 christos 16, /* bitsize */
2093 1.1 christos FALSE, /* pc_relative */
2094 1.1 christos 0, /* bitpos */
2095 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2096 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2097 1.1 christos "R_MICROMIPS_GOT_LO16",/* name */
2098 1.1 christos TRUE, /* partial_inplace */
2099 1.1 christos 0x0000ffff, /* src_mask */
2100 1.1 christos 0x0000ffff, /* dst_mask */
2101 1.1 christos FALSE), /* pcrel_offset */
2102 1.1 christos
2103 1.1 christos /* 64 bit subtraction. Used in the N32 ABI. */
2104 1.1 christos HOWTO (R_MICROMIPS_SUB, /* type */
2105 1.1 christos 0, /* rightshift */
2106 1.1 christos 4, /* size (0 = byte, 1 = short, 2 = long) */
2107 1.1 christos 64, /* bitsize */
2108 1.1 christos FALSE, /* pc_relative */
2109 1.1 christos 0, /* bitpos */
2110 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2111 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2112 1.1 christos "R_MICROMIPS_SUB", /* name */
2113 1.1 christos TRUE, /* partial_inplace */
2114 1.1 christos MINUS_ONE, /* src_mask */
2115 1.1 christos MINUS_ONE, /* dst_mask */
2116 1.1 christos FALSE), /* pcrel_offset */
2117 1.1 christos
2118 1.1 christos /* We don't support these for REL relocations, because it means building
2119 1.1 christos the addend from a R_MICROMIPS_HIGHEST/R_MICROMIPS_HIGHER/
2120 1.1 christos R_MICROMIPS_HI16/R_MICROMIPS_LO16 sequence with varying ordering,
2121 1.1 christos using fallable heuristics. */
2122 1.1 christos EMPTY_HOWTO (R_MICROMIPS_HIGHER),
2123 1.1 christos EMPTY_HOWTO (R_MICROMIPS_HIGHEST),
2124 1.1 christos
2125 1.1 christos /* High 16 bits of displacement in global offset table. */
2126 1.1 christos HOWTO (R_MICROMIPS_CALL_HI16, /* type */
2127 1.1 christos 0, /* rightshift */
2128 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2129 1.1 christos 16, /* bitsize */
2130 1.1 christos FALSE, /* pc_relative */
2131 1.1 christos 0, /* bitpos */
2132 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2133 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2134 1.1 christos "R_MICROMIPS_CALL_HI16",/* name */
2135 1.1 christos TRUE, /* partial_inplace */
2136 1.1 christos 0x0000ffff, /* src_mask */
2137 1.1 christos 0x0000ffff, /* dst_mask */
2138 1.1 christos FALSE), /* pcrel_offset */
2139 1.1 christos
2140 1.1 christos /* Low 16 bits of displacement in global offset table. */
2141 1.1 christos HOWTO (R_MICROMIPS_CALL_LO16, /* type */
2142 1.1 christos 0, /* rightshift */
2143 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2144 1.1 christos 16, /* bitsize */
2145 1.1 christos FALSE, /* pc_relative */
2146 1.1 christos 0, /* bitpos */
2147 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2148 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2149 1.1 christos "R_MICROMIPS_CALL_LO16",/* name */
2150 1.1 christos TRUE, /* partial_inplace */
2151 1.1 christos 0x0000ffff, /* src_mask */
2152 1.1 christos 0x0000ffff, /* dst_mask */
2153 1.1 christos FALSE), /* pcrel_offset */
2154 1.1 christos };
2155 1.1 christos
2156 1.1 christos static reloc_howto_type elf_micromips_howto_table_rela[] =
2157 1.1 christos {
2158 1.1 christos EMPTY_HOWTO (130),
2159 1.1 christos EMPTY_HOWTO (131),
2160 1.1 christos EMPTY_HOWTO (132),
2161 1.1 christos
2162 1.1 christos /* 26 bit jump address. */
2163 1.1 christos HOWTO (R_MICROMIPS_26_S1, /* type */
2164 1.1 christos 1, /* rightshift */
2165 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2166 1.1 christos 26, /* bitsize */
2167 1.1 christos FALSE, /* pc_relative */
2168 1.1 christos 0, /* bitpos */
2169 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2170 1.1 christos /* This needs complex overflow
2171 1.1 christos detection, because the upper four
2172 1.1 christos bits must match the PC. */
2173 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2174 1.1 christos "R_MICROMIPS_26_S1", /* name */
2175 1.1 christos FALSE, /* partial_inplace */
2176 1.1 christos 0, /* src_mask */
2177 1.1 christos 0x3ffffff, /* dst_mask */
2178 1.1 christos FALSE), /* pcrel_offset */
2179 1.1 christos
2180 1.1 christos /* High 16 bits of symbol value. */
2181 1.1 christos HOWTO (R_MICROMIPS_HI16, /* type */
2182 1.1 christos 16, /* rightshift */
2183 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2184 1.1 christos 16, /* bitsize */
2185 1.1 christos FALSE, /* pc_relative */
2186 1.1 christos 0, /* bitpos */
2187 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2188 1.1 christos _bfd_mips_elf_hi16_reloc, /* special_function */
2189 1.1 christos "R_MICROMIPS_HI16", /* name */
2190 1.1 christos FALSE, /* partial_inplace */
2191 1.1 christos 0, /* src_mask */
2192 1.1 christos 0x0000ffff, /* dst_mask */
2193 1.1 christos FALSE), /* pcrel_offset */
2194 1.1 christos
2195 1.1 christos /* Low 16 bits of symbol value. */
2196 1.1 christos HOWTO (R_MICROMIPS_LO16, /* type */
2197 1.1 christos 0, /* rightshift */
2198 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2199 1.1 christos 16, /* bitsize */
2200 1.1 christos FALSE, /* pc_relative */
2201 1.1 christos 0, /* bitpos */
2202 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2203 1.1 christos _bfd_mips_elf_lo16_reloc, /* special_function */
2204 1.1 christos "R_MICROMIPS_LO16", /* name */
2205 1.1 christos FALSE, /* partial_inplace */
2206 1.1 christos 0, /* src_mask */
2207 1.1 christos 0x0000ffff, /* dst_mask */
2208 1.1 christos FALSE), /* pcrel_offset */
2209 1.1 christos
2210 1.1 christos /* GP relative reference. */
2211 1.1 christos HOWTO (R_MICROMIPS_GPREL16, /* type */
2212 1.1 christos 0, /* rightshift */
2213 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2214 1.1 christos 16, /* bitsize */
2215 1.1 christos FALSE, /* pc_relative */
2216 1.1 christos 0, /* bitpos */
2217 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2218 1.1 christos _bfd_mips_elf32_gprel16_reloc, /* special_function */
2219 1.1 christos "R_MICROMIPS_GPREL16", /* name */
2220 1.1 christos FALSE, /* partial_inplace */
2221 1.1 christos 0, /* src_mask */
2222 1.1 christos 0x0000ffff, /* dst_mask */
2223 1.1 christos FALSE), /* pcrel_offset */
2224 1.1 christos
2225 1.1 christos /* Reference to literal section. */
2226 1.1 christos HOWTO (R_MICROMIPS_LITERAL, /* type */
2227 1.1 christos 0, /* rightshift */
2228 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2229 1.1 christos 16, /* bitsize */
2230 1.1 christos FALSE, /* pc_relative */
2231 1.1 christos 0, /* bitpos */
2232 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2233 1.1 christos _bfd_mips_elf32_gprel16_reloc, /* special_function */
2234 1.1 christos "R_MICROMIPS_LITERAL", /* name */
2235 1.1 christos FALSE, /* partial_inplace */
2236 1.1 christos 0, /* src_mask */
2237 1.1 christos 0x0000ffff, /* dst_mask */
2238 1.1 christos FALSE), /* pcrel_offset */
2239 1.1 christos
2240 1.1 christos /* Reference to global offset table. */
2241 1.1 christos HOWTO (R_MICROMIPS_GOT16, /* type */
2242 1.1 christos 0, /* rightshift */
2243 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2244 1.1 christos 16, /* bitsize */
2245 1.1 christos FALSE, /* pc_relative */
2246 1.1 christos 0, /* bitpos */
2247 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2248 1.1 christos _bfd_mips_elf_got16_reloc, /* special_function */
2249 1.1 christos "R_MICROMIPS_GOT16", /* name */
2250 1.1 christos FALSE, /* partial_inplace */
2251 1.1 christos 0, /* src_mask */
2252 1.1 christos 0x0000ffff, /* dst_mask */
2253 1.1 christos FALSE), /* pcrel_offset */
2254 1.1 christos
2255 1.1 christos /* This is for microMIPS branches. */
2256 1.1 christos HOWTO (R_MICROMIPS_PC7_S1, /* type */
2257 1.1 christos 1, /* rightshift */
2258 1.1 christos 1, /* size (0 = byte, 1 = short, 2 = long) */
2259 1.1 christos 7, /* bitsize */
2260 1.1 christos TRUE, /* pc_relative */
2261 1.1 christos 0, /* bitpos */
2262 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2263 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2264 1.1 christos "R_MICROMIPS_PC7_S1", /* name */
2265 1.1 christos FALSE, /* partial_inplace */
2266 1.1 christos 0, /* src_mask */
2267 1.1 christos 0x0000007f, /* dst_mask */
2268 1.1 christos TRUE), /* pcrel_offset */
2269 1.1 christos
2270 1.1 christos HOWTO (R_MICROMIPS_PC10_S1, /* type */
2271 1.1 christos 1, /* rightshift */
2272 1.1 christos 1, /* size (0 = byte, 1 = short, 2 = long) */
2273 1.1 christos 10, /* bitsize */
2274 1.1 christos TRUE, /* pc_relative */
2275 1.1 christos 0, /* bitpos */
2276 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2277 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2278 1.1 christos "R_MICROMIPS_PC10_S1", /* name */
2279 1.1 christos FALSE, /* partial_inplace */
2280 1.1 christos 0, /* src_mask */
2281 1.1 christos 0x000003ff, /* dst_mask */
2282 1.1 christos TRUE), /* pcrel_offset */
2283 1.1 christos
2284 1.1 christos HOWTO (R_MICROMIPS_PC16_S1, /* type */
2285 1.1 christos 1, /* rightshift */
2286 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2287 1.1 christos 16, /* bitsize */
2288 1.1 christos TRUE, /* pc_relative */
2289 1.1 christos 0, /* bitpos */
2290 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2291 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2292 1.1 christos "R_MICROMIPS_PC16_S1", /* name */
2293 1.1 christos FALSE, /* partial_inplace */
2294 1.1 christos 0, /* src_mask */
2295 1.1 christos 0x0000ffff, /* dst_mask */
2296 1.1 christos TRUE), /* pcrel_offset */
2297 1.1 christos
2298 1.1 christos /* 16 bit call through global offset table. */
2299 1.1 christos HOWTO (R_MICROMIPS_CALL16, /* type */
2300 1.1 christos 0, /* rightshift */
2301 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2302 1.1 christos 16, /* bitsize */
2303 1.1 christos FALSE, /* pc_relative */
2304 1.1 christos 0, /* bitpos */
2305 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2306 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2307 1.1 christos "R_MICROMIPS_CALL16", /* name */
2308 1.1 christos FALSE, /* partial_inplace */
2309 1.1 christos 0, /* src_mask */
2310 1.1 christos 0x0000ffff, /* dst_mask */
2311 1.1 christos FALSE), /* pcrel_offset */
2312 1.1 christos
2313 1.1 christos EMPTY_HOWTO (143),
2314 1.1 christos EMPTY_HOWTO (144),
2315 1.1 christos
2316 1.1 christos /* Displacement in the global offset table. */
2317 1.1 christos HOWTO (R_MICROMIPS_GOT_DISP, /* type */
2318 1.1 christos 0, /* rightshift */
2319 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2320 1.1 christos 16, /* bitsize */
2321 1.1 christos FALSE, /* pc_relative */
2322 1.1 christos 0, /* bitpos */
2323 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2324 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2325 1.1 christos "R_MICROMIPS_GOT_DISP",/* name */
2326 1.1 christos FALSE, /* partial_inplace */
2327 1.1 christos 0, /* src_mask */
2328 1.1 christos 0x0000ffff, /* dst_mask */
2329 1.1 christos FALSE), /* pcrel_offset */
2330 1.1 christos
2331 1.1 christos /* Displacement to page pointer in the global offset table. */
2332 1.1 christos HOWTO (R_MICROMIPS_GOT_PAGE, /* type */
2333 1.1 christos 0, /* rightshift */
2334 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2335 1.1 christos 16, /* bitsize */
2336 1.1 christos FALSE, /* pc_relative */
2337 1.1 christos 0, /* bitpos */
2338 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2339 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2340 1.1 christos "R_MICROMIPS_GOT_PAGE",/* name */
2341 1.1 christos FALSE, /* partial_inplace */
2342 1.1 christos 0, /* src_mask */
2343 1.1 christos 0x0000ffff, /* dst_mask */
2344 1.1 christos FALSE), /* pcrel_offset */
2345 1.1 christos
2346 1.1 christos /* Offset from page pointer in the global offset table. */
2347 1.1 christos HOWTO (R_MICROMIPS_GOT_OFST, /* type */
2348 1.1 christos 0, /* rightshift */
2349 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2350 1.1 christos 16, /* bitsize */
2351 1.1 christos FALSE, /* pc_relative */
2352 1.1 christos 0, /* bitpos */
2353 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2354 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2355 1.1 christos "R_MICROMIPS_GOT_OFST",/* name */
2356 1.1 christos FALSE, /* partial_inplace */
2357 1.1 christos 0, /* src_mask */
2358 1.1 christos 0x0000ffff, /* dst_mask */
2359 1.1 christos FALSE), /* pcrel_offset */
2360 1.1 christos
2361 1.1 christos /* High 16 bits of displacement in global offset table. */
2362 1.1 christos HOWTO (R_MICROMIPS_GOT_HI16, /* type */
2363 1.1 christos 0, /* rightshift */
2364 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2365 1.1 christos 16, /* bitsize */
2366 1.1 christos FALSE, /* pc_relative */
2367 1.1 christos 0, /* bitpos */
2368 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2369 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2370 1.1 christos "R_MICROMIPS_GOT_HI16",/* name */
2371 1.1 christos FALSE, /* partial_inplace */
2372 1.1 christos 0, /* src_mask */
2373 1.1 christos 0x0000ffff, /* dst_mask */
2374 1.1 christos FALSE), /* pcrel_offset */
2375 1.1 christos
2376 1.1 christos /* Low 16 bits of displacement in global offset table. */
2377 1.1 christos HOWTO (R_MICROMIPS_GOT_LO16, /* type */
2378 1.1 christos 0, /* rightshift */
2379 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2380 1.1 christos 16, /* bitsize */
2381 1.1 christos FALSE, /* pc_relative */
2382 1.1 christos 0, /* bitpos */
2383 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2384 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2385 1.1 christos "R_MICROMIPS_GOT_LO16",/* name */
2386 1.1 christos FALSE, /* partial_inplace */
2387 1.1 christos 0, /* src_mask */
2388 1.1 christos 0x0000ffff, /* dst_mask */
2389 1.1 christos FALSE), /* pcrel_offset */
2390 1.1 christos
2391 1.1 christos /* 64 bit subtraction. Used in the N32 ABI. */
2392 1.1 christos HOWTO (R_MICROMIPS_SUB, /* type */
2393 1.1 christos 0, /* rightshift */
2394 1.1 christos 4, /* size (0 = byte, 1 = short, 2 = long) */
2395 1.1 christos 64, /* bitsize */
2396 1.1 christos FALSE, /* pc_relative */
2397 1.1 christos 0, /* bitpos */
2398 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2399 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2400 1.1 christos "R_MICROMIPS_SUB", /* name */
2401 1.1 christos FALSE, /* partial_inplace */
2402 1.1 christos 0, /* src_mask */
2403 1.1 christos MINUS_ONE, /* dst_mask */
2404 1.1 christos FALSE), /* pcrel_offset */
2405 1.1 christos
2406 1.1 christos /* Get the higher value of a 64 bit addend. */
2407 1.1 christos HOWTO (R_MICROMIPS_HIGHER, /* type */
2408 1.1 christos 0, /* rightshift */
2409 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2410 1.1 christos 16, /* bitsize */
2411 1.1 christos FALSE, /* pc_relative */
2412 1.1 christos 0, /* bitpos */
2413 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2414 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2415 1.1 christos "R_MICROMIPS_HIGHER", /* name */
2416 1.1 christos FALSE, /* partial_inplace */
2417 1.1 christos 0, /* src_mask */
2418 1.1 christos 0x0000ffff, /* dst_mask */
2419 1.1 christos FALSE), /* pcrel_offset */
2420 1.1 christos
2421 1.1 christos /* Get the highest value of a 64 bit addend. */
2422 1.1 christos HOWTO (R_MICROMIPS_HIGHEST, /* type */
2423 1.1 christos 0, /* rightshift */
2424 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2425 1.1 christos 16, /* 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_HIGHEST", /* name */
2431 1.1 christos FALSE, /* partial_inplace */
2432 1.1 christos 0, /* src_mask */
2433 1.1 christos 0x0000ffff, /* dst_mask */
2434 1.1 christos FALSE), /* pcrel_offset */
2435 1.1 christos
2436 1.1 christos /* High 16 bits of displacement in global offset table. */
2437 1.1 christos HOWTO (R_MICROMIPS_CALL_HI16, /* type */
2438 1.1 christos 0, /* rightshift */
2439 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2440 1.1 christos 16, /* bitsize */
2441 1.1 christos FALSE, /* pc_relative */
2442 1.1 christos 0, /* bitpos */
2443 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2444 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2445 1.1 christos "R_MICROMIPS_CALL_HI16",/* name */
2446 1.1 christos FALSE, /* partial_inplace */
2447 1.1 christos 0, /* src_mask */
2448 1.1 christos 0x0000ffff, /* dst_mask */
2449 1.1 christos FALSE), /* pcrel_offset */
2450 1.1 christos
2451 1.1 christos /* Low 16 bits of displacement in global offset table. */
2452 1.1 christos HOWTO (R_MICROMIPS_CALL_LO16, /* type */
2453 1.1 christos 0, /* rightshift */
2454 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2455 1.1 christos 16, /* bitsize */
2456 1.1 christos FALSE, /* pc_relative */
2457 1.1 christos 0, /* bitpos */
2458 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2459 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2460 1.1 christos "R_MICROMIPS_CALL_LO16",/* name */
2461 1.1 christos FALSE, /* partial_inplace */
2462 1.1 christos 0, /* src_mask */
2463 1.1 christos 0x0000ffff, /* dst_mask */
2464 1.1 christos FALSE), /* pcrel_offset */
2465 1.1 christos };
2466 1.1 christos
2467 1.1 christos /* GNU extension to record C++ vtable hierarchy */
2468 1.1 christos static reloc_howto_type elf_mips_gnu_vtinherit_howto =
2469 1.1 christos HOWTO (R_MIPS_GNU_VTINHERIT, /* type */
2470 1.1 christos 0, /* rightshift */
2471 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2472 1.1 christos 0, /* bitsize */
2473 1.1 christos FALSE, /* pc_relative */
2474 1.1 christos 0, /* bitpos */
2475 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2476 1.1 christos NULL, /* special_function */
2477 1.1 christos "R_MIPS_GNU_VTINHERIT", /* name */
2478 1.1 christos FALSE, /* partial_inplace */
2479 1.1 christos 0, /* src_mask */
2480 1.1 christos 0, /* dst_mask */
2481 1.1 christos FALSE); /* pcrel_offset */
2482 1.1 christos
2483 1.1 christos /* GNU extension to record C++ vtable member usage */
2484 1.1 christos static reloc_howto_type elf_mips_gnu_vtentry_howto =
2485 1.1 christos HOWTO (R_MIPS_GNU_VTENTRY, /* type */
2486 1.1 christos 0, /* rightshift */
2487 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2488 1.1 christos 0, /* bitsize */
2489 1.1 christos FALSE, /* pc_relative */
2490 1.1 christos 0, /* bitpos */
2491 1.1 christos complain_overflow_dont, /* complain_on_overflow */
2492 1.1 christos _bfd_elf_rel_vtable_reloc_fn, /* special_function */
2493 1.1 christos "R_MIPS_GNU_VTENTRY", /* name */
2494 1.1 christos FALSE, /* partial_inplace */
2495 1.1 christos 0, /* src_mask */
2496 1.1 christos 0, /* dst_mask */
2497 1.1 christos FALSE); /* pcrel_offset */
2498 1.1 christos
2499 1.1 christos /* 16 bit offset for pc-relative branches. */
2501 1.1 christos static reloc_howto_type elf_mips_gnu_rel16_s2 =
2502 1.1 christos HOWTO (R_MIPS_GNU_REL16_S2, /* type */
2503 1.1 christos 2, /* rightshift */
2504 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2505 1.1 christos 16, /* bitsize */
2506 1.1 christos TRUE, /* pc_relative */
2507 1.1 christos 0, /* bitpos */
2508 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2509 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2510 1.1 christos "R_MIPS_GNU_REL16_S2", /* name */
2511 1.1 christos TRUE, /* partial_inplace */
2512 1.1 christos 0x0000ffff, /* src_mask */
2513 1.1 christos 0x0000ffff, /* dst_mask */
2514 1.1 christos TRUE); /* pcrel_offset */
2515 1.1 christos
2516 1.1 christos /* 16 bit offset for pc-relative branches. */
2517 1.1 christos static reloc_howto_type elf_mips_gnu_rela16_s2 =
2518 1.1 christos HOWTO (R_MIPS_GNU_REL16_S2, /* type */
2519 1.1 christos 2, /* rightshift */
2520 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2521 1.1 christos 16, /* bitsize */
2522 1.1 christos TRUE, /* pc_relative */
2523 1.1 christos 0, /* bitpos */
2524 1.1 christos complain_overflow_signed, /* complain_on_overflow */
2525 1.1 christos _bfd_mips_elf_generic_reloc, /* special_function */
2526 1.1 christos "R_MIPS_GNU_REL16_S2", /* name */
2527 1.1 christos FALSE, /* partial_inplace */
2528 1.1 christos 0, /* src_mask */
2529 1.1 christos 0x0000ffff, /* dst_mask */
2530 1.1 christos TRUE); /* pcrel_offset */
2531 1.1 christos
2532 1.1 christos /* Originally a VxWorks extension, but now used for other systems too. */
2534 1.1 christos static reloc_howto_type elf_mips_copy_howto =
2535 1.1 christos HOWTO (R_MIPS_COPY, /* type */
2536 1.1 christos 0, /* rightshift */
2537 1.1 christos 0, /* this one is variable size */
2538 1.1 christos 0, /* bitsize */
2539 1.1 christos FALSE, /* pc_relative */
2540 1.1 christos 0, /* bitpos */
2541 1.1 christos complain_overflow_bitfield, /* complain_on_overflow */
2542 1.1 christos bfd_elf_generic_reloc, /* special_function */
2543 1.1 christos "R_MIPS_COPY", /* name */
2544 1.1 christos FALSE, /* partial_inplace */
2545 1.1 christos 0x0, /* src_mask */
2546 1.1 christos 0x0, /* dst_mask */
2547 1.1 christos FALSE); /* pcrel_offset */
2548 1.1 christos
2549 1.1 christos /* Originally a VxWorks extension, but now used for other systems too. */
2550 1.1 christos static reloc_howto_type elf_mips_jump_slot_howto =
2551 1.1 christos HOWTO (R_MIPS_JUMP_SLOT, /* type */
2552 1.1 christos 0, /* rightshift */
2553 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
2554 1.1 christos 32, /* bitsize */
2555 1.1 christos FALSE, /* pc_relative */
2556 1.1 christos 0, /* bitpos */
2557 1.1 christos complain_overflow_bitfield, /* complain_on_overflow */
2558 1.1 christos bfd_elf_generic_reloc, /* special_function */
2559 1.1 christos "R_MIPS_JUMP_SLOT", /* name */
2560 1.1 christos FALSE, /* partial_inplace */
2561 1.1 christos 0x0, /* src_mask */
2562 1.1 christos 0x0, /* dst_mask */
2563 1.1 christos FALSE); /* pcrel_offset */
2564 1.1 christos
2565 1.1 christos /* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a
2567 1.1 christos dangerous relocation. */
2568 1.1 christos
2569 1.1 christos static bfd_boolean
2570 1.1 christos mips_elf_assign_gp (bfd *output_bfd, bfd_vma *pgp)
2571 1.1 christos {
2572 1.1 christos unsigned int count;
2573 1.1 christos asymbol **sym;
2574 1.1 christos unsigned int i;
2575 1.1 christos
2576 1.1 christos /* If we've already figured out what GP will be, just return it. */
2577 1.1 christos *pgp = _bfd_get_gp_value (output_bfd);
2578 1.1 christos if (*pgp)
2579 1.1 christos return TRUE;
2580 1.1 christos
2581 1.1 christos count = bfd_get_symcount (output_bfd);
2582 1.1 christos sym = bfd_get_outsymbols (output_bfd);
2583 1.1 christos
2584 1.1 christos /* The linker script will have created a symbol named `_gp' with the
2585 1.1 christos appropriate value. */
2586 1.1 christos if (sym == NULL)
2587 1.1 christos i = count;
2588 1.1 christos else
2589 1.1 christos {
2590 1.1 christos for (i = 0; i < count; i++, sym++)
2591 1.1 christos {
2592 1.1 christos register const char *name;
2593 1.1 christos
2594 1.1 christos name = bfd_asymbol_name (*sym);
2595 1.1 christos if (*name == '_' && strcmp (name, "_gp") == 0)
2596 1.1 christos {
2597 1.1 christos *pgp = bfd_asymbol_value (*sym);
2598 1.1 christos _bfd_set_gp_value (output_bfd, *pgp);
2599 1.1 christos break;
2600 1.1 christos }
2601 1.1 christos }
2602 1.1 christos }
2603 1.1 christos
2604 1.1 christos if (i >= count)
2605 1.1 christos {
2606 1.1 christos /* Only get the error once. */
2607 1.1 christos *pgp = 4;
2608 1.1 christos _bfd_set_gp_value (output_bfd, *pgp);
2609 1.1 christos return FALSE;
2610 1.1 christos }
2611 1.1 christos
2612 1.1 christos return TRUE;
2613 1.1 christos }
2614 1.1 christos
2615 1.1 christos /* We have to figure out the gp value, so that we can adjust the
2616 1.1 christos symbol value correctly. We look up the symbol _gp in the output
2617 1.1 christos BFD. If we can't find it, we're stuck. We cache it in the ELF
2618 1.1 christos target data. We don't need to adjust the symbol value for an
2619 1.1 christos external symbol if we are producing relocatable output. */
2620 1.1 christos
2621 1.1 christos static bfd_reloc_status_type
2622 1.1 christos mips_elf_final_gp (bfd *output_bfd, asymbol *symbol, bfd_boolean relocatable,
2623 1.1 christos char **error_message, bfd_vma *pgp)
2624 1.1 christos {
2625 1.1 christos if (bfd_is_und_section (symbol->section)
2626 1.1 christos && ! relocatable)
2627 1.1 christos {
2628 1.1 christos *pgp = 0;
2629 1.1 christos return bfd_reloc_undefined;
2630 1.1 christos }
2631 1.1 christos
2632 1.1 christos *pgp = _bfd_get_gp_value (output_bfd);
2633 1.1 christos if (*pgp == 0
2634 1.1 christos && (! relocatable
2635 1.1 christos || (symbol->flags & BSF_SECTION_SYM) != 0))
2636 1.1 christos {
2637 1.1 christos if (relocatable)
2638 1.1 christos {
2639 1.1 christos /* Make up a value. */
2640 1.1 christos *pgp = symbol->section->output_section->vma /*+ 0x4000*/;
2641 1.1 christos _bfd_set_gp_value (output_bfd, *pgp);
2642 1.1 christos }
2643 1.1 christos else if (!mips_elf_assign_gp (output_bfd, pgp))
2644 1.1 christos {
2645 1.1 christos *error_message =
2646 1.1 christos (char *) _("GP relative relocation when _gp not defined");
2647 1.1 christos return bfd_reloc_dangerous;
2648 1.1 christos }
2649 1.1 christos }
2650 1.1 christos
2651 1.1 christos return bfd_reloc_ok;
2652 1.1 christos }
2653 1.1 christos
2654 1.1 christos /* Do a R_MIPS_GPREL16 relocation. This is a 16 bit value which must
2655 1.1 christos become the offset from the gp register. */
2656 1.1 christos
2657 1.1 christos static bfd_reloc_status_type
2658 1.1 christos mips_elf_gprel16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
2659 1.1 christos asymbol *symbol, void *data ATTRIBUTE_UNUSED,
2660 1.1 christos asection *input_section, bfd *output_bfd,
2661 1.1 christos char **error_message ATTRIBUTE_UNUSED)
2662 1.1 christos {
2663 1.1 christos bfd_boolean relocatable;
2664 1.1 christos bfd_reloc_status_type ret;
2665 1.1 christos bfd_vma gp;
2666 1.1 christos
2667 1.1 christos if (output_bfd != NULL)
2668 1.1 christos relocatable = TRUE;
2669 1.1 christos else
2670 1.1 christos {
2671 1.1 christos relocatable = FALSE;
2672 1.1 christos output_bfd = symbol->section->output_section->owner;
2673 1.1 christos }
2674 1.1 christos
2675 1.1 christos ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message,
2676 1.1 christos &gp);
2677 1.1 christos if (ret != bfd_reloc_ok)
2678 1.1 christos return ret;
2679 1.1 christos
2680 1.1 christos return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
2681 1.1 christos input_section, relocatable,
2682 1.1 christos data, gp);
2683 1.1 christos }
2684 1.1 christos
2685 1.1 christos /* Do a R_MIPS_LITERAL relocation. */
2686 1.1 christos
2687 1.1 christos static bfd_reloc_status_type
2688 1.1 christos mips_elf_literal_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
2689 1.1 christos void *data, asection *input_section, bfd *output_bfd,
2690 1.1 christos char **error_message)
2691 1.1 christos {
2692 1.1 christos bfd_boolean relocatable;
2693 1.1 christos bfd_reloc_status_type ret;
2694 1.1 christos bfd_vma gp;
2695 1.1 christos
2696 1.1 christos /* R_MIPS_LITERAL relocations are defined for local symbols only. */
2697 1.1 christos if (output_bfd != NULL
2698 1.1 christos && (symbol->flags & BSF_SECTION_SYM) == 0
2699 1.1 christos && (symbol->flags & BSF_LOCAL) != 0)
2700 1.1 christos {
2701 1.1 christos *error_message = (char *)
2702 1.1 christos _("literal relocation occurs for an external symbol");
2703 1.1 christos return bfd_reloc_outofrange;
2704 1.1 christos }
2705 1.1 christos
2706 1.1 christos /* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */
2707 1.1 christos if (output_bfd != NULL)
2708 1.1 christos relocatable = TRUE;
2709 1.1 christos else
2710 1.1 christos {
2711 1.1 christos relocatable = FALSE;
2712 1.1 christos output_bfd = symbol->section->output_section->owner;
2713 1.1 christos }
2714 1.1 christos
2715 1.1 christos ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message,
2716 1.1 christos &gp);
2717 1.1 christos if (ret != bfd_reloc_ok)
2718 1.1 christos return ret;
2719 1.1 christos
2720 1.1 christos return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
2721 1.1 christos input_section, relocatable,
2722 1.1 christos data, gp);
2723 1.1 christos }
2724 1.1 christos
2725 1.1 christos /* Do a R_MIPS_GPREL32 relocation. This is a 32 bit value which must
2726 1.1 christos become the offset from the gp register. */
2727 1.1 christos
2728 1.1 christos static bfd_reloc_status_type
2729 1.1 christos mips_elf_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
2730 1.1 christos void *data, asection *input_section, bfd *output_bfd,
2731 1.1 christos char **error_message)
2732 1.1 christos {
2733 1.1 christos bfd_boolean relocatable;
2734 1.1 christos bfd_reloc_status_type ret;
2735 1.1 christos bfd_vma gp;
2736 1.1 christos
2737 1.1 christos /* R_MIPS_GPREL32 relocations are defined for local symbols only. */
2738 1.1 christos if (output_bfd != NULL
2739 1.1 christos && (symbol->flags & BSF_SECTION_SYM) == 0
2740 1.1 christos && (symbol->flags & BSF_LOCAL) != 0)
2741 1.1 christos {
2742 1.1 christos *error_message = (char *)
2743 1.1 christos _("32bits gp relative relocation occurs for an external symbol");
2744 1.1 christos return bfd_reloc_outofrange;
2745 1.1 christos }
2746 1.1 christos
2747 1.1 christos if (output_bfd != NULL)
2748 1.1 christos {
2749 1.1 christos relocatable = TRUE;
2750 1.1 christos gp = _bfd_get_gp_value (output_bfd);
2751 1.1 christos }
2752 1.1 christos else
2753 1.1 christos {
2754 1.1 christos relocatable = FALSE;
2755 1.1 christos output_bfd = symbol->section->output_section->owner;
2756 1.1 christos
2757 1.1 christos ret = mips_elf_final_gp (output_bfd, symbol, relocatable,
2758 1.1 christos error_message, &gp);
2759 1.1 christos if (ret != bfd_reloc_ok)
2760 1.1 christos return ret;
2761 1.1 christos }
2762 1.1 christos
2763 1.1 christos return gprel32_with_gp (abfd, symbol, reloc_entry, input_section,
2764 1.1 christos relocatable, data, gp);
2765 1.1 christos }
2766 1.1 christos
2767 1.1 christos static bfd_reloc_status_type
2768 1.1 christos gprel32_with_gp (bfd *abfd, asymbol *symbol, arelent *reloc_entry,
2769 1.1 christos asection *input_section, bfd_boolean relocatable,
2770 1.1 christos void *data, bfd_vma gp)
2771 1.1 christos {
2772 1.1 christos bfd_vma relocation;
2773 1.1 christos unsigned long val;
2774 1.1 christos
2775 1.1 christos if (bfd_is_com_section (symbol->section))
2776 1.1 christos relocation = 0;
2777 1.1 christos else
2778 1.1 christos relocation = symbol->value;
2779 1.1 christos
2780 1.1 christos relocation += symbol->section->output_section->vma;
2781 1.1 christos relocation += symbol->section->output_offset;
2782 1.1 christos
2783 1.1 christos if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
2784 1.1 christos return bfd_reloc_outofrange;
2785 1.1 christos
2786 1.1 christos if (reloc_entry->howto->src_mask == 0)
2787 1.1 christos val = 0;
2788 1.1 christos else
2789 1.1 christos val = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
2790 1.1 christos
2791 1.1 christos /* Set val to the offset into the section or symbol. */
2792 1.1 christos val += reloc_entry->addend;
2793 1.1 christos
2794 1.1 christos /* Adjust val for the final section location and GP value. If we
2795 1.1 christos are producing relocatable output, we don't want to do this for
2796 1.1 christos an external symbol. */
2797 1.1 christos if (! relocatable
2798 1.1 christos || (symbol->flags & BSF_SECTION_SYM) != 0)
2799 1.1 christos val += relocation - gp;
2800 1.1 christos
2801 1.1 christos bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address);
2802 1.1 christos
2803 1.1 christos if (relocatable)
2804 1.1 christos reloc_entry->address += input_section->output_offset;
2805 1.1 christos
2806 1.1 christos return bfd_reloc_ok;
2807 1.1 christos }
2808 1.1 christos
2809 1.1 christos /* Do a R_MIPS_SHIFT6 relocation. The MSB of the shift is stored at bit 2,
2810 1.1 christos the rest is at bits 6-10. The bitpos already got right by the howto. */
2811 1.1 christos
2812 1.1 christos static bfd_reloc_status_type
2813 1.1 christos mips_elf_shift6_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
2814 1.1 christos void *data, asection *input_section, bfd *output_bfd,
2815 1.1 christos char **error_message)
2816 1.1 christos {
2817 1.1 christos if (reloc_entry->howto->partial_inplace)
2818 1.1 christos {
2819 1.1 christos reloc_entry->addend = ((reloc_entry->addend & 0x00007c0)
2820 1.1 christos | (reloc_entry->addend & 0x00000800) >> 9);
2821 1.1 christos }
2822 1.1 christos
2823 1.1 christos return _bfd_mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
2824 1.1 christos input_section, output_bfd,
2825 1.1 christos error_message);
2826 1.1 christos }
2827 1.1 christos
2828 1.1 christos /* Handle a mips16 GP relative reloc. */
2830 1.1 christos
2831 1.1 christos static bfd_reloc_status_type
2832 1.1 christos mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
2833 1.1 christos void *data, asection *input_section, bfd *output_bfd,
2834 1.1 christos char **error_message)
2835 1.1 christos {
2836 1.1 christos bfd_boolean relocatable;
2837 1.1 christos bfd_reloc_status_type ret;
2838 1.1 christos bfd_byte *location;
2839 1.1 christos bfd_vma gp;
2840 1.1 christos
2841 1.1 christos /* If we're relocating, and this is an external symbol, we don't want
2842 1.1 christos to change anything. */
2843 1.1 christos if (output_bfd != NULL
2844 1.1 christos && (symbol->flags & BSF_SECTION_SYM) == 0
2845 1.1 christos && (symbol->flags & BSF_LOCAL) != 0)
2846 1.1 christos {
2847 1.1 christos reloc_entry->address += input_section->output_offset;
2848 1.1 christos return bfd_reloc_ok;
2849 1.1 christos }
2850 1.1 christos
2851 1.1 christos if (output_bfd != NULL)
2852 1.1 christos relocatable = TRUE;
2853 1.1 christos else
2854 1.1 christos {
2855 1.1 christos relocatable = FALSE;
2856 1.1 christos output_bfd = symbol->section->output_section->owner;
2857 1.1 christos }
2858 1.1 christos
2859 1.1 christos ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message,
2860 1.1 christos &gp);
2861 1.1 christos if (ret != bfd_reloc_ok)
2862 1.1 christos return ret;
2863 1.1 christos
2864 1.1 christos location = (bfd_byte *) data + reloc_entry->address;
2865 1.1 christos _bfd_mips_elf_reloc_unshuffle (abfd, reloc_entry->howto->type, FALSE,
2866 1.1 christos location);
2867 1.1 christos ret = _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
2868 1.1 christos input_section, relocatable,
2869 1.1 christos data, gp);
2870 1.1 christos _bfd_mips_elf_reloc_shuffle (abfd, reloc_entry->howto->type, !relocatable,
2871 1.1 christos location);
2872 1.1 christos
2873 1.1 christos return ret;
2874 1.1 christos }
2875 1.1 christos
2876 1.1 christos /* A mapping from BFD reloc types to MIPS ELF reloc types. */
2878 1.1 christos
2879 1.1 christos struct elf_reloc_map {
2880 1.1 christos bfd_reloc_code_real_type bfd_val;
2881 1.1 christos enum elf_mips_reloc_type elf_val;
2882 1.1 christos };
2883 1.1 christos
2884 1.1 christos static const struct elf_reloc_map mips_reloc_map[] =
2885 1.1 christos {
2886 1.1 christos { BFD_RELOC_NONE, R_MIPS_NONE },
2887 1.1 christos { BFD_RELOC_16, R_MIPS_16 },
2888 1.1 christos { BFD_RELOC_32, R_MIPS_32 },
2889 1.1 christos /* There is no BFD reloc for R_MIPS_REL32. */
2890 1.1 christos { BFD_RELOC_CTOR, R_MIPS_32 },
2891 1.1 christos { BFD_RELOC_64, R_MIPS_64 },
2892 1.1 christos { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 },
2893 1.1 christos { BFD_RELOC_HI16_S, R_MIPS_HI16 },
2894 1.1 christos { BFD_RELOC_LO16, R_MIPS_LO16 },
2895 1.1 christos { BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
2896 1.1 christos { BFD_RELOC_GPREL32, R_MIPS_GPREL32 },
2897 1.1 christos { BFD_RELOC_MIPS_JMP, R_MIPS_26 },
2898 1.1 christos { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL },
2899 1.1 christos { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 },
2900 1.1 christos { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 },
2901 1.1 christos { BFD_RELOC_MIPS_SHIFT5, R_MIPS_SHIFT5 },
2902 1.1 christos { BFD_RELOC_MIPS_SHIFT6, R_MIPS_SHIFT6 },
2903 1.1 christos { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP },
2904 1.1 christos { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE },
2905 1.1 christos { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST },
2906 1.1 christos { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 },
2907 1.1 christos { BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 },
2908 1.1 christos { BFD_RELOC_MIPS_SUB, R_MIPS_SUB },
2909 1.1 christos { BFD_RELOC_MIPS_INSERT_A, R_MIPS_INSERT_A },
2910 1.1 christos { BFD_RELOC_MIPS_INSERT_B, R_MIPS_INSERT_B },
2911 1.1 christos { BFD_RELOC_MIPS_DELETE, R_MIPS_DELETE },
2912 1.1 christos { BFD_RELOC_MIPS_HIGHEST, R_MIPS_HIGHEST },
2913 1.1 christos { BFD_RELOC_MIPS_HIGHER, R_MIPS_HIGHER },
2914 1.1 christos { BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 },
2915 1.1 christos { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 },
2916 1.1 christos { BFD_RELOC_MIPS_SCN_DISP, R_MIPS_SCN_DISP },
2917 1.1 christos { BFD_RELOC_MIPS_REL16, R_MIPS_REL16 },
2918 1.1 christos /* Use of R_MIPS_ADD_IMMEDIATE and R_MIPS_PJUMP is deprecated. */
2919 1.1 christos { BFD_RELOC_MIPS_RELGOT, R_MIPS_RELGOT },
2920 1.1 christos { BFD_RELOC_MIPS_JALR, R_MIPS_JALR },
2921 1.1 christos { BFD_RELOC_MIPS_TLS_DTPMOD32, R_MIPS_TLS_DTPMOD32 },
2922 1.1 christos { BFD_RELOC_MIPS_TLS_DTPREL32, R_MIPS_TLS_DTPREL32 },
2923 1.1 christos { BFD_RELOC_MIPS_TLS_DTPMOD64, R_MIPS_TLS_DTPMOD64 },
2924 1.1 christos { BFD_RELOC_MIPS_TLS_DTPREL64, R_MIPS_TLS_DTPREL64 },
2925 1.1 christos { BFD_RELOC_MIPS_TLS_GD, R_MIPS_TLS_GD },
2926 1.1 christos { BFD_RELOC_MIPS_TLS_LDM, R_MIPS_TLS_LDM },
2927 1.1 christos { BFD_RELOC_MIPS_TLS_DTPREL_HI16, R_MIPS_TLS_DTPREL_HI16 },
2928 1.1 christos { BFD_RELOC_MIPS_TLS_DTPREL_LO16, R_MIPS_TLS_DTPREL_LO16 },
2929 1.1 christos { BFD_RELOC_MIPS_TLS_GOTTPREL, R_MIPS_TLS_GOTTPREL },
2930 1.1 christos { BFD_RELOC_MIPS_TLS_TPREL32, R_MIPS_TLS_TPREL32 },
2931 1.1 christos { BFD_RELOC_MIPS_TLS_TPREL64, R_MIPS_TLS_TPREL64 },
2932 1.1 christos { BFD_RELOC_MIPS_TLS_TPREL_HI16, R_MIPS_TLS_TPREL_HI16 },
2933 1.1 christos { BFD_RELOC_MIPS_TLS_TPREL_LO16, R_MIPS_TLS_TPREL_LO16 }
2934 1.1 christos };
2935 1.1 christos
2936 1.1 christos static const struct elf_reloc_map mips16_reloc_map[] =
2937 1.1 christos {
2938 1.1 christos { BFD_RELOC_MIPS16_JMP, R_MIPS16_26 - R_MIPS16_min },
2939 1.1 christos { BFD_RELOC_MIPS16_GPREL, R_MIPS16_GPREL - R_MIPS16_min },
2940 1.1 christos { BFD_RELOC_MIPS16_GOT16, R_MIPS16_GOT16 - R_MIPS16_min },
2941 1.1 christos { BFD_RELOC_MIPS16_CALL16, R_MIPS16_CALL16 - R_MIPS16_min },
2942 1.1 christos { BFD_RELOC_MIPS16_HI16_S, R_MIPS16_HI16 - R_MIPS16_min },
2943 1.1 christos { BFD_RELOC_MIPS16_LO16, R_MIPS16_LO16 - R_MIPS16_min },
2944 1.1 christos { BFD_RELOC_MIPS16_TLS_GD, R_MIPS16_TLS_GD - R_MIPS16_min },
2945 1.1 christos { BFD_RELOC_MIPS16_TLS_LDM, R_MIPS16_TLS_LDM - R_MIPS16_min },
2946 1.1 christos { BFD_RELOC_MIPS16_TLS_DTPREL_HI16,
2947 1.1 christos R_MIPS16_TLS_DTPREL_HI16 - R_MIPS16_min },
2948 1.1 christos { BFD_RELOC_MIPS16_TLS_DTPREL_LO16,
2949 1.1 christos R_MIPS16_TLS_DTPREL_LO16 - R_MIPS16_min },
2950 1.1 christos { BFD_RELOC_MIPS16_TLS_GOTTPREL, R_MIPS16_TLS_GOTTPREL - R_MIPS16_min },
2951 1.1 christos { BFD_RELOC_MIPS16_TLS_TPREL_HI16, R_MIPS16_TLS_TPREL_HI16 - R_MIPS16_min },
2952 1.1 christos { BFD_RELOC_MIPS16_TLS_TPREL_LO16, R_MIPS16_TLS_TPREL_LO16 - R_MIPS16_min }
2953 1.1 christos };
2954 1.1 christos
2955 1.1 christos static const struct elf_reloc_map micromips_reloc_map[] =
2956 1.1 christos {
2957 1.1 christos { BFD_RELOC_MICROMIPS_JMP, R_MICROMIPS_26_S1 - R_MICROMIPS_min },
2958 1.1 christos { BFD_RELOC_MICROMIPS_HI16_S, R_MICROMIPS_HI16 - R_MICROMIPS_min },
2959 1.1 christos { BFD_RELOC_MICROMIPS_LO16, R_MICROMIPS_LO16 - R_MICROMIPS_min },
2960 1.1 christos { BFD_RELOC_MICROMIPS_GPREL16, R_MICROMIPS_GPREL16 - R_MICROMIPS_min },
2961 1.1 christos { BFD_RELOC_MICROMIPS_LITERAL, R_MICROMIPS_LITERAL - R_MICROMIPS_min },
2962 1.1 christos { BFD_RELOC_MICROMIPS_GOT16, R_MICROMIPS_GOT16 - R_MICROMIPS_min },
2963 1.1 christos { BFD_RELOC_MICROMIPS_7_PCREL_S1, R_MICROMIPS_PC7_S1 - R_MICROMIPS_min },
2964 1.1 christos { BFD_RELOC_MICROMIPS_10_PCREL_S1, R_MICROMIPS_PC10_S1 - R_MICROMIPS_min },
2965 1.1 christos { BFD_RELOC_MICROMIPS_16_PCREL_S1, R_MICROMIPS_PC16_S1 - R_MICROMIPS_min },
2966 1.1 christos { BFD_RELOC_MICROMIPS_CALL16, R_MICROMIPS_CALL16 - R_MICROMIPS_min },
2967 1.1 christos { BFD_RELOC_MICROMIPS_GOT_DISP, R_MICROMIPS_GOT_DISP - R_MICROMIPS_min },
2968 1.1 christos { BFD_RELOC_MICROMIPS_GOT_PAGE, R_MICROMIPS_GOT_PAGE - R_MICROMIPS_min },
2969 1.1 christos { BFD_RELOC_MICROMIPS_GOT_OFST, R_MICROMIPS_GOT_OFST - R_MICROMIPS_min },
2970 1.1 christos { BFD_RELOC_MICROMIPS_GOT_HI16, R_MICROMIPS_GOT_HI16 - R_MICROMIPS_min },
2971 1.1 christos { BFD_RELOC_MICROMIPS_GOT_LO16, R_MICROMIPS_GOT_LO16 - R_MICROMIPS_min },
2972 1.1 christos { BFD_RELOC_MICROMIPS_SUB, R_MICROMIPS_SUB - R_MICROMIPS_min },
2973 1.1 christos { BFD_RELOC_MICROMIPS_HIGHER, R_MICROMIPS_HIGHER - R_MICROMIPS_min },
2974 1.1 christos { BFD_RELOC_MICROMIPS_HIGHEST, R_MICROMIPS_HIGHEST - R_MICROMIPS_min },
2975 1.1 christos { BFD_RELOC_MICROMIPS_CALL_HI16, R_MICROMIPS_CALL_HI16 - R_MICROMIPS_min },
2976 1.1 christos { BFD_RELOC_MICROMIPS_CALL_LO16, R_MICROMIPS_CALL_LO16 - R_MICROMIPS_min },
2977 1.1 christos };
2978 1.1 christos
2979 1.1 christos /* Given a BFD reloc type, return a howto structure. */
2980 1.1 christos
2981 1.1 christos static reloc_howto_type *
2982 1.1 christos bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
2983 1.1 christos bfd_reloc_code_real_type code)
2984 1.1 christos {
2985 1.1 christos unsigned int i;
2986 1.1 christos /* FIXME: We default to RELA here instead of choosing the right
2987 1.1 christos relocation variant. */
2988 1.1 christos reloc_howto_type *howto_table = elf_mips_howto_table_rela;
2989 1.1 christos reloc_howto_type *howto16_table = elf_mips16_howto_table_rela;
2990 1.1 christos reloc_howto_type *howto_micromips_table = elf_micromips_howto_table_rela;
2991 1.1 christos
2992 1.1 christos for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map);
2993 1.1 christos i++)
2994 1.1 christos {
2995 1.1 christos if (mips_reloc_map[i].bfd_val == code)
2996 1.1 christos return &howto_table[(int) mips_reloc_map[i].elf_val];
2997 1.1 christos }
2998 1.1 christos
2999 1.1 christos for (i = 0; i < sizeof (mips16_reloc_map) / sizeof (struct elf_reloc_map);
3000 1.1 christos i++)
3001 1.1 christos {
3002 1.1 christos if (mips16_reloc_map[i].bfd_val == code)
3003 1.1 christos return &howto16_table[(int) mips16_reloc_map[i].elf_val];
3004 1.1 christos }
3005 1.1 christos
3006 1.1 christos for (i = 0; i < sizeof (micromips_reloc_map) / sizeof (struct elf_reloc_map);
3007 1.1 christos i++)
3008 1.1 christos {
3009 1.1 christos if (micromips_reloc_map[i].bfd_val == code)
3010 1.1 christos return &howto_micromips_table[(int) micromips_reloc_map[i].elf_val];
3011 1.1 christos }
3012 1.1 christos
3013 1.1 christos switch (code)
3014 1.1 christos {
3015 1.1 christos case BFD_RELOC_VTABLE_INHERIT:
3016 1.1 christos return &elf_mips_gnu_vtinherit_howto;
3017 1.1 christos case BFD_RELOC_VTABLE_ENTRY:
3018 1.1 christos return &elf_mips_gnu_vtentry_howto;
3019 1.1 christos case BFD_RELOC_MIPS_COPY:
3020 1.1 christos return &elf_mips_copy_howto;
3021 1.1 christos case BFD_RELOC_MIPS_JUMP_SLOT:
3022 1.1 christos return &elf_mips_jump_slot_howto;
3023 1.1 christos default:
3024 1.1 christos bfd_set_error (bfd_error_bad_value);
3025 1.1 christos return NULL;
3026 1.1 christos }
3027 1.1 christos }
3028 1.1 christos
3029 1.1 christos static reloc_howto_type *
3030 1.1 christos bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
3031 1.1 christos const char *r_name)
3032 1.1 christos {
3033 1.1 christos unsigned int i;
3034 1.1 christos
3035 1.1 christos for (i = 0;
3036 1.1 christos i < (sizeof (elf_mips_howto_table_rela)
3037 1.1 christos / sizeof (elf_mips_howto_table_rela[0]));
3038 1.1 christos i++)
3039 1.1 christos if (elf_mips_howto_table_rela[i].name != NULL
3040 1.1 christos && strcasecmp (elf_mips_howto_table_rela[i].name, r_name) == 0)
3041 1.1 christos return &elf_mips_howto_table_rela[i];
3042 1.1 christos
3043 1.1 christos for (i = 0;
3044 1.1 christos i < (sizeof (elf_mips16_howto_table_rela)
3045 1.1 christos / sizeof (elf_mips16_howto_table_rela[0]));
3046 1.1 christos i++)
3047 1.1 christos if (elf_mips16_howto_table_rela[i].name != NULL
3048 1.1 christos && strcasecmp (elf_mips16_howto_table_rela[i].name, r_name) == 0)
3049 1.1 christos return &elf_mips16_howto_table_rela[i];
3050 1.1 christos
3051 1.1 christos for (i = 0;
3052 1.1 christos i < (sizeof (elf_micromips_howto_table_rela)
3053 1.1 christos / sizeof (elf_micromips_howto_table_rela[0]));
3054 1.1 christos i++)
3055 1.1 christos if (elf_micromips_howto_table_rela[i].name != NULL
3056 1.1 christos && strcasecmp (elf_micromips_howto_table_rela[i].name, r_name) == 0)
3057 1.1 christos return &elf_micromips_howto_table_rela[i];
3058 1.1 christos
3059 1.1 christos if (strcasecmp (elf_mips_gnu_vtinherit_howto.name, r_name) == 0)
3060 1.1 christos return &elf_mips_gnu_vtinherit_howto;
3061 1.1 christos if (strcasecmp (elf_mips_gnu_vtentry_howto.name, r_name) == 0)
3062 1.1 christos return &elf_mips_gnu_vtentry_howto;
3063 1.1 christos if (strcasecmp (elf_mips_gnu_rel16_s2.name, r_name) == 0)
3064 1.1 christos return &elf_mips_gnu_rel16_s2;
3065 1.1 christos if (strcasecmp (elf_mips_gnu_rela16_s2.name, r_name) == 0)
3066 1.1 christos return &elf_mips_gnu_rela16_s2;
3067 1.1 christos if (strcasecmp (elf_mips_copy_howto.name, r_name) == 0)
3068 1.1 christos return &elf_mips_copy_howto;
3069 1.1 christos if (strcasecmp (elf_mips_jump_slot_howto.name, r_name) == 0)
3070 1.1 christos return &elf_mips_jump_slot_howto;
3071 1.1 christos
3072 1.1 christos return NULL;
3073 1.1 christos }
3074 1.1 christos
3075 1.1 christos /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
3076 1.1 christos
3077 1.1 christos static reloc_howto_type *
3078 1.1 christos mips_elf_n32_rtype_to_howto (unsigned int r_type, bfd_boolean rela_p)
3079 1.1 christos {
3080 1.1 christos switch (r_type)
3081 1.1 christos {
3082 1.1 christos case R_MIPS_GNU_VTINHERIT:
3083 1.1 christos return &elf_mips_gnu_vtinherit_howto;
3084 1.1 christos case R_MIPS_GNU_VTENTRY:
3085 1.1 christos return &elf_mips_gnu_vtentry_howto;
3086 1.1 christos case R_MIPS_GNU_REL16_S2:
3087 1.1 christos if (rela_p)
3088 1.1 christos return &elf_mips_gnu_rela16_s2;
3089 1.1 christos else
3090 1.1 christos return &elf_mips_gnu_rel16_s2;
3091 1.1 christos case R_MIPS_COPY:
3092 1.1 christos return &elf_mips_copy_howto;
3093 1.1 christos case R_MIPS_JUMP_SLOT:
3094 1.1 christos return &elf_mips_jump_slot_howto;
3095 1.1 christos default:
3096 1.1 christos if (r_type >= R_MICROMIPS_min && r_type < R_MICROMIPS_max)
3097 1.1 christos {
3098 1.1 christos if (rela_p)
3099 1.1 christos return &elf_micromips_howto_table_rela[r_type - R_MICROMIPS_min];
3100 1.1 christos else
3101 1.1 christos return &elf_micromips_howto_table_rel[r_type - R_MICROMIPS_min];
3102 1.1 christos }
3103 1.1 christos if (r_type >= R_MIPS16_min && r_type < R_MIPS16_max)
3104 1.1 christos {
3105 1.1 christos if (rela_p)
3106 1.1 christos return &elf_mips16_howto_table_rela[r_type - R_MIPS16_min];
3107 1.1 christos else
3108 1.1 christos return &elf_mips16_howto_table_rel[r_type - R_MIPS16_min];
3109 1.1 christos }
3110 1.1 christos BFD_ASSERT (r_type < (unsigned int) R_MIPS_max);
3111 1.1 christos if (rela_p)
3112 1.1 christos return &elf_mips_howto_table_rela[r_type];
3113 1.1 christos else
3114 1.1 christos return &elf_mips_howto_table_rel[r_type];
3115 1.1 christos break;
3116 1.1 christos }
3117 1.1 christos }
3118 1.1 christos
3119 1.1 christos /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
3120 1.1 christos
3121 1.1 christos static void
3122 1.1 christos mips_info_to_howto_rel (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst)
3123 1.1 christos {
3124 1.1 christos unsigned int r_type;
3125 1.1 christos
3126 1.1 christos r_type = ELF32_R_TYPE (dst->r_info);
3127 1.1 christos cache_ptr->howto = mips_elf_n32_rtype_to_howto (r_type, FALSE);
3128 1.1 christos
3129 1.1 christos /* The addend for a GPREL16 or LITERAL relocation comes from the GP
3130 1.1 christos value for the object file. We get the addend now, rather than
3131 1.1 christos when we do the relocation, because the symbol manipulations done
3132 1.1 christos by the linker may cause us to lose track of the input BFD. */
3133 1.1 christos if (((*cache_ptr->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0
3134 1.1 christos && (gprel16_reloc_p (r_type) || r_type == (unsigned int) R_MIPS_LITERAL))
3135 1.1 christos cache_ptr->addend = elf_gp (abfd);
3136 1.1 christos }
3137 1.1 christos
3138 1.1 christos /* Given a MIPS Elf_Internal_Rela, fill in an arelent structure. */
3139 1.1 christos
3140 1.1 christos static void
3141 1.1 christos mips_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED,
3142 1.1 christos arelent *cache_ptr, Elf_Internal_Rela *dst)
3143 1.1 christos {
3144 1.1 christos unsigned int r_type;
3145 1.1 christos
3146 1.1 christos r_type = ELF32_R_TYPE (dst->r_info);
3147 1.1 christos cache_ptr->howto = mips_elf_n32_rtype_to_howto (r_type, TRUE);
3148 1.1 christos cache_ptr->addend = dst->r_addend;
3149 1.1 christos }
3150 1.1 christos
3151 1.1 christos /* Determine whether a symbol is global for the purposes of splitting
3153 1.1 christos the symbol table into global symbols and local symbols. At least
3154 1.1 christos on Irix 5, this split must be between section symbols and all other
3155 1.1 christos symbols. On most ELF targets the split is between static symbols
3156 1.1 christos and externally visible symbols. */
3157 1.1 christos
3158 1.1 christos static bfd_boolean
3159 1.1 christos mips_elf_sym_is_global (bfd *abfd ATTRIBUTE_UNUSED, asymbol *sym)
3160 1.1 christos {
3161 1.1 christos if (SGI_COMPAT (abfd))
3162 1.1 christos return (sym->flags & BSF_SECTION_SYM) == 0;
3163 1.1 christos else
3164 1.1 christos return ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE)) != 0
3165 1.1 christos || bfd_is_und_section (bfd_get_section (sym))
3166 1.1 christos || bfd_is_com_section (bfd_get_section (sym)));
3167 1.1 christos }
3168 1.1 christos
3169 1.1 christos /* Set the right machine number for a MIPS ELF file. */
3171 1.1 christos
3172 1.1 christos static bfd_boolean
3173 1.1 christos mips_elf_n32_object_p (bfd *abfd)
3174 1.1 christos {
3175 1.1 christos unsigned long mach;
3176 1.1 christos
3177 1.1 christos /* Irix 5 and 6 are broken. Object file symbol tables are not always
3178 1.1 christos sorted correctly such that local symbols precede global symbols,
3179 1.1 christos and the sh_info field in the symbol table is not always right. */
3180 1.1 christos if (SGI_COMPAT (abfd))
3181 1.1 christos elf_bad_symtab (abfd) = TRUE;
3182 1.1 christos
3183 1.1 christos mach = _bfd_elf_mips_mach (elf_elfheader (abfd)->e_flags);
3184 1.1 christos bfd_default_set_arch_mach (abfd, bfd_arch_mips, mach);
3185 1.1 christos
3186 1.1 christos if (! ABI_N32_P(abfd))
3187 1.1 christos return FALSE;
3188 1.1 christos
3189 1.1 christos return TRUE;
3190 1.1 christos }
3191 1.1 christos
3192 1.1 christos /* Support for core dump NOTE sections. */
3194 1.1 christos static bfd_boolean
3195 1.1 christos elf32_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
3196 1.1 christos {
3197 1.1 christos int offset;
3198 1.1 christos unsigned int size;
3199 1.1 christos
3200 1.1 christos switch (note->descsz)
3201 1.1 christos {
3202 1.1 christos default:
3203 1.1 christos return FALSE;
3204 1.1 christos
3205 1.1 christos case 440: /* Linux/MIPS N32 */
3206 1.1 christos /* pr_cursig */
3207 1.1 christos elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
3208 1.1 christos
3209 1.1 christos /* pr_pid */
3210 1.1 christos elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
3211 1.1 christos
3212 1.1 christos /* pr_reg */
3213 1.1 christos offset = 72;
3214 1.1 christos size = 360;
3215 1.1 christos
3216 1.1 christos break;
3217 1.1 christos }
3218 1.1 christos
3219 1.1 christos /* Make a ".reg/999" section. */
3220 1.1 christos return _bfd_elfcore_make_pseudosection (abfd, ".reg", size,
3221 1.1 christos note->descpos + offset);
3222 1.1 christos }
3223 1.1 christos
3224 1.1 christos static bfd_boolean
3225 1.1 christos elf32_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
3226 1.1 christos {
3227 1.1 christos switch (note->descsz)
3228 1.1 christos {
3229 1.1 christos default:
3230 1.1 christos return FALSE;
3231 1.1 christos
3232 1.1 christos case 128: /* Linux/MIPS elf_prpsinfo */
3233 1.1 christos elf_tdata (abfd)->core_program
3234 1.1 christos = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
3235 1.1 christos elf_tdata (abfd)->core_command
3236 1.1 christos = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
3237 1.1 christos }
3238 1.1 christos
3239 1.1 christos /* Note that for some reason, a spurious space is tacked
3240 1.1 christos onto the end of the args in some (at least one anyway)
3241 1.1 christos implementations, so strip it off if it exists. */
3242 1.1 christos
3243 1.1 christos {
3244 1.1 christos char *command = elf_tdata (abfd)->core_command;
3245 1.1 christos int n = strlen (command);
3246 1.1 christos
3247 1.1 christos if (0 < n && command[n - 1] == ' ')
3248 1.1 christos command[n - 1] = '\0';
3249 1.1 christos }
3250 1.1 christos
3251 1.1 christos return TRUE;
3252 1.1 christos }
3253 1.1 christos
3254 1.1 christos /* MIPS ELF local labels start with "$L". */
3256 1.1 christos static bfd_boolean
3257 1.1 christos mips_elf_n32_is_local_label_name (bfd *abfd, const char *name)
3258 1.1 christos {
3259 1.1 christos if (name[0] == '$' && name[1] == 'L')
3260 1.1 christos return TRUE;
3261 1.1 christos
3262 1.1 christos /* We accept the generic ELF local label syntax as well. */
3263 1.1 christos return _bfd_elf_is_local_label_name (abfd, name);
3264 1.1 christos }
3265 1.1 christos
3266 1.1 christos /* Depending on the target vector we generate some version of Irix
3268 1.1 christos executables or "normal" MIPS ELF ABI executables. */
3269 1.1 christos static irix_compat_t
3270 1.1 christos elf_n32_mips_irix_compat (bfd *abfd)
3271 1.1 christos {
3272 1.1 christos if ((abfd->xvec == &bfd_elf32_nbigmips_vec)
3273 1.1 christos || (abfd->xvec == &bfd_elf32_nlittlemips_vec))
3274 1.1 christos return ict_irix6;
3275 1.1 christos else
3276 1.1 christos return ict_none;
3277 1.1 christos }
3278 1.1 christos
3279 1.1 christos /* ECOFF swapping routines. These are used when dealing with the
3281 1.1 christos .mdebug section, which is in the ECOFF debugging format. */
3282 1.1 christos static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
3283 1.1 christos /* Symbol table magic number. */
3284 1.1 christos magicSym,
3285 1.1 christos /* Alignment of debugging information. E.g., 4. */
3286 1.1 christos 4,
3287 1.1 christos /* Sizes of external symbolic information. */
3288 1.1 christos sizeof (struct hdr_ext),
3289 1.1 christos sizeof (struct dnr_ext),
3290 1.1 christos sizeof (struct pdr_ext),
3291 1.1 christos sizeof (struct sym_ext),
3292 1.1 christos sizeof (struct opt_ext),
3293 1.1 christos sizeof (struct fdr_ext),
3294 1.1 christos sizeof (struct rfd_ext),
3295 1.1 christos sizeof (struct ext_ext),
3296 1.1 christos /* Functions to swap in external symbolic data. */
3297 1.1 christos ecoff_swap_hdr_in,
3298 1.1 christos ecoff_swap_dnr_in,
3299 1.1 christos ecoff_swap_pdr_in,
3300 1.1 christos ecoff_swap_sym_in,
3301 1.1 christos ecoff_swap_opt_in,
3302 1.1 christos ecoff_swap_fdr_in,
3303 1.1 christos ecoff_swap_rfd_in,
3304 1.1 christos ecoff_swap_ext_in,
3305 1.1 christos _bfd_ecoff_swap_tir_in,
3306 1.1 christos _bfd_ecoff_swap_rndx_in,
3307 1.1 christos /* Functions to swap out external symbolic data. */
3308 1.1 christos ecoff_swap_hdr_out,
3309 1.1 christos ecoff_swap_dnr_out,
3310 1.1 christos ecoff_swap_pdr_out,
3311 1.1 christos ecoff_swap_sym_out,
3312 1.1 christos ecoff_swap_opt_out,
3313 1.1 christos ecoff_swap_fdr_out,
3314 1.1 christos ecoff_swap_rfd_out,
3315 1.1 christos ecoff_swap_ext_out,
3316 1.1 christos _bfd_ecoff_swap_tir_out,
3317 1.1 christos _bfd_ecoff_swap_rndx_out,
3318 1.1 christos /* Function to read in symbolic data. */
3319 1.1 christos _bfd_mips_elf_read_ecoff_info
3320 1.1 christos };
3321 1.1 christos
3322 1.1 christos #define ELF_ARCH bfd_arch_mips
3324 1.1 christos #define ELF_TARGET_ID MIPS_ELF_DATA
3325 1.1 christos #define ELF_MACHINE_CODE EM_MIPS
3326 1.1 christos
3327 1.1 christos #define elf_backend_collect TRUE
3328 1.1 christos #define elf_backend_type_change_ok TRUE
3329 1.1 christos #define elf_backend_can_gc_sections TRUE
3330 1.1 christos #define elf_info_to_howto mips_info_to_howto_rela
3331 1.1 christos #define elf_info_to_howto_rel mips_info_to_howto_rel
3332 1.1 christos #define elf_backend_sym_is_global mips_elf_sym_is_global
3333 1.1 christos #define elf_backend_object_p mips_elf_n32_object_p
3334 1.1 christos #define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing
3335 1.1 christos #define elf_backend_section_processing _bfd_mips_elf_section_processing
3336 1.1 christos #define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr
3337 1.1 christos #define elf_backend_fake_sections _bfd_mips_elf_fake_sections
3338 1.1 christos #define elf_backend_section_from_bfd_section \
3339 1.1 christos _bfd_mips_elf_section_from_bfd_section
3340 1.1 christos #define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook
3341 1.1 christos #define elf_backend_link_output_symbol_hook \
3342 1.1 christos _bfd_mips_elf_link_output_symbol_hook
3343 1.1 christos #define elf_backend_create_dynamic_sections \
3344 1.1 christos _bfd_mips_elf_create_dynamic_sections
3345 1.1 christos #define elf_backend_check_relocs _bfd_mips_elf_check_relocs
3346 1.1 christos #define elf_backend_merge_symbol_attribute \
3347 1.1 christos _bfd_mips_elf_merge_symbol_attribute
3348 1.1 christos #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag
3349 1.1 christos #define elf_backend_adjust_dynamic_symbol \
3350 1.1 christos _bfd_mips_elf_adjust_dynamic_symbol
3351 1.1 christos #define elf_backend_always_size_sections \
3352 1.1 christos _bfd_mips_elf_always_size_sections
3353 1.1 christos #define elf_backend_size_dynamic_sections \
3354 1.1 christos _bfd_mips_elf_size_dynamic_sections
3355 1.1 christos #define elf_backend_init_index_section _bfd_elf_init_1_index_section
3356 1.1 christos #define elf_backend_relocate_section _bfd_mips_elf_relocate_section
3357 1.1 christos #define elf_backend_finish_dynamic_symbol \
3358 1.1 christos _bfd_mips_elf_finish_dynamic_symbol
3359 1.1 christos #define elf_backend_finish_dynamic_sections \
3360 1.1 christos _bfd_mips_elf_finish_dynamic_sections
3361 1.1 christos #define elf_backend_final_write_processing \
3362 1.1 christos _bfd_mips_elf_final_write_processing
3363 1.1 christos #define elf_backend_additional_program_headers \
3364 1.1 christos _bfd_mips_elf_additional_program_headers
3365 1.1 christos #define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map
3366 1.1 christos #define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook
3367 1.1 christos #define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook
3368 1.1 christos #define elf_backend_copy_indirect_symbol \
3369 1.1 christos _bfd_mips_elf_copy_indirect_symbol
3370 1.1 christos #define elf_backend_grok_prstatus elf32_mips_grok_prstatus
3371 1.1 christos #define elf_backend_grok_psinfo elf32_mips_grok_psinfo
3372 1.1 christos #define elf_backend_ecoff_debug_swap &mips_elf32_ecoff_debug_swap
3373 1.1 christos
3374 1.1 christos #define elf_backend_got_header_size (4 * MIPS_RESERVED_GOTNO)
3375 1.1 christos
3376 1.1 christos /* MIPS n32 ELF can use a mixture of REL and RELA, but some Relocations
3377 1.1 christos work better/work only in RELA, so we default to this. */
3378 1.1 christos #define elf_backend_may_use_rel_p 1
3379 1.1 christos #define elf_backend_may_use_rela_p 1
3380 1.1 christos #define elf_backend_default_use_rela_p 1
3381 1.1 christos #define elf_backend_rela_plts_and_copies_p 0
3382 1.1 christos #define elf_backend_sign_extend_vma TRUE
3383 1.1 christos #define elf_backend_plt_readonly 1
3384 1.1 christos #define elf_backend_plt_sym_val _bfd_mips_elf_plt_sym_val
3385 1.1 christos
3386 1.1 christos #define elf_backend_discard_info _bfd_mips_elf_discard_info
3387 1.1 christos #define elf_backend_ignore_discarded_relocs \
3388 1.1 christos _bfd_mips_elf_ignore_discarded_relocs
3389 1.1 christos #define elf_backend_write_section _bfd_mips_elf_write_section
3390 1.1 christos #define elf_backend_mips_irix_compat elf_n32_mips_irix_compat
3391 1.1 christos #define elf_backend_mips_rtype_to_howto mips_elf_n32_rtype_to_howto
3392 1.1 christos
3393 1.1 christos #define bfd_elf32_bfd_is_local_label_name \
3394 1.1 christos mips_elf_n32_is_local_label_name
3395 1.1 christos #define bfd_elf32_bfd_is_target_special_symbol \
3396 1.1 christos _bfd_mips_elf_is_target_special_symbol
3397 1.1 christos #define bfd_elf32_find_nearest_line _bfd_mips_elf_find_nearest_line
3398 1.1 christos #define bfd_elf32_find_inliner_info _bfd_mips_elf_find_inliner_info
3399 1.1 christos #define bfd_elf32_new_section_hook _bfd_mips_elf_new_section_hook
3400 1.1 christos #define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents
3401 1.1 christos #define bfd_elf32_bfd_get_relocated_section_contents \
3402 1.1 christos _bfd_elf_mips_get_relocated_section_contents
3403 1.1 christos #define bfd_elf32_bfd_link_hash_table_create \
3404 1.1 christos _bfd_mips_elf_link_hash_table_create
3405 1.1 christos #define bfd_elf32_bfd_final_link _bfd_mips_elf_final_link
3406 1.1 christos #define bfd_elf32_bfd_merge_private_bfd_data \
3407 1.1 christos _bfd_mips_elf_merge_private_bfd_data
3408 1.1 christos #define bfd_elf32_bfd_set_private_flags _bfd_mips_elf_set_private_flags
3409 1.1 christos #define bfd_elf32_bfd_print_private_bfd_data \
3410 1.1 christos _bfd_mips_elf_print_private_bfd_data
3411 1.1 christos #define bfd_elf32_bfd_relax_section _bfd_mips_relax_section
3412 1.1 christos
3413 1.1 christos /* Support for SGI-ish mips targets using n32 ABI. */
3414 1.1 christos
3415 1.1 christos #define TARGET_LITTLE_SYM bfd_elf32_nlittlemips_vec
3416 1.1 christos #define TARGET_LITTLE_NAME "elf32-nlittlemips"
3417 1.1 christos #define TARGET_BIG_SYM bfd_elf32_nbigmips_vec
3418 1.1 christos #define TARGET_BIG_NAME "elf32-nbigmips"
3419 1.1 christos
3420 1.1 christos #define ELF_MAXPAGESIZE 0x10000
3421 1.1 christos #define ELF_COMMONPAGESIZE 0x1000
3422 1.1 christos
3423 1.1 christos #include "elf32-target.h"
3424 1.1 christos
3425 1.1 christos /* Support for traditional mips targets using n32 ABI. */
3426 1.1 christos #undef TARGET_LITTLE_SYM
3427 1.1 christos #undef TARGET_LITTLE_NAME
3428 1.1 christos #undef TARGET_BIG_SYM
3429 1.1 christos #undef TARGET_BIG_NAME
3430 1.1 christos
3431 1.1 christos #undef ELF_MAXPAGESIZE
3432 1.1 christos #undef ELF_COMMONPAGESIZE
3433 1.1 christos
3434 1.1 christos #define TARGET_LITTLE_SYM bfd_elf32_ntradlittlemips_vec
3435 1.1 christos #define TARGET_LITTLE_NAME "elf32-ntradlittlemips"
3436 1.1 christos #define TARGET_BIG_SYM bfd_elf32_ntradbigmips_vec
3437 1.1 christos #define TARGET_BIG_NAME "elf32-ntradbigmips"
3438 1.1 christos
3439 1.1 christos #define ELF_MAXPAGESIZE 0x10000
3440 1.1 christos #define ELF_COMMONPAGESIZE 0x1000
3441 1.1 christos #define elf32_bed elf32_tradbed
3442 1.1 christos
3443 1.1 christos /* Include the target file again for this target. */
3444 1.1 christos #include "elf32-target.h"
3445 1.1 christos
3446 1.1 christos
3447 1.1 christos /* FreeBSD support. */
3448 1.1 christos
3449 1.1 christos #undef TARGET_LITTLE_SYM
3450 1.1 christos #undef TARGET_LITTLE_NAME
3451 1.1 christos #undef TARGET_BIG_SYM
3452 1.1 christos #undef TARGET_BIG_NAME
3453 1.1 christos
3454 1.1 christos #define TARGET_LITTLE_SYM bfd_elf32_ntradlittlemips_freebsd_vec
3455 1.1 christos #define TARGET_LITTLE_NAME "elf32-ntradlittlemips-freebsd"
3456 1.1 christos #define TARGET_BIG_SYM bfd_elf32_ntradbigmips_freebsd_vec
3457 1.1 christos #define TARGET_BIG_NAME "elf32-ntradbigmips-freebsd"
3458 1.1 christos
3459 1.1 christos #undef ELF_OSABI
3460 1.1 christos #define ELF_OSABI ELFOSABI_FREEBSD
3461 1.1 christos
3462 1.1 christos /* The kernel recognizes executables as valid only if they carry a
3463 1.1 christos "FreeBSD" label in the ELF header. So we put this label on all
3464 1.1 christos executables and (for simplicity) also all other object files. */
3465 1.1 christos
3466 static void
3467 elf_fbsd_post_process_headers (bfd *abfd, struct bfd_link_info *info)
3468 {
3469 _bfd_elf_set_osabi (abfd, info);
3470 }
3471
3472 #undef elf_backend_post_process_headers
3473 #define elf_backend_post_process_headers elf_fbsd_post_process_headers
3474 #undef elf32_bed
3475 #define elf32_bed elf32_fbsd_tradbed
3476
3477 #include "elf32-target.h"
3478