/* VAX series support for 32-bit ELF
Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
Contributed by Matt Thomas <matt@3am-software.com>.
This file is part of BFD, the Binary File Descriptor library.
static const bfd_byte elf_vax_plt_entry[PLT_ENTRY_SIZE] =
{
0xfc, 0x0f, /* .word ^M<r11:r2> */
- 0x16, 0xef, /* jsb L^(pc) */
+ 0x16, 0xef, /* jsb L^(pc) */
0, 0, 0, 0, /* replaced with offset to start of .plt */
0, 0, 0, 0, /* index into .rela.plt */
};
bfd_vma got_addend;
};
-/* VAX ELF linker hash table. */
-
-struct elf_vax_link_hash_table
-{
- struct elf_link_hash_table root;
-};
-
/* Declare this now that the above structures are defined. */
static bfd_boolean elf_vax_discard_copies (struct elf_vax_link_hash_entry *,
- PTR);
+ void *);
/* Declare this now that the above structures are defined. */
static bfd_boolean elf_vax_instantiate_got_entries (struct elf_link_hash_entry *,
- PTR);
+ void *);
/* Traverse an VAX ELF linker hash table. */
#define elf_vax_link_hash_traverse(table, func, info) \
(elf_link_hash_traverse \
- (&(table)->root, \
+ ((table), \
(bfd_boolean (*) (struct elf_link_hash_entry *, PTR)) (func), \
(info)))
-/* Get the VAX ELF linker hash table from a link_info structure. */
-
-#define elf_vax_hash_table(p) ((struct elf_vax_link_hash_table *) (p)->hash)
-
/* Create an entry in an VAX ELF linker hash table. */
static struct bfd_hash_entry *
static struct bfd_link_hash_table *
elf_vax_link_hash_table_create (bfd *abfd)
{
- struct elf_vax_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct elf_vax_link_hash_table);
+ struct elf_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct elf_link_hash_table);
ret = bfd_malloc (amt);
if (ret == NULL)
return NULL;
- if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
+ if (!_bfd_elf_link_hash_table_init (ret, abfd,
elf_vax_link_hash_newfunc,
- sizeof (struct elf_vax_link_hash_entry)))
+ sizeof (struct elf_vax_link_hash_entry),
+ GENERIC_ELF_DATA))
{
free (ret);
return NULL;
}
- return &ret->root.root;
+ return &ret->root;
}
/* Keep vax-specific flags in the ELF header */
static bfd_boolean
elf32_vax_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
{
- flagword out_flags;
flagword in_flags;
if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour
return TRUE;
in_flags = elf_elfheader (ibfd)->e_flags;
- out_flags = elf_elfheader (obfd)->e_flags;
if (!elf_flags_init (obfd))
{
allocated space for them in the check_relocs routine, but we will not
fill them in in the relocate_section routine. */
if (info->shared && info->symbolic)
- elf_vax_link_hash_traverse (elf_vax_hash_table (info),
+ elf_vax_link_hash_traverse (elf_hash_table (info),
elf_vax_discard_copies,
NULL);
bfd *dynobj;
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
- bfd_vma *local_got_offsets;
bfd_vma plt_index;
bfd_vma got_offset;
asection *sgot;
dynobj = elf_hash_table (info)->dynobj;
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
- local_got_offsets = elf_local_got_offsets (input_bfd);
sgot = NULL;
splt = NULL;
}
if (sec != NULL && elf_discarded_section (sec))
- {
- /* For relocs against symbols from removed linkonce sections,
- or sections discarded by a linker script, we just want the
- section contents zeroed. Avoid any special processing. */
- _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
- rel->r_info = 0;
- rel->r_addend = 0;
- continue;
- }
+ RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
+ rel, relend, howto, contents);
if (info->relocatable)
continue;
if (sgotplt == NULL)
{
sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
- BFD_ASSERT (splt != NULL);
+ BFD_ASSERT (sgotplt != NULL);
}
plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1;
The first two are reserved. */
got_offset = (plt_index + 3) * 4;
- /* We want the relocate to point into the .got.plt instead
+ /* We want the relocation to point into the .got.plt instead
of the plt itself. */
relocation = (sgotplt->output_section->vma
+ sgotplt->output_offset
case R_VAX_16:
case R_VAX_32:
if (info->shared
- && r_symndx != 0
+ && r_symndx != STN_UNDEF
&& (input_section->flags & SEC_ALLOC) != 0
&& ((r_type != R_VAX_PC8
&& r_type != R_VAX_PC16