/* SPU specific support for 32-bit ELF
- Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012
- Free Software Foundation, Inc.
+ Copyright 2006-2013 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
{
struct spu_link_hash_table *htab;
- htab = bfd_malloc (sizeof (*htab));
+ htab = bfd_zmalloc (sizeof (*htab));
if (htab == NULL)
return NULL;
return NULL;
}
- memset (&htab->ovtab, 0,
- sizeof (*htab) - offsetof (struct spu_link_hash_table, ovtab));
-
htab->elf.init_got_refcount.refcount = 0;
htab->elf.init_got_refcount.glist = NULL;
htab->elf.init_got_offset.offset = 0;
}
/* Support two sizes of overlay stubs, a slower more compact stub of two
- intructions, and a faster stub of four instructions.
+ instructions, and a faster stub of four instructions.
Soft-icache stubs are four or eight words. */
static unsigned int
htab->local_store = hi + 1 - lo;
- for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+ for (m = elf_seg_map (abfd); m != NULL; m = m->next)
if (m->p_type == PT_LOAD)
for (i = 0; i < m->count; i++)
if (m->sections[i]->size != 0
/* Find the extents of our loadable image. */
lo = (unsigned int) -1;
hi = 0;
- for (m = elf_tdata (info->output_bfd)->segment_map; m != NULL; m = m->next)
+ for (m = elf_seg_map (info->output_bfd); m != NULL; m = m->next)
if (m->p_type == PT_LOAD)
for (i = 0; i < m->count; i++)
if (m->sections[i]->size != 0)
/* Set ELF header e_type for plugins. */
static void
-spu_elf_post_process_headers (bfd *abfd,
- struct bfd_link_info *info ATTRIBUTE_UNUSED)
+spu_elf_post_process_headers (bfd *abfd, struct bfd_link_info *info)
{
if (spu_plugin)
{
i_ehdrp->e_type = ET_DYN;
}
+
+ _bfd_elf_post_process_headers (abfd, info);
}
/* We may add an extra PT_LOAD segment for .toe. We also need extra
return TRUE;
toe = bfd_get_section_by_name (abfd, ".toe");
- for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+ for (m = elf_seg_map (abfd); m != NULL; m = m->next)
if (m->p_type == PT_LOAD && m->count > 1)
for (i = 0; i < m->count; i++)
if ((s = m->sections[i]) == toe
as PF_OVERLAY) will be placed into SPU local store on startup. */
/* Move all overlay segments onto a separate list. */
- p = &elf_tdata (abfd)->segment_map;
+ p = &elf_seg_map (abfd);
p_overlay = &m_overlay;
while (*p != NULL)
{
}
/* Re-insert overlay segments at the head of the segment map. */
- *p_overlay = elf_tdata (abfd)->segment_map;
- elf_tdata (abfd)->segment_map = m_overlay;
+ *p_overlay = elf_seg_map (abfd);
+ elf_seg_map (abfd) = m_overlay;
return TRUE;
}
bed = get_elf_backend_data (abfd);
tdata = elf_tdata (abfd);
phdr = tdata->phdr;
- count = tdata->program_header_size / bed->s->sizeof_phdr;
+ count = elf_program_header_size (abfd) / bed->s->sizeof_phdr;
htab = spu_hash_table (info);
if (htab->num_overlays != 0)
{
struct elf_segment_map *m;
unsigned int o;
- for (i = 0, m = elf_tdata (abfd)->segment_map; m; ++i, m = m->next)
+ for (i = 0, m = elf_seg_map (abfd); m; ++i, m = m->next)
if (m->count != 0
&& (o = spu_elf_section_data (m->sections[0])->u.o.ovl_index) != 0)
{