* elf32-spu.c (spu_elf_size_stubs): Do set up soft-icache manager

data even when no stubs.
	(spu_elf_place_overlay_data, spu_elf_build_stubs): Adjust.
This commit is contained in:
Alan Modra
2009-07-10 14:00:38 +00:00
parent 4135c73ba2
commit 52cfded73c
2 changed files with 97 additions and 86 deletions

View File

@ -1,3 +1,9 @@
2009-07-10 Alan Modra <amodra@bigpond.net.au>
* elf32-spu.c (spu_elf_size_stubs): Do set up soft-icache manager
data even when no stubs.
(spu_elf_place_overlay_data, spu_elf_build_stubs): Adjust.
2009-07-10 Alan Modra <amodra@bigpond.net.au>
* elf32-ppc.c (ppc_elf_howto_raw): Add R_PPC_IRELATIVE.

View File

@ -1627,7 +1627,7 @@ process_stubs (struct bfd_link_info *info, bfd_boolean build)
}
/* Allocate space for overlay call and return stubs.
Return 0 on error, 1 if no stubs, 2 otherwise. */
Return 0 on error, 1 if no overlays, 2 otherwise. */
int
spu_elf_size_stubs (struct bfd_link_info *info)
@ -1647,10 +1647,9 @@ spu_elf_size_stubs (struct bfd_link_info *info)
if (htab->stub_err)
return 0;
if (htab->stub_count == NULL)
return 1;
ibfd = info->input_bfds;
if (htab->stub_count != NULL)
{
amt = (htab->num_overlays + 1) * sizeof (*htab->stub_sec);
htab->stub_sec = bfd_zmalloc (amt);
if (htab->stub_sec == NULL)
@ -1681,6 +1680,7 @@ spu_elf_size_stubs (struct bfd_link_info *info)
return 0;
stub->size = htab->stub_count[ovl] * ovl_stub_size (htab->params);
}
}
if (htab->params->ovly_flavour == ovly_soft_icache)
{
@ -1707,6 +1707,8 @@ spu_elf_size_stubs (struct bfd_link_info *info)
htab->init->size = 16;
}
else if (htab->stub_count == NULL)
return 1;
else
{
/* htab->ovtab consists of two arrays.
@ -1750,11 +1752,9 @@ spu_elf_place_overlay_data (struct bfd_link_info *info)
{
struct spu_link_hash_table *htab = spu_hash_table (info);
unsigned int i;
const char *ovout;
if (htab->stub_count == NULL)
return;
if (htab->stub_sec != NULL)
{
(*htab->params->place_spu_section) (htab->stub_sec[0], NULL, ".text");
for (i = 0; i < htab->num_overlays; ++i)
@ -1763,15 +1763,20 @@ spu_elf_place_overlay_data (struct bfd_link_info *info)
unsigned int ovl = spu_elf_section_data (osec)->u.o.ovl_index;
(*htab->params->place_spu_section) (htab->stub_sec[ovl], osec, NULL);
}
}
if (htab->params->ovly_flavour == ovly_soft_icache)
(*htab->params->place_spu_section) (htab->init, NULL, ".ovl.init");
ovout = ".data";
if (htab->ovtab != NULL)
{
const char *ovout = ".data";
if (htab->params->ovly_flavour == ovly_soft_icache)
ovout = ".bss";
(*htab->params->place_spu_section) (htab->ovtab, NULL, ovout);
}
if (htab->toe != NULL)
(*htab->params->place_spu_section) (htab->toe, NULL, ".toe");
}
@ -1883,26 +1888,13 @@ spu_elf_build_stubs (struct bfd_link_info *info)
bfd *obfd;
unsigned int i;
if (htab->stub_count == NULL)
return TRUE;
for (i = 0; i <= htab->num_overlays; i++)
if (htab->stub_sec[i]->size != 0)
if (htab->num_overlays != 0)
{
htab->stub_sec[i]->contents = bfd_zalloc (htab->stub_sec[i]->owner,
htab->stub_sec[i]->size);
if (htab->stub_sec[i]->contents == NULL)
return FALSE;
htab->stub_sec[i]->rawsize = htab->stub_sec[i]->size;
htab->stub_sec[i]->size = 0;
}
for (i = 0; i < 2; i++)
{
h = htab->ovly_entry[i];
BFD_ASSERT (h != NULL);
if ((h->root.type == bfd_link_hash_defined
if (h != NULL
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& h->def_regular)
{
@ -1915,8 +1907,20 @@ spu_elf_build_stubs (struct bfd_link_info *info)
return FALSE;
}
}
else
BFD_ASSERT (0);
}
}
if (htab->stub_sec != NULL)
{
for (i = 0; i <= htab->num_overlays; i++)
if (htab->stub_sec[i]->size != 0)
{
htab->stub_sec[i]->contents = bfd_zalloc (htab->stub_sec[i]->owner,
htab->stub_sec[i]->size);
if (htab->stub_sec[i]->contents == NULL)
return FALSE;
htab->stub_sec[i]->rawsize = htab->stub_sec[i]->size;
htab->stub_sec[i]->size = 0;
}
/* Fill in all the stubs. */
@ -1941,6 +1945,7 @@ spu_elf_build_stubs (struct bfd_link_info *info)
}
htab->stub_sec[i]->rawsize = 0;
}
}
if (htab->ovtab == NULL || htab->ovtab->size == 0)
return TRUE;