This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PowerPC64 segfault in ppc64_elf_edit_toc
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Sat, 24 Aug 2019 10:06:53 +0930
- Subject: 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.
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 60918d91a1..4eba829450 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;
--
Alan Modra
Australia Development Lab, IBM