[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
llvm-svn: 342702
diff --git a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
index 36ed77a..ce2a1f1 100644
--- a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
+++ b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
@@ -892,6 +892,11 @@
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 @@
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) + "'");