[llvm-objcopy] Default --output-target to --input-target when unspecified
Fixes PR42171.
In GNU objcopy, if -O (--output-target) is not specified, the value is
copied from -I (--input-target).
```
objcopy -I binary -B i386:x86-64 a.txt b # b is copied from a.txt
llvm-objcopy -I binary -B i386:x86-64 a.txt b # b is an x86-64 object file
```
This patch changes our behavior to match GNU. With this change, we can
delete code related to -B handling (D67215).
Reviewed By: jakehehrlich
Differential Revision: https://reviews.llvm.org/D67144
llvm-svn: 371913
diff --git a/llvm/test/tools/llvm-objcopy/ELF/binary-input.test b/llvm/test/tools/llvm-objcopy/ELF/binary-input.test
index d7a708d..8eef7f7 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/binary-input.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/binary-input.test
@@ -1,7 +1,7 @@
# RUN: echo -n abcd > %t.x-txt
# Preserve input to verify it is not modified
# RUN: cp %t.x-txt %t-copy.txt
-# RUN: llvm-objcopy -I binary -B i386:x86-64 %t.x-txt %t.o
+# RUN: llvm-objcopy -I binary -O elf64-x86-64 %t.x-txt %t.o
# RUN: llvm-readobj --sections --symbols %t.o | FileCheck %s
# RUN: cmp %t.x-txt %t-copy.txt