fix pr2658, segfault in ppc_elf_relax_section

Alan Modra amodra@bigpond.net.au
Mon May 15 10:14:00 GMT 2006


Applying mainline and 2.17.

	PR 2658
	* elf32-ppc.c (ppc_elf_relax_section): Don't segfault on non-pic
	-shared link.

Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.197
diff -u -p -r1.197 elf32-ppc.c
--- bfd/elf32-ppc.c	2 May 2006 01:41:20 -0000	1.197
+++ bfd/elf32-ppc.c	15 May 2006 02:01:17 -0000
@@ -5181,6 +5181,10 @@ ppc_elf_relax_section (bfd *abfd,
       else if (r_type != R_PPC_PLTREL24)
 	toff += irel->r_addend;
 
+      /* Attempted -shared link of non-pic code loses.  */
+      if (tsec->output_section == NULL)
+	continue;
+
       symaddr = tsec->output_section->vma + tsec->output_offset + toff;
 
       roff = irel->r_offset;

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list