/* X86-64 specific support for 64-bit ELF
- Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Contributed by Jan Hubicka <jh@suse.cz>.
#define elf64_x86_64_local_tlsdesc_gotent(abfd) \
(elf64_x86_64_tdata (abfd)->local_tlsdesc_gotent)
+#define is_x86_64_elf(bfd) \
+ (bfd_get_flavour (bfd) == bfd_target_elf_flavour \
+ && elf_tdata (bfd) != NULL \
+ && elf_object_id (bfd) == X86_64_ELF_TDATA)
+
+static bfd_boolean
+elf64_x86_64_mkobject (bfd *abfd)
+{
+ return bfd_elf_allocate_object (abfd, sizeof (struct elf64_x86_64_obj_tdata),
+ X86_64_ELF_TDATA);
+}
+
/* x86-64 ELF linker hash table. */
struct elf64_x86_64_link_hash_table
_bfd_elf_link_hash_copy_indirect (info, dir, ind);
}
-static bfd_boolean
-elf64_x86_64_mkobject (bfd *abfd)
-{
- if (abfd->tdata.any == NULL)
- {
- bfd_size_type amt = sizeof (struct elf64_x86_64_obj_tdata);
- abfd->tdata.any = bfd_zalloc (abfd, amt);
- if (abfd->tdata.any == NULL)
- return FALSE;
- }
- return bfd_elf_mkobject (abfd);
-}
-
static bfd_boolean
elf64_x86_64_elf_object_p (bfd *abfd)
{
if (info->relocatable)
return TRUE;
+ BFD_ASSERT (is_x86_64_elf (abfd));
+
htab = elf64_x86_64_hash_table (info);
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ symtab_hdr = &elf_symtab_hdr (abfd);
sym_hashes = elf_sym_hashes (abfd);
sreloc = NULL;
elf_section_data (sec)->local_dynrel = NULL;
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ symtab_hdr = &elf_symtab_hdr (abfd);
sym_hashes = elf_sym_hashes (abfd);
local_got_refcounts = elf_local_got_refcounts (abfd);
Elf_Internal_Shdr *symtab_hdr;
asection *srel;
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
+ if (! is_x86_64_elf (ibfd))
continue;
for (s = ibfd->sections; s != NULL; s = s->next)
if (!local_got)
continue;
- symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
+ symtab_hdr = &elf_symtab_hdr (ibfd);
locsymcount = symtab_hdr->sh_info;
end_local_got = local_got + locsymcount;
local_tls_type = elf64_x86_64_local_got_tls_type (ibfd);
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
+ BFD_ASSERT (is_x86_64_elf (input_bfd));
+
htab = elf64_x86_64_hash_table (info);
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ symtab_hdr = &elf_symtab_hdr (input_bfd);
sym_hashes = elf_sym_hashes (input_bfd);
local_got_offsets = elf_local_got_offsets (input_bfd);
local_tlsdesc_gotents = elf64_x86_64_local_tlsdesc_gotent (input_bfd);