aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-08-24 09:59:03 +0930
committerAlan Modra <amodra@gmail.com>2019-08-24 10:05:40 +0930
commit6d5554a605a8ce908ba04b00fd960d02ca9fc613 (patch)
treeeafe8ed9650c6a72b46e0f4ac5c0fcc395fc8147 /bfd/elf64-ppc.c
parent8a9455cc824134d40943c34dc2cd44bee8275083 (diff)
downloadgdb-6d5554a605a8ce908ba04b00fd960d02ca9fc613.zip
gdb-6d5554a605a8ce908ba04b00fd960d02ca9fc613.tar.gz
gdb-6d5554a605a8ce908ba04b00fd960d02ca9fc613.tar.bz2
PowerPC64 segfault in ppc64_elf_edit_toc
Found on a GOT reference to __ehdr_start, which is tweaked to be undefined weak at some stages of linking. SYMBOL_REFERENCES_LOCAL isn't a sufficient test. * elf64-ppc.c (ppc64_elf_edit_toc): Exclude undefined weak symbols from GOT optimisation.
Diffstat (limited to 'bfd/elf64-ppc.c')
-rw-r--r--bfd/elf64-ppc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 60918d9..4eba829 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -9112,6 +9112,11 @@ ppc64_elf_edit_toc (struct bfd_link_info *info)
r_symndx, ibfd))
goto got_error_ret;
+ if (sym_sec == NULL
+ || sym_sec->output_section == NULL
+ || discarded_section (sym_sec))
+ continue;
+
if (!SYMBOL_REFERENCES_LOCAL (info, h))
continue;