From c1ee2db0ec7a20bcdf46e4b76fb460c191025483 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 15 May 2006 02:22:20 +0000 Subject: [PATCH] PR 2658 * elf32-ppc.c (ppc_elf_relax_section): Don't segfault on non-pic -shared link. --- bfd/ChangeLog | 6 ++++++ bfd/elf32-ppc.c | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index c64ae218c1..d5e2c7904c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2006-05-15 Alan Modra + + PR 2658 + * elf32-ppc.c (ppc_elf_relax_section): Don't segfault on non-pic + -shared link. + 2006-05-11 Michael Matz * elflink.c (match_group_member): Correctly iterate group diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 9ee2bcd857..9be70f82ce 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -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; -- 2.11.0