OSDN Git Service

[llvm-objcopy] Hook up the -V alias to --version, output "GNU strip"
authorMartin Storsjo <martin@martin.st>
Wed, 28 Nov 2018 06:51:50 +0000 (06:51 +0000)
committerMartin Storsjo <martin@martin.st>
Wed, 28 Nov 2018 06:51:50 +0000 (06:51 +0000)
This allows libtool to detect the presence of llvm-strip and use
it with the options --strip-debug and --strip-unneeded.

Also hook up the -V alias for objcopy.

Differential Revision: https://reviews.llvm.org/D54936

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347731 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/llvm-objcopy/objcopy-version.test
test/tools/llvm-objcopy/strip-version.test
tools/llvm-objcopy/CopyConfig.cpp
tools/llvm-objcopy/ObjcopyOpts.td
tools/llvm-objcopy/StripOpts.td

index 3b5cd59..f2f7fa0 100644 (file)
@@ -1,4 +1,5 @@
 # RUN: llvm-objcopy -version | FileCheck %s
 # RUN: llvm-objcopy --version | FileCheck %s
+# RUN: llvm-objcopy -V | FileCheck %s
 
 # CHECK: {{ version }}
index bd91dd3..d1d3165 100644 (file)
@@ -1,4 +1,6 @@
 # RUN: llvm-strip -version | FileCheck %s
 # RUN: llvm-strip --version | FileCheck %s
+# RUN: llvm-strip -V | FileCheck %s
 
-# CHECK: {{ version }}
+# CHECK-DAG: {{ version }}
+# CHECK-DAG: GNU strip
index b4ebbc5..0385782 100644 (file)
@@ -226,6 +226,7 @@ DriverConfig parseObjcopyOptions(ArrayRef<const char *> ArgsArr) {
   }
 
   if (InputArgs.hasArg(OBJCOPY_version)) {
+    outs() << "llvm-objcopy, compatible with GNU objcopy\n";
     cl::PrintVersionMessage();
     exit(0);
   }
@@ -383,6 +384,7 @@ DriverConfig parseStripOptions(ArrayRef<const char *> ArgsArr) {
   }
 
   if (InputArgs.hasArg(STRIP_version)) {
+    outs() << "llvm-strip, compatible with GNU strip\n";
     cl::PrintVersionMessage();
     exit(0);
   }
index 6a84155..4217188 100644 (file)
@@ -165,3 +165,4 @@ defm prefix_symbols
 
 def version : Flag<["-", "--"], "version">,
               HelpText<"Print the version and exit.">;
+def V : Flag<["-"], "V">, Alias<version>;
index 032aa6f..fa98e27 100644 (file)
@@ -64,3 +64,4 @@ def x : Flag<["-"], "x">, Alias<discard_all>;
 
 def version : Flag<["-", "--"], "version">,
               HelpText<"Print the version and exit.">;
+def V : Flag<["-"], "V">, Alias<version>;