Commit | Line | Data |
---|---|---|
0e5136c6 | 1 | /* Intel i860 specific support for 32-bit ELF. |
1049f94e | 2 | Copyright 1993, 1995, 1999, 2000, 2001, 2002, 2003 |
b491616a | 3 | Free Software Foundation, Inc. |
9d751335 | 4 | |
0e5136c6 | 5 | Full i860 support contributed by Jason Eckhardt <jle@cygnus.com>. |
252b5132 RH |
6 | |
7 | This file is part of BFD, the Binary File Descriptor library. | |
8 | ||
9 | This program is free software; you can redistribute it and/or modify | |
10 | it under the terms of the GNU General Public License as published by | |
11 | the Free Software Foundation; either version 2 of the License, or | |
12 | (at your option) any later version. | |
13 | ||
14 | This program is distributed in the hope that it will be useful, | |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU General Public License | |
20 | along with this program; if not, write to the Free Software | |
21 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
22 | ||
23 | #include "bfd.h" | |
24 | #include "sysdep.h" | |
25 | #include "libbfd.h" | |
26 | #include "elf-bfd.h" | |
0e5136c6 JE |
27 | #include "elf/i860.h" |
28 | ||
de24da47 | 29 | |
0e5136c6 JE |
30 | /* This howto table is preliminary. */ |
31 | static reloc_howto_type elf32_i860_howto_table [] = | |
32 | { | |
33 | /* This relocation does nothing. */ | |
34 | HOWTO (R_860_NONE, /* type */ | |
35 | 0, /* rightshift */ | |
36 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
37 | 32, /* bitsize */ | |
b34976b6 | 38 | FALSE, /* pc_relative */ |
0e5136c6 JE |
39 | 0, /* bitpos */ |
40 | complain_overflow_bitfield, /* complain_on_overflow */ | |
41 | bfd_elf_generic_reloc, /* special_function */ | |
42 | "R_860_NONE", /* name */ | |
b34976b6 | 43 | FALSE, /* partial_inplace */ |
0e5136c6 JE |
44 | 0, /* src_mask */ |
45 | 0, /* dst_mask */ | |
b34976b6 | 46 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
47 | |
48 | /* A 32-bit absolute relocation. */ | |
49 | HOWTO (R_860_32, /* type */ | |
50 | 0, /* rightshift */ | |
51 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
52 | 32, /* bitsize */ | |
b34976b6 | 53 | FALSE, /* pc_relative */ |
0e5136c6 JE |
54 | 0, /* bitpos */ |
55 | complain_overflow_bitfield, /* complain_on_overflow */ | |
56 | bfd_elf_generic_reloc, /* special_function */ | |
57 | "R_860_32", /* name */ | |
b34976b6 | 58 | FALSE, /* partial_inplace */ |
0e5136c6 JE |
59 | 0xffffffff, /* src_mask */ |
60 | 0xffffffff, /* dst_mask */ | |
b34976b6 | 61 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
62 | |
63 | HOWTO (R_860_COPY, /* type */ | |
64 | 0, /* rightshift */ | |
65 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
66 | 32, /* bitsize */ | |
b34976b6 | 67 | FALSE, /* pc_relative */ |
0e5136c6 JE |
68 | 0, /* bitpos */ |
69 | complain_overflow_bitfield, /* complain_on_overflow */ | |
70 | bfd_elf_generic_reloc, /* special_function */ | |
71 | "R_860_COPY", /* name */ | |
b34976b6 | 72 | TRUE, /* partial_inplace */ |
0e5136c6 JE |
73 | 0xffffffff, /* src_mask */ |
74 | 0xffffffff, /* dst_mask */ | |
b34976b6 | 75 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
76 | |
77 | HOWTO (R_860_GLOB_DAT, /* type */ | |
78 | 0, /* rightshift */ | |
79 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
80 | 32, /* bitsize */ | |
b34976b6 | 81 | FALSE, /* pc_relative */ |
0e5136c6 JE |
82 | 0, /* bitpos */ |
83 | complain_overflow_bitfield, /* complain_on_overflow */ | |
84 | bfd_elf_generic_reloc, /* special_function */ | |
85 | "R_860_GLOB_DAT", /* name */ | |
b34976b6 | 86 | TRUE, /* partial_inplace */ |
0e5136c6 JE |
87 | 0xffffffff, /* src_mask */ |
88 | 0xffffffff, /* dst_mask */ | |
b34976b6 | 89 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
90 | |
91 | HOWTO (R_860_JUMP_SLOT, /* type */ | |
92 | 0, /* rightshift */ | |
93 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
94 | 32, /* bitsize */ | |
b34976b6 | 95 | FALSE, /* pc_relative */ |
0e5136c6 JE |
96 | 0, /* bitpos */ |
97 | complain_overflow_bitfield, /* complain_on_overflow */ | |
98 | bfd_elf_generic_reloc, /* special_function */ | |
99 | "R_860_JUMP_SLOT", /* name */ | |
b34976b6 | 100 | TRUE, /* partial_inplace */ |
0e5136c6 JE |
101 | 0xffffffff, /* src_mask */ |
102 | 0xffffffff, /* dst_mask */ | |
b34976b6 | 103 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
104 | |
105 | HOWTO (R_860_RELATIVE, /* type */ | |
106 | 0, /* rightshift */ | |
107 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
108 | 32, /* bitsize */ | |
b34976b6 | 109 | FALSE, /* pc_relative */ |
0e5136c6 JE |
110 | 0, /* bitpos */ |
111 | complain_overflow_bitfield, /* complain_on_overflow */ | |
112 | bfd_elf_generic_reloc, /* special_function */ | |
113 | "R_860_RELATIVE", /* name */ | |
b34976b6 | 114 | TRUE, /* partial_inplace */ |
0e5136c6 JE |
115 | 0xffffffff, /* src_mask */ |
116 | 0xffffffff, /* dst_mask */ | |
b34976b6 | 117 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
118 | |
119 | /* A 26-bit PC-relative relocation. */ | |
120 | HOWTO (R_860_PC26, /* type */ | |
fdeafce7 | 121 | 2, /* rightshift */ |
0e5136c6 JE |
122 | 2, /* size (0 = byte, 1 = short, 2 = long) */ |
123 | 26, /* bitsize */ | |
b34976b6 | 124 | TRUE, /* pc_relative */ |
0e5136c6 JE |
125 | 0, /* bitpos */ |
126 | complain_overflow_bitfield, /* complain_on_overflow */ | |
127 | bfd_elf_generic_reloc, /* special_function */ | |
128 | "R_860_PC26", /* name */ | |
b34976b6 | 129 | FALSE, /* partial_inplace */ |
0e5136c6 JE |
130 | 0x3ffffff, /* src_mask */ |
131 | 0x3ffffff, /* dst_mask */ | |
b34976b6 | 132 | TRUE), /* pcrel_offset */ |
0e5136c6 JE |
133 | |
134 | HOWTO (R_860_PLT26, /* type */ | |
135 | 0, /* rightshift */ | |
136 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
137 | 26, /* bitsize */ | |
b34976b6 | 138 | TRUE, /* pc_relative */ |
0e5136c6 JE |
139 | 0, /* bitpos */ |
140 | complain_overflow_bitfield, /* complain_on_overflow */ | |
141 | bfd_elf_generic_reloc, /* special_function */ | |
142 | "R_860_PLT26", /* name */ | |
b34976b6 | 143 | TRUE, /* partial_inplace */ |
0e5136c6 JE |
144 | 0xffffffff, /* src_mask */ |
145 | 0xffffffff, /* dst_mask */ | |
b34976b6 | 146 | TRUE), /* pcrel_offset */ |
0e5136c6 JE |
147 | |
148 | /* A 16-bit PC-relative relocation. */ | |
149 | HOWTO (R_860_PC16, /* type */ | |
fdeafce7 | 150 | 2, /* rightshift */ |
0e5136c6 JE |
151 | 2, /* size (0 = byte, 1 = short, 2 = long) */ |
152 | 16, /* bitsize */ | |
b34976b6 | 153 | TRUE, /* pc_relative */ |
0e5136c6 JE |
154 | 0, /* bitpos */ |
155 | complain_overflow_bitfield, /* complain_on_overflow */ | |
156 | bfd_elf_generic_reloc, /* special_function */ | |
157 | "R_860_PC16", /* name */ | |
b34976b6 | 158 | FALSE, /* partial_inplace */ |
305d537e JE |
159 | 0x1f07ff, /* src_mask */ |
160 | 0x1f07ff, /* dst_mask */ | |
b34976b6 | 161 | TRUE), /* pcrel_offset */ |
0e5136c6 JE |
162 | |
163 | HOWTO (R_860_LOW0, /* type */ | |
164 | 0, /* rightshift */ | |
165 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
166 | 16, /* bitsize */ | |
b34976b6 | 167 | FALSE, /* pc_relative */ |
0e5136c6 JE |
168 | 0, /* bitpos */ |
169 | complain_overflow_dont, /* complain_on_overflow */ | |
170 | bfd_elf_generic_reloc, /* special_function */ | |
171 | "R_860_LOW0", /* name */ | |
b34976b6 | 172 | FALSE, /* partial_inplace */ |
0e5136c6 JE |
173 | 0xffff, /* src_mask */ |
174 | 0xffff, /* dst_mask */ | |
b34976b6 | 175 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
176 | |
177 | HOWTO (R_860_SPLIT0, /* type */ | |
178 | 0, /* rightshift */ | |
179 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
180 | 16, /* bitsize */ | |
b34976b6 | 181 | FALSE, /* pc_relative */ |
0e5136c6 JE |
182 | 0, /* bitpos */ |
183 | complain_overflow_dont, /* complain_on_overflow */ | |
184 | bfd_elf_generic_reloc, /* special_function */ | |
185 | "R_860_SPLIT0", /* name */ | |
b34976b6 | 186 | FALSE, /* partial_inplace */ |
0e5136c6 JE |
187 | 0x1f07ff, /* src_mask */ |
188 | 0x1f07ff, /* dst_mask */ | |
b34976b6 | 189 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
190 | |
191 | HOWTO (R_860_LOW1, /* type */ | |
192 | 0, /* rightshift */ | |
193 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
194 | 16, /* bitsize */ | |
b34976b6 | 195 | FALSE, /* pc_relative */ |
0e5136c6 JE |
196 | 0, /* bitpos */ |
197 | complain_overflow_dont, /* complain_on_overflow */ | |
198 | bfd_elf_generic_reloc, /* special_function */ | |
199 | "R_860_LOW1", /* name */ | |
b34976b6 | 200 | FALSE, /* partial_inplace */ |
0e5136c6 JE |
201 | 0xfffe, /* src_mask */ |
202 | 0xfffe, /* dst_mask */ | |
b34976b6 | 203 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
204 | |
205 | HOWTO (R_860_SPLIT1, /* type */ | |
206 | 0, /* rightshift */ | |
207 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
208 | 16, /* bitsize */ | |
b34976b6 | 209 | FALSE, /* pc_relative */ |
0e5136c6 JE |
210 | 0, /* bitpos */ |
211 | complain_overflow_dont, /* complain_on_overflow */ | |
212 | bfd_elf_generic_reloc, /* special_function */ | |
213 | "R_860_SPLIT1", /* name */ | |
b34976b6 | 214 | FALSE, /* partial_inplace */ |
305d537e JE |
215 | 0x1f07fe, /* src_mask */ |
216 | 0x1f07fe, /* dst_mask */ | |
b34976b6 | 217 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
218 | |
219 | HOWTO (R_860_LOW2, /* type */ | |
220 | 0, /* rightshift */ | |
221 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
222 | 16, /* bitsize */ | |
b34976b6 | 223 | FALSE, /* pc_relative */ |
0e5136c6 JE |
224 | 0, /* bitpos */ |
225 | complain_overflow_dont, /* complain_on_overflow */ | |
226 | bfd_elf_generic_reloc, /* special_function */ | |
227 | "R_860_LOW2", /* name */ | |
b34976b6 | 228 | FALSE, /* partial_inplace */ |
0e5136c6 JE |
229 | 0xfffc, /* src_mask */ |
230 | 0xfffc, /* dst_mask */ | |
b34976b6 | 231 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
232 | |
233 | HOWTO (R_860_SPLIT2, /* type */ | |
234 | 0, /* rightshift */ | |
235 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
236 | 16, /* bitsize */ | |
b34976b6 | 237 | FALSE, /* pc_relative */ |
0e5136c6 JE |
238 | 0, /* bitpos */ |
239 | complain_overflow_dont, /* complain_on_overflow */ | |
240 | bfd_elf_generic_reloc, /* special_function */ | |
241 | "R_860_SPLIT2", /* name */ | |
b34976b6 | 242 | FALSE, /* partial_inplace */ |
305d537e JE |
243 | 0x1f07fc, /* src_mask */ |
244 | 0x1f07fc, /* dst_mask */ | |
b34976b6 | 245 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
246 | |
247 | HOWTO (R_860_LOW3, /* type */ | |
248 | 0, /* rightshift */ | |
249 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
250 | 16, /* bitsize */ | |
b34976b6 | 251 | FALSE, /* pc_relative */ |
0e5136c6 JE |
252 | 0, /* bitpos */ |
253 | complain_overflow_dont, /* complain_on_overflow */ | |
254 | bfd_elf_generic_reloc, /* special_function */ | |
255 | "R_860_LOW3", /* name */ | |
b34976b6 | 256 | FALSE, /* partial_inplace */ |
0e5136c6 JE |
257 | 0xfff8, /* src_mask */ |
258 | 0xfff8, /* dst_mask */ | |
b34976b6 | 259 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
260 | |
261 | HOWTO (R_860_LOGOT0, /* type */ | |
262 | 0, /* rightshift */ | |
263 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
264 | 16, /* bitsize */ | |
b34976b6 | 265 | FALSE, /* pc_relative */ |
0e5136c6 JE |
266 | 0, /* bitpos */ |
267 | complain_overflow_dont, /* complain_on_overflow */ | |
268 | bfd_elf_generic_reloc, /* special_function */ | |
269 | "R_860_LOGOT0", /* name */ | |
b34976b6 | 270 | FALSE, /* partial_inplace */ |
0e5136c6 JE |
271 | 0, /* src_mask */ |
272 | 0xffff, /* dst_mask */ | |
b34976b6 | 273 | TRUE), /* pcrel_offset */ |
0e5136c6 JE |
274 | |
275 | HOWTO (R_860_SPGOT0, /* type */ | |
276 | 0, /* rightshift */ | |
277 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
278 | 16, /* bitsize */ | |
b34976b6 | 279 | FALSE, /* pc_relative */ |
0e5136c6 JE |
280 | 0, /* bitpos */ |
281 | complain_overflow_dont, /* complain_on_overflow */ | |
282 | bfd_elf_generic_reloc, /* special_function */ | |
283 | "R_860_SPGOT0", /* name */ | |
b34976b6 | 284 | FALSE, /* partial_inplace */ |
0e5136c6 JE |
285 | 0, /* src_mask */ |
286 | 0xffff, /* dst_mask */ | |
b34976b6 | 287 | TRUE), /* pcrel_offset */ |
0e5136c6 JE |
288 | |
289 | HOWTO (R_860_LOGOT1, /* type */ | |
290 | 0, /* rightshift */ | |
291 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
292 | 16, /* bitsize */ | |
b34976b6 | 293 | FALSE, /* pc_relative */ |
0e5136c6 JE |
294 | 0, /* bitpos */ |
295 | complain_overflow_dont, /* complain_on_overflow */ | |
296 | bfd_elf_generic_reloc, /* special_function */ | |
297 | "R_860_LOGOT1", /* name */ | |
b34976b6 | 298 | FALSE, /* partial_inplace */ |
0e5136c6 JE |
299 | 0, /* src_mask */ |
300 | 0xffff, /* dst_mask */ | |
b34976b6 | 301 | TRUE), /* pcrel_offset */ |
0e5136c6 JE |
302 | |
303 | HOWTO (R_860_SPGOT1, /* type */ | |
304 | 0, /* rightshift */ | |
305 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
306 | 16, /* bitsize */ | |
b34976b6 | 307 | FALSE, /* pc_relative */ |
0e5136c6 JE |
308 | 0, /* bitpos */ |
309 | complain_overflow_dont, /* complain_on_overflow */ | |
310 | bfd_elf_generic_reloc, /* special_function */ | |
311 | "R_860_SPGOT1", /* name */ | |
b34976b6 | 312 | FALSE, /* partial_inplace */ |
0e5136c6 JE |
313 | 0, /* src_mask */ |
314 | 0xffff, /* dst_mask */ | |
b34976b6 | 315 | TRUE), /* pcrel_offset */ |
0e5136c6 JE |
316 | |
317 | HOWTO (R_860_LOGOTOFF0, /* type */ | |
318 | 0, /* rightshift */ | |
319 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
320 | 32, /* bitsize */ | |
b34976b6 | 321 | FALSE, /* pc_relative */ |
0e5136c6 JE |
322 | 0, /* bitpos */ |
323 | complain_overflow_dont, /* complain_on_overflow */ | |
324 | bfd_elf_generic_reloc, /* special_function */ | |
325 | "R_860_LOGOTOFF0", /* name */ | |
b34976b6 | 326 | TRUE, /* partial_inplace */ |
0e5136c6 JE |
327 | 0xffffffff, /* src_mask */ |
328 | 0xffffffff, /* dst_mask */ | |
b34976b6 | 329 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
330 | |
331 | HOWTO (R_860_SPGOTOFF0, /* type */ | |
332 | 0, /* rightshift */ | |
333 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
334 | 32, /* bitsize */ | |
b34976b6 | 335 | FALSE, /* pc_relative */ |
0e5136c6 JE |
336 | 0, /* bitpos */ |
337 | complain_overflow_dont, /* complain_on_overflow */ | |
338 | bfd_elf_generic_reloc, /* special_function */ | |
339 | "R_860_SPGOTOFF0", /* name */ | |
b34976b6 | 340 | TRUE, /* partial_inplace */ |
0e5136c6 JE |
341 | 0xffffffff, /* src_mask */ |
342 | 0xffffffff, /* dst_mask */ | |
b34976b6 | 343 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
344 | |
345 | HOWTO (R_860_LOGOTOFF1, /* type */ | |
346 | 0, /* rightshift */ | |
347 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
348 | 32, /* bitsize */ | |
b34976b6 | 349 | FALSE, /* pc_relative */ |
0e5136c6 JE |
350 | 0, /* bitpos */ |
351 | complain_overflow_dont, /* complain_on_overflow */ | |
352 | bfd_elf_generic_reloc, /* special_function */ | |
353 | "R_860_LOGOTOFF1", /* name */ | |
b34976b6 | 354 | TRUE, /* partial_inplace */ |
0e5136c6 JE |
355 | 0xffffffff, /* src_mask */ |
356 | 0xffffffff, /* dst_mask */ | |
b34976b6 | 357 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
358 | |
359 | HOWTO (R_860_SPGOTOFF1, /* type */ | |
360 | 0, /* rightshift */ | |
361 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
362 | 32, /* bitsize */ | |
b34976b6 | 363 | FALSE, /* pc_relative */ |
0e5136c6 JE |
364 | 0, /* bitpos */ |
365 | complain_overflow_dont, /* complain_on_overflow */ | |
366 | bfd_elf_generic_reloc, /* special_function */ | |
367 | "R_860_SPGOTOFF1", /* name */ | |
b34976b6 | 368 | TRUE, /* partial_inplace */ |
0e5136c6 JE |
369 | 0xffffffff, /* src_mask */ |
370 | 0xffffffff, /* dst_mask */ | |
b34976b6 | 371 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
372 | |
373 | HOWTO (R_860_LOGOTOFF2, /* type */ | |
374 | 0, /* rightshift */ | |
375 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
376 | 32, /* bitsize */ | |
b34976b6 | 377 | FALSE, /* pc_relative */ |
0e5136c6 JE |
378 | 0, /* bitpos */ |
379 | complain_overflow_dont, /* complain_on_overflow */ | |
380 | bfd_elf_generic_reloc, /* special_function */ | |
381 | "R_860_LOGOTOFF2", /* name */ | |
b34976b6 | 382 | TRUE, /* partial_inplace */ |
0e5136c6 JE |
383 | 0xffffffff, /* src_mask */ |
384 | 0xffffffff, /* dst_mask */ | |
b34976b6 | 385 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
386 | |
387 | HOWTO (R_860_LOGOTOFF3, /* type */ | |
388 | 0, /* rightshift */ | |
389 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
390 | 32, /* bitsize */ | |
b34976b6 | 391 | FALSE, /* pc_relative */ |
0e5136c6 JE |
392 | 0, /* bitpos */ |
393 | complain_overflow_dont, /* complain_on_overflow */ | |
394 | bfd_elf_generic_reloc, /* special_function */ | |
395 | "R_860_LOGOTOFF3", /* name */ | |
b34976b6 | 396 | TRUE, /* partial_inplace */ |
0e5136c6 JE |
397 | 0xffffffff, /* src_mask */ |
398 | 0xffffffff, /* dst_mask */ | |
b34976b6 | 399 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
400 | |
401 | HOWTO (R_860_LOPC, /* type */ | |
402 | 0, /* rightshift */ | |
403 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
404 | 16, /* bitsize */ | |
b34976b6 | 405 | TRUE, /* pc_relative */ |
0e5136c6 JE |
406 | 0, /* bitpos */ |
407 | complain_overflow_bitfield, /* complain_on_overflow */ | |
408 | bfd_elf_generic_reloc, /* special_function */ | |
409 | "R_860_LOPC", /* name */ | |
b34976b6 | 410 | FALSE, /* partial_inplace */ |
0e5136c6 JE |
411 | 0xffff, /* src_mask */ |
412 | 0xffff, /* dst_mask */ | |
b34976b6 | 413 | TRUE), /* pcrel_offset */ |
0e5136c6 JE |
414 | |
415 | HOWTO (R_860_HIGHADJ, /* type */ | |
416 | 0, /* rightshift */ | |
417 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
418 | 16, /* bitsize */ | |
b34976b6 | 419 | FALSE, /* pc_relative */ |
0e5136c6 JE |
420 | 0, /* bitpos */ |
421 | complain_overflow_dont, /* complain_on_overflow */ | |
422 | bfd_elf_generic_reloc, /* special_function */ | |
423 | "R_860_HIGHADJ", /* name */ | |
b34976b6 | 424 | FALSE, /* partial_inplace */ |
0e5136c6 JE |
425 | 0xffff, /* src_mask */ |
426 | 0xffff, /* dst_mask */ | |
b34976b6 | 427 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
428 | |
429 | HOWTO (R_860_HAGOT, /* type */ | |
430 | 0, /* rightshift */ | |
431 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
432 | 16, /* bitsize */ | |
b34976b6 | 433 | FALSE, /* pc_relative */ |
0e5136c6 JE |
434 | 0, /* bitpos */ |
435 | complain_overflow_dont, /* complain_on_overflow */ | |
436 | bfd_elf_generic_reloc, /* special_function */ | |
437 | "R_860_HAGOT", /* name */ | |
b34976b6 | 438 | FALSE, /* partial_inplace */ |
0e5136c6 JE |
439 | 0, /* src_mask */ |
440 | 0xffff, /* dst_mask */ | |
b34976b6 | 441 | TRUE), /* pcrel_offset */ |
0e5136c6 JE |
442 | |
443 | HOWTO (R_860_HAGOTOFF, /* type */ | |
444 | 0, /* rightshift */ | |
445 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
446 | 32, /* bitsize */ | |
b34976b6 | 447 | FALSE, /* pc_relative */ |
0e5136c6 JE |
448 | 0, /* bitpos */ |
449 | complain_overflow_dont, /* complain_on_overflow */ | |
450 | bfd_elf_generic_reloc, /* special_function */ | |
451 | "R_860_HAGOTOFF", /* name */ | |
b34976b6 | 452 | TRUE, /* partial_inplace */ |
0e5136c6 JE |
453 | 0xffffffff, /* src_mask */ |
454 | 0xffffffff, /* dst_mask */ | |
b34976b6 | 455 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
456 | |
457 | HOWTO (R_860_HAPC, /* type */ | |
458 | 0, /* rightshift */ | |
459 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
460 | 16, /* bitsize */ | |
b34976b6 | 461 | TRUE, /* pc_relative */ |
0e5136c6 JE |
462 | 0, /* bitpos */ |
463 | complain_overflow_bitfield, /* complain_on_overflow */ | |
464 | bfd_elf_generic_reloc, /* special_function */ | |
465 | "R_860_HAPC", /* name */ | |
b34976b6 | 466 | FALSE, /* partial_inplace */ |
0e5136c6 JE |
467 | 0xffff, /* src_mask */ |
468 | 0xffff, /* dst_mask */ | |
b34976b6 | 469 | TRUE), /* pcrel_offset */ |
0e5136c6 JE |
470 | |
471 | HOWTO (R_860_HIGH, /* type */ | |
fdeafce7 | 472 | 16, /* rightshift */ |
0e5136c6 JE |
473 | 2, /* size (0 = byte, 1 = short, 2 = long) */ |
474 | 16, /* bitsize */ | |
b34976b6 | 475 | FALSE, /* pc_relative */ |
0e5136c6 JE |
476 | 0, /* bitpos */ |
477 | complain_overflow_dont, /* complain_on_overflow */ | |
478 | bfd_elf_generic_reloc, /* special_function */ | |
479 | "R_860_HIGH", /* name */ | |
b34976b6 | 480 | FALSE, /* partial_inplace */ |
0e5136c6 JE |
481 | 0xffff, /* src_mask */ |
482 | 0xffff, /* dst_mask */ | |
b34976b6 | 483 | FALSE), /* pcrel_offset */ |
0e5136c6 JE |
484 | |
485 | HOWTO (R_860_HIGOT, /* type */ | |
486 | 0, /* rightshift */ | |
487 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
488 | 16, /* bitsize */ | |
b34976b6 | 489 | FALSE, /* pc_relative */ |
0e5136c6 JE |
490 | 0, /* bitpos */ |
491 | complain_overflow_dont, /* complain_on_overflow */ | |
492 | bfd_elf_generic_reloc, /* special_function */ | |
493 | "R_860_HIGOT", /* name */ | |
b34976b6 | 494 | FALSE, /* partial_inplace */ |
0e5136c6 JE |
495 | 0, /* src_mask */ |
496 | 0xffff, /* dst_mask */ | |
b34976b6 | 497 | TRUE), /* pcrel_offset */ |
0e5136c6 JE |
498 | |
499 | HOWTO (R_860_HIGOTOFF, /* type */ | |
500 | 0, /* rightshift */ | |
501 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
502 | 32, /* bitsize */ | |
b34976b6 | 503 | FALSE, /* pc_relative */ |
0e5136c6 JE |
504 | 0, /* bitpos */ |
505 | complain_overflow_dont, /* complain_on_overflow */ | |
506 | bfd_elf_generic_reloc, /* special_function */ | |
507 | "R_860_HIGOTOFF", /* name */ | |
b34976b6 | 508 | TRUE, /* partial_inplace */ |
0e5136c6 JE |
509 | 0xffffffff, /* src_mask */ |
510 | 0xffffffff, /* dst_mask */ | |
b34976b6 | 511 | FALSE), /* pcrel_offset */ |
0e5136c6 | 512 | }; |
0e5136c6 JE |
513 | \f |
514 | static unsigned char elf_code_to_howto_index[R_860_max + 1]; | |
515 | ||
516 | static reloc_howto_type * | |
7734b6e9 | 517 | lookup_howto (unsigned int rtype) |
0e5136c6 JE |
518 | { |
519 | static int initialized = 0; | |
520 | int i; | |
521 | int howto_tbl_size = (int) (sizeof (elf32_i860_howto_table) | |
522 | / sizeof (elf32_i860_howto_table[0])); | |
523 | ||
524 | if (! initialized) | |
525 | { | |
526 | initialized = 1; | |
527 | memset (elf_code_to_howto_index, 0xff, | |
528 | sizeof (elf_code_to_howto_index)); | |
529 | for (i = 0; i < howto_tbl_size; i++) | |
530 | elf_code_to_howto_index[elf32_i860_howto_table[i].type] = i; | |
531 | } | |
532 | ||
533 | BFD_ASSERT (rtype <= R_860_max); | |
534 | i = elf_code_to_howto_index[rtype]; | |
535 | if (i >= howto_tbl_size) | |
536 | return 0; | |
537 | return elf32_i860_howto_table + i; | |
538 | } | |
539 | ||
0e5136c6 JE |
540 | /* Given a BFD reloc, return the matching HOWTO structure. */ |
541 | static reloc_howto_type * | |
7734b6e9 JE |
542 | elf32_i860_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, |
543 | bfd_reloc_code_real_type code) | |
0e5136c6 JE |
544 | { |
545 | unsigned int rtype; | |
546 | ||
547 | switch (code) | |
548 | { | |
549 | case BFD_RELOC_NONE: | |
550 | rtype = R_860_NONE; | |
551 | break; | |
552 | case BFD_RELOC_32: | |
553 | rtype = R_860_32; | |
554 | break; | |
555 | case BFD_RELOC_860_COPY: | |
556 | rtype = R_860_COPY; | |
557 | break; | |
558 | case BFD_RELOC_860_GLOB_DAT: | |
6609fa74 | 559 | rtype = R_860_GLOB_DAT; |
0e5136c6 JE |
560 | break; |
561 | case BFD_RELOC_860_JUMP_SLOT: | |
562 | rtype = R_860_JUMP_SLOT; | |
563 | break; | |
564 | case BFD_RELOC_860_RELATIVE: | |
565 | rtype = R_860_RELATIVE; | |
566 | break; | |
567 | case BFD_RELOC_860_PC26: | |
568 | rtype = R_860_PC26; | |
569 | break; | |
570 | case BFD_RELOC_860_PLT26: | |
571 | rtype = R_860_PLT26; | |
572 | break; | |
573 | case BFD_RELOC_860_PC16: | |
574 | rtype = R_860_PC16; | |
575 | break; | |
576 | case BFD_RELOC_860_LOW0: | |
577 | rtype = R_860_LOW0; | |
578 | break; | |
579 | case BFD_RELOC_860_SPLIT0: | |
580 | rtype = R_860_SPLIT0; | |
581 | break; | |
582 | case BFD_RELOC_860_LOW1: | |
583 | rtype = R_860_LOW1; | |
584 | break; | |
585 | case BFD_RELOC_860_SPLIT1: | |
586 | rtype = R_860_SPLIT1; | |
587 | break; | |
588 | case BFD_RELOC_860_LOW2: | |
589 | rtype = R_860_LOW2; | |
590 | break; | |
591 | case BFD_RELOC_860_SPLIT2: | |
592 | rtype = R_860_SPLIT2; | |
593 | break; | |
594 | case BFD_RELOC_860_LOW3: | |
595 | rtype = R_860_LOW3; | |
596 | break; | |
597 | case BFD_RELOC_860_LOGOT0: | |
598 | rtype = R_860_LOGOT0; | |
599 | break; | |
600 | case BFD_RELOC_860_SPGOT0: | |
601 | rtype = R_860_SPGOT0; | |
602 | break; | |
603 | case BFD_RELOC_860_LOGOT1: | |
604 | rtype = R_860_LOGOT1; | |
605 | break; | |
606 | case BFD_RELOC_860_SPGOT1: | |
607 | rtype = R_860_SPGOT1; | |
608 | break; | |
609 | case BFD_RELOC_860_LOGOTOFF0: | |
610 | rtype = R_860_LOGOTOFF0; | |
611 | break; | |
612 | case BFD_RELOC_860_SPGOTOFF0: | |
613 | rtype = R_860_SPGOTOFF0; | |
614 | break; | |
615 | case BFD_RELOC_860_LOGOTOFF1: | |
616 | rtype = R_860_LOGOTOFF1; | |
617 | break; | |
618 | case BFD_RELOC_860_SPGOTOFF1: | |
619 | rtype = R_860_SPGOTOFF1; | |
620 | break; | |
621 | case BFD_RELOC_860_LOGOTOFF2: | |
622 | rtype = R_860_LOGOTOFF2; | |
623 | break; | |
624 | case BFD_RELOC_860_LOGOTOFF3: | |
625 | rtype = R_860_LOGOTOFF3; | |
626 | break; | |
627 | case BFD_RELOC_860_LOPC: | |
628 | rtype = R_860_LOPC; | |
629 | break; | |
630 | case BFD_RELOC_860_HIGHADJ: | |
631 | rtype = R_860_HIGHADJ; | |
632 | break; | |
633 | case BFD_RELOC_860_HAGOT: | |
634 | rtype = R_860_HAGOT; | |
635 | break; | |
636 | case BFD_RELOC_860_HAGOTOFF: | |
637 | rtype = R_860_HAGOTOFF; | |
638 | break; | |
639 | case BFD_RELOC_860_HAPC: | |
640 | rtype = R_860_HAPC; | |
641 | break; | |
642 | case BFD_RELOC_860_HIGH: | |
643 | rtype = R_860_HIGH; | |
644 | break; | |
645 | case BFD_RELOC_860_HIGOT: | |
646 | rtype = R_860_HIGOT; | |
647 | break; | |
648 | case BFD_RELOC_860_HIGOTOFF: | |
649 | rtype = R_860_HIGOTOFF; | |
650 | break; | |
651 | default: | |
652 | rtype = 0; | |
653 | break; | |
654 | } | |
655 | return lookup_howto (rtype); | |
656 | } | |
657 | ||
0e5136c6 JE |
658 | /* Given a ELF reloc, return the matching HOWTO structure. */ |
659 | static void | |
7734b6e9 JE |
660 | elf32_i860_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED, |
661 | arelent *bfd_reloc, | |
662 | Elf_Internal_Rela *elf_reloc) | |
0e5136c6 | 663 | { |
dc810e39 AM |
664 | bfd_reloc->howto |
665 | = lookup_howto ((unsigned) ELF32_R_TYPE (elf_reloc->r_info)); | |
0e5136c6 | 666 | } |
fdeafce7 JE |
667 | \f |
668 | /* Specialized relocation handler for R_860_SPLITn. These relocations | |
669 | involves a 16-bit field that is split into two contiguous parts. */ | |
670 | static bfd_reloc_status_type | |
7734b6e9 JE |
671 | elf32_i860_relocate_splitn (bfd *input_bfd, |
672 | Elf_Internal_Rela *rello, | |
673 | bfd_byte *contents, | |
674 | bfd_vma value) | |
fdeafce7 | 675 | { |
ded0649c | 676 | bfd_vma insn; |
fdeafce7 | 677 | reloc_howto_type *howto; |
dc810e39 | 678 | howto = lookup_howto ((unsigned) ELF32_R_TYPE (rello->r_info)); |
fdeafce7 JE |
679 | insn = bfd_get_32 (input_bfd, contents + rello->r_offset); |
680 | ||
fdeafce7 | 681 | /* Relocate. */ |
ded0649c | 682 | value += rello->r_addend; |
fdeafce7 | 683 | |
ded0649c | 684 | /* Separate the fields and insert. */ |
a48c6a54 | 685 | value = (((value & 0xf800) << 5) | (value & 0x7ff)) & howto->dst_mask; |
fdeafce7 JE |
686 | insn = (insn & ~howto->dst_mask) | value; |
687 | ||
688 | bfd_put_32 (input_bfd, insn, contents + rello->r_offset); | |
689 | return bfd_reloc_ok; | |
690 | } | |
691 | ||
fdeafce7 JE |
692 | /* Specialized relocation handler for R_860_PC16. This relocation |
693 | involves a 16-bit, PC-relative field that is split into two contiguous | |
694 | parts. */ | |
695 | static bfd_reloc_status_type | |
7734b6e9 JE |
696 | elf32_i860_relocate_pc16 (bfd *input_bfd, |
697 | asection *input_section, | |
698 | Elf_Internal_Rela *rello, | |
699 | bfd_byte *contents, | |
700 | bfd_vma value) | |
fdeafce7 | 701 | { |
ded0649c | 702 | bfd_vma insn; |
d670a150 | 703 | reloc_howto_type *howto; |
dc810e39 | 704 | howto = lookup_howto ((unsigned) ELF32_R_TYPE (rello->r_info)); |
d670a150 JE |
705 | insn = bfd_get_32 (input_bfd, contents + rello->r_offset); |
706 | ||
707 | /* Adjust for PC-relative relocation. */ | |
708 | value -= (input_section->output_section->vma | |
709 | + input_section->output_offset); | |
710 | value -= rello->r_offset; | |
711 | ||
d670a150 | 712 | /* Relocate. */ |
ded0649c | 713 | value += rello->r_addend; |
d670a150 | 714 | |
ded0649c | 715 | /* Separate the fields and insert. */ |
a48c6a54 | 716 | value = (((value & 0xf800) << 5) | (value & 0x7ff)) & howto->dst_mask; |
d670a150 JE |
717 | insn = (insn & ~howto->dst_mask) | value; |
718 | ||
719 | bfd_put_32 (input_bfd, insn, contents + rello->r_offset); | |
720 | return bfd_reloc_ok; | |
721 | ||
fdeafce7 | 722 | } |
fdeafce7 | 723 | |
c1e8b710 JE |
724 | /* Specialized relocation handler for R_860_PC26. This relocation |
725 | involves a 26-bit, PC-relative field which must be adjusted by 4. */ | |
726 | static bfd_reloc_status_type | |
7734b6e9 JE |
727 | elf32_i860_relocate_pc26 (bfd *input_bfd, |
728 | asection *input_section, | |
729 | Elf_Internal_Rela *rello, | |
730 | bfd_byte *contents, | |
731 | bfd_vma value) | |
c1e8b710 JE |
732 | { |
733 | bfd_vma insn; | |
734 | reloc_howto_type *howto; | |
dc810e39 | 735 | howto = lookup_howto ((unsigned) ELF32_R_TYPE (rello->r_info)); |
c1e8b710 JE |
736 | insn = bfd_get_32 (input_bfd, contents + rello->r_offset); |
737 | ||
738 | /* Adjust for PC-relative relocation. */ | |
739 | value -= (input_section->output_section->vma | |
740 | + input_section->output_offset); | |
741 | value -= rello->r_offset; | |
742 | ||
743 | /* Relocate. */ | |
744 | value += rello->r_addend; | |
745 | ||
746 | /* Adjust value by 4 and insert the field. */ | |
6609fa74 | 747 | value = ((value - 4) >> howto->rightshift) & howto->dst_mask; |
c1e8b710 JE |
748 | insn = (insn & ~howto->dst_mask) | value; |
749 | ||
750 | bfd_put_32 (input_bfd, insn, contents + rello->r_offset); | |
751 | return bfd_reloc_ok; | |
752 | ||
753 | } | |
754 | ||
fdeafce7 JE |
755 | /* Specialized relocation handler for R_860_HIGHADJ. */ |
756 | static bfd_reloc_status_type | |
7734b6e9 JE |
757 | elf32_i860_relocate_highadj (bfd *input_bfd, |
758 | Elf_Internal_Rela *rel, | |
759 | bfd_byte *contents, | |
760 | bfd_vma value) | |
fdeafce7 JE |
761 | { |
762 | bfd_vma insn; | |
763 | ||
764 | insn = bfd_get_32 (input_bfd, contents + rel->r_offset); | |
765 | ||
fdeafce7 | 766 | value += rel->r_addend; |
b645cb17 | 767 | value += 0x8000; |
fdeafce7 | 768 | value = ((value >> 16) & 0xffff); |
fdeafce7 JE |
769 | |
770 | insn = (insn & 0xffff0000) | value; | |
771 | ||
772 | bfd_put_32 (input_bfd, insn, contents + rel->r_offset); | |
773 | return bfd_reloc_ok; | |
774 | } | |
775 | ||
fdeafce7 JE |
776 | /* Perform a single relocation. By default we use the standard BFD |
777 | routines. However, we handle some specially. */ | |
778 | static bfd_reloc_status_type | |
7734b6e9 JE |
779 | i860_final_link_relocate (reloc_howto_type *howto, |
780 | bfd *input_bfd, | |
781 | asection *input_section, | |
782 | bfd_byte *contents, | |
783 | Elf_Internal_Rela *rel, | |
784 | bfd_vma relocation) | |
fdeafce7 JE |
785 | { |
786 | return _bfd_final_link_relocate (howto, input_bfd, input_section, | |
787 | contents, rel->r_offset, relocation, | |
788 | rel->r_addend); | |
789 | } | |
790 | ||
fdeafce7 | 791 | /* Relocate an i860 ELF section. |
252b5132 | 792 | |
fdeafce7 | 793 | This is boiler-plate code copied from fr30. |
fdeafce7 JE |
794 | |
795 | The RELOCATE_SECTION function is called by the new ELF backend linker | |
796 | to handle the relocations for a section. | |
797 | ||
798 | The relocs are always passed as Rela structures; if the section | |
799 | actually uses Rel structures, the r_addend field will always be | |
800 | zero. | |
801 | ||
802 | This function is responsible for adjusting the section contents as | |
1049f94e | 803 | necessary, and (if using Rela relocs and generating a relocatable |
fdeafce7 JE |
804 | output file) adjusting the reloc addend as necessary. |
805 | ||
806 | This function does not have to worry about setting the reloc | |
807 | address or the reloc symbol index. | |
808 | ||
809 | LOCAL_SYMS is a pointer to the swapped in local symbols. | |
810 | ||
811 | LOCAL_SECTIONS is an array giving the section in the input file | |
812 | corresponding to the st_shndx field of each local symbol. | |
813 | ||
814 | The global hash table entry for the global symbols can be found | |
815 | via elf_sym_hashes (input_bfd). | |
816 | ||
1049f94e | 817 | When generating relocatable output, this function must handle |
fdeafce7 JE |
818 | STB_LOCAL/STT_SECTION symbols specially. The output symbol is |
819 | going to be the section symbol corresponding to the output | |
820 | section, which means that the addend must be adjusted | |
821 | accordingly. */ | |
b34976b6 | 822 | static bfd_boolean |
7734b6e9 JE |
823 | elf32_i860_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, |
824 | struct bfd_link_info *info, | |
825 | bfd *input_bfd, | |
826 | asection *input_section, | |
827 | bfd_byte *contents, | |
828 | Elf_Internal_Rela *relocs, | |
829 | Elf_Internal_Sym *local_syms, | |
830 | asection **local_sections) | |
fdeafce7 | 831 | { |
b34976b6 AM |
832 | Elf_Internal_Shdr *symtab_hdr; |
833 | struct elf_link_hash_entry **sym_hashes; | |
834 | Elf_Internal_Rela *rel; | |
835 | Elf_Internal_Rela *relend; | |
fdeafce7 | 836 | |
1049f94e | 837 | if (info->relocatable) |
b34976b6 | 838 | return TRUE; |
b491616a | 839 | |
fdeafce7 JE |
840 | symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; |
841 | sym_hashes = elf_sym_hashes (input_bfd); | |
842 | relend = relocs + input_section->reloc_count; | |
843 | ||
844 | for (rel = relocs; rel < relend; rel ++) | |
845 | { | |
846 | reloc_howto_type * howto; | |
847 | unsigned long r_symndx; | |
848 | Elf_Internal_Sym * sym; | |
849 | asection * sec; | |
850 | struct elf_link_hash_entry * h; | |
851 | bfd_vma relocation; | |
852 | bfd_reloc_status_type r; | |
853 | const char * name = NULL; | |
854 | int r_type; | |
6609fa74 | 855 | |
fdeafce7 | 856 | r_type = ELF32_R_TYPE (rel->r_info); |
6609fa74 | 857 | |
fdeafce7 JE |
858 | #if 0 |
859 | if ( r_type == R_860_GNU_VTINHERIT | |
860 | || r_type == R_860_GNU_VTENTRY) | |
861 | continue; | |
862 | #endif | |
6609fa74 | 863 | |
fdeafce7 JE |
864 | r_symndx = ELF32_R_SYM (rel->r_info); |
865 | ||
dc810e39 AM |
866 | howto = lookup_howto ((unsigned) ELF32_R_TYPE (rel->r_info)); |
867 | h = NULL; | |
868 | sym = NULL; | |
869 | sec = NULL; | |
6609fa74 | 870 | |
fdeafce7 JE |
871 | if (r_symndx < symtab_hdr->sh_info) |
872 | { | |
873 | sym = local_syms + r_symndx; | |
874 | sec = local_sections [r_symndx]; | |
f8df10f4 | 875 | relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); |
6609fa74 | 876 | |
fdeafce7 JE |
877 | name = bfd_elf_string_from_elf_section |
878 | (input_bfd, symtab_hdr->sh_link, sym->st_name); | |
879 | name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; | |
880 | } | |
881 | else | |
882 | { | |
883 | h = sym_hashes [r_symndx - symtab_hdr->sh_info]; | |
6609fa74 | 884 | |
fdeafce7 JE |
885 | while (h->root.type == bfd_link_hash_indirect |
886 | || h->root.type == bfd_link_hash_warning) | |
887 | h = (struct elf_link_hash_entry *) h->root.u.i.link; | |
888 | ||
889 | name = h->root.root.string; | |
6609fa74 | 890 | |
fdeafce7 JE |
891 | if (h->root.type == bfd_link_hash_defined |
892 | || h->root.type == bfd_link_hash_defweak) | |
893 | { | |
894 | sec = h->root.u.def.section; | |
895 | relocation = (h->root.u.def.value | |
896 | + sec->output_section->vma | |
897 | + sec->output_offset); | |
898 | } | |
899 | else if (h->root.type == bfd_link_hash_undefweak) | |
900 | { | |
901 | relocation = 0; | |
902 | } | |
903 | else | |
904 | { | |
905 | if (! ((*info->callbacks->undefined_symbol) | |
906 | (info, h->root.root.string, input_bfd, | |
b34976b6 AM |
907 | input_section, rel->r_offset, TRUE))) |
908 | return FALSE; | |
fdeafce7 JE |
909 | relocation = 0; |
910 | } | |
911 | } | |
6609fa74 | 912 | |
fdeafce7 JE |
913 | switch (r_type) |
914 | { | |
915 | default: | |
916 | r = i860_final_link_relocate (howto, input_bfd, input_section, | |
917 | contents, rel, relocation); | |
918 | break; | |
919 | ||
920 | case R_860_HIGHADJ: | |
921 | r = elf32_i860_relocate_highadj (input_bfd, rel, contents, | |
922 | relocation); | |
923 | break; | |
924 | ||
fdeafce7 | 925 | case R_860_PC16: |
d670a150 JE |
926 | r = elf32_i860_relocate_pc16 (input_bfd, input_section, rel, |
927 | contents, relocation); | |
fdeafce7 | 928 | break; |
fdeafce7 | 929 | |
c1e8b710 JE |
930 | case R_860_PC26: |
931 | r = elf32_i860_relocate_pc26 (input_bfd, input_section, rel, | |
932 | contents, relocation); | |
933 | break; | |
934 | ||
fdeafce7 JE |
935 | case R_860_SPLIT0: |
936 | case R_860_SPLIT1: | |
937 | case R_860_SPLIT2: | |
938 | r = elf32_i860_relocate_splitn (input_bfd, rel, contents, | |
939 | relocation); | |
940 | break; | |
941 | ||
942 | /* We do not yet handle GOT/PLT/Dynamic relocations. */ | |
943 | case R_860_COPY: | |
944 | case R_860_GLOB_DAT: | |
945 | case R_860_JUMP_SLOT: | |
946 | case R_860_RELATIVE: | |
947 | case R_860_PLT26: | |
948 | case R_860_LOGOT0: | |
949 | case R_860_SPGOT0: | |
950 | case R_860_LOGOT1: | |
951 | case R_860_SPGOT1: | |
952 | case R_860_LOGOTOFF0: | |
953 | case R_860_SPGOTOFF0: | |
954 | case R_860_LOGOTOFF1: | |
955 | case R_860_SPGOTOFF1: | |
956 | case R_860_LOGOTOFF2: | |
957 | case R_860_LOGOTOFF3: | |
958 | case R_860_LOPC: | |
959 | case R_860_HAGOT: | |
960 | case R_860_HAGOTOFF: | |
961 | case R_860_HAPC: | |
962 | case R_860_HIGOT: | |
963 | case R_860_HIGOTOFF: | |
964 | r = bfd_reloc_notsupported; | |
965 | break; | |
6609fa74 | 966 | } |
fdeafce7 JE |
967 | |
968 | if (r != bfd_reloc_ok) | |
969 | { | |
970 | const char * msg = (const char *) NULL; | |
971 | ||
972 | switch (r) | |
973 | { | |
974 | case bfd_reloc_overflow: | |
975 | r = info->callbacks->reloc_overflow | |
976 | (info, name, howto->name, (bfd_vma) 0, | |
977 | input_bfd, input_section, rel->r_offset); | |
978 | break; | |
6609fa74 | 979 | |
fdeafce7 JE |
980 | case bfd_reloc_undefined: |
981 | r = info->callbacks->undefined_symbol | |
b34976b6 | 982 | (info, name, input_bfd, input_section, rel->r_offset, TRUE); |
fdeafce7 | 983 | break; |
6609fa74 | 984 | |
fdeafce7 JE |
985 | case bfd_reloc_outofrange: |
986 | msg = _("internal error: out of range error"); | |
987 | break; | |
988 | ||
989 | case bfd_reloc_notsupported: | |
990 | msg = _("internal error: unsupported relocation error"); | |
991 | break; | |
992 | ||
993 | case bfd_reloc_dangerous: | |
994 | msg = _("internal error: dangerous relocation"); | |
995 | break; | |
996 | ||
997 | default: | |
998 | msg = _("internal error: unknown error"); | |
999 | break; | |
1000 | } | |
1001 | ||
1002 | if (msg) | |
1003 | r = info->callbacks->warning | |
1004 | (info, msg, name, input_bfd, input_section, rel->r_offset); | |
1005 | ||
1006 | if (! r) | |
b34976b6 | 1007 | return FALSE; |
fdeafce7 JE |
1008 | } |
1009 | } | |
1010 | ||
b34976b6 | 1011 | return TRUE; |
fdeafce7 JE |
1012 | } |
1013 | ||
de24da47 JE |
1014 | /* Return whether a symbol name implies a local label. SVR4/860 compilers |
1015 | generate labels of the form ".ep.function_name" to denote the end of a | |
1016 | function prolog. These should be local. | |
1017 | ??? Do any other SVR4 compilers have this convention? If so, this should | |
1018 | be added to the generic routine. */ | |
b34976b6 | 1019 | static bfd_boolean |
7734b6e9 | 1020 | elf32_i860_is_local_label_name (bfd *abfd, const char *name) |
de24da47 JE |
1021 | { |
1022 | if (name[0] == '.' && name[1] == 'e' && name[2] == 'p' && name[3] == '.') | |
b34976b6 | 1023 | return TRUE; |
de24da47 JE |
1024 | |
1025 | return _bfd_elf_is_local_label_name (abfd, name); | |
1026 | } | |
fdeafce7 | 1027 | \f |
9d751335 JE |
1028 | #define TARGET_BIG_SYM bfd_elf32_i860_vec |
1029 | #define TARGET_BIG_NAME "elf32-i860" | |
1030 | #define TARGET_LITTLE_SYM bfd_elf32_i860_little_vec | |
1031 | #define TARGET_LITTLE_NAME "elf32-i860-little" | |
0e5136c6 JE |
1032 | #define ELF_ARCH bfd_arch_i860 |
1033 | #define ELF_MACHINE_CODE EM_860 | |
1034 | #define ELF_MAXPAGESIZE 4096 | |
1035 | ||
b491616a | 1036 | #define elf_backend_rela_normal 1 |
fdeafce7 | 1037 | #define elf_info_to_howto_rel NULL |
0e5136c6 | 1038 | #define elf_info_to_howto elf32_i860_info_to_howto_rela |
fdeafce7 | 1039 | #define elf_backend_relocate_section elf32_i860_relocate_section |
0e5136c6 | 1040 | #define bfd_elf32_bfd_reloc_type_lookup elf32_i860_reloc_type_lookup |
de24da47 | 1041 | #define bfd_elf32_bfd_is_local_label_name elf32_i860_is_local_label_name |
252b5132 RH |
1042 | |
1043 | #include "elf32-target.h" |