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