From f1885d1e59a7e6e0627429cd3068740d96f8a184 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 16 Oct 2014 21:16:07 +1030 Subject: Fix 17492, ld segfault with --oformat=binary PR 17492 * elf32-arm.c (elf32_arm_add_symbol_hook): Only set has_gnu_symbols on ELF output bfd. * elf32-i386.c (elf_i386_add_symbol_hook): Likewise. * elf32-m68k.c (elf_m68k_add_symbol_hook): Likewise. * elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise. * elf32-sparc.c (elf32_sparc_add_symbol_hook): Likewise. * elf64-ppc.c (ppc64_elf_add_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_add_symbol_hook): Likewise. * elf64-x86-64.c (elf_x86_64_add_symbol_hook): Likewise. * elfxx-aarch64.c (_bfd_aarch64_elf_add_symbol_hook): Likewise. * elf-s390-common.c (elf_s390_add_symbol_hook): Likewise. Handle STB_GNU_UNIQUE too. --- bfd/elfxx-aarch64.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'bfd/elfxx-aarch64.c') diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c index b30e730..6ae4adf 100644 --- a/bfd/elfxx-aarch64.c +++ b/bfd/elfxx-aarch64.c @@ -481,9 +481,10 @@ _bfd_aarch64_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, asection **secp ATTRIBUTE_UNUSED, bfd_vma *valp ATTRIBUTE_UNUSED) { - if ((abfd->flags & DYNAMIC) == 0 - && (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC - || ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE)) + if ((ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC + || ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE) + && (abfd->flags & DYNAMIC) == 0 + && bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour) elf_tdata (info->output_bfd)->has_gnu_symbols = TRUE; return TRUE; -- cgit v1.1