summaryrefslogtreecommitdiff
path: root/bfd/elf32-spu.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2008-06-19 16:14:15 +0000
committerAlan Modra <amodra@bigpond.net.au>2008-06-19 16:14:15 +0000
commit2ebe69e2e7457b3e249adcd36b44577a8b3ba2ba (patch)
tree1e4cdc95c450567dd95e2feded30864f6ff2d40a /bfd/elf32-spu.c
parentb6e658f0b629f97750a98816c8977bf0af6cde6f (diff)
downloadbinutils-redhat-2ebe69e2e7457b3e249adcd36b44577a8b3ba2ba.tar.gz
* elf32-spu.c (build_stub): Allow wraparound on stub branches.
(allocate_spuear_stubs, build_spuear_stubs): Return value from count_stub/build_stub. (spu_elf_build_stubs): Correct location of stub reloc error message.
Diffstat (limited to 'bfd/elf32-spu.c')
-rw-r--r--bfd/elf32-spu.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c
index 590ebd5b38..89b3422768 100644
--- a/bfd/elf32-spu.c
+++ b/bfd/elf32-spu.c
@@ -977,7 +977,7 @@ build_stub (struct spu_link_hash_table *htab,
if (OVL_STUB_SIZE == 16)
val -= 12;
if (((dest | to | from) & 3) != 0
- || val + 0x20000 >= 0x40000)
+ || val + 0x40000 >= 0x80000)
{
htab->stub_err = 1;
return FALSE;
@@ -1083,7 +1083,7 @@ allocate_spuear_stubs (struct elf_link_hash_entry *h, void *inf)
&& (spu_elf_section_data (sym_sec->output_section)->u.o.ovl_index != 0
|| htab->non_overlay_stubs))
{
- count_stub (htab, NULL, NULL, nonovl_stub, h, NULL);
+ return count_stub (htab, NULL, NULL, nonovl_stub, h, NULL);
}
return TRUE;
@@ -1109,8 +1109,8 @@ build_spuear_stubs (struct elf_link_hash_entry *h, void *inf)
&& (spu_elf_section_data (sym_sec->output_section)->u.o.ovl_index != 0
|| htab->non_overlay_stubs))
{
- build_stub (htab, NULL, NULL, nonovl_stub, h, NULL,
- h->root.u.def.value, sym_sec);
+ return build_stub (htab, NULL, NULL, nonovl_stub, h, NULL,
+ h->root.u.def.value, sym_sec);
}
return TRUE;
@@ -1461,10 +1461,15 @@ spu_elf_build_stubs (struct bfd_link_info *info, int emit_syms)
/* Fill in all the stubs. */
process_stubs (info, TRUE);
+ if (!htab->stub_err)
+ elf_link_hash_traverse (&htab->elf, build_spuear_stubs, info);
- elf_link_hash_traverse (&htab->elf, build_spuear_stubs, info);
if (htab->stub_err)
- return FALSE;
+ {
+ (*_bfd_error_handler) (_("overlay stub relocation overflow"));
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
for (i = 0; i <= htab->num_overlays; i++)
{
@@ -1477,13 +1482,6 @@ spu_elf_build_stubs (struct bfd_link_info *info, int emit_syms)
htab->stub_sec[i]->rawsize = 0;
}
- if (htab->stub_err)
- {
- (*_bfd_error_handler) (_("overlay stub relocation overflow"));
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
htab->ovtab->contents = bfd_zalloc (htab->ovtab->owner, htab->ovtab->size);
if (htab->ovtab->contents == NULL)
return FALSE;