1 /* V850-specific support for 32-bit ELF
2 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
3 Free Software Foundation, Inc.
5 This file is part of BFD, the Binary File Descriptor library.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
21 /* XXX FIXME: This code is littered with 32bit int, 16bit short, 8bit char
22 dependencies. As is the gas & simulator code or the v850. */
30 #include "libiberty.h"
32 /* Sign-extend a 24-bit number. */
33 #define SEXT24(x) ((((x) & 0xffffff) ^ 0x800000) - 0x800000)
35 static reloc_howto_type
*v850_elf_reloc_type_lookup
36 PARAMS ((bfd
*abfd
, bfd_reloc_code_real_type code
));
37 static void v850_elf_info_to_howto_rel
38 PARAMS ((bfd
*, arelent
*, Elf32_Internal_Rel
*));
39 static void v850_elf_info_to_howto_rela
40 PARAMS ((bfd
*, arelent
*, Elf32_Internal_Rela
*));
41 static bfd_reloc_status_type v850_elf_reloc
42 PARAMS ((bfd
*, arelent
*, asymbol
*, PTR
, asection
*, bfd
*, char **));
43 static boolean v850_elf_is_local_label_name
44 PARAMS ((bfd
*, const char *));
45 static boolean v850_elf_relocate_section
46 PARAMS((bfd
*, struct bfd_link_info
*, bfd
*, asection
*, bfd_byte
*,
47 Elf_Internal_Rela
*, Elf_Internal_Sym
*, asection
**));
48 static bfd_reloc_status_type v850_elf_perform_relocation
49 PARAMS ((bfd
*, unsigned int, bfd_vma
, bfd_byte
*));
50 static boolean v850_elf_check_relocs
51 PARAMS ((bfd
*, struct bfd_link_info
*, asection
*, const Elf_Internal_Rela
*));
52 static void remember_hi16s_reloc
53 PARAMS ((bfd
*, bfd_vma
, bfd_byte
*));
54 static bfd_byte
* find_remembered_hi16s_reloc
55 PARAMS ((bfd_vma
, boolean
*));
56 static bfd_reloc_status_type v850_elf_final_link_relocate
57 PARAMS ((reloc_howto_type
*, bfd
*, bfd
*, asection
*, bfd_byte
*, bfd_vma
,
58 bfd_vma
, bfd_vma
, struct bfd_link_info
*, asection
*, int));
59 static boolean v850_elf_object_p
61 static boolean v850_elf_fake_sections
62 PARAMS ((bfd
*, Elf32_Internal_Shdr
*, asection
*));
63 static void v850_elf_final_write_processing
64 PARAMS ((bfd
*, boolean
));
65 static boolean v850_elf_set_private_flags
66 PARAMS ((bfd
*, flagword
));
67 static boolean v850_elf_merge_private_bfd_data
68 PARAMS ((bfd
*, bfd
*));
69 static boolean v850_elf_print_private_bfd_data
70 PARAMS ((bfd
*, PTR
));
71 static boolean v850_elf_section_from_bfd_section
72 PARAMS ((bfd
*, asection
*, int *));
73 static void v850_elf_symbol_processing
74 PARAMS ((bfd
*, asymbol
*));
75 static boolean v850_elf_add_symbol_hook
76 PARAMS ((bfd
*, struct bfd_link_info
*, const Elf_Internal_Sym
*,
77 const char **, flagword
*, asection
**, bfd_vma
*));
78 static boolean v850_elf_link_output_symbol_hook
79 PARAMS ((bfd
*, struct bfd_link_info
*, const char *,
80 Elf_Internal_Sym
*, asection
*));
81 static boolean v850_elf_section_from_shdr
82 PARAMS ((bfd
*, Elf_Internal_Shdr
*, const char *));
83 static boolean v850_elf_gc_sweep_hook
84 PARAMS ((bfd
*, struct bfd_link_info
*, asection
*,
85 const Elf_Internal_Rela
*));
86 static asection
* v850_elf_gc_mark_hook
87 PARAMS ((asection
*, struct bfd_link_info
*,
88 Elf_Internal_Rela
*, struct elf_link_hash_entry
*,
91 /* Note: It is REQUIRED that the 'type' value of each entry
92 in this array match the index of the entry in the array. */
93 static reloc_howto_type v850_elf_howto_table
[] =
95 /* This reloc does nothing. */
96 HOWTO (R_V850_NONE
, /* type */
98 2, /* size (0 = byte, 1 = short, 2 = long) */
100 false, /* pc_relative */
102 complain_overflow_bitfield
, /* complain_on_overflow */
103 bfd_elf_generic_reloc
, /* special_function */
104 "R_V850_NONE", /* name */
105 false, /* partial_inplace */
108 false), /* pcrel_offset */
110 /* A PC relative 9 bit branch. */
111 HOWTO (R_V850_9_PCREL
, /* type */
113 2, /* size (0 = byte, 1 = short, 2 = long) */
115 true, /* pc_relative */
117 complain_overflow_bitfield
, /* complain_on_overflow */
118 v850_elf_reloc
, /* special_function */
119 "R_V850_9_PCREL", /* name */
120 false, /* partial_inplace */
121 0x00ffffff, /* src_mask */
122 0x00ffffff, /* dst_mask */
123 true), /* pcrel_offset */
125 /* A PC relative 22 bit branch. */
126 HOWTO (R_V850_22_PCREL
, /* type */
128 2, /* size (0 = byte, 1 = short, 2 = long) */
130 true, /* pc_relative */
132 complain_overflow_signed
, /* complain_on_overflow */
133 v850_elf_reloc
, /* special_function */
134 "R_V850_22_PCREL", /* name */
135 false, /* partial_inplace */
136 0x07ffff80, /* src_mask */
137 0x07ffff80, /* dst_mask */
138 true), /* pcrel_offset */
140 /* High 16 bits of symbol value. */
141 HOWTO (R_V850_HI16_S
, /* type */
143 1, /* size (0 = byte, 1 = short, 2 = long) */
145 false, /* pc_relative */
147 complain_overflow_dont
, /* complain_on_overflow */
148 v850_elf_reloc
, /* special_function */
149 "R_V850_HI16_S", /* name */
150 false, /* partial_inplace */
151 0xffff, /* src_mask */
152 0xffff, /* dst_mask */
153 false), /* pcrel_offset */
155 /* High 16 bits of symbol value. */
156 HOWTO (R_V850_HI16
, /* type */
158 1, /* size (0 = byte, 1 = short, 2 = long) */
160 false, /* pc_relative */
162 complain_overflow_dont
, /* complain_on_overflow */
163 v850_elf_reloc
, /* special_function */
164 "R_V850_HI16", /* name */
165 false, /* partial_inplace */
166 0xffff, /* src_mask */
167 0xffff, /* dst_mask */
168 false), /* pcrel_offset */
170 /* Low 16 bits of symbol value. */
171 HOWTO (R_V850_LO16
, /* type */
173 1, /* size (0 = byte, 1 = short, 2 = long) */
175 false, /* pc_relative */
177 complain_overflow_dont
, /* complain_on_overflow */
178 v850_elf_reloc
, /* special_function */
179 "R_V850_LO16", /* name */
180 false, /* partial_inplace */
181 0xffff, /* src_mask */
182 0xffff, /* dst_mask */
183 false), /* pcrel_offset */
185 /* Simple 32bit reloc. */
186 HOWTO (R_V850_32
, /* type */
188 2, /* size (0 = byte, 1 = short, 2 = long) */
190 false, /* pc_relative */
192 complain_overflow_dont
, /* complain_on_overflow */
193 v850_elf_reloc
, /* special_function */
194 "R_V850_32", /* name */
195 false, /* partial_inplace */
196 0xffffffff, /* src_mask */
197 0xffffffff, /* dst_mask */
198 false), /* pcrel_offset */
200 /* Simple 16bit reloc. */
201 HOWTO (R_V850_16
, /* type */
203 1, /* size (0 = byte, 1 = short, 2 = long) */
205 false, /* pc_relative */
207 complain_overflow_dont
, /* complain_on_overflow */
208 bfd_elf_generic_reloc
, /* special_function */
209 "R_V850_16", /* name */
210 false, /* partial_inplace */
211 0xffff, /* src_mask */
212 0xffff, /* dst_mask */
213 false), /* pcrel_offset */
215 /* Simple 8bit reloc. */
216 HOWTO (R_V850_8
, /* type */
218 0, /* size (0 = byte, 1 = short, 2 = long) */
220 false, /* pc_relative */
222 complain_overflow_dont
, /* complain_on_overflow */
223 bfd_elf_generic_reloc
, /* special_function */
224 "R_V850_8", /* name */
225 false, /* partial_inplace */
228 false), /* pcrel_offset */
230 /* 16 bit offset from the short data area pointer. */
231 HOWTO (R_V850_SDA_16_16_OFFSET
, /* type */
233 1, /* size (0 = byte, 1 = short, 2 = long) */
235 false, /* pc_relative */
237 complain_overflow_dont
, /* complain_on_overflow */
238 v850_elf_reloc
, /* special_function */
239 "R_V850_SDA_16_16_OFFSET", /* name */
240 false, /* partial_inplace */
241 0xffff, /* src_mask */
242 0xffff, /* dst_mask */
243 false), /* pcrel_offset */
245 /* 15 bit offset from the short data area pointer. */
246 HOWTO (R_V850_SDA_15_16_OFFSET
, /* type */
248 1, /* size (0 = byte, 1 = short, 2 = long) */
250 false, /* pc_relative */
252 complain_overflow_dont
, /* complain_on_overflow */
253 v850_elf_reloc
, /* special_function */
254 "R_V850_SDA_15_16_OFFSET", /* name */
255 false, /* partial_inplace */
256 0xfffe, /* src_mask */
257 0xfffe, /* dst_mask */
258 false), /* pcrel_offset */
260 /* 16 bit offset from the zero data area pointer. */
261 HOWTO (R_V850_ZDA_16_16_OFFSET
, /* type */
263 1, /* size (0 = byte, 1 = short, 2 = long) */
265 false, /* pc_relative */
267 complain_overflow_dont
, /* complain_on_overflow */
268 v850_elf_reloc
, /* special_function */
269 "R_V850_ZDA_16_16_OFFSET", /* name */
270 false, /* partial_inplace */
271 0xffff, /* src_mask */
272 0xffff, /* dst_mask */
273 false), /* pcrel_offset */
275 /* 15 bit offset from the zero data area pointer. */
276 HOWTO (R_V850_ZDA_15_16_OFFSET
, /* type */
278 1, /* size (0 = byte, 1 = short, 2 = long) */
280 false, /* pc_relative */
282 complain_overflow_dont
, /* complain_on_overflow */
283 v850_elf_reloc
, /* special_function */
284 "R_V850_ZDA_15_16_OFFSET", /* name */
285 false, /* partial_inplace */
286 0xfffe, /* src_mask */
287 0xfffe, /* dst_mask */
288 false), /* pcrel_offset */
290 /* 6 bit offset from the tiny data area pointer. */
291 HOWTO (R_V850_TDA_6_8_OFFSET
, /* type */
293 1, /* size (0 = byte, 1 = short, 2 = long) */
295 false, /* pc_relative */
297 complain_overflow_dont
, /* complain_on_overflow */
298 v850_elf_reloc
, /* special_function */
299 "R_V850_TDA_6_8_OFFSET", /* name */
300 false, /* partial_inplace */
303 false), /* pcrel_offset */
305 /* 8 bit offset from the tiny data area pointer. */
306 HOWTO (R_V850_TDA_7_8_OFFSET
, /* type */
308 1, /* size (0 = byte, 1 = short, 2 = long) */
310 false, /* pc_relative */
312 complain_overflow_dont
, /* complain_on_overflow */
313 v850_elf_reloc
, /* special_function */
314 "R_V850_TDA_7_8_OFFSET", /* name */
315 false, /* partial_inplace */
318 false), /* pcrel_offset */
320 /* 7 bit offset from the tiny data area pointer. */
321 HOWTO (R_V850_TDA_7_7_OFFSET
, /* type */
323 1, /* size (0 = byte, 1 = short, 2 = long) */
325 false, /* pc_relative */
327 complain_overflow_dont
, /* complain_on_overflow */
328 v850_elf_reloc
, /* special_function */
329 "R_V850_TDA_7_7_OFFSET", /* name */
330 false, /* partial_inplace */
333 false), /* pcrel_offset */
335 /* 16 bit offset from the tiny data area pointer! */
336 HOWTO (R_V850_TDA_16_16_OFFSET
, /* type */
338 1, /* size (0 = byte, 1 = short, 2 = long) */
340 false, /* pc_relative */
342 complain_overflow_dont
, /* complain_on_overflow */
343 v850_elf_reloc
, /* special_function */
344 "R_V850_TDA_16_16_OFFSET", /* name */
345 false, /* partial_inplace */
346 0xffff, /* src_mask */
347 0xfff, /* dst_mask */
348 false), /* pcrel_offset */
350 /* 5 bit offset from the tiny data area pointer. */
351 HOWTO (R_V850_TDA_4_5_OFFSET
, /* type */
353 1, /* size (0 = byte, 1 = short, 2 = long) */
355 false, /* pc_relative */
357 complain_overflow_dont
, /* complain_on_overflow */
358 v850_elf_reloc
, /* special_function */
359 "R_V850_TDA_4_5_OFFSET", /* name */
360 false, /* partial_inplace */
363 false), /* pcrel_offset */
365 /* 4 bit offset from the tiny data area pointer. */
366 HOWTO (R_V850_TDA_4_4_OFFSET
, /* type */
368 1, /* size (0 = byte, 1 = short, 2 = long) */
370 false, /* pc_relative */
372 complain_overflow_dont
, /* complain_on_overflow */
373 v850_elf_reloc
, /* special_function */
374 "R_V850_TDA_4_4_OFFSET", /* name */
375 false, /* partial_inplace */
378 false), /* pcrel_offset */
380 /* 16 bit offset from the short data area pointer. */
381 HOWTO (R_V850_SDA_16_16_SPLIT_OFFSET
, /* type */
383 2, /* size (0 = byte, 1 = short, 2 = long) */
385 false, /* pc_relative */
387 complain_overflow_dont
, /* complain_on_overflow */
388 v850_elf_reloc
, /* special_function */
389 "R_V850_SDA_16_16_SPLIT_OFFSET",/* name */
390 false, /* partial_inplace */
391 0xfffe0020, /* src_mask */
392 0xfffe0020, /* dst_mask */
393 false), /* pcrel_offset */
395 /* 16 bit offset from the zero data area pointer. */
396 HOWTO (R_V850_ZDA_16_16_SPLIT_OFFSET
, /* type */
398 2, /* size (0 = byte, 1 = short, 2 = long) */
400 false, /* pc_relative */
402 complain_overflow_dont
, /* complain_on_overflow */
403 v850_elf_reloc
, /* special_function */
404 "R_V850_ZDA_16_16_SPLIT_OFFSET",/* name */
405 false, /* partial_inplace */
406 0xfffe0020, /* src_mask */
407 0xfffe0020, /* dst_mask */
408 false), /* pcrel_offset */
410 /* 6 bit offset from the call table base pointer. */
411 HOWTO (R_V850_CALLT_6_7_OFFSET
, /* type */
413 1, /* size (0 = byte, 1 = short, 2 = long) */
415 false, /* pc_relative */
417 complain_overflow_dont
, /* complain_on_overflow */
418 v850_elf_reloc
, /* special_function */
419 "R_V850_CALLT_6_7_OFFSET", /* name */
420 false, /* partial_inplace */
423 false), /* pcrel_offset */
425 /* 16 bit offset from the call table base pointer. */
426 HOWTO (R_V850_CALLT_16_16_OFFSET
, /* type */
428 1, /* size (0 = byte, 1 = short, 2 = long) */
430 false, /* pc_relative */
432 complain_overflow_dont
, /* complain_on_overflow */
433 v850_elf_reloc
, /* special_function */
434 "R_V850_CALLT_16_16_OFFSET", /* name */
435 false, /* partial_inplace */
436 0xffff, /* src_mask */
437 0xffff, /* dst_mask */
438 false), /* pcrel_offset */
440 /* GNU extension to record C++ vtable hierarchy */
441 HOWTO (R_V850_GNU_VTINHERIT
, /* type */
443 2, /* size (0 = byte, 1 = short, 2 = long) */
445 false, /* pc_relative */
447 complain_overflow_dont
, /* complain_on_overflow */
448 NULL
, /* special_function */
449 "R_V850_GNU_VTINHERIT", /* name */
450 false, /* partial_inplace */
453 false), /* pcrel_offset */
455 /* GNU extension to record C++ vtable member usage */
456 HOWTO (R_V850_GNU_VTENTRY
, /* type */
458 2, /* size (0 = byte, 1 = short, 2 = long) */
460 false, /* pc_relative */
462 complain_overflow_dont
, /* complain_on_overflow */
463 _bfd_elf_rel_vtable_reloc_fn
, /* special_function */
464 "R_V850_GNU_VTENTRY", /* name */
465 false, /* partial_inplace */
468 false), /* pcrel_offset */
472 /* Map BFD reloc types to V850 ELF reloc types. */
474 struct v850_elf_reloc_map
476 /* BFD_RELOC_V850_CALLT_16_16_OFFSET is 258, which will not fix in an
478 bfd_reloc_code_real_type bfd_reloc_val
;
479 unsigned int elf_reloc_val
;
482 static const struct v850_elf_reloc_map v850_elf_reloc_map
[] =
484 { BFD_RELOC_NONE
, R_V850_NONE
},
485 { BFD_RELOC_V850_9_PCREL
, R_V850_9_PCREL
},
486 { BFD_RELOC_V850_22_PCREL
, R_V850_22_PCREL
},
487 { BFD_RELOC_HI16_S
, R_V850_HI16_S
},
488 { BFD_RELOC_HI16
, R_V850_HI16
},
489 { BFD_RELOC_LO16
, R_V850_LO16
},
490 { BFD_RELOC_32
, R_V850_32
},
491 { BFD_RELOC_16
, R_V850_16
},
492 { BFD_RELOC_8
, R_V850_8
},
493 { BFD_RELOC_V850_SDA_16_16_OFFSET
, R_V850_SDA_16_16_OFFSET
},
494 { BFD_RELOC_V850_SDA_15_16_OFFSET
, R_V850_SDA_15_16_OFFSET
},
495 { BFD_RELOC_V850_ZDA_16_16_OFFSET
, R_V850_ZDA_16_16_OFFSET
},
496 { BFD_RELOC_V850_ZDA_15_16_OFFSET
, R_V850_ZDA_15_16_OFFSET
},
497 { BFD_RELOC_V850_TDA_6_8_OFFSET
, R_V850_TDA_6_8_OFFSET
},
498 { BFD_RELOC_V850_TDA_7_8_OFFSET
, R_V850_TDA_7_8_OFFSET
},
499 { BFD_RELOC_V850_TDA_7_7_OFFSET
, R_V850_TDA_7_7_OFFSET
},
500 { BFD_RELOC_V850_TDA_16_16_OFFSET
, R_V850_TDA_16_16_OFFSET
},
501 { BFD_RELOC_V850_TDA_4_5_OFFSET
, R_V850_TDA_4_5_OFFSET
},
502 { BFD_RELOC_V850_TDA_4_4_OFFSET
, R_V850_TDA_4_4_OFFSET
},
503 { BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET
, R_V850_SDA_16_16_SPLIT_OFFSET
},
504 { BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET
, R_V850_ZDA_16_16_SPLIT_OFFSET
},
505 { BFD_RELOC_V850_CALLT_6_7_OFFSET
, R_V850_CALLT_6_7_OFFSET
},
506 { BFD_RELOC_V850_CALLT_16_16_OFFSET
, R_V850_CALLT_16_16_OFFSET
},
507 { BFD_RELOC_VTABLE_INHERIT
, R_V850_GNU_VTINHERIT
},
508 { BFD_RELOC_VTABLE_ENTRY
, R_V850_GNU_VTENTRY
},
512 /* Map a bfd relocation into the appropriate howto structure. */
514 static reloc_howto_type
*
515 v850_elf_reloc_type_lookup (abfd
, code
)
516 bfd
* abfd ATTRIBUTE_UNUSED
;
517 bfd_reloc_code_real_type code
;
521 for (i
= ARRAY_SIZE (v850_elf_reloc_map
); i
--;)
522 if (v850_elf_reloc_map
[i
].bfd_reloc_val
== code
)
524 unsigned int elf_reloc_val
= v850_elf_reloc_map
[i
].elf_reloc_val
;
526 BFD_ASSERT (v850_elf_howto_table
[elf_reloc_val
].type
== elf_reloc_val
);
528 return v850_elf_howto_table
+ elf_reloc_val
;
534 /* Set the howto pointer for an V850 ELF reloc. */
537 v850_elf_info_to_howto_rel (abfd
, cache_ptr
, dst
)
538 bfd
* abfd ATTRIBUTE_UNUSED
;
540 Elf32_Internal_Rel
* dst
;
544 r_type
= ELF32_R_TYPE (dst
->r_info
);
545 BFD_ASSERT (r_type
< (unsigned int) R_V850_max
);
546 cache_ptr
->howto
= &v850_elf_howto_table
[r_type
];
549 /* Set the howto pointer for a V850 ELF reloc (type RELA). */
551 v850_elf_info_to_howto_rela (abfd
, cache_ptr
, dst
)
552 bfd
* abfd ATTRIBUTE_UNUSED
;
554 Elf32_Internal_Rela
*dst
;
558 r_type
= ELF32_R_TYPE (dst
->r_info
);
559 BFD_ASSERT (r_type
< (unsigned int) R_V850_max
);
560 cache_ptr
->howto
= &v850_elf_howto_table
[r_type
];
563 /* Look through the relocs for a section during the first phase, and
564 allocate space in the global offset table or procedure linkage
568 v850_elf_check_relocs (abfd
, info
, sec
, relocs
)
570 struct bfd_link_info
* info
;
572 const Elf_Internal_Rela
* relocs
;
576 Elf_Internal_Shdr
*symtab_hdr
;
577 struct elf_link_hash_entry
**sym_hashes
;
578 const Elf_Internal_Rela
*rel
;
579 const Elf_Internal_Rela
*rel_end
;
581 enum v850_reloc_type r_type
;
583 const char *common
= (const char *)0;
585 if (info
->relocateable
)
589 fprintf (stderr
, "v850_elf_check_relocs called for section %s in %s\n",
590 bfd_get_section_name (abfd
, sec
),
591 bfd_archive_filename (abfd
));
594 dynobj
= elf_hash_table (info
)->dynobj
;
595 symtab_hdr
= &elf_tdata (abfd
)->symtab_hdr
;
596 sym_hashes
= elf_sym_hashes (abfd
);
599 rel_end
= relocs
+ sec
->reloc_count
;
600 for (rel
= relocs
; rel
< rel_end
; rel
++)
602 unsigned long r_symndx
;
603 struct elf_link_hash_entry
*h
;
605 r_symndx
= ELF32_R_SYM (rel
->r_info
);
606 if (r_symndx
< symtab_hdr
->sh_info
)
609 h
= sym_hashes
[r_symndx
- symtab_hdr
->sh_info
];
611 r_type
= (enum v850_reloc_type
) ELF32_R_TYPE (rel
->r_info
);
617 case R_V850_22_PCREL
:
624 case R_V850_CALLT_6_7_OFFSET
:
625 case R_V850_CALLT_16_16_OFFSET
:
628 /* This relocation describes the C++ object vtable hierarchy.
629 Reconstruct it for later use during GC. */
630 case R_V850_GNU_VTINHERIT
:
631 if (!_bfd_elf32_gc_record_vtinherit (abfd
, sec
, h
, rel
->r_offset
))
635 /* This relocation describes which C++ vtable entries
636 are actually used. Record for later use during GC. */
637 case R_V850_GNU_VTENTRY
:
638 if (!_bfd_elf32_gc_record_vtentry (abfd
, sec
, h
, rel
->r_addend
))
642 case R_V850_SDA_16_16_SPLIT_OFFSET
:
643 case R_V850_SDA_16_16_OFFSET
:
644 case R_V850_SDA_15_16_OFFSET
:
645 other
= V850_OTHER_SDA
;
647 goto small_data_common
;
649 case R_V850_ZDA_16_16_SPLIT_OFFSET
:
650 case R_V850_ZDA_16_16_OFFSET
:
651 case R_V850_ZDA_15_16_OFFSET
:
652 other
= V850_OTHER_ZDA
;
654 goto small_data_common
;
656 case R_V850_TDA_4_5_OFFSET
:
657 case R_V850_TDA_4_4_OFFSET
:
658 case R_V850_TDA_6_8_OFFSET
:
659 case R_V850_TDA_7_8_OFFSET
:
660 case R_V850_TDA_7_7_OFFSET
:
661 case R_V850_TDA_16_16_OFFSET
:
662 other
= V850_OTHER_TDA
;
666 #define V850_OTHER_MASK (V850_OTHER_TDA | V850_OTHER_SDA | V850_OTHER_ZDA)
671 /* Flag which type of relocation was used. */
673 if ((h
->other
& V850_OTHER_MASK
) != (other
& V850_OTHER_MASK
)
674 && (h
->other
& V850_OTHER_ERROR
) == 0)
677 static char buff
[200]; /* XXX */
679 switch (h
->other
& V850_OTHER_MASK
)
682 msg
= _("Variable `%s' cannot occupy in multiple small data regions");
684 case V850_OTHER_SDA
| V850_OTHER_ZDA
| V850_OTHER_TDA
:
685 msg
= _("Variable `%s' can only be in one of the small, zero, and tiny data regions");
687 case V850_OTHER_SDA
| V850_OTHER_ZDA
:
688 msg
= _("Variable `%s' cannot be in both small and zero data regions simultaneously");
690 case V850_OTHER_SDA
| V850_OTHER_TDA
:
691 msg
= _("Variable `%s' cannot be in both small and tiny data regions simultaneously");
693 case V850_OTHER_ZDA
| V850_OTHER_TDA
:
694 msg
= _("Variable `%s' cannot be in both zero and tiny data regions simultaneously");
698 sprintf (buff
, msg
, h
->root
.root
.string
);
699 info
->callbacks
->warning (info
, buff
, h
->root
.root
.string
,
700 abfd
, h
->root
.u
.def
.section
,
703 bfd_set_error (bfd_error_bad_value
);
704 h
->other
|= V850_OTHER_ERROR
;
709 if (h
&& h
->root
.type
== bfd_link_hash_common
711 && !strcmp (bfd_get_section_name (abfd
, h
->root
.u
.c
.p
->section
), "COMMON"))
715 section
= h
->root
.u
.c
.p
->section
= bfd_make_section_old_way (abfd
, common
);
716 section
->flags
|= SEC_IS_COMMON
;
720 fprintf (stderr
, "v850_elf_check_relocs, found %s relocation for %s%s\n",
721 v850_elf_howto_table
[ (int)r_type
].name
,
722 (h
&& h
->root
.root
.string
) ? h
->root
.root
.string
: "<unknown>",
723 (h
->root
.type
== bfd_link_hash_common
) ? ", symbol is common" : "");
732 /* In the old version, when an entry was checked out from the table,
733 it was deleted. This produced an error if the entry was needed
734 more than once, as the second attempted retry failed.
736 In the current version, the entry is not deleted, instead we set
737 the field 'found' to true. If a second lookup matches the same
738 entry, then we know that the hi16s reloc has already been updated
739 and does not need to be updated a second time.
741 TODO - TOFIX: If it is possible that we need to restore 2 different
742 addresses from the same table entry, where the first generates an
743 overflow, whilst the second do not, then this code will fail. */
745 typedef struct hi16s_location
749 unsigned long counter
;
751 struct hi16s_location
* next
;
755 static hi16s_location
* previous_hi16s
;
756 static hi16s_location
* free_hi16s
;
757 static unsigned long hi16s_counter
;
760 remember_hi16s_reloc (abfd
, addend
, address
)
765 hi16s_location
* entry
= NULL
;
766 bfd_size_type amt
= sizeof (* free_hi16s
);
768 /* Find a free structure. */
769 if (free_hi16s
== NULL
)
770 free_hi16s
= (hi16s_location
*) bfd_zalloc (abfd
, amt
);
773 free_hi16s
= free_hi16s
->next
;
775 entry
->addend
= addend
;
776 entry
->address
= address
;
777 entry
->counter
= hi16s_counter
++;
778 entry
->found
= false;
779 entry
->next
= previous_hi16s
;
780 previous_hi16s
= entry
;
782 /* Cope with wrap around of our counter. */
783 if (hi16s_counter
== 0)
785 /* XXX - Assume that all counter entries differ only in their low 16 bits. */
786 for (entry
= previous_hi16s
; entry
!= NULL
; entry
= entry
->next
)
787 entry
->counter
&= 0xffff;
789 hi16s_counter
= 0x10000;
796 find_remembered_hi16s_reloc (addend
, already_found
)
798 boolean
* already_found
;
800 hi16s_location
* match
= NULL
;
801 hi16s_location
* entry
;
802 hi16s_location
* previous
= NULL
;
803 hi16s_location
* prev
;
806 /* Search the table. Record the most recent entry that matches. */
807 for (entry
= previous_hi16s
; entry
; entry
= entry
->next
)
809 if (entry
->addend
== addend
810 && (match
== NULL
|| match
->counter
< entry
->counter
))
822 /* Extract the address. */
823 addr
= match
->address
;
825 /* Remeber if this entry has already been used before. */
827 * already_found
= match
->found
;
829 /* Note that this entry has now been used. */
835 /* FIXME: The code here probably ought to be removed and the code in reloc.c
836 allowed to do its stuff instead. At least for most of the relocs, anwyay. */
838 static bfd_reloc_status_type
839 v850_elf_perform_relocation (abfd
, r_type
, addend
, address
)
846 bfd_signed_vma saddend
= (bfd_signed_vma
) addend
;
851 /* fprintf (stderr, "reloc type %d not SUPPORTED\n", r_type ); */
852 return bfd_reloc_notsupported
;
855 bfd_put_32 (abfd
, addend
, address
);
858 case R_V850_22_PCREL
:
859 if (saddend
> 0x1fffff || saddend
< -0x200000)
860 return bfd_reloc_overflow
;
862 if ((addend
% 2) != 0)
863 return bfd_reloc_dangerous
;
865 insn
= bfd_get_32 (abfd
, address
);
867 insn
|= (((addend
& 0xfffe) << 16) | ((addend
& 0x3f0000) >> 16));
868 bfd_put_32 (abfd
, (bfd_vma
) insn
, address
);
872 if (saddend
> 0xff || saddend
< -0x100)
873 return bfd_reloc_overflow
;
875 if ((addend
% 2) != 0)
876 return bfd_reloc_dangerous
;
878 insn
= bfd_get_16 (abfd
, address
);
880 insn
|= ((addend
& 0x1f0) << 7) | ((addend
& 0x0e) << 3);
884 addend
+= (bfd_get_16 (abfd
, address
) << 16);
885 addend
= (addend
>> 16);
890 /* Remember where this relocation took place. */
891 remember_hi16s_reloc (abfd
, addend
, address
);
893 addend
+= (bfd_get_16 (abfd
, address
) << 16);
894 addend
= (addend
>> 16) + ((addend
& 0x8000) != 0);
896 /* This relocation cannot overflow. */
904 /* Calculate the sum of the value stored in the instruction and the
905 addend and check for overflow from the low 16 bits into the high
906 16 bits. The assembler has already done some of this: If the
907 value stored in the instruction has its 15th bit set, (counting
908 from zero) then the assembler will have added 1 to the value
909 stored in the associated HI16S reloc. So for example, these
912 movhi hi( fred ), r0, r1
913 movea lo( fred ), r1, r1
915 will store 0 in the value fields for the MOVHI and MOVEA instructions
916 and addend will be the address of fred, but for these instructions:
918 movhi hi( fred + 0x123456), r0, r1
919 movea lo( fred + 0x123456), r1, r1
921 the value stored in the MOVHI instruction will be 0x12 and the value
922 stored in the MOVEA instruction will be 0x3456. If however the
925 movhi hi( fred + 0x10ffff), r0, r1
926 movea lo( fred + 0x10ffff), r1, r1
928 then the value stored in the MOVHI instruction would be 0x11 (not
929 0x10) and the value stored in the MOVEA instruction would be 0xffff.
930 Thus (assuming for the moment that the addend is 0), at run time the
931 MOVHI instruction loads 0x110000 into r1, then the MOVEA instruction
932 adds 0xffffffff (sign extension!) producing 0x10ffff. Similarly if
933 the instructions were:
935 movhi hi( fred - 1), r0, r1
936 movea lo( fred - 1), r1, r1
938 then 0 is stored in the MOVHI instruction and -1 is stored in the
941 Overflow can occur if the addition of the value stored in the
942 instruction plus the addend sets the 15th bit when before it was clear.
943 This is because the 15th bit will be sign extended into the high part,
944 thus reducing its value by one, but since the 15th bit was originally
945 clear, the assembler will not have added 1 to the previous HI16S reloc
946 to compensate for this effect. For example:
948 movhi hi( fred + 0x123456), r0, r1
949 movea lo( fred + 0x123456), r1, r1
951 The value stored in HI16S reloc is 0x12, the value stored in the LO16
952 reloc is 0x3456. If we assume that the address of fred is 0x00007000
953 then the relocations become:
955 HI16S: 0x0012 + (0x00007000 >> 16) = 0x12
956 LO16: 0x3456 + (0x00007000 & 0xffff) = 0xa456
958 but when the instructions are executed, the MOVEA instruction's value
959 is signed extended, so the sum becomes:
964 0x0011a456 but 'fred + 0x123456' = 0x0012a456
966 Note that if the 15th bit was set in the value stored in the LO16
967 reloc, then we do not have to do anything:
969 movhi hi( fred + 0x10ffff), r0, r1
970 movea lo( fred + 0x10ffff), r1, r1
972 HI16S: 0x0011 + (0x00007000 >> 16) = 0x11
973 LO16: 0xffff + (0x00007000 & 0xffff) = 0x6fff
978 0x00116fff = fred + 0x10ffff = 0x7000 + 0x10ffff
980 Overflow can also occur if the computation carries into the 16th bit
981 and it also results in the 15th bit having the same value as the 15th
982 bit of the original value. What happens is that the HI16S reloc
983 will have already examined the 15th bit of the original value and
984 added 1 to the high part if the bit is set. This compensates for the
985 sign extension of 15th bit of the result of the computation. But now
986 there is a carry into the 16th bit, and this has not been allowed for.
988 So, for example if fred is at address 0xf000:
990 movhi hi( fred + 0xffff), r0, r1 [bit 15 of the offset is set]
991 movea lo( fred + 0xffff), r1, r1
993 HI16S: 0x0001 + (0x0000f000 >> 16) = 0x0001
994 LO16: 0xffff + (0x0000f000 & 0xffff) = 0xefff (carry into bit 16 is lost)
999 0x0000efff but 'fred + 0xffff' = 0x0001efff
1001 Similarly, if the 15th bit remains clear, but overflow occurs into
1002 the 16th bit then (assuming the address of fred is 0xf000):
1004 movhi hi( fred + 0x7000), r0, r1 [bit 15 of the offset is clear]
1005 movea lo( fred + 0x7000), r1, r1
1007 HI16S: 0x0000 + (0x0000f000 >> 16) = 0x0000
1008 LO16: 0x7000 + (0x0000f000 & 0xffff) = 0x6fff (carry into bit 16 is lost)
1013 0x00006fff but 'fred + 0x7000' = 0x00016fff
1015 Note - there is no need to change anything if a carry occurs, and the
1016 15th bit changes its value from being set to being clear, as the HI16S
1017 reloc will have already added in 1 to the high part for us:
1019 movhi hi( fred + 0xffff), r0, r1 [bit 15 of the offset is set]
1020 movea lo( fred + 0xffff), r1, r1
1022 HI16S: 0x0001 + (0x00007000 >> 16)
1023 LO16: 0xffff + (0x00007000 & 0xffff) = 0x6fff (carry into bit 16 is lost)
1026 + 0x00006fff (bit 15 not set, so the top half is zero)
1028 0x00016fff which is right (assuming that fred is at 0x7000)
1030 but if the 15th bit goes from being clear to being set, then we must
1031 once again handle overflow:
1033 movhi hi( fred + 0x7000), r0, r1 [bit 15 of the offset is clear]
1034 movea lo( fred + 0x7000), r1, r1
1036 HI16S: 0x0000 + (0x0000ffff >> 16)
1037 LO16: 0x7000 + (0x0000ffff & 0xffff) = 0x6fff (carry into bit 16)
1040 + 0x00006fff (bit 15 not set, so the top half is zero)
1042 0x00006fff which is wrong (assuming that fred is at 0xffff). */
1046 insn
= bfd_get_16 (abfd
, address
);
1047 result
= insn
+ addend
;
1049 #define BIT15_SET(x) ((x) & 0x8000)
1050 #define OVERFLOWS(a,i) ((((a) & 0xffff) + (i)) > 0xffff)
1052 if ((BIT15_SET (result
) && ! BIT15_SET (addend
))
1053 || (OVERFLOWS (addend
, insn
)
1054 && ((! BIT15_SET (insn
)) || (BIT15_SET (addend
)))))
1056 boolean already_updated
;
1057 bfd_byte
* hi16s_address
= find_remembered_hi16s_reloc
1058 (addend
, & already_updated
);
1060 /* Amend the matching HI16_S relocation. */
1061 if (hi16s_address
!= NULL
)
1063 if (! already_updated
)
1065 insn
= bfd_get_16 (abfd
, hi16s_address
);
1067 bfd_put_16 (abfd
, (bfd_vma
) insn
, hi16s_address
);
1072 fprintf (stderr
, _("FAILED to find previous HI16 reloc\n"));
1073 return bfd_reloc_overflow
;
1077 /* Do not complain if value has top bit set, as this has been anticipated. */
1078 insn
= result
& 0xffff;
1083 addend
+= (char) bfd_get_8 (abfd
, address
);
1085 saddend
= (bfd_signed_vma
) addend
;
1087 if (saddend
> 0x7f || saddend
< -0x80)
1088 return bfd_reloc_overflow
;
1090 bfd_put_8 (abfd
, addend
, address
);
1091 return bfd_reloc_ok
;
1093 case R_V850_CALLT_16_16_OFFSET
:
1094 addend
+= bfd_get_16 (abfd
, address
);
1096 saddend
= (bfd_signed_vma
) addend
;
1098 if (saddend
> 0xffff || saddend
< 0)
1099 return bfd_reloc_overflow
;
1107 case R_V850_SDA_16_16_OFFSET
:
1108 case R_V850_ZDA_16_16_OFFSET
:
1109 case R_V850_TDA_16_16_OFFSET
:
1110 addend
+= bfd_get_16 (abfd
, address
);
1112 saddend
= (bfd_signed_vma
) addend
;
1114 if (saddend
> 0x7fff || saddend
< -0x8000)
1115 return bfd_reloc_overflow
;
1120 case R_V850_SDA_15_16_OFFSET
:
1121 case R_V850_ZDA_15_16_OFFSET
:
1122 insn
= bfd_get_16 (abfd
, address
);
1123 addend
+= (insn
& 0xfffe);
1125 saddend
= (bfd_signed_vma
) addend
;
1127 if (saddend
> 0x7ffe || saddend
< -0x8000)
1128 return bfd_reloc_overflow
;
1131 return bfd_reloc_dangerous
;
1133 insn
= (addend
&~ (bfd_vma
) 1) | (insn
& 1);
1136 case R_V850_TDA_6_8_OFFSET
:
1137 insn
= bfd_get_16 (abfd
, address
);
1138 addend
+= ((insn
& 0x7e) << 1);
1140 saddend
= (bfd_signed_vma
) addend
;
1142 if (saddend
> 0xfc || saddend
< 0)
1143 return bfd_reloc_overflow
;
1146 return bfd_reloc_dangerous
;
1149 insn
|= (addend
>> 1);
1152 case R_V850_TDA_7_8_OFFSET
:
1153 insn
= bfd_get_16 (abfd
, address
);
1154 addend
+= ((insn
& 0x7f) << 1);
1156 saddend
= (bfd_signed_vma
) addend
;
1158 if (saddend
> 0xfe || saddend
< 0)
1159 return bfd_reloc_overflow
;
1162 return bfd_reloc_dangerous
;
1165 insn
|= (addend
>> 1);
1168 case R_V850_TDA_7_7_OFFSET
:
1169 insn
= bfd_get_16 (abfd
, address
);
1170 addend
+= insn
& 0x7f;
1172 saddend
= (bfd_signed_vma
) addend
;
1174 if (saddend
> 0x7f || saddend
< 0)
1175 return bfd_reloc_overflow
;
1181 case R_V850_TDA_4_5_OFFSET
:
1182 insn
= bfd_get_16 (abfd
, address
);
1183 addend
+= ((insn
& 0xf) << 1);
1185 saddend
= (bfd_signed_vma
) addend
;
1187 if (saddend
> 0x1e || saddend
< 0)
1188 return bfd_reloc_overflow
;
1191 return bfd_reloc_dangerous
;
1194 insn
|= (addend
>> 1);
1197 case R_V850_TDA_4_4_OFFSET
:
1198 insn
= bfd_get_16 (abfd
, address
);
1199 addend
+= insn
& 0xf;
1201 saddend
= (bfd_signed_vma
) addend
;
1203 if (saddend
> 0xf || saddend
< 0)
1204 return bfd_reloc_overflow
;
1210 case R_V850_ZDA_16_16_SPLIT_OFFSET
:
1211 case R_V850_SDA_16_16_SPLIT_OFFSET
:
1212 insn
= bfd_get_32 (abfd
, address
);
1213 addend
+= ((insn
& 0xfffe0000) >> 16) + ((insn
& 0x20) >> 5);
1215 saddend
= (bfd_signed_vma
) addend
;
1217 if (saddend
> 0x7fff || saddend
< -0x8000)
1218 return bfd_reloc_overflow
;
1221 insn
|= (addend
& 1) << 5;
1222 insn
|= (addend
&~ (bfd_vma
) 1) << 16;
1224 bfd_put_32 (abfd
, (bfd_vma
) insn
, address
);
1225 return bfd_reloc_ok
;
1227 case R_V850_CALLT_6_7_OFFSET
:
1228 insn
= bfd_get_16 (abfd
, address
);
1229 addend
+= ((insn
& 0x3f) << 1);
1231 saddend
= (bfd_signed_vma
) addend
;
1233 if (saddend
> 0x7e || saddend
< 0)
1234 return bfd_reloc_overflow
;
1237 return bfd_reloc_dangerous
;
1240 insn
|= (addend
>> 1);
1243 case R_V850_GNU_VTINHERIT
:
1244 case R_V850_GNU_VTENTRY
:
1245 return bfd_reloc_ok
;
1249 bfd_put_16 (abfd
, (bfd_vma
) insn
, address
);
1250 return bfd_reloc_ok
;
1253 /* Insert the addend into the instruction. */
1255 static bfd_reloc_status_type
1256 v850_elf_reloc (abfd
, reloc
, symbol
, data
, isection
, obfd
, err
)
1257 bfd
* abfd ATTRIBUTE_UNUSED
;
1260 PTR data ATTRIBUTE_UNUSED
;
1261 asection
* isection
;
1263 char ** err ATTRIBUTE_UNUSED
;
1267 /* If there is an output BFD,
1268 and the symbol is not a section name (which is only defined at final link time),
1269 and either we are not putting the addend into the instruction
1270 or the addend is zero, so there is nothing to add into the instruction
1271 then just fixup the address and return. */
1272 if (obfd
!= (bfd
*) NULL
1273 && (symbol
->flags
& BSF_SECTION_SYM
) == 0
1274 && (! reloc
->howto
->partial_inplace
1275 || reloc
->addend
== 0))
1277 reloc
->address
+= isection
->output_offset
;
1278 return bfd_reloc_ok
;
1281 else if (obfd
!= NULL
)
1282 return bfd_reloc_continue
;
1285 /* Catch relocs involving undefined symbols. */
1286 if (bfd_is_und_section (symbol
->section
)
1287 && (symbol
->flags
& BSF_WEAK
) == 0
1289 return bfd_reloc_undefined
;
1291 /* We handle final linking of some relocs ourselves. */
1293 /* Is the address of the relocation really within the section? */
1294 if (reloc
->address
> isection
->_cooked_size
)
1295 return bfd_reloc_outofrange
;
1297 /* Work out which section the relocation is targetted at and the
1298 initial relocation command value. */
1300 /* Get symbol value. (Common symbols are special.) */
1301 if (bfd_is_com_section (symbol
->section
))
1304 relocation
= symbol
->value
;
1306 /* Convert input-section-relative symbol value to absolute + addend. */
1307 relocation
+= symbol
->section
->output_section
->vma
;
1308 relocation
+= symbol
->section
->output_offset
;
1309 relocation
+= reloc
->addend
;
1311 #if 0 /* Since this reloc is going to be processed later on, we should
1312 not make it pc-relative here. To test this, try assembling and
1313 linking this program:
1321 .section ".foo","ax"
1325 if (reloc
->howto
->pc_relative
)
1327 /* Here the variable relocation holds the final address of the
1328 symbol we are relocating against, plus any addend. */
1329 relocation
-= isection
->output_section
->vma
+ isection
->output_offset
;
1331 /* Deal with pcrel_offset. */
1332 relocation
-= reloc
->address
;
1335 reloc
->addend
= relocation
;
1336 return bfd_reloc_ok
;
1340 v850_elf_is_local_label_name (abfd
, name
)
1341 bfd
* abfd ATTRIBUTE_UNUSED
;
1344 return ( (name
[0] == '.' && (name
[1] == 'L' || name
[1] == '.'))
1345 || (name
[0] == '_' && name
[1] == '.' && name
[2] == 'L' && name
[3] == '_'));
1348 /* Perform a relocation as part of a final link. */
1350 static bfd_reloc_status_type
1351 v850_elf_final_link_relocate (howto
, input_bfd
, output_bfd
,
1352 input_section
, contents
, offset
, value
,
1353 addend
, info
, sym_sec
, is_local
)
1354 reloc_howto_type
* howto
;
1356 bfd
* output_bfd ATTRIBUTE_UNUSED
;
1357 asection
* input_section
;
1358 bfd_byte
* contents
;
1362 struct bfd_link_info
* info
;
1364 int is_local ATTRIBUTE_UNUSED
;
1366 unsigned int r_type
= howto
->type
;
1367 bfd_byte
* hit_data
= contents
+ offset
;
1369 /* Adjust the value according to the relocation. */
1372 case R_V850_9_PCREL
:
1373 value
-= (input_section
->output_section
->vma
1374 + input_section
->output_offset
);
1378 case R_V850_22_PCREL
:
1379 value
-= (input_section
->output_section
->vma
1380 + input_section
->output_offset
1383 /* If the sign extension will corrupt the value then we have overflowed. */
1384 if (((value
& 0xff000000) != 0x0) && ((value
& 0xff000000) != 0xff000000))
1385 return bfd_reloc_overflow
;
1387 /* Only the bottom 24 bits of the PC are valid */
1388 value
= SEXT24 (value
);
1399 case R_V850_ZDA_15_16_OFFSET
:
1400 case R_V850_ZDA_16_16_OFFSET
:
1401 case R_V850_ZDA_16_16_SPLIT_OFFSET
:
1402 if (sym_sec
== NULL
)
1403 return bfd_reloc_undefined
;
1405 value
-= sym_sec
->output_section
->vma
;
1408 case R_V850_SDA_15_16_OFFSET
:
1409 case R_V850_SDA_16_16_OFFSET
:
1410 case R_V850_SDA_16_16_SPLIT_OFFSET
:
1413 struct bfd_link_hash_entry
* h
;
1415 if (sym_sec
== NULL
)
1416 return bfd_reloc_undefined
;
1418 /* Get the value of __gp. */
1419 h
= bfd_link_hash_lookup (info
->hash
, "__gp", false, false, true);
1420 if (h
== (struct bfd_link_hash_entry
*) NULL
1421 || h
->type
!= bfd_link_hash_defined
)
1422 return bfd_reloc_other
;
1424 gp
= (h
->u
.def
.value
1425 + h
->u
.def
.section
->output_section
->vma
1426 + h
->u
.def
.section
->output_offset
);
1428 value
-= sym_sec
->output_section
->vma
;
1429 value
-= (gp
- sym_sec
->output_section
->vma
);
1433 case R_V850_TDA_4_4_OFFSET
:
1434 case R_V850_TDA_4_5_OFFSET
:
1435 case R_V850_TDA_16_16_OFFSET
:
1436 case R_V850_TDA_7_7_OFFSET
:
1437 case R_V850_TDA_7_8_OFFSET
:
1438 case R_V850_TDA_6_8_OFFSET
:
1441 struct bfd_link_hash_entry
* h
;
1443 /* Get the value of __ep. */
1444 h
= bfd_link_hash_lookup (info
->hash
, "__ep", false, false, true);
1445 if (h
== (struct bfd_link_hash_entry
*) NULL
1446 || h
->type
!= bfd_link_hash_defined
)
1447 /* Actually this indicates that __ep could not be found. */
1448 return bfd_reloc_continue
;
1450 ep
= (h
->u
.def
.value
1451 + h
->u
.def
.section
->output_section
->vma
1452 + h
->u
.def
.section
->output_offset
);
1458 case R_V850_CALLT_6_7_OFFSET
:
1461 struct bfd_link_hash_entry
* h
;
1463 /* Get the value of __ctbp. */
1464 h
= bfd_link_hash_lookup (info
->hash
, "__ctbp", false, false, true);
1465 if (h
== (struct bfd_link_hash_entry
*) NULL
1466 || h
->type
!= bfd_link_hash_defined
)
1467 /* Actually this indicates that __ctbp could not be found. */
1468 return bfd_reloc_dangerous
+ 1;
1470 ctbp
= (h
->u
.def
.value
1471 + h
->u
.def
.section
->output_section
->vma
1472 + h
->u
.def
.section
->output_offset
);
1477 case R_V850_CALLT_16_16_OFFSET
:
1480 struct bfd_link_hash_entry
* h
;
1482 if (sym_sec
== NULL
)
1483 return bfd_reloc_undefined
;
1485 /* Get the value of __ctbp. */
1486 h
= bfd_link_hash_lookup (info
->hash
, "__ctbp", false, false, true);
1487 if (h
== (struct bfd_link_hash_entry
*) NULL
1488 || h
->type
!= bfd_link_hash_defined
)
1489 return (bfd_reloc_dangerous
+ 1);
1491 ctbp
= (h
->u
.def
.value
1492 + h
->u
.def
.section
->output_section
->vma
1493 + h
->u
.def
.section
->output_offset
);
1495 value
-= sym_sec
->output_section
->vma
;
1496 value
-= (ctbp
- sym_sec
->output_section
->vma
);
1501 case R_V850_GNU_VTINHERIT
:
1502 case R_V850_GNU_VTENTRY
:
1503 return bfd_reloc_ok
;
1506 return bfd_reloc_notsupported
;
1509 /* Perform the relocation. */
1510 return v850_elf_perform_relocation (input_bfd
, r_type
, value
+ addend
, hit_data
);
1513 /* Relocate an V850 ELF section. */
1516 v850_elf_relocate_section (output_bfd
, info
, input_bfd
, input_section
,
1517 contents
, relocs
, local_syms
, local_sections
)
1519 struct bfd_link_info
* info
;
1521 asection
* input_section
;
1522 bfd_byte
* contents
;
1523 Elf_Internal_Rela
* relocs
;
1524 Elf_Internal_Sym
* local_syms
;
1525 asection
** local_sections
;
1527 Elf_Internal_Shdr
* symtab_hdr
;
1528 struct elf_link_hash_entry
** sym_hashes
;
1529 Elf_Internal_Rela
* rel
;
1530 Elf_Internal_Rela
* relend
;
1532 symtab_hdr
= & elf_tdata (input_bfd
)->symtab_hdr
;
1533 sym_hashes
= elf_sym_hashes (input_bfd
);
1535 if (sym_hashes
== NULL
)
1537 info
->callbacks
->warning
1538 (info
, "no hash table available",
1539 NULL
, input_bfd
, input_section
, (bfd_vma
) 0);
1544 /* Reset the list of remembered HI16S relocs to empty. */
1545 free_hi16s
= previous_hi16s
;
1546 previous_hi16s
= NULL
;
1550 relend
= relocs
+ input_section
->reloc_count
;
1551 for (; rel
< relend
; rel
++)
1554 reloc_howto_type
* howto
;
1555 unsigned long r_symndx
;
1556 Elf_Internal_Sym
* sym
;
1558 struct elf_link_hash_entry
* h
;
1560 bfd_reloc_status_type r
;
1562 r_symndx
= ELF32_R_SYM (rel
->r_info
);
1563 r_type
= ELF32_R_TYPE (rel
->r_info
);
1565 if (r_type
== R_V850_GNU_VTENTRY
1566 || r_type
== R_V850_GNU_VTINHERIT
)
1569 howto
= v850_elf_howto_table
+ r_type
;
1571 if (info
->relocateable
)
1573 /* This is a relocateable link. We don't have to change
1574 anything, unless the reloc is against a section symbol,
1575 in which case we have to adjust according to where the
1576 section symbol winds up in the output section. */
1577 if (r_symndx
< symtab_hdr
->sh_info
)
1579 sym
= local_syms
+ r_symndx
;
1580 if (ELF_ST_TYPE (sym
->st_info
) == STT_SECTION
)
1582 sec
= local_sections
[r_symndx
];
1583 rel
->r_addend
+= sec
->output_offset
+ sym
->st_value
;
1590 /* This is a final link. */
1594 if (r_symndx
< symtab_hdr
->sh_info
)
1596 sym
= local_syms
+ r_symndx
;
1597 sec
= local_sections
[r_symndx
];
1598 relocation
= _bfd_elf_rela_local_sym (output_bfd
, sym
, sec
, rel
);
1603 name
= bfd_elf_string_from_elf_section (input_bfd
, symtab_hdr
->sh_link
, sym
->st_name
);
1604 name
= (name
== NULL
) ? "<none>" : name
;
1605 fprintf (stderr
, "local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n",
1606 sec
->name
, name
, sym
->st_name
,
1607 sec
->output_section
->vma
, sec
->output_offset
, sym
->st_value
, rel
->r_addend
);
1613 h
= sym_hashes
[r_symndx
- symtab_hdr
->sh_info
];
1615 while (h
->root
.type
== bfd_link_hash_indirect
1616 || h
->root
.type
== bfd_link_hash_warning
)
1617 h
= (struct elf_link_hash_entry
*) h
->root
.u
.i
.link
;
1619 if (h
->root
.type
== bfd_link_hash_defined
1620 || h
->root
.type
== bfd_link_hash_defweak
)
1622 sec
= h
->root
.u
.def
.section
;
1623 relocation
= (h
->root
.u
.def
.value
1624 + sec
->output_section
->vma
1625 + sec
->output_offset
);
1627 fprintf (stderr
, "defined: sec: %s, name: %s, value: %x + %x + %x gives: %x\n",
1628 sec
->name
, h
->root
.root
.string
, h
->root
.u
.def
.value
, sec
->output_section
->vma
, sec
->output_offset
, relocation
);
1631 else if (h
->root
.type
== bfd_link_hash_undefweak
)
1634 fprintf (stderr
, "undefined: sec: %s, name: %s\n",
1635 sec
->name
, h
->root
.root
.string
);
1641 if (! ((*info
->callbacks
->undefined_symbol
)
1642 (info
, h
->root
.root
.string
, input_bfd
,
1643 input_section
, rel
->r_offset
, true)))
1646 fprintf (stderr
, "unknown: name: %s\n", h
->root
.root
.string
);
1652 /* FIXME: We should use the addend, but the COFF relocations don't. */
1653 r
= v850_elf_final_link_relocate (howto
, input_bfd
, output_bfd
,
1655 contents
, rel
->r_offset
,
1656 relocation
, rel
->r_addend
,
1657 info
, sec
, h
== NULL
);
1659 if (r
!= bfd_reloc_ok
)
1662 const char * msg
= (const char *)0;
1665 name
= h
->root
.root
.string
;
1668 name
= (bfd_elf_string_from_elf_section
1669 (input_bfd
, symtab_hdr
->sh_link
, sym
->st_name
));
1670 if (name
== NULL
|| *name
== '\0')
1671 name
= bfd_section_name (input_bfd
, sec
);
1676 case bfd_reloc_overflow
:
1677 if (! ((*info
->callbacks
->reloc_overflow
)
1678 (info
, name
, howto
->name
, (bfd_vma
) 0,
1679 input_bfd
, input_section
, rel
->r_offset
)))
1683 case bfd_reloc_undefined
:
1684 if (! ((*info
->callbacks
->undefined_symbol
)
1685 (info
, name
, input_bfd
, input_section
,
1686 rel
->r_offset
, true)))
1690 case bfd_reloc_outofrange
:
1691 msg
= _("internal error: out of range error");
1694 case bfd_reloc_notsupported
:
1695 msg
= _("internal error: unsupported relocation error");
1698 case bfd_reloc_dangerous
:
1699 msg
= _("internal error: dangerous relocation");
1702 case bfd_reloc_other
:
1703 msg
= _("could not locate special linker symbol __gp");
1706 case bfd_reloc_continue
:
1707 msg
= _("could not locate special linker symbol __ep");
1710 case (bfd_reloc_dangerous
+ 1):
1711 msg
= _("could not locate special linker symbol __ctbp");
1715 msg
= _("internal error: unknown error");
1719 if (!((*info
->callbacks
->warning
)
1720 (info
, msg
, name
, input_bfd
, input_section
,
1732 v850_elf_gc_sweep_hook (abfd
, info
, sec
, relocs
)
1733 bfd
*abfd ATTRIBUTE_UNUSED
;
1734 struct bfd_link_info
*info ATTRIBUTE_UNUSED
;
1735 asection
*sec ATTRIBUTE_UNUSED
;
1736 const Elf_Internal_Rela
*relocs ATTRIBUTE_UNUSED
;
1738 /* No got and plt entries for v850-elf. */
1743 v850_elf_gc_mark_hook (sec
, info
, rel
, h
, sym
)
1745 struct bfd_link_info
*info ATTRIBUTE_UNUSED
;
1746 Elf_Internal_Rela
*rel
;
1747 struct elf_link_hash_entry
*h
;
1748 Elf_Internal_Sym
*sym
;
1752 switch (ELF32_R_TYPE (rel
->r_info
))
1754 case R_V850_GNU_VTINHERIT
:
1755 case R_V850_GNU_VTENTRY
:
1759 switch (h
->root
.type
)
1761 case bfd_link_hash_defined
:
1762 case bfd_link_hash_defweak
:
1763 return h
->root
.u
.def
.section
;
1765 case bfd_link_hash_common
:
1766 return h
->root
.u
.c
.p
->section
;
1774 return bfd_section_from_elf_index (sec
->owner
, sym
->st_shndx
);
1779 /* Set the right machine number. */
1782 v850_elf_object_p (abfd
)
1785 switch (elf_elfheader (abfd
)->e_flags
& EF_V850_ARCH
)
1788 case E_V850_ARCH
: (void) bfd_default_set_arch_mach (abfd
, bfd_arch_v850
, 0); break;
1789 case E_V850E_ARCH
: (void) bfd_default_set_arch_mach (abfd
, bfd_arch_v850
, bfd_mach_v850e
); break;
1790 case E_V850EA_ARCH
: (void) bfd_default_set_arch_mach (abfd
, bfd_arch_v850
, bfd_mach_v850ea
); break;
1795 /* Store the machine number in the flags field. */
1798 v850_elf_final_write_processing (abfd
, linker
)
1800 boolean linker ATTRIBUTE_UNUSED
;
1804 switch (bfd_get_mach (abfd
))
1807 case 0: val
= E_V850_ARCH
; break;
1808 case bfd_mach_v850e
: val
= E_V850E_ARCH
; break;
1809 case bfd_mach_v850ea
: val
= E_V850EA_ARCH
; break;
1812 elf_elfheader (abfd
)->e_flags
&=~ EF_V850_ARCH
;
1813 elf_elfheader (abfd
)->e_flags
|= val
;
1816 /* Function to keep V850 specific file flags. */
1819 v850_elf_set_private_flags (abfd
, flags
)
1823 BFD_ASSERT (!elf_flags_init (abfd
)
1824 || elf_elfheader (abfd
)->e_flags
== flags
);
1826 elf_elfheader (abfd
)->e_flags
= flags
;
1827 elf_flags_init (abfd
) = true;
1831 /* Merge backend specific data from an object file
1832 to the output object file when linking. */
1834 v850_elf_merge_private_bfd_data (ibfd
, obfd
)
1841 if ( bfd_get_flavour (ibfd
) != bfd_target_elf_flavour
1842 || bfd_get_flavour (obfd
) != bfd_target_elf_flavour
)
1845 in_flags
= elf_elfheader (ibfd
)->e_flags
;
1846 out_flags
= elf_elfheader (obfd
)->e_flags
;
1848 if (! elf_flags_init (obfd
))
1850 /* If the input is the default architecture then do not
1851 bother setting the flags for the output architecture,
1852 instead allow future merges to do this. If no future
1853 merges ever set these flags then they will retain their
1854 unitialised values, which surprise surprise, correspond
1855 to the default values. */
1856 if (bfd_get_arch_info (ibfd
)->the_default
)
1859 elf_flags_init (obfd
) = true;
1860 elf_elfheader (obfd
)->e_flags
= in_flags
;
1862 if (bfd_get_arch (obfd
) == bfd_get_arch (ibfd
)
1863 && bfd_get_arch_info (obfd
)->the_default
)
1864 return bfd_set_arch_mach (obfd
, bfd_get_arch (ibfd
), bfd_get_mach (ibfd
));
1869 /* Check flag compatibility. */
1870 if (in_flags
== out_flags
)
1873 if ((in_flags
& EF_V850_ARCH
) != (out_flags
& EF_V850_ARCH
)
1874 && (in_flags
& EF_V850_ARCH
) != E_V850_ARCH
)
1875 _bfd_error_handler (_("%s: Architecture mismatch with previous modules"),
1876 bfd_archive_filename (ibfd
));
1881 /* Display the flags field. */
1884 v850_elf_print_private_bfd_data (abfd
, ptr
)
1888 FILE * file
= (FILE *) ptr
;
1890 BFD_ASSERT (abfd
!= NULL
&& ptr
!= NULL
);
1892 _bfd_elf_print_private_bfd_data (abfd
, ptr
);
1894 /* xgettext:c-format */
1895 fprintf (file
, _("private flags = %lx: "), elf_elfheader (abfd
)->e_flags
);
1897 switch (elf_elfheader (abfd
)->e_flags
& EF_V850_ARCH
)
1900 case E_V850_ARCH
: fprintf (file
, _("v850 architecture")); break;
1901 case E_V850E_ARCH
: fprintf (file
, _("v850e architecture")); break;
1902 case E_V850EA_ARCH
: fprintf (file
, _("v850ea architecture")); break;
1910 /* V850 ELF uses four common sections. One is the usual one, and the
1911 others are for (small) objects in one of the special data areas:
1912 small, tiny and zero. All the objects are kept together, and then
1913 referenced via the gp register, the ep register or the r0 register
1914 respectively, which yields smaller, faster assembler code. This
1915 approach is copied from elf32-mips.c. */
1917 static asection v850_elf_scom_section
;
1918 static asymbol v850_elf_scom_symbol
;
1919 static asymbol
* v850_elf_scom_symbol_ptr
;
1920 static asection v850_elf_tcom_section
;
1921 static asymbol v850_elf_tcom_symbol
;
1922 static asymbol
* v850_elf_tcom_symbol_ptr
;
1923 static asection v850_elf_zcom_section
;
1924 static asymbol v850_elf_zcom_symbol
;
1925 static asymbol
* v850_elf_zcom_symbol_ptr
;
1927 /* Given a BFD section, try to locate the
1928 corresponding ELF section index. */
1931 v850_elf_section_from_bfd_section (abfd
, sec
, retval
)
1932 bfd
* abfd ATTRIBUTE_UNUSED
;
1936 if (strcmp (bfd_get_section_name (abfd
, sec
), ".scommon") == 0)
1937 *retval
= SHN_V850_SCOMMON
;
1938 else if (strcmp (bfd_get_section_name (abfd
, sec
), ".tcommon") == 0)
1939 *retval
= SHN_V850_TCOMMON
;
1940 else if (strcmp (bfd_get_section_name (abfd
, sec
), ".zcommon") == 0)
1941 *retval
= SHN_V850_ZCOMMON
;
1948 /* Handle the special V850 section numbers that a symbol may use. */
1951 v850_elf_symbol_processing (abfd
, asym
)
1955 elf_symbol_type
* elfsym
= (elf_symbol_type
*) asym
;
1958 indx
= elfsym
->internal_elf_sym
.st_shndx
;
1960 /* If the section index is an "ordinary" index, then it may
1961 refer to a v850 specific section created by the assembler.
1962 Check the section's type and change the index it matches.
1964 FIXME: Should we alter the st_shndx field as well ? */
1966 if (indx
< elf_numsections (abfd
))
1967 switch (elf_elfsections(abfd
)[indx
]->sh_type
)
1969 case SHT_V850_SCOMMON
:
1970 indx
= SHN_V850_SCOMMON
;
1973 case SHT_V850_TCOMMON
:
1974 indx
= SHN_V850_TCOMMON
;
1977 case SHT_V850_ZCOMMON
:
1978 indx
= SHN_V850_ZCOMMON
;
1987 case SHN_V850_SCOMMON
:
1988 if (v850_elf_scom_section
.name
== NULL
)
1990 /* Initialize the small common section. */
1991 v850_elf_scom_section
.name
= ".scommon";
1992 v850_elf_scom_section
.flags
= SEC_IS_COMMON
| SEC_ALLOC
| SEC_DATA
;
1993 v850_elf_scom_section
.output_section
= & v850_elf_scom_section
;
1994 v850_elf_scom_section
.symbol
= & v850_elf_scom_symbol
;
1995 v850_elf_scom_section
.symbol_ptr_ptr
= & v850_elf_scom_symbol_ptr
;
1996 v850_elf_scom_symbol
.name
= ".scommon";
1997 v850_elf_scom_symbol
.flags
= BSF_SECTION_SYM
;
1998 v850_elf_scom_symbol
.section
= & v850_elf_scom_section
;
1999 v850_elf_scom_symbol_ptr
= & v850_elf_scom_symbol
;
2001 asym
->section
= & v850_elf_scom_section
;
2002 asym
->value
= elfsym
->internal_elf_sym
.st_size
;
2005 case SHN_V850_TCOMMON
:
2006 if (v850_elf_tcom_section
.name
== NULL
)
2008 /* Initialize the tcommon section. */
2009 v850_elf_tcom_section
.name
= ".tcommon";
2010 v850_elf_tcom_section
.flags
= SEC_IS_COMMON
;
2011 v850_elf_tcom_section
.output_section
= & v850_elf_tcom_section
;
2012 v850_elf_tcom_section
.symbol
= & v850_elf_tcom_symbol
;
2013 v850_elf_tcom_section
.symbol_ptr_ptr
= & v850_elf_tcom_symbol_ptr
;
2014 v850_elf_tcom_symbol
.name
= ".tcommon";
2015 v850_elf_tcom_symbol
.flags
= BSF_SECTION_SYM
;
2016 v850_elf_tcom_symbol
.section
= & v850_elf_tcom_section
;
2017 v850_elf_tcom_symbol_ptr
= & v850_elf_tcom_symbol
;
2019 asym
->section
= & v850_elf_tcom_section
;
2020 asym
->value
= elfsym
->internal_elf_sym
.st_size
;
2023 case SHN_V850_ZCOMMON
:
2024 if (v850_elf_zcom_section
.name
== NULL
)
2026 /* Initialize the zcommon section. */
2027 v850_elf_zcom_section
.name
= ".zcommon";
2028 v850_elf_zcom_section
.flags
= SEC_IS_COMMON
;
2029 v850_elf_zcom_section
.output_section
= & v850_elf_zcom_section
;
2030 v850_elf_zcom_section
.symbol
= & v850_elf_zcom_symbol
;
2031 v850_elf_zcom_section
.symbol_ptr_ptr
= & v850_elf_zcom_symbol_ptr
;
2032 v850_elf_zcom_symbol
.name
= ".zcommon";
2033 v850_elf_zcom_symbol
.flags
= BSF_SECTION_SYM
;
2034 v850_elf_zcom_symbol
.section
= & v850_elf_zcom_section
;
2035 v850_elf_zcom_symbol_ptr
= & v850_elf_zcom_symbol
;
2037 asym
->section
= & v850_elf_zcom_section
;
2038 asym
->value
= elfsym
->internal_elf_sym
.st_size
;
2043 /* Hook called by the linker routine which adds symbols from an object
2044 file. We must handle the special v850 section numbers here. */
2047 v850_elf_add_symbol_hook (abfd
, info
, sym
, namep
, flagsp
, secp
, valp
)
2049 struct bfd_link_info
* info ATTRIBUTE_UNUSED
;
2050 const Elf_Internal_Sym
* sym
;
2051 const char ** namep ATTRIBUTE_UNUSED
;
2052 flagword
* flagsp ATTRIBUTE_UNUSED
;
2056 unsigned int indx
= sym
->st_shndx
;
2058 /* If the section index is an "ordinary" index, then it may
2059 refer to a v850 specific section created by the assembler.
2060 Check the section's type and change the index it matches.
2062 FIXME: Should we alter the st_shndx field as well ? */
2064 if (indx
< elf_numsections (abfd
))
2065 switch (elf_elfsections(abfd
)[indx
]->sh_type
)
2067 case SHT_V850_SCOMMON
:
2068 indx
= SHN_V850_SCOMMON
;
2071 case SHT_V850_TCOMMON
:
2072 indx
= SHN_V850_TCOMMON
;
2075 case SHT_V850_ZCOMMON
:
2076 indx
= SHN_V850_ZCOMMON
;
2085 case SHN_V850_SCOMMON
:
2086 *secp
= bfd_make_section_old_way (abfd
, ".scommon");
2087 (*secp
)->flags
|= SEC_IS_COMMON
;
2088 *valp
= sym
->st_size
;
2091 case SHN_V850_TCOMMON
:
2092 *secp
= bfd_make_section_old_way (abfd
, ".tcommon");
2093 (*secp
)->flags
|= SEC_IS_COMMON
;
2094 *valp
= sym
->st_size
;
2097 case SHN_V850_ZCOMMON
:
2098 *secp
= bfd_make_section_old_way (abfd
, ".zcommon");
2099 (*secp
)->flags
|= SEC_IS_COMMON
;
2100 *valp
= sym
->st_size
;
2108 v850_elf_link_output_symbol_hook (abfd
, info
, name
, sym
, input_sec
)
2109 bfd
* abfd ATTRIBUTE_UNUSED
;
2110 struct bfd_link_info
* info ATTRIBUTE_UNUSED
;
2111 const char * name ATTRIBUTE_UNUSED
;
2112 Elf_Internal_Sym
* sym
;
2113 asection
* input_sec
;
2115 /* If we see a common symbol, which implies a relocatable link, then
2116 if a symbol was in a special common section in an input file, mark
2117 it as a special common in the output file. */
2119 if (sym
->st_shndx
== SHN_COMMON
)
2121 if (strcmp (input_sec
->name
, ".scommon") == 0)
2122 sym
->st_shndx
= SHN_V850_SCOMMON
;
2123 else if (strcmp (input_sec
->name
, ".tcommon") == 0)
2124 sym
->st_shndx
= SHN_V850_TCOMMON
;
2125 else if (strcmp (input_sec
->name
, ".zcommon") == 0)
2126 sym
->st_shndx
= SHN_V850_ZCOMMON
;
2133 v850_elf_section_from_shdr (abfd
, hdr
, name
)
2135 Elf_Internal_Shdr
* hdr
;
2138 /* There ought to be a place to keep ELF backend specific flags, but
2139 at the moment there isn't one. We just keep track of the
2140 sections by their name, instead. */
2142 if (! _bfd_elf_make_section_from_shdr (abfd
, hdr
, name
))
2145 switch (hdr
->sh_type
)
2147 case SHT_V850_SCOMMON
:
2148 case SHT_V850_TCOMMON
:
2149 case SHT_V850_ZCOMMON
:
2150 if (! bfd_set_section_flags (abfd
, hdr
->bfd_section
,
2151 (bfd_get_section_flags (abfd
,
2160 /* Set the correct type for a V850 ELF section. We do this
2161 by the section name, which is a hack, but ought to work. */
2164 v850_elf_fake_sections (abfd
, hdr
, sec
)
2165 bfd
* abfd ATTRIBUTE_UNUSED
;
2166 Elf32_Internal_Shdr
* hdr
;
2169 register const char * name
;
2171 name
= bfd_get_section_name (abfd
, sec
);
2173 if (strcmp (name
, ".scommon") == 0)
2175 hdr
->sh_type
= SHT_V850_SCOMMON
;
2177 else if (strcmp (name
, ".tcommon") == 0)
2179 hdr
->sh_type
= SHT_V850_TCOMMON
;
2181 else if (strcmp (name
, ".zcommon") == 0)
2182 hdr
->sh_type
= SHT_V850_ZCOMMON
;
2187 #define TARGET_LITTLE_SYM bfd_elf32_v850_vec
2188 #define TARGET_LITTLE_NAME "elf32-v850"
2189 #define ELF_ARCH bfd_arch_v850
2190 #define ELF_MACHINE_CODE EM_V850
2191 #define ELF_MACHINE_ALT1 EM_CYGNUS_V850
2192 #define ELF_MAXPAGESIZE 0x1000
2194 #define elf_info_to_howto v850_elf_info_to_howto_rela
2195 #define elf_info_to_howto_rel v850_elf_info_to_howto_rel
2197 #define elf_backend_check_relocs v850_elf_check_relocs
2198 #define elf_backend_relocate_section v850_elf_relocate_section
2199 #define elf_backend_object_p v850_elf_object_p
2200 #define elf_backend_final_write_processing v850_elf_final_write_processing
2201 #define elf_backend_section_from_bfd_section v850_elf_section_from_bfd_section
2202 #define elf_backend_symbol_processing v850_elf_symbol_processing
2203 #define elf_backend_add_symbol_hook v850_elf_add_symbol_hook
2204 #define elf_backend_link_output_symbol_hook v850_elf_link_output_symbol_hook
2205 #define elf_backend_section_from_shdr v850_elf_section_from_shdr
2206 #define elf_backend_fake_sections v850_elf_fake_sections
2207 #define elf_backend_gc_mark_hook v850_elf_gc_mark_hook
2208 #define elf_backend_gc_sweep_hook v850_elf_gc_sweep_hook
2210 #define elf_backend_can_gc_sections 1
2212 #define bfd_elf32_bfd_is_local_label_name v850_elf_is_local_label_name
2213 #define bfd_elf32_bfd_reloc_type_lookup v850_elf_reloc_type_lookup
2214 #define bfd_elf32_bfd_merge_private_bfd_data v850_elf_merge_private_bfd_data
2215 #define bfd_elf32_bfd_set_private_flags v850_elf_set_private_flags
2216 #define bfd_elf32_bfd_print_private_bfd_data v850_elf_print_private_bfd_data
2218 #define elf_symbol_leading_char '_'
2220 #include "elf32-target.h"