version 1.2, 2016/10/09 08:21:37 |
version 1.3, 2016/10/26 17:08:38 |
|
|
/* Motorola MCore specific support for 32-bit ELF |
/* Motorola MCore specific support for 32-bit ELF |
Copyright 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, |
Copyright (C) 1994-2015 Free Software Foundation, Inc. |
2007, 2011, 2012 Free Software Foundation, Inc. |
|
|
|
This file is part of BFD, the Binary File Descriptor library. |
This file is part of BFD, the Binary File Descriptor library. |
|
|
Line 111 static reloc_howto_type mcore_elf_howto_ |
|
Line 110 static reloc_howto_type mcore_elf_howto_ |
|
/* This reloc does nothing. */ |
/* This reloc does nothing. */ |
HOWTO (R_MCORE_NONE, /* type */ |
HOWTO (R_MCORE_NONE, /* type */ |
0, /* rightshift */ |
0, /* rightshift */ |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
3, /* size (0 = byte, 1 = short, 2 = long) */ |
32, /* bitsize */ |
0, /* bitsize */ |
FALSE, /* pc_relative */ |
FALSE, /* pc_relative */ |
0, /* bitpos */ |
0, /* bitpos */ |
complain_overflow_bitfield, /* complain_on_overflow */ |
complain_overflow_dont, /* complain_on_overflow */ |
NULL, /* special_function */ |
NULL, /* special_function */ |
"R_MCORE_NONE", /* name */ |
"R_MCORE_NONE", /* name */ |
FALSE, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
Line 341 mcore_elf_info_to_howto (bfd * abfd ATTR |
|
Line 340 mcore_elf_info_to_howto (bfd * abfd ATTR |
|
arelent * cache_ptr, |
arelent * cache_ptr, |
Elf_Internal_Rela * dst) |
Elf_Internal_Rela * dst) |
{ |
{ |
|
unsigned int r_type; |
|
|
if (! mcore_elf_howto_table [R_MCORE_PCRELIMM8BY4]) |
if (! mcore_elf_howto_table [R_MCORE_PCRELIMM8BY4]) |
/* Initialize howto table if needed. */ |
/* Initialize howto table if needed. */ |
mcore_elf_howto_init (); |
mcore_elf_howto_init (); |
|
|
BFD_ASSERT (ELF32_R_TYPE (dst->r_info) < (unsigned int) R_MCORE_max); |
r_type = ELF32_R_TYPE (dst->r_info); |
|
if (r_type >= R_MCORE_max) |
|
{ |
|
(*_bfd_error_handler) (_("%B: unrecognised MCore reloc number: %d"), |
|
abfd, r_type); |
|
bfd_set_error (bfd_error_bad_value); |
|
r_type = R_MCORE_NONE; |
|
} |
|
|
cache_ptr->howto = mcore_elf_howto_table [ELF32_R_TYPE (dst->r_info)]; |
cache_ptr->howto = mcore_elf_howto_table [r_type]; |
} |
} |
|
|
/* The RELOCATE_SECTION function is called by the ELF backend linker |
/* The RELOCATE_SECTION function is called by the ELF backend linker |
Line 401 mcore_elf_relocate_section (bfd * output |
|
Line 409 mcore_elf_relocate_section (bfd * output |
|
input_bfd, |
input_bfd, |
input_section, |
input_section, |
(long) input_section->reloc_count, |
(long) input_section->reloc_count, |
(info->relocatable) ? " (relocatable)" : ""); |
(bfd_link_relocatable (info)) ? " (relocatable)" : ""); |
#endif |
#endif |
|
|
if (! mcore_elf_howto_table [R_MCORE_PCRELIMM8BY4]) /* Initialize howto table if needed */ |
if (! mcore_elf_howto_table [R_MCORE_PCRELIMM8BY4]) /* Initialize howto table if needed */ |
Line 458 mcore_elf_relocate_section (bfd * output |
|
Line 466 mcore_elf_relocate_section (bfd * output |
|
} |
} |
else |
else |
{ |
{ |
bfd_boolean unresolved_reloc, warned; |
bfd_boolean unresolved_reloc, warned, ignored; |
|
|
RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, |
RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, |
r_symndx, symtab_hdr, sym_hashes, |
r_symndx, symtab_hdr, sym_hashes, |
h, sec, relocation, |
h, sec, relocation, |
unresolved_reloc, warned); |
unresolved_reloc, warned, ignored); |
} |
} |
|
|
if (sec != NULL && discarded_section (sec)) |
if (sec != NULL && discarded_section (sec)) |
RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, |
RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, |
rel, 1, relend, howto, 0, contents); |
rel, 1, relend, howto, 0, contents); |
|
|
if (info->relocatable) |
if (bfd_link_relocatable (info)) |
continue; |
continue; |
|
|
switch (r_type) |
switch (r_type) |
Line 590 mcore_elf_check_relocs (bfd * abfd, |
|
Line 598 mcore_elf_check_relocs (bfd * abfd, |
|
const Elf_Internal_Rela * rel; |
const Elf_Internal_Rela * rel; |
const Elf_Internal_Rela * rel_end; |
const Elf_Internal_Rela * rel_end; |
|
|
if (info->relocatable) |
if (bfd_link_relocatable (info)) |
return TRUE; |
return TRUE; |
|
|
symtab_hdr = & elf_tdata (abfd)->symtab_hdr; |
symtab_hdr = & elf_tdata (abfd)->symtab_hdr; |
Line 613 mcore_elf_check_relocs (bfd * abfd, |
|
Line 621 mcore_elf_check_relocs (bfd * abfd, |
|
while (h->root.type == bfd_link_hash_indirect |
while (h->root.type == bfd_link_hash_indirect |
|| h->root.type == bfd_link_hash_warning) |
|| h->root.type == bfd_link_hash_warning) |
h = (struct elf_link_hash_entry *) h->root.u.i.link; |
h = (struct elf_link_hash_entry *) h->root.u.i.link; |
|
|
|
/* PR15323, ref flags aren't set for references in the same |
|
object. */ |
|
h->root.non_ir_ref = 1; |
} |
} |
|
|
switch (ELF32_R_TYPE (rel->r_info)) |
switch (ELF32_R_TYPE (rel->r_info)) |
Line 645 static const struct bfd_elf_special_sect |
|
Line 657 static const struct bfd_elf_special_sect |
|
{ NULL, 0, 0, 0, 0 } |
{ NULL, 0, 0, 0, 0 } |
}; |
}; |
|
|
#define TARGET_BIG_SYM bfd_elf32_mcore_big_vec |
#define TARGET_BIG_SYM mcore_elf32_be_vec |
#define TARGET_BIG_NAME "elf32-mcore-big" |
#define TARGET_BIG_NAME "elf32-mcore-big" |
#define TARGET_LITTLE_SYM bfd_elf32_mcore_little_vec |
#define TARGET_LITTLE_SYM mcore_elf32_le_vec |
#define TARGET_LITTLE_NAME "elf32-mcore-little" |
#define TARGET_LITTLE_NAME "elf32-mcore-little" |
|
|
#define ELF_ARCH bfd_arch_mcore |
#define ELF_ARCH bfd_arch_mcore |