fix powerpc64 ld segfault

Alan Modra amodra@bigpond.net.au
Sun Oct 1 14:00:00 GMT 2006


It's possible for the .plt section to be created but never used, so this
test should have also checked that htab->plt->size was non-zero.  Better,
since this particular piece of code is dealing with setting up .glink,
do the checks on htab->glink.

	* elf64-ppc.c (ppc64_elf_build_stubs): Test glink size for
	existence of PLT.

Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.246
diff -u -p -r1.246 elf64-ppc.c
--- bfd/elf64-ppc.c	16 Sep 2006 18:12:14 -0000	1.246
+++ bfd/elf64-ppc.c	30 Sep 2006 13:48:19 -0000
@@ -9451,7 +9451,7 @@ ppc64_elf_build_stubs (bfd_boolean emit_
 	stub_sec->size = 0;
       }
 
-  if (htab->plt != NULL)
+  if (htab->glink != NULL && htab->glink->size != 0)
     {
       unsigned int indx;
       bfd_vma plt0;

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list