This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
fix pr2658, segfault in ppc_elf_relax_section
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sourceware dot org
- Cc: Lior Balkohen <balkohen at gmail dot com>
- Date: Mon, 15 May 2006 11:33:05 +0930
- Subject: fix pr2658, segfault in ppc_elf_relax_section
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