1 /* V850-specific support for 32-bit ELF
2 Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
4 This file is part of BFD, the Binary File Descriptor library.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
22 /* XXX FIXME: This code is littered with 32bit int, 16bit short, 8bit char
23 dependencies. As is the gas & simulator code or the v850. */
33 /* sign-extend a 24-bit number */
34 #define SEXT24(x) ((((x) & 0xffffff) ^ (~ 0x7fffff)) + 0x800000)
36 static reloc_howto_type
*v850_elf_reloc_type_lookup
37 PARAMS ((bfd
*abfd
, bfd_reloc_code_real_type code
));
38 static void v850_elf_info_to_howto_rel
39 PARAMS ((bfd
*, arelent
*, Elf32_Internal_Rel
*));
40 static void v850_elf_info_to_howto_rela
41 PARAMS ((bfd
*, arelent
*, Elf32_Internal_Rela
*));
42 static bfd_reloc_status_type v850_elf_reloc
43 PARAMS ((bfd
*, arelent
*, asymbol
*, PTR
, asection
*, bfd
*, char **));
44 static boolean v850_elf_is_local_label_name
45 PARAMS ((bfd
*, const char *));
46 static boolean v850_elf_relocate_section
47 PARAMS((bfd
*, struct bfd_link_info
*, bfd
*, asection
*, bfd_byte
*,
48 Elf_Internal_Rela
*, Elf_Internal_Sym
*, asection
**));
49 static bfd_reloc_status_type v850_elf_perform_relocation
50 PARAMS ((bfd
*, int, bfd_vma
, bfd_byte
*));
51 static boolean v850_elf_check_relocs
52 PARAMS ((bfd
*, struct bfd_link_info
*, asection
*, const Elf_Internal_Rela
*));
53 static void remember_hi16s_reloc
54 PARAMS ((bfd
*, bfd_vma
, bfd_byte
*));
55 static bfd_byte
* find_remembered_hi16s_reloc
56 PARAMS ((bfd_vma
, boolean
*));
57 static bfd_reloc_status_type v850_elf_final_link_relocate
58 PARAMS ((reloc_howto_type
*, bfd
*, bfd
*, asection
*, bfd_byte
*, bfd_vma
,
59 bfd_vma
, bfd_vma
, struct bfd_link_info
*, asection
*, int));
60 static boolean v850_elf_object_p
62 static boolean v850_elf_fake_sections
63 PARAMS ((bfd
*, Elf32_Internal_Shdr
*, asection
*));
64 static void v850_elf_final_write_processing
65 PARAMS ((bfd
*, boolean
));
66 static boolean v850_elf_set_private_flags
67 PARAMS ((bfd
*, flagword
));
68 static boolean v850_elf_copy_private_bfd_data
69 PARAMS ((bfd
*, bfd
*));
70 static boolean v850_elf_merge_private_bfd_data
71 PARAMS ((bfd
*, bfd
*));
72 static boolean v850_elf_print_private_bfd_data
73 PARAMS ((bfd
*, PTR
));
74 static boolean v850_elf_section_from_bfd_section
75 PARAMS ((bfd
*, Elf32_Internal_Shdr
*, asection
*, int *));
76 static void v850_elf_symbol_processing
77 PARAMS ((bfd
*, asymbol
*));
78 static boolean v850_elf_add_symbol_hook
79 PARAMS ((bfd
*, struct bfd_link_info
*, const Elf_Internal_Sym
*,
80 const char **, flagword
*, asection
**, bfd_vma
*));
81 static boolean v850_elf_link_output_symbol_hook
82 PARAMS ((bfd
*, struct bfd_link_info
*, const char *,
83 Elf_Internal_Sym
*, asection
*));
84 static boolean v850_elf_section_from_shdr
85 PARAMS ((bfd
*, Elf_Internal_Shdr
*, char *));
87 /* Note: It is REQUIRED that the 'type' value of each entry in this array
88 match the index of the entry in the array. */
89 static reloc_howto_type v850_elf_howto_table
[] =
91 /* This reloc does nothing. */
92 HOWTO (R_V850_NONE
, /* type */
94 2, /* size (0 = byte, 1 = short, 2 = long) */
96 false, /* pc_relative */
98 complain_overflow_bitfield
, /* complain_on_overflow */
99 bfd_elf_generic_reloc
, /* special_function */
100 "R_V850_NONE", /* name */
101 false, /* partial_inplace */
104 false), /* pcrel_offset */
106 /* A PC relative 9 bit branch. */
107 HOWTO (R_V850_9_PCREL
, /* type */
109 2, /* size (0 = byte, 1 = short, 2 = long) */
111 true, /* pc_relative */
113 complain_overflow_bitfield
, /* complain_on_overflow */
114 v850_elf_reloc
, /* special_function */
115 "R_V850_9_PCREL", /* name */
116 false, /* partial_inplace */
117 0x00ffffff, /* src_mask */
118 0x00ffffff, /* dst_mask */
119 true), /* pcrel_offset */
121 /* A PC relative 22 bit branch. */
122 HOWTO (R_V850_22_PCREL
, /* type */
124 2, /* size (0 = byte, 1 = short, 2 = long) */
126 true, /* pc_relative */
128 complain_overflow_signed
, /* complain_on_overflow */
129 v850_elf_reloc
, /* special_function */
130 "R_V850_22_PCREL", /* name */
131 false, /* partial_inplace */
132 0x07ffff80, /* src_mask */
133 0x07ffff80, /* dst_mask */
134 true), /* pcrel_offset */
136 /* High 16 bits of symbol value. */
137 HOWTO (R_V850_HI16_S
, /* type */
139 1, /* size (0 = byte, 1 = short, 2 = long) */
141 false, /* pc_relative */
143 complain_overflow_dont
, /* complain_on_overflow */
144 v850_elf_reloc
, /* special_function */
145 "R_V850_HI16_S", /* name */
146 false, /* partial_inplace */
147 0xffff, /* src_mask */
148 0xffff, /* dst_mask */
149 false), /* pcrel_offset */
151 /* High 16 bits of symbol value. */
152 HOWTO (R_V850_HI16
, /* type */
154 1, /* size (0 = byte, 1 = short, 2 = long) */
156 false, /* pc_relative */
158 complain_overflow_dont
, /* complain_on_overflow */
159 v850_elf_reloc
, /* special_function */
160 "R_V850_HI16", /* name */
161 false, /* partial_inplace */
162 0xffff, /* src_mask */
163 0xffff, /* dst_mask */
164 false), /* pcrel_offset */
166 /* Low 16 bits of symbol value. */
167 HOWTO (R_V850_LO16
, /* type */
169 1, /* size (0 = byte, 1 = short, 2 = long) */
171 false, /* pc_relative */
173 complain_overflow_dont
, /* complain_on_overflow */
174 v850_elf_reloc
, /* special_function */
175 "R_V850_LO16", /* name */
176 false, /* partial_inplace */
177 0xffff, /* src_mask */
178 0xffff, /* dst_mask */
179 false), /* pcrel_offset */
181 /* Simple 32bit reloc. */
182 HOWTO (R_V850_32
, /* type */
184 2, /* size (0 = byte, 1 = short, 2 = long) */
186 false, /* pc_relative */
188 complain_overflow_dont
, /* complain_on_overflow */
189 v850_elf_reloc
, /* special_function */
190 "R_V850_32", /* name */
191 false, /* partial_inplace */
192 0xffffffff, /* src_mask */
193 0xffffffff, /* dst_mask */
194 false), /* pcrel_offset */
196 /* Simple 16bit reloc. */
197 HOWTO (R_V850_16
, /* type */
199 1, /* size (0 = byte, 1 = short, 2 = long) */
201 false, /* pc_relative */
203 complain_overflow_dont
, /* complain_on_overflow */
204 bfd_elf_generic_reloc
, /* special_function */
205 "R_V850_16", /* name */
206 false, /* partial_inplace */
207 0xffff, /* src_mask */
208 0xffff, /* dst_mask */
209 false), /* pcrel_offset */
211 /* Simple 8bit reloc. */
212 HOWTO (R_V850_8
, /* type */
214 0, /* size (0 = byte, 1 = short, 2 = long) */
216 false, /* pc_relative */
218 complain_overflow_dont
, /* complain_on_overflow */
219 bfd_elf_generic_reloc
, /* special_function */
220 "R_V850_8", /* name */
221 false, /* partial_inplace */
224 false), /* pcrel_offset */
226 /* 16 bit offset from the short data area pointer. */
227 HOWTO (R_V850_SDA_16_16_OFFSET
, /* type */
229 1, /* size (0 = byte, 1 = short, 2 = long) */
231 false, /* pc_relative */
233 complain_overflow_dont
, /* complain_on_overflow */
234 v850_elf_reloc
, /* special_function */
235 "R_V850_SDA_16_16_OFFSET", /* name */
236 false, /* partial_inplace */
237 0xffff, /* src_mask */
238 0xffff, /* dst_mask */
239 false), /* pcrel_offset */
241 /* 15 bit offset from the short data area pointer. */
242 HOWTO (R_V850_SDA_15_16_OFFSET
, /* type */
244 1, /* size (0 = byte, 1 = short, 2 = long) */
246 false, /* pc_relative */
248 complain_overflow_dont
, /* complain_on_overflow */
249 v850_elf_reloc
, /* special_function */
250 "R_V850_SDA_15_16_OFFSET", /* name */
251 false, /* partial_inplace */
252 0xfffe, /* src_mask */
253 0xfffe, /* dst_mask */
254 false), /* pcrel_offset */
256 /* 16 bit offset from the zero data area pointer. */
257 HOWTO (R_V850_ZDA_16_16_OFFSET
, /* type */
259 1, /* size (0 = byte, 1 = short, 2 = long) */
261 false, /* pc_relative */
263 complain_overflow_dont
, /* complain_on_overflow */
264 v850_elf_reloc
, /* special_function */
265 "R_V850_ZDA_16_16_OFFSET", /* name */
266 false, /* partial_inplace */
267 0xffff, /* src_mask */
268 0xffff, /* dst_mask */
269 false), /* pcrel_offset */
271 /* 15 bit offset from the zero data area pointer. */
272 HOWTO (R_V850_ZDA_15_16_OFFSET
, /* type */
274 1, /* size (0 = byte, 1 = short, 2 = long) */
276 false, /* pc_relative */
278 complain_overflow_dont
, /* complain_on_overflow */
279 v850_elf_reloc
, /* special_function */
280 "R_V850_ZDA_15_16_OFFSET", /* name */
281 false, /* partial_inplace */
282 0xfffe, /* src_mask */
283 0xfffe, /* dst_mask */
284 false), /* pcrel_offset */
286 /* 6 bit offset from the tiny data area pointer. */
287 HOWTO (R_V850_TDA_6_8_OFFSET
, /* type */
289 1, /* size (0 = byte, 1 = short, 2 = long) */
291 false, /* pc_relative */
293 complain_overflow_dont
, /* complain_on_overflow */
294 v850_elf_reloc
, /* special_function */
295 "R_V850_TDA_6_8_OFFSET", /* name */
296 false, /* partial_inplace */
299 false), /* pcrel_offset */
301 /* 8 bit offset from the tiny data area pointer. */
302 HOWTO (R_V850_TDA_7_8_OFFSET
, /* type */
304 1, /* size (0 = byte, 1 = short, 2 = long) */
306 false, /* pc_relative */
308 complain_overflow_dont
, /* complain_on_overflow */
309 v850_elf_reloc
, /* special_function */
310 "R_V850_TDA_7_8_OFFSET", /* name */
311 false, /* partial_inplace */
314 false), /* pcrel_offset */
316 /* 7 bit offset from the tiny data area pointer. */
317 HOWTO (R_V850_TDA_7_7_OFFSET
, /* type */
319 1, /* size (0 = byte, 1 = short, 2 = long) */
321 false, /* pc_relative */
323 complain_overflow_dont
, /* complain_on_overflow */
324 v850_elf_reloc
, /* special_function */
325 "R_V850_TDA_7_7_OFFSET", /* name */
326 false, /* partial_inplace */
329 false), /* pcrel_offset */
331 /* 16 bit offset from the tiny data area pointer! */
332 HOWTO (R_V850_TDA_16_16_OFFSET
, /* type */
334 1, /* size (0 = byte, 1 = short, 2 = long) */
336 false, /* pc_relative */
338 complain_overflow_dont
, /* complain_on_overflow */
339 v850_elf_reloc
, /* special_function */
340 "R_V850_TDA_16_16_OFFSET", /* name */
341 false, /* partial_inplace */
342 0xffff, /* src_mask */
343 0xfff, /* dst_mask */
344 false), /* pcrel_offset */
346 /* 5 bit offset from the tiny data area pointer. */
347 HOWTO (R_V850_TDA_4_5_OFFSET
, /* type */
349 1, /* size (0 = byte, 1 = short, 2 = long) */
351 false, /* pc_relative */
353 complain_overflow_dont
, /* complain_on_overflow */
354 v850_elf_reloc
, /* special_function */
355 "R_V850_TDA_4_5_OFFSET", /* name */
356 false, /* partial_inplace */
359 false), /* pcrel_offset */
361 /* 4 bit offset from the tiny data area pointer. */
362 HOWTO (R_V850_TDA_4_4_OFFSET
, /* type */
364 1, /* size (0 = byte, 1 = short, 2 = long) */
366 false, /* pc_relative */
368 complain_overflow_dont
, /* complain_on_overflow */
369 v850_elf_reloc
, /* special_function */
370 "R_V850_TDA_4_4_OFFSET", /* name */
371 false, /* partial_inplace */
374 false), /* pcrel_offset */
376 /* 16 bit offset from the short data area pointer. */
377 HOWTO (R_V850_SDA_16_16_SPLIT_OFFSET
, /* type */
379 2, /* size (0 = byte, 1 = short, 2 = long) */
381 false, /* pc_relative */
383 complain_overflow_dont
, /* complain_on_overflow */
384 v850_elf_reloc
, /* special_function */
385 "R_V850_SDA_16_16_SPLIT_OFFSET",/* name */
386 false, /* partial_inplace */
387 0xfffe0020, /* src_mask */
388 0xfffe0020, /* dst_mask */
389 false), /* pcrel_offset */
391 /* 16 bit offset from the zero data area pointer. */
392 HOWTO (R_V850_ZDA_16_16_SPLIT_OFFSET
, /* type */
394 2, /* size (0 = byte, 1 = short, 2 = long) */
396 false, /* pc_relative */
398 complain_overflow_dont
, /* complain_on_overflow */
399 v850_elf_reloc
, /* special_function */
400 "R_V850_ZDA_16_16_SPLIT_OFFSET",/* name */
401 false, /* partial_inplace */
402 0xfffe0020, /* src_mask */
403 0xfffe0020, /* dst_mask */
404 false), /* pcrel_offset */
406 /* 6 bit offset from the call table base pointer. */
407 HOWTO (R_V850_CALLT_6_7_OFFSET
, /* type */
409 1, /* size (0 = byte, 1 = short, 2 = long) */
411 false, /* pc_relative */
413 complain_overflow_dont
, /* complain_on_overflow */
414 v850_elf_reloc
, /* special_function */
415 "R_V850_CALLT_6_7_OFFSET", /* name */
416 false, /* partial_inplace */
419 false), /* pcrel_offset */
421 /* 16 bit offset from the call table base pointer. */
422 HOWTO (R_V850_CALLT_16_16_OFFSET
, /* type */
424 1, /* size (0 = byte, 1 = short, 2 = long) */
426 false, /* pc_relative */
428 complain_overflow_dont
, /* complain_on_overflow */
429 v850_elf_reloc
, /* special_function */
430 "R_V850_CALLT_16_16_OFFSET", /* name */
431 false, /* partial_inplace */
432 0xffff, /* src_mask */
433 0xffff, /* dst_mask */
434 false), /* pcrel_offset */
436 /* GNU extension to record C++ vtable hierarchy */
437 HOWTO (R_V850_GNU_VTINHERIT
, /* type */
439 2, /* size (0 = byte, 1 = short, 2 = long) */
441 false, /* pc_relative */
443 complain_overflow_dont
, /* complain_on_overflow */
444 NULL
, /* special_function */
445 "R_V850_GNU_VTINHERIT", /* name */
446 false, /* partial_inplace */
449 false), /* pcrel_offset */
451 /* GNU extension to record C++ vtable member usage */
452 HOWTO (R_V850_GNU_VTENTRY
, /* type */
454 2, /* size (0 = byte, 1 = short, 2 = long) */
456 false, /* pc_relative */
458 complain_overflow_dont
, /* complain_on_overflow */
459 _bfd_elf_rel_vtable_reloc_fn
, /* special_function */
460 "R_V850_GNU_VTENTRY", /* name */
461 false, /* partial_inplace */
464 false), /* pcrel_offset */
468 /* Map BFD reloc types to V850 ELF reloc types. */
470 struct v850_elf_reloc_map
472 /* BFD_RELOC_V850_CALLT_16_16_OFFSET is 258, which will not fix in an
474 bfd_reloc_code_real_type bfd_reloc_val
;
475 unsigned char elf_reloc_val
;
478 static const struct v850_elf_reloc_map v850_elf_reloc_map
[] =
480 { BFD_RELOC_NONE
, R_V850_NONE
},
481 { BFD_RELOC_V850_9_PCREL
, R_V850_9_PCREL
},
482 { BFD_RELOC_V850_22_PCREL
, R_V850_22_PCREL
},
483 { BFD_RELOC_HI16_S
, R_V850_HI16_S
},
484 { BFD_RELOC_HI16
, R_V850_HI16
},
485 { BFD_RELOC_LO16
, R_V850_LO16
},
486 { BFD_RELOC_32
, R_V850_32
},
487 { BFD_RELOC_16
, R_V850_16
},
488 { BFD_RELOC_8
, R_V850_8
},
489 { BFD_RELOC_V850_SDA_16_16_OFFSET
, R_V850_SDA_16_16_OFFSET
},
490 { BFD_RELOC_V850_SDA_15_16_OFFSET
, R_V850_SDA_15_16_OFFSET
},
491 { BFD_RELOC_V850_ZDA_16_16_OFFSET
, R_V850_ZDA_16_16_OFFSET
},
492 { BFD_RELOC_V850_ZDA_15_16_OFFSET
, R_V850_ZDA_15_16_OFFSET
},
493 { BFD_RELOC_V850_TDA_6_8_OFFSET
, R_V850_TDA_6_8_OFFSET
},
494 { BFD_RELOC_V850_TDA_7_8_OFFSET
, R_V850_TDA_7_8_OFFSET
},
495 { BFD_RELOC_V850_TDA_7_7_OFFSET
, R_V850_TDA_7_7_OFFSET
},
496 { BFD_RELOC_V850_TDA_16_16_OFFSET
, R_V850_TDA_16_16_OFFSET
},
497 { BFD_RELOC_V850_TDA_4_5_OFFSET
, R_V850_TDA_4_5_OFFSET
},
498 { BFD_RELOC_V850_TDA_4_4_OFFSET
, R_V850_TDA_4_4_OFFSET
},
499 { BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET
, R_V850_SDA_16_16_SPLIT_OFFSET
},
500 { BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET
, R_V850_ZDA_16_16_SPLIT_OFFSET
},
501 { BFD_RELOC_V850_CALLT_6_7_OFFSET
, R_V850_CALLT_6_7_OFFSET
},
502 { BFD_RELOC_V850_CALLT_16_16_OFFSET
, R_V850_CALLT_16_16_OFFSET
},
503 { BFD_RELOC_VTABLE_INHERIT
, R_V850_GNU_VTINHERIT
},
504 { BFD_RELOC_VTABLE_ENTRY
, R_V850_GNU_VTENTRY
},
509 /* Map a bfd relocation into the appropriate howto structure */
510 static reloc_howto_type
*
511 v850_elf_reloc_type_lookup (abfd
, code
)
513 bfd_reloc_code_real_type code
;
518 i
< sizeof (v850_elf_reloc_map
) / sizeof (struct v850_elf_reloc_map
);
521 if (v850_elf_reloc_map
[i
].bfd_reloc_val
== code
)
523 BFD_ASSERT (v850_elf_howto_table
[v850_elf_reloc_map
[i
].elf_reloc_val
].type
== v850_elf_reloc_map
[i
].elf_reloc_val
);
525 return & v850_elf_howto_table
[v850_elf_reloc_map
[i
].elf_reloc_val
];
533 /* Set the howto pointer for an V850 ELF reloc. */
535 v850_elf_info_to_howto_rel (abfd
, cache_ptr
, dst
)
538 Elf32_Internal_Rel
* dst
;
542 r_type
= ELF32_R_TYPE (dst
->r_info
);
543 BFD_ASSERT (r_type
< (unsigned int) R_V850_max
);
544 cache_ptr
->howto
= &v850_elf_howto_table
[r_type
];
547 /* Set the howto pointer for a V850 ELF reloc (type RELA). */
549 v850_elf_info_to_howto_rela (abfd
, cache_ptr
, dst
)
552 Elf32_Internal_Rela
*dst
;
556 r_type
= ELF32_R_TYPE (dst
->r_info
);
557 BFD_ASSERT (r_type
< (unsigned int) R_V850_max
);
558 cache_ptr
->howto
= &v850_elf_howto_table
[r_type
];
562 /* Look through the relocs for a section during the first phase, and
563 allocate space in the global offset table or procedure linkage
567 v850_elf_check_relocs (abfd
, info
, sec
, relocs
)
569 struct bfd_link_info
* info
;
571 const Elf_Internal_Rela
* relocs
;
575 Elf_Internal_Shdr
*symtab_hdr
;
576 struct elf_link_hash_entry
**sym_hashes
;
577 const Elf_Internal_Rela
*rel
;
578 const Elf_Internal_Rela
*rel_end
;
580 enum v850_reloc_type r_type
;
582 const char *common
= (const char *)0;
584 if (info
->relocateable
)
588 fprintf (stderr
, "v850_elf_check_relocs called for section %s in %s\n",
589 bfd_get_section_name (abfd
, sec
),
590 bfd_get_filename (abfd
));
593 dynobj
= elf_hash_table (info
)->dynobj
;
594 symtab_hdr
= &elf_tdata (abfd
)->symtab_hdr
;
595 sym_hashes
= elf_sym_hashes (abfd
);
598 rel_end
= relocs
+ sec
->reloc_count
;
599 for (rel
= relocs
; rel
< rel_end
; rel
++)
601 unsigned long r_symndx
;
602 struct elf_link_hash_entry
*h
;
604 r_symndx
= ELF32_R_SYM (rel
->r_info
);
605 if (r_symndx
< symtab_hdr
->sh_info
)
608 h
= sym_hashes
[r_symndx
- symtab_hdr
->sh_info
];
610 r_type
= (enum v850_reloc_type
) ELF32_R_TYPE (rel
->r_info
);
616 case R_V850_22_PCREL
:
623 case R_V850_CALLT_6_7_OFFSET
:
624 case R_V850_CALLT_16_16_OFFSET
:
627 /* This relocation describes the C++ object vtable hierarchy.
628 Reconstruct it for later use during GC. */
629 case R_V850_GNU_VTINHERIT
:
630 if (!_bfd_elf32_gc_record_vtinherit (abfd
, sec
, h
, rel
->r_offset
))
634 /* This relocation describes which C++ vtable entries are actually
635 used. Record for later use during GC. */
636 case R_V850_GNU_VTENTRY
:
637 if (!_bfd_elf32_gc_record_vtentry (abfd
, sec
, h
, rel
->r_addend
))
641 case R_V850_SDA_16_16_SPLIT_OFFSET
:
642 case R_V850_SDA_16_16_OFFSET
:
643 case R_V850_SDA_15_16_OFFSET
:
644 other
= V850_OTHER_SDA
;
646 goto small_data_common
;
648 case R_V850_ZDA_16_16_SPLIT_OFFSET
:
649 case R_V850_ZDA_16_16_OFFSET
:
650 case R_V850_ZDA_15_16_OFFSET
:
651 other
= V850_OTHER_ZDA
;
653 goto small_data_common
;
655 case R_V850_TDA_4_5_OFFSET
:
656 case R_V850_TDA_4_4_OFFSET
:
657 case R_V850_TDA_6_8_OFFSET
:
658 case R_V850_TDA_7_8_OFFSET
:
659 case R_V850_TDA_7_7_OFFSET
:
660 case R_V850_TDA_16_16_OFFSET
:
661 other
= V850_OTHER_TDA
;
665 #define V850_OTHER_MASK (V850_OTHER_TDA | V850_OTHER_SDA | V850_OTHER_ZDA)
670 h
->other
|= other
; /* flag which type of relocation was used */
671 if ((h
->other
& V850_OTHER_MASK
) != (other
& V850_OTHER_MASK
)
672 && (h
->other
& V850_OTHER_ERROR
) == 0)
675 static char buff
[200]; /* XXX */
677 switch (h
->other
& V850_OTHER_MASK
)
680 msg
= _("Variable `%s' cannot occupy in multiple small data regions");
682 case V850_OTHER_SDA
| V850_OTHER_ZDA
| V850_OTHER_TDA
:
683 msg
= _("Variable `%s' can only be in one of the small, zero, and tiny data regions");
685 case V850_OTHER_SDA
| V850_OTHER_ZDA
:
686 msg
= _("Variable `%s' cannot be in both small and zero data regions simultaneously");
688 case V850_OTHER_SDA
| V850_OTHER_TDA
:
689 msg
= _("Variable `%s' cannot be in both small and tiny data regions simultaneously");
691 case V850_OTHER_ZDA
| V850_OTHER_TDA
:
692 msg
= _("Variable `%s' cannot be in both zero and tiny data regions simultaneously");
696 sprintf (buff
, msg
, h
->root
.root
.string
);
697 info
->callbacks
->warning (info
, buff
, h
->root
.root
.string
,
698 abfd
, h
->root
.u
.def
.section
, 0);
700 bfd_set_error (bfd_error_bad_value
);
701 h
->other
|= V850_OTHER_ERROR
;
706 if (h
&& h
->root
.type
== bfd_link_hash_common
708 && !strcmp (bfd_get_section_name (abfd
, h
->root
.u
.c
.p
->section
), "COMMON"))
710 asection
*section
= h
->root
.u
.c
.p
->section
= bfd_make_section_old_way (abfd
, common
);
711 section
->flags
|= SEC_IS_COMMON
;
715 fprintf (stderr
, "v850_elf_check_relocs, found %s relocation for %s%s\n",
716 v850_elf_howto_table
[ (int)r_type
].name
,
717 (h
&& h
->root
.root
.string
) ? h
->root
.root
.string
: "<unknown>",
718 (h
->root
.type
== bfd_link_hash_common
) ? ", symbol is common" : "");
728 * In the old version, when an entry was checked out from the table,
729 * it was deleted. This produced an error if the entry was needed
730 * more than once, as the second attempted retry failed.
732 * In the current version, the entry is not deleted, instead we set
733 * the field 'found' to true. If a second lookup matches the same
734 * entry, then we know that the hi16s reloc has already been updated
735 * and does not need to be updated a second time.
737 * TODO - TOFIX: If it is possible that we need to restore 2 different
738 * addresses from the same table entry, where the first generates an
739 * overflow, whilst the second do not, then this code will fail.
742 typedef struct hi16s_location
746 unsigned long counter
;
748 struct hi16s_location
* next
;
752 static hi16s_location
* previous_hi16s
;
753 static hi16s_location
* free_hi16s
;
754 static unsigned long hi16s_counter
;
757 remember_hi16s_reloc (abfd
, addend
, address
)
762 hi16s_location
* entry
= NULL
;
764 /* Find a free structure. */
765 if (free_hi16s
== NULL
)
766 free_hi16s
= (hi16s_location
*) bfd_zalloc (abfd
, sizeof (* free_hi16s
));
769 free_hi16s
= free_hi16s
->next
;
771 entry
->addend
= addend
;
772 entry
->address
= address
;
773 entry
->counter
= hi16s_counter
++;
774 entry
->found
= false;
775 entry
->next
= previous_hi16s
;
776 previous_hi16s
= entry
;
778 /* Cope with wrap around of our counter. */
779 if (hi16s_counter
== 0)
781 /* XXX - Assume that all counter entries differ only in their low 16 bits. */
782 for (entry
= previous_hi16s
; entry
!= NULL
; entry
= entry
->next
)
783 entry
->counter
&= 0xffff;
785 hi16s_counter
= 0x10000;
792 find_remembered_hi16s_reloc (addend
, already_found
)
794 boolean
* already_found
;
796 hi16s_location
* match
= NULL
;
797 hi16s_location
* entry
;
798 hi16s_location
* previous
= NULL
;
799 hi16s_location
* prev
;
803 /* Search the table. Record the most recent entry that matches. */
804 for (entry
= previous_hi16s
; entry
; entry
= entry
->next
)
806 if (entry
->addend
== addend
807 && (match
== NULL
|| match
->counter
< entry
->counter
))
819 /* Extract the address. */
820 addr
= match
->address
;
822 /* Remeber if this entry has already been used before. */
824 * already_found
= match
->found
;
826 /* Note that this entry has now been used. */
832 /* FIXME: The code here probably ought to be removed and the code in reloc.c
833 allowed to do its stuff instead. At least for most of the relocs, anwyay. */
834 static bfd_reloc_status_type
835 v850_elf_perform_relocation (abfd
, r_type
, addend
, address
)
842 bfd_signed_vma saddend
= (bfd_signed_vma
) addend
;
847 /* fprintf (stderr, "reloc type %d not SUPPORTED\n", r_type ); */
848 return bfd_reloc_notsupported
;
851 bfd_put_32 (abfd
, addend
, address
);
854 case R_V850_22_PCREL
:
855 if (saddend
> 0x1fffff || saddend
< -0x200000)
856 return bfd_reloc_overflow
;
858 if ((addend
% 2) != 0)
859 return bfd_reloc_dangerous
;
861 insn
= bfd_get_32 (abfd
, address
);
863 insn
|= (((addend
& 0xfffe) << 16) | ((addend
& 0x3f0000) >> 16));
864 bfd_put_32 (abfd
, insn
, address
);
868 if (saddend
> 0xff || saddend
< -0x100)
869 return bfd_reloc_overflow
;
871 if ((addend
% 2) != 0)
872 return bfd_reloc_dangerous
;
874 insn
= bfd_get_16 (abfd
, address
);
876 insn
|= ((addend
& 0x1f0) << 7) | ((addend
& 0x0e) << 3);
880 addend
+= (bfd_get_16 (abfd
, address
) << 16);
881 addend
= (addend
>> 16);
886 /* Remember where this relocation took place. */
887 remember_hi16s_reloc (abfd
, addend
, address
);
889 addend
+= (bfd_get_16 (abfd
, address
) << 16);
890 addend
= (addend
>> 16) + ((addend
& 0x8000) != 0);
892 /* This relocation cannot overflow. */
900 /* Calculate the sum of the value stored in the instruction and the
901 addend and check for overflow from the low 16 bits into the high
902 16 bits. The assembler has already done some of this: If the
903 value stored in the instruction has its 15th bit set, (counting
904 from zero) then the assembler will have added 1 to the value
905 stored in the associated HI16S reloc. So for example, these
908 movhi hi( fred ), r0, r1
909 movea lo( fred ), r1, r1
911 will store 0 in the value fields for the MOVHI and MOVEA instructions
912 and addend will be the address of fred, but for these instructions:
914 movhi hi( fred + 0x123456), r0, r1
915 movea lo( fred + 0x123456), r1, r1
917 the value stored in the MOVHI instruction will be 0x12 and the value
918 stored in the MOVEA instruction will be 0x3456. If however the
921 movhi hi( fred + 0x10ffff), r0, r1
922 movea lo( fred + 0x10ffff), r1, r1
924 then the value stored in the MOVHI instruction would be 0x11 (not
925 0x10) and the value stored in the MOVEA instruction would be 0xffff.
926 Thus (assuming for the moment that the addend is 0), at run time the
927 MOVHI instruction loads 0x110000 into r1, then the MOVEA instruction
928 adds 0xffffffff (sign extension!) producing 0x10ffff. Similarly if
929 the instructions were:
931 movhi hi( fred - 1), r0, r1
932 movea lo( fred - 1), r1, r1
934 then 0 is stored in the MOVHI instruction and -1 is stored in the
937 Overflow can occur if the addition of the value stored in the
938 instruction plus the addend sets the 15th bit when before it was clear.
939 This is because the 15th bit will be sign extended into the high part,
940 thus reducing its value by one, but since the 15th bit was originally
941 clear, the assembler will not have added 1 to the previous HI16S reloc
942 to compensate for this effect. For example:
944 movhi hi( fred + 0x123456), r0, r1
945 movea lo( fred + 0x123456), r1, r1
947 The value stored in HI16S reloc is 0x12, the value stored in the LO16
948 reloc is 0x3456. If we assume that the address of fred is 0x00007000
949 then the relocations become:
951 HI16S: 0x0012 + (0x00007000 >> 16) = 0x12
952 LO16: 0x3456 + (0x00007000 & 0xffff) = 0xa456
954 but when the instructions are executed, the MOVEA instruction's value
955 is signed extended, so the sum becomes:
960 0x0011a456 but 'fred + 0x123456' = 0x0012a456
962 Note that if the 15th bit was set in the value stored in the LO16
963 reloc, then we do not have to do anything:
965 movhi hi( fred + 0x10ffff), r0, r1
966 movea lo( fred + 0x10ffff), r1, r1
968 HI16S: 0x0011 + (0x00007000 >> 16) = 0x11
969 LO16: 0xffff + (0x00007000 & 0xffff) = 0x6fff
974 0x00116fff = fred + 0x10ffff = 0x7000 + 0x10ffff
977 Overflow can also occur if the computation carries into the 16th bit
978 and it also results in the 15th bit having the same value as the 15th
979 bit of the original value. What happens is that the HI16S reloc
980 will have already examined the 15th bit of the original value and
981 added 1 to the high part if the bit is set. This compensates for the
982 sign extension of 15th bit of the result of the computation. But now
983 there is a carry into the 16th bit, and this has not been allowed for.
985 So, for example if fred is at address 0xf000:
987 movhi hi( fred + 0xffff), r0, r1 [bit 15 of the offset is set]
988 movea lo( fred + 0xffff), r1, r1
990 HI16S: 0x0001 + (0x0000f000 >> 16) = 0x0001
991 LO16: 0xffff + (0x0000f000 & 0xffff) = 0xefff (carry into bit 16 is lost)
996 0x0000efff but 'fred + 0xffff' = 0x0001efff
998 Similarly, if the 15th bit remains clear, but overflow occurs into
999 the 16th bit then (assuming the address of fred is 0xf000):
1001 movhi hi( fred + 0x7000), r0, r1 [bit 15 of the offset is clear]
1002 movea lo( fred + 0x7000), r1, r1
1004 HI16S: 0x0000 + (0x0000f000 >> 16) = 0x0000
1005 LO16: 0x7000 + (0x0000f000 & 0xffff) = 0x6fff (carry into bit 16 is lost)
1010 0x00006fff but 'fred + 0x7000' = 0x00016fff
1012 Note - there is no need to change anything if a carry occurs, and the
1013 15th bit changes its value from being set to being clear, as the HI16S
1014 reloc will have already added in 1 to the high part for us:
1016 movhi hi( fred + 0xffff), r0, r1 [bit 15 of the offset is set]
1017 movea lo( fred + 0xffff), r1, r1
1019 HI16S: 0x0001 + (0x00007000 >> 16)
1020 LO16: 0xffff + (0x00007000 & 0xffff) = 0x6fff (carry into bit 16 is lost)
1023 + 0x00006fff (bit 15 not set, so the top half is zero)
1025 0x00016fff which is right (assuming that fred is at 0x7000)
1027 but if the 15th bit goes from being clear to being set, then we must
1028 once again handle overflow:
1030 movhi hi( fred + 0x7000), r0, r1 [bit 15 of the offset is clear]
1031 movea lo( fred + 0x7000), r1, r1
1033 HI16S: 0x0000 + (0x0000ffff >> 16)
1034 LO16: 0x7000 + (0x0000ffff & 0xffff) = 0x6fff (carry into bit 16)
1037 + 0x00006fff (bit 15 not set, so the top half is zero)
1039 0x00006fff which is wrong (assuming that fred is at 0xffff)
1045 insn
= bfd_get_16 (abfd
, address
);
1046 result
= insn
+ addend
;
1048 #define BIT15_SET(x) ((x) & 0x8000)
1049 #define OVERFLOWS(a,i) ((((a) & 0xffff) + (i)) > 0xffff)
1051 if ((BIT15_SET (result
) && ! BIT15_SET (addend
))
1052 || (OVERFLOWS (addend
, insn
)
1053 && ((! BIT15_SET (insn
)) || (BIT15_SET (addend
)))))
1055 boolean already_updated
;
1056 bfd_byte
* hi16s_address
= find_remembered_hi16s_reloc
1057 (addend
, & already_updated
);
1059 /* Amend the matching HI16_S relocation. */
1060 if (hi16s_address
!= NULL
)
1062 if (! already_updated
)
1064 insn
= bfd_get_16 (abfd
, hi16s_address
);
1066 bfd_put_16 (abfd
, insn
, hi16s_address
);
1071 fprintf (stderr
, _("FAILED to find previous HI16 reloc\n"));
1072 return bfd_reloc_overflow
;
1076 /* Do not complain if value has top bit set, as this has been anticipated. */
1077 insn
= result
& 0xffff;
1082 addend
+= (char) bfd_get_8 (abfd
, address
);
1084 saddend
= (bfd_signed_vma
) addend
;
1086 if (saddend
> 0x7f || saddend
< -0x80)
1087 return bfd_reloc_overflow
;
1089 bfd_put_8 (abfd
, addend
, address
);
1090 return bfd_reloc_ok
;
1092 case R_V850_CALLT_16_16_OFFSET
:
1093 addend
+= bfd_get_16 (abfd
, address
);
1095 saddend
= (bfd_signed_vma
) addend
;
1097 if (saddend
> 0xffff || saddend
< 0)
1098 return bfd_reloc_overflow
;
1106 case R_V850_SDA_16_16_OFFSET
:
1107 case R_V850_ZDA_16_16_OFFSET
:
1108 case R_V850_TDA_16_16_OFFSET
:
1109 addend
+= bfd_get_16 (abfd
, address
);
1111 saddend
= (bfd_signed_vma
) addend
;
1113 if (saddend
> 0x7fff || saddend
< -0x8000)
1114 return bfd_reloc_overflow
;
1119 case R_V850_SDA_15_16_OFFSET
:
1120 case R_V850_ZDA_15_16_OFFSET
:
1121 insn
= bfd_get_16 (abfd
, address
);
1122 addend
+= (insn
& 0xfffe);
1124 saddend
= (bfd_signed_vma
) addend
;
1126 if (saddend
> 0x7ffe || saddend
< -0x8000)
1127 return bfd_reloc_overflow
;
1130 return bfd_reloc_dangerous
;
1132 insn
= (addend
& ~1) | (insn
& 1);
1135 case R_V850_TDA_6_8_OFFSET
:
1136 insn
= bfd_get_16 (abfd
, address
);
1137 addend
+= ((insn
& 0x7e) << 1);
1139 saddend
= (bfd_signed_vma
) addend
;
1141 if (saddend
> 0xfc || saddend
< 0)
1142 return bfd_reloc_overflow
;
1145 return bfd_reloc_dangerous
;
1148 insn
|= (addend
>> 1);
1151 case R_V850_TDA_7_8_OFFSET
:
1152 insn
= bfd_get_16 (abfd
, address
);
1153 addend
+= ((insn
& 0x7f) << 1);
1155 saddend
= (bfd_signed_vma
) addend
;
1157 if (saddend
> 0xfe || saddend
< 0)
1158 return bfd_reloc_overflow
;
1161 return bfd_reloc_dangerous
;
1164 insn
|= (addend
>> 1);
1167 case R_V850_TDA_7_7_OFFSET
:
1168 insn
= bfd_get_16 (abfd
, address
);
1169 addend
+= insn
& 0x7f;
1171 saddend
= (bfd_signed_vma
) addend
;
1173 if (saddend
> 0x7f || saddend
< 0)
1174 return bfd_reloc_overflow
;
1180 case R_V850_TDA_4_5_OFFSET
:
1181 insn
= bfd_get_16 (abfd
, address
);
1182 addend
+= ((insn
& 0xf) << 1);
1184 saddend
= (bfd_signed_vma
) addend
;
1186 if (saddend
> 0x1e || saddend
< 0)
1187 return bfd_reloc_overflow
;
1190 return bfd_reloc_dangerous
;
1193 insn
|= (addend
>> 1);
1196 case R_V850_TDA_4_4_OFFSET
:
1197 insn
= bfd_get_16 (abfd
, address
);
1198 addend
+= insn
& 0xf;
1200 saddend
= (bfd_signed_vma
) addend
;
1202 if (saddend
> 0xf || saddend
< 0)
1203 return bfd_reloc_overflow
;
1209 case R_V850_ZDA_16_16_SPLIT_OFFSET
:
1210 case R_V850_SDA_16_16_SPLIT_OFFSET
:
1211 insn
= bfd_get_32 (abfd
, address
);
1212 addend
+= ((insn
& 0xfffe0000) >> 16) + ((insn
& 0x20) >> 5);
1214 saddend
= (bfd_signed_vma
) addend
;
1216 if (saddend
> 0x7fff || saddend
< -0x8000)
1217 return bfd_reloc_overflow
;
1220 insn
|= (addend
& 1) << 5;
1221 insn
|= (addend
& ~1) << 16;
1223 bfd_put_32 (abfd
, insn
, address
);
1224 return bfd_reloc_ok
;
1226 case R_V850_CALLT_6_7_OFFSET
:
1227 insn
= bfd_get_16 (abfd
, address
);
1228 addend
+= ((insn
& 0x3f) << 1);
1230 saddend
= (bfd_signed_vma
) addend
;
1232 if (saddend
> 0x7e || saddend
< 0)
1233 return bfd_reloc_overflow
;
1236 return bfd_reloc_dangerous
;
1239 insn
|= (addend
>> 1);
1242 case R_V850_GNU_VTINHERIT
:
1243 case R_V850_GNU_VTENTRY
:
1244 return bfd_reloc_ok
;
1248 bfd_put_16 (abfd
, insn
, address
);
1249 return bfd_reloc_ok
;
1253 /* Insert the addend into the instruction. */
1254 static bfd_reloc_status_type
1255 v850_elf_reloc (abfd
, reloc
, symbol
, data
, isection
, obfd
, err
)
1260 asection
* isection
;
1266 /* If there is an output BFD,
1267 and the symbol is not a section name (which is only defined at final link time),
1268 and either we are not putting the addend into the instruction
1269 or the addend is zero, so there is nothing to add into the instruction
1270 then just fixup the address and return. */
1271 if (obfd
!= (bfd
*) NULL
1272 && (symbol
->flags
& BSF_SECTION_SYM
) == 0
1273 && (! reloc
->howto
->partial_inplace
1274 || reloc
->addend
== 0))
1276 reloc
->address
+= isection
->output_offset
;
1277 return bfd_reloc_ok
;
1280 else if (obfd
!= NULL
)
1282 return bfd_reloc_continue
;
1286 /* Catch relocs involving undefined symbols. */
1287 if (bfd_is_und_section (symbol
->section
)
1288 && (symbol
->flags
& BSF_WEAK
) == 0
1290 return bfd_reloc_undefined
;
1292 /* We handle final linking of some relocs ourselves. */
1294 /* Is the address of the relocation really within the section? */
1295 if (reloc
->address
> isection
->_cooked_size
)
1296 return bfd_reloc_outofrange
;
1298 /* Work out which section the relocation is targetted at and the
1299 initial relocation command value. */
1301 /* Get symbol value. (Common symbols are special.) */
1302 if (bfd_is_com_section (symbol
->section
))
1305 relocation
= symbol
->value
;
1307 /* Convert input-section-relative symbol value to absolute + addend. */
1308 relocation
+= symbol
->section
->output_section
->vma
;
1309 relocation
+= symbol
->section
->output_offset
;
1310 relocation
+= reloc
->addend
;
1312 if (reloc
->howto
->pc_relative
== true)
1314 /* Here the variable relocation holds the final address of the
1315 symbol we are relocating against, plus any addend. */
1316 relocation
-= isection
->output_section
->vma
+ isection
->output_offset
;
1318 /* Deal with pcrel_offset */
1319 relocation
-= reloc
->address
;
1322 reloc
->addend
= relocation
;
1323 return bfd_reloc_ok
;
1329 v850_elf_is_local_label_name (abfd
, name
)
1333 return ( (name
[0] == '.' && (name
[1] == 'L' || name
[1] == '.'))
1334 || (name
[0] == '_' && name
[1] == '.' && name
[2] == 'L' && name
[3] == '_'));
1338 /* Perform a relocation as part of a final link. */
1339 static bfd_reloc_status_type
1340 v850_elf_final_link_relocate (howto
, input_bfd
, output_bfd
,
1341 input_section
, contents
, offset
, value
,
1342 addend
, info
, sym_sec
, is_local
)
1343 reloc_howto_type
* howto
;
1346 asection
* input_section
;
1347 bfd_byte
* contents
;
1351 struct bfd_link_info
* info
;
1355 unsigned long r_type
= howto
->type
;
1356 bfd_byte
* hit_data
= contents
+ offset
;
1358 /* Adjust the value according to the relocation. */
1361 case R_V850_9_PCREL
:
1362 value
-= (input_section
->output_section
->vma
1363 + input_section
->output_offset
);
1367 case R_V850_22_PCREL
:
1368 value
-= (input_section
->output_section
->vma
1369 + input_section
->output_offset
1372 /* If the sign extension will corrupt the value then we have overflowed. */
1373 if (((value
& 0xff000000) != 0x0) && ((value
& 0xff000000) != 0xff000000))
1374 return bfd_reloc_overflow
;
1376 value
= SEXT24 (value
); /* Only the bottom 24 bits of the PC are valid */
1387 case R_V850_ZDA_15_16_OFFSET
:
1388 case R_V850_ZDA_16_16_OFFSET
:
1389 case R_V850_ZDA_16_16_SPLIT_OFFSET
:
1390 if (sym_sec
== NULL
)
1391 return bfd_reloc_undefined
;
1393 value
-= sym_sec
->output_section
->vma
;
1396 case R_V850_SDA_15_16_OFFSET
:
1397 case R_V850_SDA_16_16_OFFSET
:
1398 case R_V850_SDA_16_16_SPLIT_OFFSET
:
1401 struct bfd_link_hash_entry
* h
;
1403 if (sym_sec
== NULL
)
1404 return bfd_reloc_undefined
;
1406 /* Get the value of __gp. */
1407 h
= bfd_link_hash_lookup (info
->hash
, "__gp", false, false, true);
1408 if (h
== (struct bfd_link_hash_entry
*) NULL
1409 || h
->type
!= bfd_link_hash_defined
)
1410 return bfd_reloc_other
;
1412 gp
= (h
->u
.def
.value
1413 + h
->u
.def
.section
->output_section
->vma
1414 + h
->u
.def
.section
->output_offset
);
1416 value
-= sym_sec
->output_section
->vma
;
1417 value
-= (gp
- sym_sec
->output_section
->vma
);
1421 case R_V850_TDA_4_4_OFFSET
:
1422 case R_V850_TDA_4_5_OFFSET
:
1423 case R_V850_TDA_16_16_OFFSET
:
1424 case R_V850_TDA_7_7_OFFSET
:
1425 case R_V850_TDA_7_8_OFFSET
:
1426 case R_V850_TDA_6_8_OFFSET
:
1429 struct bfd_link_hash_entry
* h
;
1431 /* Get the value of __ep. */
1432 h
= bfd_link_hash_lookup (info
->hash
, "__ep", false, false, true);
1433 if (h
== (struct bfd_link_hash_entry
*) NULL
1434 || h
->type
!= bfd_link_hash_defined
)
1435 return bfd_reloc_continue
; /* Actually this indicates that __ep could not be found. */
1437 ep
= (h
->u
.def
.value
1438 + h
->u
.def
.section
->output_section
->vma
1439 + h
->u
.def
.section
->output_offset
);
1445 case R_V850_CALLT_6_7_OFFSET
:
1448 struct bfd_link_hash_entry
* h
;
1450 /* Get the value of __ctbp. */
1451 h
= bfd_link_hash_lookup (info
->hash
, "__ctbp", false, false, true);
1452 if (h
== (struct bfd_link_hash_entry
*) NULL
1453 || h
->type
!= bfd_link_hash_defined
)
1454 return (bfd_reloc_dangerous
+ 1); /* Actually this indicates that __ctbp could not be found. */
1456 ctbp
= (h
->u
.def
.value
1457 + h
->u
.def
.section
->output_section
->vma
1458 + h
->u
.def
.section
->output_offset
);
1463 case R_V850_CALLT_16_16_OFFSET
:
1466 struct bfd_link_hash_entry
* h
;
1468 if (sym_sec
== NULL
)
1469 return bfd_reloc_undefined
;
1471 /* Get the value of __ctbp. */
1472 h
= bfd_link_hash_lookup (info
->hash
, "__ctbp", false, false, true);
1473 if (h
== (struct bfd_link_hash_entry
*) NULL
1474 || h
->type
!= bfd_link_hash_defined
)
1475 return (bfd_reloc_dangerous
+ 1);
1477 ctbp
= (h
->u
.def
.value
1478 + h
->u
.def
.section
->output_section
->vma
1479 + h
->u
.def
.section
->output_offset
);
1481 value
-= sym_sec
->output_section
->vma
;
1482 value
-= (ctbp
- sym_sec
->output_section
->vma
);
1487 case R_V850_GNU_VTINHERIT
:
1488 case R_V850_GNU_VTENTRY
:
1489 return bfd_reloc_ok
;
1492 return bfd_reloc_notsupported
;
1495 /* Perform the relocation. */
1496 return v850_elf_perform_relocation (input_bfd
, r_type
, value
+ addend
, hit_data
);
1500 /* Relocate an V850 ELF section. */
1502 v850_elf_relocate_section (output_bfd
, info
, input_bfd
, input_section
,
1503 contents
, relocs
, local_syms
, local_sections
)
1505 struct bfd_link_info
* info
;
1507 asection
* input_section
;
1508 bfd_byte
* contents
;
1509 Elf_Internal_Rela
* relocs
;
1510 Elf_Internal_Sym
* local_syms
;
1511 asection
** local_sections
;
1513 Elf_Internal_Shdr
* symtab_hdr
;
1514 struct elf_link_hash_entry
** sym_hashes
;
1515 Elf_Internal_Rela
* rel
;
1516 Elf_Internal_Rela
* relend
;
1518 symtab_hdr
= & elf_tdata (input_bfd
)->symtab_hdr
;
1519 sym_hashes
= elf_sym_hashes (input_bfd
);
1521 if (sym_hashes
== NULL
)
1523 info
->callbacks
->warning
1524 (info
, "no hash table available", NULL
, input_bfd
, input_section
, 0);
1529 /* Reset the list of remembered HI16S relocs to empty. */
1530 free_hi16s
= previous_hi16s
;
1531 previous_hi16s
= NULL
;
1535 relend
= relocs
+ input_section
->reloc_count
;
1536 for (; rel
< relend
; rel
++)
1539 reloc_howto_type
* howto
;
1540 unsigned long r_symndx
;
1541 Elf_Internal_Sym
* sym
;
1543 struct elf_link_hash_entry
* h
;
1545 bfd_reloc_status_type r
;
1547 r_symndx
= ELF32_R_SYM (rel
->r_info
);
1548 r_type
= ELF32_R_TYPE (rel
->r_info
);
1550 if (r_type
== R_V850_GNU_VTENTRY
1551 || r_type
== R_V850_GNU_VTINHERIT
)
1554 howto
= v850_elf_howto_table
+ r_type
;
1556 if (info
->relocateable
)
1558 /* This is a relocateable link. We don't have to change
1559 anything, unless the reloc is against a section symbol,
1560 in which case we have to adjust according to where the
1561 section symbol winds up in the output section. */
1562 if (r_symndx
< symtab_hdr
->sh_info
)
1564 sym
= local_syms
+ r_symndx
;
1565 if (ELF_ST_TYPE (sym
->st_info
) == STT_SECTION
)
1567 sec
= local_sections
[r_symndx
];
1568 rel
->r_addend
+= sec
->output_offset
+ sym
->st_value
;
1575 /* This is a final link. */
1579 if (r_symndx
< symtab_hdr
->sh_info
)
1581 sym
= local_syms
+ r_symndx
;
1582 sec
= local_sections
[r_symndx
];
1583 relocation
= (sec
->output_section
->vma
1584 + sec
->output_offset
1589 name
= bfd_elf_string_from_elf_section (input_bfd
, symtab_hdr
->sh_link
, sym
->st_name
);
1590 name
= (name
== NULL
) ? "<none>" : name
;
1591 fprintf (stderr
, "local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n",
1592 sec
->name
, name
, sym
->st_name
,
1593 sec
->output_section
->vma
, sec
->output_offset
, sym
->st_value
, rel
->r_addend
);
1599 h
= sym_hashes
[r_symndx
- symtab_hdr
->sh_info
];
1601 while (h
->root
.type
== bfd_link_hash_indirect
1602 || h
->root
.type
== bfd_link_hash_warning
)
1603 h
= (struct elf_link_hash_entry
*) h
->root
.u
.i
.link
;
1605 if (h
->root
.type
== bfd_link_hash_defined
1606 || h
->root
.type
== bfd_link_hash_defweak
)
1608 sec
= h
->root
.u
.def
.section
;
1609 relocation
= (h
->root
.u
.def
.value
1610 + sec
->output_section
->vma
1611 + sec
->output_offset
);
1613 fprintf (stderr
, "defined: sec: %s, name: %s, value: %x + %x + %x gives: %x\n",
1614 sec
->name
, h
->root
.root
.string
, h
->root
.u
.def
.value
, sec
->output_section
->vma
, sec
->output_offset
, relocation
);
1617 else if (h
->root
.type
== bfd_link_hash_undefweak
)
1620 fprintf (stderr
, "undefined: sec: %s, name: %s\n",
1621 sec
->name
, h
->root
.root
.string
);
1627 if (! ((*info
->callbacks
->undefined_symbol
)
1628 (info
, h
->root
.root
.string
, input_bfd
,
1629 input_section
, rel
->r_offset
)))
1632 fprintf (stderr
, "unknown: name: %s\n", h
->root
.root
.string
);
1638 /* FIXME: We should use the addend, but the COFF relocations
1640 r
= v850_elf_final_link_relocate (howto
, input_bfd
, output_bfd
,
1642 contents
, rel
->r_offset
,
1643 relocation
, rel
->r_addend
,
1644 info
, sec
, h
== NULL
);
1646 if (r
!= bfd_reloc_ok
)
1649 const char * msg
= (const char *)0;
1652 name
= h
->root
.root
.string
;
1655 name
= (bfd_elf_string_from_elf_section
1656 (input_bfd
, symtab_hdr
->sh_link
, sym
->st_name
));
1657 if (name
== NULL
|| *name
== '\0')
1658 name
= bfd_section_name (input_bfd
, sec
);
1663 case bfd_reloc_overflow
:
1664 if (! ((*info
->callbacks
->reloc_overflow
)
1665 (info
, name
, howto
->name
, (bfd_vma
) 0,
1666 input_bfd
, input_section
, rel
->r_offset
)))
1670 case bfd_reloc_undefined
:
1671 if (! ((*info
->callbacks
->undefined_symbol
)
1672 (info
, name
, input_bfd
, input_section
,
1677 case bfd_reloc_outofrange
:
1678 msg
= _("internal error: out of range error");
1681 case bfd_reloc_notsupported
:
1682 msg
= _("internal error: unsupported relocation error");
1685 case bfd_reloc_dangerous
:
1686 msg
= _("internal error: dangerous relocation");
1689 case bfd_reloc_other
:
1690 msg
= _("could not locate special linker symbol __gp");
1693 case bfd_reloc_continue
:
1694 msg
= _("could not locate special linker symbol __ep");
1697 case (bfd_reloc_dangerous
+ 1):
1698 msg
= _("could not locate special linker symbol __ctbp");
1702 msg
= _("internal error: unknown error");
1706 if (!((*info
->callbacks
->warning
)
1707 (info
, msg
, name
, input_bfd
, input_section
,
1719 v850_elf_gc_sweep_hook (abfd
, info
, sec
, relocs
)
1721 struct bfd_link_info
*info
;
1723 const Elf_Internal_Rela
*relocs
;
1725 /* No got and plt entries for v850-elf */
1730 v850_elf_gc_mark_hook (abfd
, info
, rel
, h
, sym
)
1732 struct bfd_link_info
*info
;
1733 Elf_Internal_Rela
*rel
;
1734 struct elf_link_hash_entry
*h
;
1735 Elf_Internal_Sym
*sym
;
1739 switch (ELF32_R_TYPE (rel
->r_info
))
1741 case R_V850_GNU_VTINHERIT
:
1742 case R_V850_GNU_VTENTRY
:
1746 switch (h
->root
.type
)
1748 case bfd_link_hash_defined
:
1749 case bfd_link_hash_defweak
:
1750 return h
->root
.u
.def
.section
;
1752 case bfd_link_hash_common
:
1753 return h
->root
.u
.c
.p
->section
;
1759 if (!(elf_bad_symtab (abfd
)
1760 && ELF_ST_BIND (sym
->st_info
) != STB_LOCAL
)
1761 && ! ((sym
->st_shndx
<= 0 || sym
->st_shndx
>= SHN_LORESERVE
)
1762 && sym
->st_shndx
!= SHN_COMMON
))
1764 return bfd_section_from_elf_index (abfd
, sym
->st_shndx
);
1769 /* Set the right machine number. */
1771 v850_elf_object_p (abfd
)
1774 switch (elf_elfheader (abfd
)->e_flags
& EF_V850_ARCH
)
1777 case E_V850_ARCH
: (void) bfd_default_set_arch_mach (abfd
, bfd_arch_v850
, 0); break;
1778 case E_V850E_ARCH
: (void) bfd_default_set_arch_mach (abfd
, bfd_arch_v850
, bfd_mach_v850e
); break;
1779 case E_V850EA_ARCH
: (void) bfd_default_set_arch_mach (abfd
, bfd_arch_v850
, bfd_mach_v850ea
); break;
1784 /* Store the machine number in the flags field. */
1786 v850_elf_final_write_processing (abfd
, linker
)
1792 switch (bfd_get_mach (abfd
))
1795 case 0: val
= E_V850_ARCH
; break;
1796 case bfd_mach_v850e
: val
= E_V850E_ARCH
; break;
1797 case bfd_mach_v850ea
: val
= E_V850EA_ARCH
; break;
1800 elf_elfheader (abfd
)->e_flags
&=~ EF_V850_ARCH
;
1801 elf_elfheader (abfd
)->e_flags
|= val
;
1804 /* Function to keep V850 specific file flags. */
1806 v850_elf_set_private_flags (abfd
, flags
)
1810 BFD_ASSERT (!elf_flags_init (abfd
)
1811 || elf_elfheader (abfd
)->e_flags
== flags
);
1813 elf_elfheader (abfd
)->e_flags
= flags
;
1814 elf_flags_init (abfd
) = true;
1818 /* Copy backend specific data from one object module to another */
1820 v850_elf_copy_private_bfd_data (ibfd
, obfd
)
1824 if ( bfd_get_flavour (ibfd
) != bfd_target_elf_flavour
1825 || bfd_get_flavour (obfd
) != bfd_target_elf_flavour
)
1828 BFD_ASSERT (!elf_flags_init (obfd
)
1829 || (elf_elfheader (obfd
)->e_flags
1830 == elf_elfheader (ibfd
)->e_flags
));
1832 elf_gp (obfd
) = elf_gp (ibfd
);
1833 elf_elfheader (obfd
)->e_flags
= elf_elfheader (ibfd
)->e_flags
;
1834 elf_flags_init (obfd
) = true;
1838 /* Merge backend specific data from an object file to the output
1839 object file when linking. */
1841 v850_elf_merge_private_bfd_data (ibfd
, obfd
)
1848 if ( bfd_get_flavour (ibfd
) != bfd_target_elf_flavour
1849 || bfd_get_flavour (obfd
) != bfd_target_elf_flavour
)
1852 in_flags
= elf_elfheader (ibfd
)->e_flags
;
1853 out_flags
= elf_elfheader (obfd
)->e_flags
;
1855 if (! elf_flags_init (obfd
))
1857 /* If the input is the default architecture then do not
1858 bother setting the flags for the output architecture,
1859 instead allow future merges to do this. If no future
1860 merges ever set these flags then they will retain their
1861 unitialised values, which surprise surprise, correspond
1862 to the default values. */
1863 if (bfd_get_arch_info (ibfd
)->the_default
)
1866 elf_flags_init (obfd
) = true;
1867 elf_elfheader (obfd
)->e_flags
= in_flags
;
1869 if (bfd_get_arch (obfd
) == bfd_get_arch (ibfd
)
1870 && bfd_get_arch_info (obfd
)->the_default
)
1872 return bfd_set_arch_mach (obfd
, bfd_get_arch (ibfd
), bfd_get_mach (ibfd
));
1878 /* Check flag compatibility. */
1879 if (in_flags
== out_flags
)
1882 if ((in_flags
& EF_V850_ARCH
) != (out_flags
& EF_V850_ARCH
)
1883 && (in_flags
& EF_V850_ARCH
) != E_V850_ARCH
)
1884 _bfd_error_handler (_("%s: Architecture mismatch with previous modules"),
1885 bfd_get_filename (ibfd
));
1889 /* Display the flags field */
1892 v850_elf_print_private_bfd_data (abfd
, ptr
)
1896 FILE * file
= (FILE *) ptr
;
1898 BFD_ASSERT (abfd
!= NULL
&& ptr
!= NULL
);
1900 _bfd_elf_print_private_bfd_data (abfd
, ptr
);
1902 /* xgettext:c-format */
1903 fprintf (file
, _("private flags = %lx: "), elf_elfheader (abfd
)->e_flags
);
1905 switch (elf_elfheader (abfd
)->e_flags
& EF_V850_ARCH
)
1908 case E_V850_ARCH
: fprintf (file
, _("v850 architecture")); break;
1909 case E_V850E_ARCH
: fprintf (file
, _("v850e architecture")); break;
1910 case E_V850EA_ARCH
: fprintf (file
, _("v850ea architecture")); break;
1918 /* V850 ELF uses four common sections. One is the usual one, and the
1919 others are for (small) objects in one of the special data areas:
1920 small, tiny and zero. All the objects are kept together, and then
1921 referenced via the gp register, the ep register or the r0 register
1922 respectively, which yields smaller, faster assembler code. This
1923 approach is copied from elf32-mips.c. */
1925 static asection v850_elf_scom_section
;
1926 static asymbol v850_elf_scom_symbol
;
1927 static asymbol
* v850_elf_scom_symbol_ptr
;
1928 static asection v850_elf_tcom_section
;
1929 static asymbol v850_elf_tcom_symbol
;
1930 static asymbol
* v850_elf_tcom_symbol_ptr
;
1931 static asection v850_elf_zcom_section
;
1932 static asymbol v850_elf_zcom_symbol
;
1933 static asymbol
* v850_elf_zcom_symbol_ptr
;
1936 /* Given a BFD section, try to locate the corresponding ELF section
1940 v850_elf_section_from_bfd_section (abfd
, hdr
, sec
, retval
)
1942 Elf32_Internal_Shdr
* hdr
;
1946 if (strcmp (bfd_get_section_name (abfd
, sec
), ".scommon") == 0)
1947 *retval
= SHN_V850_SCOMMON
;
1948 else if (strcmp (bfd_get_section_name (abfd
, sec
), ".tcommon") == 0)
1949 *retval
= SHN_V850_TCOMMON
;
1950 else if (strcmp (bfd_get_section_name (abfd
, sec
), ".zcommon") == 0)
1951 *retval
= SHN_V850_ZCOMMON
;
1958 /* Handle the special V850 section numbers that a symbol may use. */
1961 v850_elf_symbol_processing (abfd
, asym
)
1965 elf_symbol_type
* elfsym
= (elf_symbol_type
*) asym
;
1966 unsigned short index
;
1968 index
= elfsym
->internal_elf_sym
.st_shndx
;
1970 /* If the section index is an "ordinary" index, then it may
1971 refer to a v850 specific section created by the assembler.
1972 Check the section's type and change the index it matches.
1974 FIXME: Should we alter the st_shndx field as well ? */
1976 if (index
< elf_elfheader(abfd
)[0].e_shnum
)
1977 switch (elf_elfsections(abfd
)[index
]->sh_type
)
1979 case SHT_V850_SCOMMON
:
1980 index
= SHN_V850_SCOMMON
;
1983 case SHT_V850_TCOMMON
:
1984 index
= SHN_V850_TCOMMON
;
1987 case SHT_V850_ZCOMMON
:
1988 index
= SHN_V850_ZCOMMON
;
1997 case SHN_V850_SCOMMON
:
1998 if (v850_elf_scom_section
.name
== NULL
)
2000 /* Initialize the small common section. */
2001 v850_elf_scom_section
.name
= ".scommon";
2002 v850_elf_scom_section
.flags
= SEC_IS_COMMON
| SEC_ALLOC
| SEC_DATA
;
2003 v850_elf_scom_section
.output_section
= & v850_elf_scom_section
;
2004 v850_elf_scom_section
.symbol
= & v850_elf_scom_symbol
;
2005 v850_elf_scom_section
.symbol_ptr_ptr
= & v850_elf_scom_symbol_ptr
;
2006 v850_elf_scom_symbol
.name
= ".scommon";
2007 v850_elf_scom_symbol
.flags
= BSF_SECTION_SYM
;
2008 v850_elf_scom_symbol
.section
= & v850_elf_scom_section
;
2009 v850_elf_scom_symbol_ptr
= & v850_elf_scom_symbol
;
2011 asym
->section
= & v850_elf_scom_section
;
2012 asym
->value
= elfsym
->internal_elf_sym
.st_size
;
2015 case SHN_V850_TCOMMON
:
2016 if (v850_elf_tcom_section
.name
== NULL
)
2018 /* Initialize the tcommon section. */
2019 v850_elf_tcom_section
.name
= ".tcommon";
2020 v850_elf_tcom_section
.flags
= SEC_IS_COMMON
;
2021 v850_elf_tcom_section
.output_section
= & v850_elf_tcom_section
;
2022 v850_elf_tcom_section
.symbol
= & v850_elf_tcom_symbol
;
2023 v850_elf_tcom_section
.symbol_ptr_ptr
= & v850_elf_tcom_symbol_ptr
;
2024 v850_elf_tcom_symbol
.name
= ".tcommon";
2025 v850_elf_tcom_symbol
.flags
= BSF_SECTION_SYM
;
2026 v850_elf_tcom_symbol
.section
= & v850_elf_tcom_section
;
2027 v850_elf_tcom_symbol_ptr
= & v850_elf_tcom_symbol
;
2029 asym
->section
= & v850_elf_tcom_section
;
2030 asym
->value
= elfsym
->internal_elf_sym
.st_size
;
2033 case SHN_V850_ZCOMMON
:
2034 if (v850_elf_zcom_section
.name
== NULL
)
2036 /* Initialize the zcommon section. */
2037 v850_elf_zcom_section
.name
= ".zcommon";
2038 v850_elf_zcom_section
.flags
= SEC_IS_COMMON
;
2039 v850_elf_zcom_section
.output_section
= & v850_elf_zcom_section
;
2040 v850_elf_zcom_section
.symbol
= & v850_elf_zcom_symbol
;
2041 v850_elf_zcom_section
.symbol_ptr_ptr
= & v850_elf_zcom_symbol_ptr
;
2042 v850_elf_zcom_symbol
.name
= ".zcommon";
2043 v850_elf_zcom_symbol
.flags
= BSF_SECTION_SYM
;
2044 v850_elf_zcom_symbol
.section
= & v850_elf_zcom_section
;
2045 v850_elf_zcom_symbol_ptr
= & v850_elf_zcom_symbol
;
2047 asym
->section
= & v850_elf_zcom_section
;
2048 asym
->value
= elfsym
->internal_elf_sym
.st_size
;
2053 /* Hook called by the linker routine which adds symbols from an object
2054 file. We must handle the special v850 section numbers here. */
2058 v850_elf_add_symbol_hook (abfd
, info
, sym
, namep
, flagsp
, secp
, valp
)
2060 struct bfd_link_info
* info
;
2061 const Elf_Internal_Sym
* sym
;
2062 const char ** namep
;
2067 int index
= sym
->st_shndx
;
2069 /* If the section index is an "ordinary" index, then it may
2070 refer to a v850 specific section created by the assembler.
2071 Check the section's type and change the index it matches.
2073 FIXME: Should we alter the st_shndx field as well ? */
2075 if (index
< elf_elfheader(abfd
)[0].e_shnum
)
2076 switch (elf_elfsections(abfd
)[index
]->sh_type
)
2078 case SHT_V850_SCOMMON
:
2079 index
= SHN_V850_SCOMMON
;
2082 case SHT_V850_TCOMMON
:
2083 index
= SHN_V850_TCOMMON
;
2086 case SHT_V850_ZCOMMON
:
2087 index
= SHN_V850_ZCOMMON
;
2096 case SHN_V850_SCOMMON
:
2097 *secp
= bfd_make_section_old_way (abfd
, ".scommon");
2098 (*secp
)->flags
|= SEC_IS_COMMON
;
2099 *valp
= sym
->st_size
;
2102 case SHN_V850_TCOMMON
:
2103 *secp
= bfd_make_section_old_way (abfd
, ".tcommon");
2104 (*secp
)->flags
|= SEC_IS_COMMON
;
2105 *valp
= sym
->st_size
;
2108 case SHN_V850_ZCOMMON
:
2109 *secp
= bfd_make_section_old_way (abfd
, ".zcommon");
2110 (*secp
)->flags
|= SEC_IS_COMMON
;
2111 *valp
= sym
->st_size
;
2120 v850_elf_link_output_symbol_hook (abfd
, info
, name
, sym
, input_sec
)
2122 struct bfd_link_info
* info
;
2124 Elf_Internal_Sym
* sym
;
2125 asection
* input_sec
;
2127 /* If we see a common symbol, which implies a relocatable link, then
2128 if a symbol was in a special common section in an input file, mark
2129 it as a special common in the output file. */
2131 if (sym
->st_shndx
== SHN_COMMON
)
2133 if (strcmp (input_sec
->name
, ".scommon") == 0)
2134 sym
->st_shndx
= SHN_V850_SCOMMON
;
2135 else if (strcmp (input_sec
->name
, ".tcommon") == 0)
2136 sym
->st_shndx
= SHN_V850_TCOMMON
;
2137 else if (strcmp (input_sec
->name
, ".zcommon") == 0)
2138 sym
->st_shndx
= SHN_V850_ZCOMMON
;
2145 v850_elf_section_from_shdr (abfd
, hdr
, name
)
2147 Elf_Internal_Shdr
* hdr
;
2150 /* There ought to be a place to keep ELF backend specific flags, but
2151 at the moment there isn't one. We just keep track of the
2152 sections by their name, instead. */
2154 if (! _bfd_elf_make_section_from_shdr (abfd
, hdr
, name
))
2157 switch (hdr
->sh_type
)
2159 case SHT_V850_SCOMMON
:
2160 case SHT_V850_TCOMMON
:
2161 case SHT_V850_ZCOMMON
:
2162 if (! bfd_set_section_flags (abfd
, hdr
->bfd_section
,
2163 (bfd_get_section_flags (abfd
,
2172 /* Set the correct type for a V850 ELF section. We do this by the
2173 section name, which is a hack, but ought to work. */
2175 v850_elf_fake_sections (abfd
, hdr
, sec
)
2177 Elf32_Internal_Shdr
* hdr
;
2180 register const char * name
;
2182 name
= bfd_get_section_name (abfd
, sec
);
2184 if (strcmp (name
, ".scommon") == 0)
2186 hdr
->sh_type
= SHT_V850_SCOMMON
;
2188 else if (strcmp (name
, ".tcommon") == 0)
2190 hdr
->sh_type
= SHT_V850_TCOMMON
;
2192 else if (strcmp (name
, ".zcommon") == 0)
2193 hdr
->sh_type
= SHT_V850_ZCOMMON
;
2200 #define TARGET_LITTLE_SYM bfd_elf32_v850_vec
2201 #define TARGET_LITTLE_NAME "elf32-v850"
2202 #define ELF_ARCH bfd_arch_v850
2203 #define ELF_MACHINE_CODE EM_CYGNUS_V850
2204 #define ELF_MAXPAGESIZE 0x1000
2206 #define elf_info_to_howto v850_elf_info_to_howto_rela
2207 #define elf_info_to_howto_rel v850_elf_info_to_howto_rel
2209 #define elf_backend_check_relocs v850_elf_check_relocs
2210 #define elf_backend_relocate_section v850_elf_relocate_section
2211 #define elf_backend_object_p v850_elf_object_p
2212 #define elf_backend_final_write_processing v850_elf_final_write_processing
2213 #define elf_backend_section_from_bfd_section v850_elf_section_from_bfd_section
2214 #define elf_backend_symbol_processing v850_elf_symbol_processing
2215 #define elf_backend_add_symbol_hook v850_elf_add_symbol_hook
2216 #define elf_backend_link_output_symbol_hook v850_elf_link_output_symbol_hook
2217 #define elf_backend_section_from_shdr v850_elf_section_from_shdr
2218 #define elf_backend_fake_sections v850_elf_fake_sections
2219 #define elf_backend_gc_mark_hook v850_elf_gc_mark_hook
2220 #define elf_backend_gc_sweep_hook v850_elf_gc_sweep_hook
2222 #define elf_backend_can_gc_sections 1
2225 #define bfd_elf32_bfd_is_local_label_name v850_elf_is_local_label_name
2226 #define bfd_elf32_bfd_reloc_type_lookup v850_elf_reloc_type_lookup
2227 #define bfd_elf32_bfd_copy_private_bfd_data v850_elf_copy_private_bfd_data
2228 #define bfd_elf32_bfd_merge_private_bfd_data v850_elf_merge_private_bfd_data
2229 #define bfd_elf32_bfd_set_private_flags v850_elf_set_private_flags
2230 #define bfd_elf32_bfd_print_private_bfd_data v850_elf_print_private_bfd_data
2232 #define elf_symbol_leading_char '_'
2234 #include "elf32-target.h"