From 459609d6f8f65d4b4440385499b84cc8c1804f65 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 16 Oct 2014 09:38:09 +1030 Subject: PR17488, powerpc64-linux-ld segfault For binary ouput, we don't have an ELF bfd output so can't access elf_elfheader. The elf64-ppc.c changes are really just a tidy, triggered by looking at all places where the abiversion bits are accessed. bfd/ * elf64-ppc.c (ppc64_elf_before_check_relocs): Do .opd processing even when output is not ppc64 ELF. Remove redundant tests on type of input bfd. ld/ PR 17488 * emultempl/ppc64elf.em (gld${EMULATION_NAME}_finish): Don't attempt to access ELF header e_flags when not ppc64 ELF output. --- ld/ChangeLog | 6 ++++++ ld/emultempl/ppc64elf.em | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index 7cb8428..a545bb0 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2014-10-16 Alan Modra + + PR 17488 + * emultempl/ppc64elf.em (gld${EMULATION_NAME}_finish): Don't attempt + to access ELF header e_flags when not ppc64 ELF output. + 2014-10-15 Tristan Gingold * configure: Regenerate. diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em index 914fc52..59ea786 100644 --- a/ld/emultempl/ppc64elf.em +++ b/ld/emultempl/ppc64elf.em @@ -531,7 +531,8 @@ gld${EMULATION_NAME}_finish (void) /* e_entry on PowerPC64 points to the function descriptor for _start. If _start is missing, default to the first function descriptor in the .opd section. */ - if ((elf_elfheader (link_info.output_bfd)->e_flags & EF_PPC64_ABI) == 1) + if (stub_file != NULL + && (elf_elfheader (link_info.output_bfd)->e_flags & EF_PPC64_ABI) == 1) entry_section = ".opd"; if (params.emit_stub_syms < 0) -- cgit v1.1