aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2008-03-11 09:30:50 +0000
committerAlan Modra <amodra@gmail.com>2008-03-11 09:30:50 +0000
commit5f5fb9ec64b9498a205202e2668f15b03be646b4 (patch)
tree87b11bb55393aac35c558d94d05db0e73c11eaaa /bfd
parent20a6ec495b38548cc88165e7c18203d6d387d55d (diff)
downloadgdb-5f5fb9ec64b9498a205202e2668f15b03be646b4.zip
gdb-5f5fb9ec64b9498a205202e2668f15b03be646b4.tar.gz
gdb-5f5fb9ec64b9498a205202e2668f15b03be646b4.tar.bz2
* elf32-spu.c (spu_elf_relocate_section): Test identical conditions
to those in process_stubs for overlay symbols.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf32-spu.c53
2 files changed, 40 insertions, 18 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a786a3e..936b729 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-11 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-spu.c (spu_elf_relocate_section): Test identical conditions
+ to those in process_stubs for overlay symbols.
+
2008-03-09 Paul Brook <paul@codesourcery.com>
* elf32-arm.c (elf32_arm_merge_eabi_attributes): Handle new
diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c
index 7560135..99b1b61 100644
--- a/bfd/elf32-spu.c
+++ b/bfd/elf32-spu.c
@@ -2708,7 +2708,6 @@ spu_elf_relocate_section (bfd *output_bfd,
bfd_reloc_status_type r;
bfd_boolean unresolved_reloc;
bfd_boolean warned;
- bfd_boolean branch;
r_symndx = ELF32_R_SYM (rel->r_info);
r_type = ELF32_R_TYPE (rel->r_info);
@@ -2769,33 +2768,51 @@ spu_elf_relocate_section (bfd *output_bfd,
/* If this symbol is in an overlay area, we may need to relocate
to the overlay stub. */
addend = rel->r_addend;
- branch = (is_branch (contents + rel->r_offset)
- || is_hint (contents + rel->r_offset));
if (htab->stub_sec != NULL
- && needs_ovl_stub (sym_name, sec, input_section, htab, branch)
+ && sec != NULL
+ && sec->output_section != NULL
+ && sec->output_section->owner == output_bfd
&& (h == NULL
|| (h != htab->ovly_load && h != htab->ovly_return)))
{
- unsigned int ovl = 0;
- struct got_entry *g, **head;
+ bfd_boolean branch;
+ unsigned int sym_type;
- if (branch)
- ovl = (spu_elf_section_data (input_section->output_section)
- ->u.o.ovl_index);
+ branch = FALSE;
+ if (r_type == R_SPU_REL16
+ || r_type == R_SPU_ADDR16)
+ branch = (is_branch (contents + rel->r_offset)
+ || is_hint (contents + rel->r_offset));
if (h != NULL)
- head = &h->got.glist;
+ sym_type = h->type;
else
- head = elf_local_got_ents (input_bfd) + r_symndx;
+ sym_type = ELF_ST_TYPE (sym->st_info);
- for (g = *head; g != NULL; g = g->next)
- if (g->addend == addend && (g->ovl == ovl || g->ovl == 0))
- break;
- if (g == NULL)
- abort ();
+ if ((sym_type == STT_FUNC || branch)
+ && needs_ovl_stub (sym_name, sec, input_section, htab, branch))
+ {
+ unsigned int ovl = 0;
+ struct got_entry *g, **head;
+
+ if (branch)
+ ovl = (spu_elf_section_data (input_section->output_section)
+ ->u.o.ovl_index);
+
+ if (h != NULL)
+ head = &h->got.glist;
+ else
+ head = elf_local_got_ents (input_bfd) + r_symndx;
- relocation = g->stub_addr;
- addend = 0;
+ for (g = *head; g != NULL; g = g->next)
+ if (g->addend == addend && (g->ovl == ovl || g->ovl == 0))
+ break;
+ if (g == NULL)
+ abort ();
+
+ relocation = g->stub_addr;
+ addend = 0;
+ }
}
r = _bfd_final_link_relocate (howto,