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