]> granicus.if.org Git - llvm/commit
[llvm-objcopy] Ignore -B --binary-architecture=
authorFangrui Song <maskray@google.com>
Sat, 14 Sep 2019 01:36:31 +0000 (01:36 +0000)
committerFangrui Song <maskray@google.com>
Sat, 14 Sep 2019 01:36:31 +0000 (01:36 +0000)
commitf6dc13fa4dec7ac1eea514b3b50e5c926c1ed804
tree45047f4dc28248d33f223b5de64ad9564417e830
parent9c01fe05637edd2ff921d974d8e5efe514998af8
[llvm-objcopy] Ignore -B --binary-architecture=

GNU objcopy documents that -B is only useful with architecture-less
input (i.e. "binary" or "ihex"). After D67144, -O defaults to -I, and
-B is essentially a NOP.

* If -O is binary/ihex, GNU objcopy ignores -B.
* If -O is elf*, -B provides the e_machine field in GNU objcopy.

So to convert a blob to an ELF, `-I binary -B i386:x86-64 -O elf64-x86-64` has to be specified.

`-I binary -B i386:x86-64 -O elf64-x86-64` creates an ELF with its
e_machine field set to EM_NONE in GNU objcopy, but a regular x86_64 ELF
in elftoolchain elfcopy. Follow the elftoolchain approach (ignoring -B)
to simplify code. Users that expect their command line portable should
specify -B.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D67215

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371914 91177308-0d34-0410-b5e6-96231b3b80d8
docs/CommandGuide/llvm-objcopy.rst
test/tools/llvm-objcopy/ELF/binary-input-error.test
tools/llvm-objcopy/CopyConfig.cpp
tools/llvm-objcopy/CopyConfig.h
tools/llvm-objcopy/ELF/ELFObjcopy.cpp
tools/llvm-objcopy/ELF/Object.cpp
tools/llvm-objcopy/ELF/Object.h
tools/llvm-objcopy/ObjcopyOpts.td