Bug 17492 - ld segfault with --oformat=binary
Summary: ld segfault with --oformat=binary
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.25
: P2 normal
Target Milestone: ---
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-16 09:36 UTC by Matthias Klose
Modified: 2014-10-28 06:42 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2014-10-16 09:36:25 UTC
$ cat sample.c 
int main(void)
{
  return 0;
}

$ gcc -static -Xlinker --oformat=binary -Xlinker --format=elf64-x86-64 sample.c
collect2: error: ld terminated with signal 11 [Segmentation fault]
Comment 1 Sourceware Commits 2014-10-16 10:51:44 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  f1885d1e59a7e6e0627429cd3068740d96f8a184 (commit)
      from  bb99c4726c8926b943e0f525247d2ce0d7ffe6d1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f1885d1e59a7e6e0627429cd3068740d96f8a184

commit f1885d1e59a7e6e0627429cd3068740d96f8a184
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Oct 16 21:16:07 2014 +1030

    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.

-----------------------------------------------------------------------

Summary of changes:
 bfd/ChangeLog         |   16 ++++++++++++++++
 bfd/elf-s390-common.c |    6 ++++--
 bfd/elf32-arm.c       |    7 ++++---
 bfd/elf32-i386.c      |    9 +++++----
 bfd/elf32-m68k.c      |    7 ++++---
 bfd/elf32-ppc.c       |    7 ++++---
 bfd/elf32-sparc.c     |    9 +++++----
 bfd/elf64-ppc.c       |   19 ++++++++-----------
 bfd/elf64-sparc.c     |    7 ++++---
 bfd/elf64-x86-64.c    |    7 ++++---
 bfd/elfxx-aarch64.c   |    7 ++++---
 11 files changed, 62 insertions(+), 39 deletions(-)
Comment 2 Alan Modra 2014-10-16 10:52:59 UTC
Fixed.
Comment 3 Sourceware Commits 2014-10-28 06:42:28 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, binutils-2_25-branch has been updated
       via  04253f276b48227728cac3e4c6df614e161f1e9c (commit)
      from  16bfc7bb18b272d5a4e40ee37ced21e4b9a8fbb4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=04253f276b48227728cac3e4c6df614e161f1e9c

commit 04253f276b48227728cac3e4c6df614e161f1e9c
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Oct 16 21:16:07 2014 +1030

    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.

-----------------------------------------------------------------------

Summary of changes:
 bfd/ChangeLog         |   15 +++++++++++++++
 bfd/elf-s390-common.c |    6 ++++--
 bfd/elf32-arm.c       |    7 ++++---
 bfd/elf32-i386.c      |    9 +++++----
 bfd/elf32-m68k.c      |    7 ++++---
 bfd/elf32-ppc.c       |    7 ++++---
 bfd/elf32-sparc.c     |    9 +++++----
 bfd/elf64-ppc.c       |   19 ++++++++-----------
 bfd/elf64-sparc.c     |    7 ++++---
 bfd/elf64-x86-64.c    |    7 ++++---
 bfd/elfxx-aarch64.c   |    7 ++++---
 11 files changed, 61 insertions(+), 39 deletions(-)