Fix powerpc64 ld segfault on invalid input

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Fix powerpc64 ld segfault on invalid input

Alan Modra
I managed to make ld segfault recently, when forcing ld to attempt
linking a powerpc libc.a into a powerpc64 output.  This cures it.

        * elf64-ppc.c (ppc64_elf_size_stubs): Don't consider non-ppc64 input.

Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.226
diff -u -p -r1.226 elf64-ppc.c
--- bfd/elf64-ppc.c 18 Nov 2005 04:52:57 -0000 1.226
+++ bfd/elf64-ppc.c 12 Dec 2005 03:52:17 -0000
@@ -8912,6 +8912,9 @@ ppc64_elf_size_stubs (bfd *output_bfd,
   asection *section;
   Elf_Internal_Sym *local_syms = NULL;
 
+  if (!is_ppc64_elf_target (input_bfd->xvec))
+    continue;
+
   /* We'll need the symbol table in a second.  */
   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
   if (symtab_hdr->sh_info == 0)

--
Alan Modra
IBM OzLabs - Linux Technology Centre