]>
Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* D10V-specific support for 32-bit ELF |
1049f94e AM |
2 | Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003 |
3 | Free Software Foundation, Inc. | |
252b5132 RH |
4 | Contributed by Martin Hunt ([email protected]). |
5 | ||
6 | This file is part of BFD, the Binary File Descriptor library. | |
7 | ||
8 | This program is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 2 of the License, or | |
11 | (at your option) any later version. | |
12 | ||
13 | This program is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with this program; if not, write to the Free Software | |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
21 | ||
22 | #include "bfd.h" | |
23 | #include "sysdep.h" | |
24 | #include "libbfd.h" | |
25 | #include "elf-bfd.h" | |
1b452ec6 | 26 | #include "elf/d10v.h" |
252b5132 RH |
27 | |
28 | static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup | |
29 | PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); | |
30 | static void d10v_info_to_howto_rel | |
947216bf | 31 | PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); |
917583ad | 32 | static asection * elf32_d10v_gc_mark_hook |
1e2f5b6e | 33 | PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, |
917583ad | 34 | struct elf_link_hash_entry *, Elf_Internal_Sym *)); |
b34976b6 | 35 | static bfd_boolean elf32_d10v_gc_sweep_hook |
917583ad NC |
36 | PARAMS ((bfd *, struct bfd_link_info *, asection *, |
37 | const Elf_Internal_Rela *)); | |
b34976b6 | 38 | static bfd_boolean elf32_d10v_check_relocs |
917583ad NC |
39 | PARAMS ((bfd *, struct bfd_link_info *, asection *, |
40 | const Elf_Internal_Rela *)); | |
b34976b6 | 41 | static bfd_boolean elf32_d10v_relocate_section |
917583ad NC |
42 | PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, |
43 | bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, | |
44 | asection **)); | |
45 | ||
46 | /* Use REL instead of RELA to save space. */ | |
acf8aed4 | 47 | #define USE_REL 1 |
252b5132 | 48 | |
252b5132 | 49 | static reloc_howto_type elf_d10v_howto_table[] = |
917583ad NC |
50 | { |
51 | /* This reloc does nothing. */ | |
52 | HOWTO (R_D10V_NONE, /* type */ | |
53 | 0, /* rightshift */ | |
54 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
55 | 32, /* bitsize */ | |
b34976b6 | 56 | FALSE, /* pc_relative */ |
917583ad | 57 | 0, /* bitpos */ |
2888ec15 AO |
58 | complain_overflow_dont, /* complain_on_overflow */ |
59 | bfd_elf_generic_reloc, /* special_function */ | |
60 | "R_D10V_NONE", /* name */ | |
b34976b6 | 61 | FALSE, /* partial_inplace */ |
917583ad NC |
62 | 0, /* src_mask */ |
63 | 0, /* dst_mask */ | |
b34976b6 | 64 | FALSE), /* pcrel_offset */ |
917583ad NC |
65 | |
66 | /* An PC Relative 10-bit relocation, shifted by 2 */ | |
67 | /* right container */ | |
68 | HOWTO (R_D10V_10_PCREL_R, /* type */ | |
69 | 2, /* rightshift */ | |
70 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
57fb03ac | 71 | 7, /* bitsize */ |
b34976b6 | 72 | TRUE, /* pc_relative */ |
917583ad | 73 | 0, /* bitpos */ |
57fb03ac | 74 | complain_overflow_bitfield, /* complain_on_overflow */ |
917583ad NC |
75 | bfd_elf_generic_reloc, /* special_function */ |
76 | "R_D10V_10_PCREL_R", /* name */ | |
b34976b6 | 77 | FALSE, /* partial_inplace */ |
2888ec15 | 78 | 0xff, /* src_mask */ |
917583ad | 79 | 0xff, /* dst_mask */ |
b34976b6 | 80 | TRUE), /* pcrel_offset */ |
917583ad NC |
81 | |
82 | /* An PC Relative 10-bit relocation, shifted by 2 */ | |
83 | /* left container */ | |
84 | HOWTO (R_D10V_10_PCREL_L, /* type */ | |
85 | 2, /* rightshift */ | |
86 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
57fb03ac | 87 | 7, /* bitsize */ |
b34976b6 | 88 | TRUE, /* pc_relative */ |
917583ad | 89 | 15, /* bitpos */ |
57fb03ac | 90 | complain_overflow_bitfield, /* complain_on_overflow */ |
917583ad NC |
91 | bfd_elf_generic_reloc, /* special_function */ |
92 | "R_D10V_10_PCREL_L", /* name */ | |
b34976b6 | 93 | FALSE, /* partial_inplace */ |
2888ec15 AO |
94 | 0x07f8000, /* src_mask */ |
95 | 0x07f8000, /* dst_mask */ | |
b34976b6 | 96 | TRUE), /* pcrel_offset */ |
917583ad NC |
97 | |
98 | /* A 16 bit absolute relocation */ | |
99 | HOWTO (R_D10V_16, /* type */ | |
100 | 0, /* rightshift */ | |
101 | 1, /* size (0 = byte, 1 = short, 2 = long) */ | |
102 | 16, /* bitsize */ | |
b34976b6 | 103 | FALSE, /* pc_relative */ |
917583ad NC |
104 | 0, /* bitpos */ |
105 | complain_overflow_dont, /* complain_on_overflow */ | |
2888ec15 | 106 | bfd_elf_generic_reloc, /* special_function */ |
917583ad | 107 | "R_D10V_16", /* name */ |
b34976b6 | 108 | FALSE, /* partial_inplace */ |
917583ad NC |
109 | 0xffff, /* src_mask */ |
110 | 0xffff, /* dst_mask */ | |
b34976b6 | 111 | FALSE), /* pcrel_offset */ |
917583ad NC |
112 | |
113 | /* An 18 bit absolute relocation, right shifted 2 */ | |
114 | HOWTO (R_D10V_18, /* type */ | |
115 | 2, /* rightshift */ | |
116 | 1, /* size (0 = byte, 1 = short, 2 = long) */ | |
2888ec15 | 117 | 16, /* bitsize */ |
b34976b6 | 118 | FALSE, /* pc_relative */ |
917583ad NC |
119 | 0, /* bitpos */ |
120 | complain_overflow_dont, /* complain_on_overflow */ | |
2888ec15 | 121 | bfd_elf_generic_reloc, /* special_function */ |
917583ad | 122 | "R_D10V_18", /* name */ |
b34976b6 | 123 | FALSE, /* partial_inplace */ |
917583ad NC |
124 | 0xffff, /* src_mask */ |
125 | 0xffff, /* dst_mask */ | |
b34976b6 | 126 | FALSE), /* pcrel_offset */ |
917583ad NC |
127 | |
128 | /* A relative 18 bit relocation, right shifted by 2 */ | |
129 | HOWTO (R_D10V_18_PCREL, /* type */ | |
130 | 2, /* rightshift */ | |
131 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
57fb03ac | 132 | 15, /* bitsize */ |
b34976b6 | 133 | TRUE, /* pc_relative */ |
917583ad | 134 | 0, /* bitpos */ |
57fb03ac | 135 | complain_overflow_bitfield, /* complain_on_overflow */ |
2888ec15 | 136 | bfd_elf_generic_reloc, /* special_function */ |
917583ad | 137 | "R_D10V_18_PCREL", /* name */ |
b34976b6 | 138 | FALSE, /* partial_inplace */ |
917583ad NC |
139 | 0xffff, /* src_mask */ |
140 | 0xffff, /* dst_mask */ | |
b34976b6 | 141 | TRUE), /* pcrel_offset */ |
917583ad NC |
142 | |
143 | /* A 32 bit absolute relocation */ | |
144 | HOWTO (R_D10V_32, /* type */ | |
145 | 0, /* rightshift */ | |
146 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
147 | 32, /* bitsize */ | |
b34976b6 | 148 | FALSE, /* pc_relative */ |
917583ad | 149 | 0, /* bitpos */ |
2888ec15 AO |
150 | complain_overflow_dont, /* complain_on_overflow */ |
151 | bfd_elf_generic_reloc, /* special_function */ | |
917583ad | 152 | "R_D10V_32", /* name */ |
b34976b6 | 153 | FALSE, /* partial_inplace */ |
917583ad NC |
154 | 0xffffffff, /* src_mask */ |
155 | 0xffffffff, /* dst_mask */ | |
b34976b6 | 156 | FALSE), /* pcrel_offset */ |
917583ad NC |
157 | |
158 | /* GNU extension to record C++ vtable hierarchy */ | |
159 | HOWTO (R_D10V_GNU_VTINHERIT, /* type */ | |
160 | 0, /* rightshift */ | |
161 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
162 | 0, /* bitsize */ | |
b34976b6 | 163 | FALSE, /* pc_relative */ |
917583ad NC |
164 | 0, /* bitpos */ |
165 | complain_overflow_dont, /* complain_on_overflow */ | |
166 | NULL, /* special_function */ | |
167 | "R_D10V_GNU_VTINHERIT", /* name */ | |
b34976b6 | 168 | FALSE, /* partial_inplace */ |
917583ad NC |
169 | 0, /* src_mask */ |
170 | 0, /* dst_mask */ | |
b34976b6 | 171 | FALSE), /* pcrel_offset */ |
917583ad NC |
172 | |
173 | /* GNU extension to record C++ vtable member usage */ | |
174 | HOWTO (R_D10V_GNU_VTENTRY, /* type */ | |
175 | 0, /* rightshift */ | |
176 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
177 | 0, /* bitsize */ | |
b34976b6 | 178 | FALSE, /* pc_relative */ |
917583ad NC |
179 | 0, /* bitpos */ |
180 | complain_overflow_dont, /* complain_on_overflow */ | |
181 | _bfd_elf_rel_vtable_reloc_fn, /* special_function */ | |
182 | "R_D10V_GNU_VTENTRY", /* name */ | |
b34976b6 | 183 | FALSE, /* partial_inplace */ |
917583ad NC |
184 | 0, /* src_mask */ |
185 | 0, /* dst_mask */ | |
b34976b6 | 186 | FALSE), /* pcrel_offset */ |
917583ad | 187 | }; |
252b5132 RH |
188 | |
189 | /* Map BFD reloc types to D10V ELF reloc types. */ | |
190 | ||
191 | struct d10v_reloc_map | |
917583ad NC |
192 | { |
193 | bfd_reloc_code_real_type bfd_reloc_val; | |
194 | unsigned char elf_reloc_val; | |
195 | }; | |
196 | ||
197 | static const struct d10v_reloc_map d10v_reloc_map[] = | |
198 | { | |
199 | { BFD_RELOC_NONE, R_D10V_NONE, }, | |
200 | { BFD_RELOC_D10V_10_PCREL_R, R_D10V_10_PCREL_R }, | |
201 | { BFD_RELOC_D10V_10_PCREL_L, R_D10V_10_PCREL_L }, | |
202 | { BFD_RELOC_16, R_D10V_16 }, | |
203 | { BFD_RELOC_D10V_18, R_D10V_18 }, | |
204 | { BFD_RELOC_D10V_18_PCREL, R_D10V_18_PCREL }, | |
205 | { BFD_RELOC_32, R_D10V_32 }, | |
206 | { BFD_RELOC_VTABLE_INHERIT, R_D10V_GNU_VTINHERIT }, | |
207 | { BFD_RELOC_VTABLE_ENTRY, R_D10V_GNU_VTENTRY }, | |
208 | }; | |
252b5132 RH |
209 | |
210 | static reloc_howto_type * | |
211 | bfd_elf32_bfd_reloc_type_lookup (abfd, code) | |
5f771d47 | 212 | bfd *abfd ATTRIBUTE_UNUSED; |
252b5132 RH |
213 | bfd_reloc_code_real_type code; |
214 | { | |
215 | unsigned int i; | |
216 | ||
217 | for (i = 0; | |
218 | i < sizeof (d10v_reloc_map) / sizeof (struct d10v_reloc_map); | |
219 | i++) | |
220 | { | |
221 | if (d10v_reloc_map[i].bfd_reloc_val == code) | |
222 | return &elf_d10v_howto_table[d10v_reloc_map[i].elf_reloc_val]; | |
223 | } | |
224 | ||
225 | return NULL; | |
226 | } | |
227 | ||
228 | /* Set the howto pointer for an D10V ELF reloc. */ | |
229 | ||
230 | static void | |
231 | d10v_info_to_howto_rel (abfd, cache_ptr, dst) | |
5f771d47 | 232 | bfd *abfd ATTRIBUTE_UNUSED; |
252b5132 | 233 | arelent *cache_ptr; |
947216bf | 234 | Elf_Internal_Rela *dst; |
252b5132 RH |
235 | { |
236 | unsigned int r_type; | |
237 | ||
238 | r_type = ELF32_R_TYPE (dst->r_info); | |
239 | BFD_ASSERT (r_type < (unsigned int) R_D10V_max); | |
240 | cache_ptr->howto = &elf_d10v_howto_table[r_type]; | |
241 | } | |
242 | ||
243 | static asection * | |
1e2f5b6e AM |
244 | elf32_d10v_gc_mark_hook (sec, info, rel, h, sym) |
245 | asection *sec; | |
246 | struct bfd_link_info *info ATTRIBUTE_UNUSED; | |
247 | Elf_Internal_Rela *rel; | |
248 | struct elf_link_hash_entry *h; | |
249 | Elf_Internal_Sym *sym; | |
252b5132 RH |
250 | { |
251 | if (h != NULL) | |
252 | { | |
253 | switch (ELF32_R_TYPE (rel->r_info)) | |
254 | { | |
255 | case R_D10V_GNU_VTINHERIT: | |
256 | case R_D10V_GNU_VTENTRY: | |
257 | break; | |
258 | ||
259 | default: | |
260 | switch (h->root.type) | |
261 | { | |
262 | case bfd_link_hash_defined: | |
263 | case bfd_link_hash_defweak: | |
264 | return h->root.u.def.section; | |
265 | ||
266 | case bfd_link_hash_common: | |
267 | return h->root.u.c.p->section; | |
e049a0de ILT |
268 | |
269 | default: | |
270 | break; | |
252b5132 RH |
271 | } |
272 | } | |
273 | } | |
274 | else | |
1e2f5b6e AM |
275 | return bfd_section_from_elf_index (sec->owner, sym->st_shndx); |
276 | ||
252b5132 RH |
277 | return NULL; |
278 | } | |
279 | ||
b34976b6 | 280 | static bfd_boolean |
252b5132 | 281 | elf32_d10v_gc_sweep_hook (abfd, info, sec, relocs) |
5f771d47 ILT |
282 | bfd *abfd ATTRIBUTE_UNUSED; |
283 | struct bfd_link_info *info ATTRIBUTE_UNUSED; | |
284 | asection *sec ATTRIBUTE_UNUSED; | |
285 | const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; | |
252b5132 RH |
286 | { |
287 | /* we don't use got and plt entries for d10v */ | |
b34976b6 | 288 | return TRUE; |
252b5132 RH |
289 | } |
290 | ||
291 | /* Look through the relocs for a section during the first phase. | |
292 | Since we don't do .gots or .plts, we just need to consider the | |
293 | virtual table relocs for gc. */ | |
a7c10850 | 294 | |
b34976b6 | 295 | static bfd_boolean |
252b5132 RH |
296 | elf32_d10v_check_relocs (abfd, info, sec, relocs) |
297 | bfd *abfd; | |
298 | struct bfd_link_info *info; | |
299 | asection *sec; | |
300 | const Elf_Internal_Rela *relocs; | |
301 | { | |
302 | Elf_Internal_Shdr *symtab_hdr; | |
303 | struct elf_link_hash_entry **sym_hashes, **sym_hashes_end; | |
304 | const Elf_Internal_Rela *rel; | |
305 | const Elf_Internal_Rela *rel_end; | |
a7c10850 | 306 | |
1049f94e | 307 | if (info->relocatable) |
b34976b6 | 308 | return TRUE; |
a7c10850 | 309 | |
252b5132 RH |
310 | symtab_hdr = &elf_tdata (abfd)->symtab_hdr; |
311 | sym_hashes = elf_sym_hashes (abfd); | |
a7c10850 | 312 | sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym); |
252b5132 RH |
313 | if (!elf_bad_symtab (abfd)) |
314 | sym_hashes_end -= symtab_hdr->sh_info; | |
a7c10850 | 315 | |
252b5132 RH |
316 | rel_end = relocs + sec->reloc_count; |
317 | for (rel = relocs; rel < rel_end; rel++) | |
318 | { | |
319 | struct elf_link_hash_entry *h; | |
320 | unsigned long r_symndx; | |
a7c10850 | 321 | |
252b5132 RH |
322 | r_symndx = ELF32_R_SYM (rel->r_info); |
323 | if (r_symndx < symtab_hdr->sh_info) | |
324 | h = NULL; | |
325 | else | |
326 | h = sym_hashes[r_symndx - symtab_hdr->sh_info]; | |
a7c10850 | 327 | |
252b5132 RH |
328 | switch (ELF32_R_TYPE (rel->r_info)) |
329 | { | |
330 | /* This relocation describes the C++ object vtable hierarchy. | |
331 | Reconstruct it for later use during GC. */ | |
332 | case R_D10V_GNU_VTINHERIT: | |
333 | if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) | |
b34976b6 | 334 | return FALSE; |
252b5132 | 335 | break; |
a7c10850 | 336 | |
252b5132 RH |
337 | /* This relocation describes which C++ vtable entries are actually |
338 | used. Record for later use during GC. */ | |
339 | case R_D10V_GNU_VTENTRY: | |
340 | if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_offset)) | |
b34976b6 | 341 | return FALSE; |
252b5132 RH |
342 | break; |
343 | } | |
344 | } | |
a7c10850 | 345 | |
b34976b6 | 346 | return TRUE; |
252b5132 RH |
347 | } |
348 | ||
349 | /* Relocate a D10V ELF section. */ | |
b34976b6 | 350 | static bfd_boolean |
252b5132 RH |
351 | elf32_d10v_relocate_section (output_bfd, info, input_bfd, input_section, |
352 | contents, relocs, local_syms, local_sections) | |
f8df10f4 | 353 | bfd *output_bfd; |
252b5132 RH |
354 | struct bfd_link_info *info; |
355 | bfd *input_bfd; | |
356 | asection *input_section; | |
357 | bfd_byte *contents; | |
358 | Elf_Internal_Rela *relocs; | |
359 | Elf_Internal_Sym *local_syms; | |
360 | asection **local_sections; | |
361 | { | |
362 | Elf_Internal_Shdr *symtab_hdr; | |
363 | struct elf_link_hash_entry **sym_hashes; | |
364 | Elf_Internal_Rela *rel, *relend; | |
365 | const char *name; | |
366 | ||
367 | symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; | |
368 | sym_hashes = elf_sym_hashes (input_bfd); | |
369 | ||
370 | rel = relocs; | |
371 | relend = relocs + input_section->reloc_count; | |
372 | for (; rel < relend; rel++) | |
373 | { | |
374 | int r_type; | |
375 | reloc_howto_type *howto; | |
376 | unsigned long r_symndx; | |
377 | Elf_Internal_Sym *sym; | |
378 | asection *sec; | |
379 | struct elf_link_hash_entry *h; | |
380 | bfd_vma relocation; | |
381 | bfd_reloc_status_type r; | |
382 | ||
383 | r_symndx = ELF32_R_SYM (rel->r_info); | |
384 | r_type = ELF32_R_TYPE (rel->r_info); | |
385 | ||
386 | if (r_type == R_D10V_GNU_VTENTRY | |
387 | || r_type == R_D10V_GNU_VTINHERIT ) | |
388 | continue; | |
389 | ||
390 | howto = elf_d10v_howto_table + r_type; | |
391 | ||
1049f94e | 392 | if (info->relocatable) |
252b5132 | 393 | { |
1049f94e | 394 | /* This is a relocatable link. We don't have to change |
252b5132 RH |
395 | anything, unless the reloc is against a section symbol, |
396 | in which case we have to adjust according to where the | |
397 | section symbol winds up in the output section. */ | |
398 | if (r_symndx < symtab_hdr->sh_info) | |
399 | { | |
400 | sym = local_syms + r_symndx; | |
401 | if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) | |
402 | { | |
403 | sec = local_sections[r_symndx]; | |
404 | rel->r_addend += sec->output_offset + sym->st_value; | |
405 | } | |
406 | } | |
407 | ||
408 | continue; | |
409 | } | |
410 | ||
411 | /* This is a final link. */ | |
412 | h = NULL; | |
413 | sym = NULL; | |
414 | sec = NULL; | |
415 | if (r_symndx < symtab_hdr->sh_info) | |
416 | { | |
417 | sym = local_syms + r_symndx; | |
418 | sec = local_sections[r_symndx]; | |
f8df10f4 | 419 | relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); |
252b5132 RH |
420 | } |
421 | else | |
422 | { | |
423 | h = sym_hashes[r_symndx - symtab_hdr->sh_info]; | |
424 | while (h->root.type == bfd_link_hash_indirect | |
425 | || h->root.type == bfd_link_hash_warning) | |
426 | h = (struct elf_link_hash_entry *) h->root.u.i.link; | |
427 | if (h->root.type == bfd_link_hash_defined | |
428 | || h->root.type == bfd_link_hash_defweak) | |
429 | { | |
430 | sec = h->root.u.def.section; | |
431 | relocation = (h->root.u.def.value | |
432 | + sec->output_section->vma | |
433 | + sec->output_offset); | |
434 | } | |
435 | else if (h->root.type == bfd_link_hash_undefweak) | |
436 | relocation = 0; | |
437 | else | |
438 | { | |
439 | if (!((*info->callbacks->undefined_symbol) | |
440 | (info, h->root.root.string, input_bfd, | |
b34976b6 AM |
441 | input_section, rel->r_offset, TRUE))) |
442 | return FALSE; | |
252b5132 RH |
443 | relocation = 0; |
444 | } | |
445 | } | |
446 | ||
447 | if (h != NULL) | |
448 | name = h->root.root.string; | |
449 | else | |
450 | { | |
451 | name = (bfd_elf_string_from_elf_section | |
452 | (input_bfd, symtab_hdr->sh_link, sym->st_name)); | |
453 | if (name == NULL || *name == '\0') | |
454 | name = bfd_section_name (input_bfd, sec); | |
455 | } | |
a7c10850 | 456 | |
252b5132 RH |
457 | r = _bfd_final_link_relocate (howto, input_bfd, input_section, |
458 | contents, rel->r_offset, | |
459 | relocation, rel->r_addend); | |
460 | ||
461 | if (r != bfd_reloc_ok) | |
462 | { | |
463 | const char * msg = (const char *) 0; | |
464 | ||
465 | switch (r) | |
466 | { | |
467 | case bfd_reloc_overflow: | |
468 | if (!((*info->callbacks->reloc_overflow) | |
469 | (info, name, howto->name, (bfd_vma) 0, | |
470 | input_bfd, input_section, rel->r_offset))) | |
b34976b6 | 471 | return FALSE; |
252b5132 RH |
472 | break; |
473 | ||
474 | case bfd_reloc_undefined: | |
475 | if (!((*info->callbacks->undefined_symbol) | |
476 | (info, name, input_bfd, input_section, | |
b34976b6 AM |
477 | rel->r_offset, TRUE))) |
478 | return FALSE; | |
252b5132 RH |
479 | break; |
480 | ||
481 | case bfd_reloc_outofrange: | |
517662d4 | 482 | msg = _("internal error: out of range error"); |
252b5132 RH |
483 | goto common_error; |
484 | ||
485 | case bfd_reloc_notsupported: | |
517662d4 | 486 | msg = _("internal error: unsupported relocation error"); |
252b5132 RH |
487 | goto common_error; |
488 | ||
489 | case bfd_reloc_dangerous: | |
517662d4 | 490 | msg = _("internal error: dangerous error"); |
252b5132 RH |
491 | goto common_error; |
492 | ||
493 | default: | |
517662d4 | 494 | msg = _("internal error: unknown error"); |
252b5132 RH |
495 | /* fall through */ |
496 | ||
497 | common_error: | |
498 | if (!((*info->callbacks->warning) | |
499 | (info, msg, name, input_bfd, input_section, | |
500 | rel->r_offset))) | |
b34976b6 | 501 | return FALSE; |
252b5132 RH |
502 | break; |
503 | } | |
504 | } | |
505 | } | |
506 | ||
b34976b6 | 507 | return TRUE; |
252b5132 RH |
508 | } |
509 | #define ELF_ARCH bfd_arch_d10v | |
aa4f99bb AO |
510 | #define ELF_MACHINE_CODE EM_D10V |
511 | #define ELF_MACHINE_ALT1 EM_CYGNUS_D10V | |
252b5132 RH |
512 | #define ELF_MAXPAGESIZE 0x1000 |
513 | ||
514 | #define TARGET_BIG_SYM bfd_elf32_d10v_vec | |
515 | #define TARGET_BIG_NAME "elf32-d10v" | |
516 | ||
517 | #define elf_info_to_howto 0 | |
518 | #define elf_info_to_howto_rel d10v_info_to_howto_rel | |
519 | #define elf_backend_object_p 0 | |
520 | #define elf_backend_final_write_processing 0 | |
521 | #define elf_backend_gc_mark_hook elf32_d10v_gc_mark_hook | |
522 | #define elf_backend_gc_sweep_hook elf32_d10v_gc_sweep_hook | |
523 | #define elf_backend_check_relocs elf32_d10v_check_relocs | |
524 | #define elf_backend_relocate_section elf32_d10v_relocate_section | |
525 | #define elf_backend_can_gc_sections 1 | |
526 | ||
527 | #include "elf32-target.h" |