Bug 20968 - ld ignores -b binary
Summary: ld ignores -b binary
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.28
: P2 normal
Target Milestone: ---
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-15 08:12 UTC by Adam Lackorzynski
Modified: 2016-12-15 13:32 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed: 2016-12-15 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Lackorzynski 2016-12-15 08:12:09 UTC
Hi,

HEAD of ld/binutils ignores -b binary:

$ ld -m elf_x86_64 -r --oformat elf64-x86-64 -o foo.o -b binary foo.txt
ld: foo.txt: not in ELF format
$ ld --version
GNU ld (GNU Binutils) 2.27.51.20161215

Instead, in previous versions it works:
$ ld -m elf_x86_64 -r --oformat elf64-x86-64 -o foo.o -b binary foo.txt 
$ file foo.o 
foo.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
Comment 1 Sourceware Commits 2016-12-15 13:27:10 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

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

commit a961cdd5f139d3c3e09170db52bd8df7dafae13f
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Dec 15 21:29:44 2016 +1030

    Linking non-ELF file broken by PR20908 fix
    
    	PR ld/20968
    	PR ld/20908
    	* elflink.c (bfd_elf_final_link): Revert 2016-12-02 change.  Move
    	reloc counting code later after ELF flavour test.
Comment 2 Alan Modra 2016-12-15 13:30:25 UTC
fixed
Comment 3 Adam Lackorzynski 2016-12-15 13:32:43 UTC
Thanks! (And confirmed.)