/* Lattice Mico32-specific support for 32-bit ELF
- Copyright 2008, 2009 Free Software Foundation, Inc.
+ Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
Contributed by Jon Beniston <jon@beniston.com>
This file is part of BFD, the Binary File Descriptor library.
/* Get the lm32 ELF linker hash table from a link_info structure. */
#define lm32_elf_hash_table(p) \
- ((struct elf_lm32_link_hash_table *) ((p)->hash))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == LM32_ELF_DATA ? ((struct elf_lm32_link_hash_table *) ((p)->hash)) : NULL)
#define lm32fdpic_got_section(info) \
(lm32_elf_hash_table (info)->sgot)
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
lm32_elf_link_hash_newfunc,
- sizeof (struct elf_lm32_link_hash_entry)))
+ sizeof (struct elf_lm32_link_hash_entry),
+ LM32_ELF_DATA))
{
free (ret);
return NULL;
if (s != NULL && (s->flags & SEC_LINKER_CREATED) != 0)
return TRUE;
+ htab = lm32_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
if (! _bfd_elf_create_got_section (dynobj, info))
return FALSE;
- htab = lm32_elf_hash_table (info);
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
htab->srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
struct elf_lm32_link_hash_table *htab;
htab = lm32_elf_hash_table (info);
- /* Fixup section for R_LM32_32 relocs */
+ if (htab == NULL)
+ return FALSE;
+
+ /* Fixup section for R_LM32_32 relocs. */
lm32fdpic_fixup32_section (info) = bfd_make_section_with_flags (dynobj,
".rofixup",
(SEC_ALLOC
Elf_Internal_Shdr *symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
Elf_Internal_Rela *rel, *relend;
-
struct elf_lm32_link_hash_table *htab = lm32_elf_hash_table (info);
bfd *dynobj;
bfd_vma *local_got_offsets;
asection *sgot, *splt, *sreloc;
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->root.dynobj;
local_got_offsets = elf_local_got_offsets (input_bfd);
if (r != bfd_reloc_ok)
{
- const char *name;
const char *msg = NULL;
arelent bfd_reloc;
- reloc_howto_type *howto;
lm32_info_to_howto_rela (input_bfd, &bfd_reloc, rel);
howto = bfd_reloc.howto;
sym_hashes_end -= symtab_hdr->sh_info;
htab = lm32_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->root.dynobj;
local_got_offsets = elf_local_got_offsets (abfd);
asection *sgot;
htab = lm32_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->root.dynobj;
sgot = htab->sgotplt;
bfd_byte *loc;
htab = lm32_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->root.dynobj;
if (h->plt.offset != (bfd_vma) -1)
same memory location for the variable. */
htab = lm32_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
s = htab->sdynbss;
BFD_ASSERT (s != NULL);
info = (struct bfd_link_info *) inf;
htab = lm32_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
eh = (struct elf_lm32_link_hash_entry *) h;
bfd *ibfd;
htab = lm32_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->root.dynobj;
BFD_ASSERT (dynobj != NULL);
int ptralign = 2; /* 32bit */
htab = lm32_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* Make sure we have a GOT - For the case where we have a dynamic object
but none of the relocs in check_relocs */