mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-13 14:47:00 +00:00
[llvm-objcopy/llvm-strip]: handle --version
Summary: Implement --version for objcopy and strip. I think there are LLVM utilities that automatically handle this, but that doesn't seem to work with custom parsing since this binary handles both objcopy and strip, so it uses custom parsing. This fixes PR38298 Reviewers: jhenderson, alexshap, jakehehrlich Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D52328 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342702 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7b73473893
commit
5b1329de30
4
test/tools/llvm-objcopy/objcopy-version.test
Normal file
4
test/tools/llvm-objcopy/objcopy-version.test
Normal file
@ -0,0 +1,4 @@
|
||||
# RUN: llvm-objcopy -version | FileCheck %s
|
||||
# RUN: llvm-objcopy --version | FileCheck %s
|
||||
|
||||
# CHECK: {{ version }}
|
4
test/tools/llvm-objcopy/strip-version.test
Normal file
4
test/tools/llvm-objcopy/strip-version.test
Normal file
@ -0,0 +1,4 @@
|
||||
# RUN: llvm-strip -version | FileCheck %s
|
||||
# RUN: llvm-strip --version | FileCheck %s
|
||||
|
||||
# CHECK: {{ version }}
|
@ -107,6 +107,9 @@ defm keep_global_symbols
|
||||
"with '#'. Leading and trailing whitespace is stripped from each "
|
||||
"line. May be repeated to read symbols from many files.">;
|
||||
|
||||
def version : Flag<[ "-", "--" ], "version">,
|
||||
HelpText<"Print the version and exit.">;
|
||||
|
||||
defm weaken_symbol : Eq<"weaken-symbol">,
|
||||
MetaVarName<"symbol">,
|
||||
HelpText<"Mark <symbol> as weak">;
|
||||
|
@ -47,6 +47,10 @@ def K : JoinedOrSeparate<["-"], "K">,
|
||||
|
||||
def discard_all : Flag<["-", "--"], "discard-all">,
|
||||
HelpText<"Remove all local symbols except file and section symbols">;
|
||||
|
||||
def version : Flag<[ "-", "--" ], "version">,
|
||||
HelpText<"Print the version and exit.">;
|
||||
|
||||
def x : Flag<["-"], "x">,
|
||||
Alias<discard_all>;
|
||||
|
||||
|
@ -892,6 +892,11 @@ static DriverConfig parseObjcopyOptions(ArrayRef<const char *> ArgsArr) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (InputArgs.hasArg(OBJCOPY_version)) {
|
||||
cl::PrintVersionMessage();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
SmallVector<const char *, 2> Positional;
|
||||
|
||||
for (auto Arg : InputArgs.filtered(OBJCOPY_UNKNOWN))
|
||||
@ -1019,6 +1024,11 @@ static DriverConfig parseStripOptions(ArrayRef<const char *> ArgsArr) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (InputArgs.hasArg(STRIP_version)) {
|
||||
cl::PrintVersionMessage();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
SmallVector<const char *, 2> Positional;
|
||||
for (auto Arg : InputArgs.filtered(STRIP_UNKNOWN))
|
||||
error("unknown argument '" + Arg->getAsString(InputArgs) + "'");
|
||||
|
Loading…
Reference in New Issue
Block a user