This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]