/* Motorola MCore specific support for 32-bit ELF
- Copyright 1994, 1995, 1999 Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
static boolean mcore_elf_set_private_flags
PARAMS ((bfd *, flagword));
-static boolean mcore_elf_copy_private_bfd_data
- PARAMS ((bfd *, bfd *));
static boolean mcore_elf_merge_private_bfd_data
PARAMS ((bfd *, bfd *));
static bfd_reloc_status_type mcore_elf_unsupported_reloc
static boolean mcore_elf_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
+static asection * mcore_elf_gc_mark_hook
+ PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
+ struct elf_link_hash_entry *, Elf_Internal_Sym *));
+static boolean mcore_elf_gc_sweep_hook
+ PARAMS ((bfd *, struct bfd_link_info *, asection *,
+ const Elf_Internal_Rela *));
+static boolean mcore_elf_check_relocs
+ PARAMS ((bfd *, struct bfd_link_info *, asection *,
+ const Elf_Internal_Rela *));
static reloc_howto_type * mcore_elf_howto_table [(int) R_MCORE_max];
mcore_elf_howto_table [type] = & mcore_elf_howto_raw [i];
}
}
-
\f
static reloc_howto_type *
mcore_elf_reloc_type_lookup (abfd, code)
return true;
}
-/* Copy backend specific data from one object module to another. */
-static boolean
-mcore_elf_copy_private_bfd_data (ibfd, obfd)
- bfd * ibfd;
- bfd * obfd;
-{
- if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour
- || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return true;
-
- BFD_ASSERT (! elf_flags_init (obfd)
- || elf_elfheader (obfd)->e_flags == elf_elfheader (ibfd)->e_flags);
-
- elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
- elf_flags_init (obfd) = true;
- return true;
-}
-
/* Merge backend specific data from an object file to the output
object file when linking. */
static boolean
return true;
}
-
\f
/* Don't pretend we can deal with unsupported relocs. */
BFD_ASSERT (reloc_entry->howto != (reloc_howto_type *)0);
_bfd_error_handler (_("%s: Relocation %s (%d) is not currently supported.\n"),
- bfd_get_filename (abfd),
+ bfd_archive_filename (abfd),
reloc_entry->howto->name,
reloc_entry->howto->type);
return bfd_reloc_notsupported;
}
-
\f
/* The RELOCATE_SECTION function is called by the ELF backend linker
to handle the relocations for a section.
static boolean
mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section,
contents, relocs, local_syms, local_sections)
- bfd * output_bfd ATTRIBUTE_UNUSED;
+ bfd * output_bfd;
struct bfd_link_info * info;
bfd * input_bfd;
asection * input_section;
#ifdef DEBUG
fprintf (stderr,
"mcore_elf_relocate_section called for %s section %s, %ld relocations%s\n",
- bfd_get_filename (input_bfd),
+ bfd_archive_filename (input_bfd),
bfd_section_name(input_bfd, input_section),
(long) input_section->reloc_count,
(info->relocateable) ? " (relocatable)" : "");
|| ! mcore_elf_howto_table [(int)r_type])
{
_bfd_error_handler (_("%s: Unknown relocation type %d\n"),
- bfd_get_filename (input_bfd),
+ bfd_archive_filename (input_bfd),
(int) r_type);
bfd_set_error (bfd_error_bad_value);
if (howto->special_function == mcore_elf_unsupported_reloc)
{
_bfd_error_handler (_("%s: Relocation %s (%d) is not currently supported.\n"),
- bfd_get_filename (input_bfd),
+ bfd_archive_filename (input_bfd),
howto->name,
(int)r_type);
{
sym = local_syms + r_symndx;
sec = local_sections [r_symndx];
- relocation = (sec->output_section->vma
- + sec->output_offset
- + sym->st_value);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ addend = rel->r_addend;
}
else
{
case R_MCORE_PCRELJSR_IMM11BY2:
oldinst = bfd_get_16 (input_bfd, contents + offset);
#define MCORE_INST_BSR 0xF800
- bfd_put_16 (input_bfd, MCORE_INST_BSR, contents + offset);
+ bfd_put_16 (input_bfd, (bfd_vma) MCORE_INST_BSR, contents + offset);
break;
}
if (r != bfd_reloc_ok && r_type == R_MCORE_PCRELJSR_IMM11BY2)
{
/* Wasn't ok, back it out and give up. */
- bfd_put_16 (input_bfd, oldinst, contents + offset);
+ bfd_put_16 (input_bfd, (bfd_vma) oldinst, contents + offset);
r = bfd_reloc_ok;
}
}
else
{
- if (!(elf_bad_symtab (abfd)
- && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
- && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
- && sym->st_shndx != SHN_COMMON))
- {
- return bfd_section_from_elf_index (abfd, sym->st_shndx);
- }
+ return bfd_section_from_elf_index (abfd, sym->st_shndx);
}
return NULL;
#define elf_info_to_howto mcore_elf_info_to_howto
#define elf_info_to_howto_rel NULL
-#define bfd_elf32_bfd_copy_private_bfd_data mcore_elf_copy_private_bfd_data
#define bfd_elf32_bfd_merge_private_bfd_data mcore_elf_merge_private_bfd_data
#define bfd_elf32_bfd_set_private_flags mcore_elf_set_private_flags
#define bfd_elf32_bfd_reloc_type_lookup mcore_elf_reloc_type_lookup