[PATCH] D41125: [llvm-objcopy] Add -o option to llvm-objcopy
Jake Ehrlich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 12 12:06:22 PST 2017
jakehehrlich created this revision.
jakehehrlich added reviewers: phosek, jhenderson.
llvm-objcopy needs to have an llvm-strip alias. The llvm-strip alias needs to be command line compatible with GNU strip. This change adds a -o option to llvm-objcopy to allow the user to specify the output file name using -o rather than a positional argument.
Repository:
rL LLVM
https://reviews.llvm.org/D41125
Files:
test/tools/llvm-objcopy/basic-strip.test
test/tools/llvm-objcopy/explicit-out.test
tools/llvm-objcopy/llvm-objcopy.cpp
Index: tools/llvm-objcopy/llvm-objcopy.cpp
===================================================================
--- tools/llvm-objcopy/llvm-objcopy.cpp
+++ tools/llvm-objcopy/llvm-objcopy.cpp
@@ -276,6 +276,8 @@
static cl::opt<std::string> InputFilename(cl::Positional, cl::desc("<input>"));
static cl::opt<std::string> OutputFilename(cl::Positional, cl::desc("<output>"));
+static cl::alias ExplicitOutput("o", cl::desc("file to output to"),
+ cl::aliasopt(OutputFilename));
static cl::opt<std::string>
OutputFormat("O", cl::desc("Set output format to one of the following:"
"\n\tbinary\n\telf"), cl::init("elf"));
Index: test/tools/llvm-objcopy/explicit-out.test
===================================================================
--- /dev/null
+++ test/tools/llvm-objcopy/explicit-out.test
@@ -0,0 +1,23 @@
+# RUN: yaml2obj %s > %t
+# RUN: llvm-objcopy %t -o %t2
+# RUN: llvm-objcopy %t %t3
+# RUN: diff %t2 %t3
+
+!ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
+Sections:
+ - Name: .bss
+ Type: SHT_NOBITS
+ Flags: [ SHF_ALLOC ]
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ - Name: .blarg
+ Type: SHT_PROGBITS
+ Flags: [ ]
+ - Name: .gnu.warning.foo
+ Type: SHT_PROGBITS
Index: test/tools/llvm-objcopy/basic-strip.test
===================================================================
--- test/tools/llvm-objcopy/basic-strip.test
+++ test/tools/llvm-objcopy/basic-strip.test
@@ -1,5 +1,5 @@
# RUN: yaml2obj %s > %t
-# RUN: llvm-strip %t %t2
+# RUN: llvm-strip %t -o %t2
# RUN: llvm-readobj -file-headers -sections %t2 | FileCheck %s
!ELF
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41125.126598.patch
Type: text/x-patch
Size: 1888 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171212/2e60066d/attachment.bin>
More information about the llvm-commits
mailing list