From cf67633e66de0853ed061dd38960623209aa9dba Mon Sep 17 00:00:00 2001 From: Jordan Rupprecht Date: Fri, 17 Aug 2018 18:51:11 +0000 Subject: [llvm-objcopy] Add support for -I binary -B . Summary: The -I (--input-target) and -B (--binary-architecture) flags exist but are currently silently ignored. This adds support for -I binary for architectures i386, x86-64 (and alias i386:x86-64), arm, aarch64, sparc, and ppc (powerpc:common64). This is largely based on D41687. This is done by implementing an additional subclass of Reader, BinaryReader, which works by interpreting the input file as contents for .data field, sets up a synthetic header, and adds additional sections/symbols (e.g. _binary__tmp_data_txt_start). Reviewers: jakehehrlich, alexshap, jhenderson, javed.absar Reviewed By: jhenderson Subscribers: jyknight, nemanjai, kbarton, fedor.sergeev, jrtc27, kristof.beyls, paulsemel, llvm-commits Differential Revision: https://reviews.llvm.org/D50343 llvm-svn: 340070 --- llvm/test/tools/llvm-objcopy/binary-input-error.test | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 llvm/test/tools/llvm-objcopy/binary-input-error.test (limited to 'llvm/test/tools/llvm-objcopy/binary-input-error.test') diff --git a/llvm/test/tools/llvm-objcopy/binary-input-error.test b/llvm/test/tools/llvm-objcopy/binary-input-error.test new file mode 100644 index 00000000000..820e569ad7b --- /dev/null +++ b/llvm/test/tools/llvm-objcopy/binary-input-error.test @@ -0,0 +1,10 @@ +# RUN: echo abcd > %t.txt + +# RUN: not llvm-objcopy -I binary %t.txt %t.o 2>&1 \ +# RUN: | FileCheck %s --check-prefix=MISSING-BINARY-ARCH + +# RUN: not llvm-objcopy -I binary -B xyz %t.txt %t.o 2>&1 \ +# RUN: | FileCheck %s --check-prefix=BAD-BINARY-ARCH + +# MISSING-BINARY-ARCH: Specified binary input without specifiying an architecture. +# BAD-BINARY-ARCH: Invalid architecture: 'xyz'. -- cgit v1.2.3