aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2003-06-20 12:35:30 +0000
committerAlan Modra <amodra@gmail.com>2003-06-20 12:35:30 +0000
commit8f3bab57754eb34346df536d6b7d5ec4a4255cbc (patch)
tree208dc8460406b2347e93c5bb9fe1f23da041f70a /bfd/elf64-ppc.c
parentc8c18e652edd5c207340dea5bc8fd33d34af65df (diff)
downloadgdb-8f3bab57754eb34346df536d6b7d5ec4a4255cbc.zip
gdb-8f3bab57754eb34346df536d6b7d5ec4a4255cbc.tar.gz
gdb-8f3bab57754eb34346df536d6b7d5ec4a4255cbc.tar.bz2
* elf64-ppc.c (struct ppc_link_hash_table): Add top_id.
(ppc64_elf_setup_section_lists): Set it. (ppc64_elf_relocate_section): Check sym section id against top_id. (ppc_build_one_stub): Comment on top_id.
Diffstat (limited to 'bfd/elf64-ppc.c')
-rw-r--r--bfd/elf64-ppc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index a95f860..68879de 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -2708,6 +2708,9 @@ struct ppc_link_hash_table
/* Temp used when calculating TOC pointers. */
bfd_vma toc_curr;
+ /* Highest input section id. */
+ int top_id;
+
/* Highest output section index. */
int top_index;
@@ -6114,7 +6117,9 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
{
/* Point the symbol at the stub. There may be multiple stubs,
we don't really care; The main thing is to make this sym
- defined somewhere. */
+ defined somewhere. Maybe defining the symbol in the stub
+ section is a silly idea. If we didn't do this, htab->top_id
+ could disappear. */
stub_entry->h->oh->root.type = bfd_link_hash_defined;
stub_entry->h->oh->root.u.def.section = stub_entry->stub_sec;
stub_entry->h->oh->root.u.def.value = stub_entry->stub_offset;
@@ -6285,6 +6290,7 @@ ppc64_elf_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info)
}
}
+ htab->top_id = top_id;
amt = sizeof (struct map_stub) * (top_id + 1);
htab->stub_group = bfd_zmalloc (amt);
if (htab->stub_group == NULL)
@@ -8314,6 +8320,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
if ((relocation + addend - from + max_br_offset >= 2 * max_br_offset
|| (sec != NULL
&& sec->output_section != NULL
+ && sec->id <= htab->top_id
&& (htab->stub_group[sec->id].toc_off
!= htab->stub_group[input_section->id].toc_off)))
&& (stub_entry = ppc_get_stub_entry (input_section, sec, h,