From d0daa090e62b233176c211c555a87f87ad666358 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Wed, 28 Nov 2018 06:51:50 +0000 Subject: [PATCH] [llvm-objcopy] Hook up the -V alias to --version, output "GNU strip" 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 | 1 + test/tools/llvm-objcopy/strip-version.test | 4 +++- tools/llvm-objcopy/CopyConfig.cpp | 2 ++ tools/llvm-objcopy/ObjcopyOpts.td | 1 + tools/llvm-objcopy/StripOpts.td | 1 + 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/test/tools/llvm-objcopy/objcopy-version.test b/test/tools/llvm-objcopy/objcopy-version.test index 3b5cd593ddf..f2f7fa05306 100644 --- a/test/tools/llvm-objcopy/objcopy-version.test +++ b/test/tools/llvm-objcopy/objcopy-version.test @@ -1,4 +1,5 @@ # RUN: llvm-objcopy -version | FileCheck %s # RUN: llvm-objcopy --version | FileCheck %s +# RUN: llvm-objcopy -V | FileCheck %s # CHECK: {{ version }} diff --git a/test/tools/llvm-objcopy/strip-version.test b/test/tools/llvm-objcopy/strip-version.test index bd91dd3de83..d1d3165106a 100644 --- a/test/tools/llvm-objcopy/strip-version.test +++ b/test/tools/llvm-objcopy/strip-version.test @@ -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 diff --git a/tools/llvm-objcopy/CopyConfig.cpp b/tools/llvm-objcopy/CopyConfig.cpp index b4ebbc5fcfd..0385782fa91 100644 --- a/tools/llvm-objcopy/CopyConfig.cpp +++ b/tools/llvm-objcopy/CopyConfig.cpp @@ -226,6 +226,7 @@ DriverConfig parseObjcopyOptions(ArrayRef 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 ArgsArr) { } if (InputArgs.hasArg(STRIP_version)) { + outs() << "llvm-strip, compatible with GNU strip\n"; cl::PrintVersionMessage(); exit(0); } diff --git a/tools/llvm-objcopy/ObjcopyOpts.td b/tools/llvm-objcopy/ObjcopyOpts.td index 6a84155a089..4217188bbec 100644 --- a/tools/llvm-objcopy/ObjcopyOpts.td +++ b/tools/llvm-objcopy/ObjcopyOpts.td @@ -165,3 +165,4 @@ defm prefix_symbols def version : Flag<["-", "--"], "version">, HelpText<"Print the version and exit.">; +def V : Flag<["-"], "V">, Alias; diff --git a/tools/llvm-objcopy/StripOpts.td b/tools/llvm-objcopy/StripOpts.td index 032aa6f85c7..fa98e27e932 100644 --- a/tools/llvm-objcopy/StripOpts.td +++ b/tools/llvm-objcopy/StripOpts.td @@ -64,3 +64,4 @@ def x : Flag<["-"], "x">, Alias; def version : Flag<["-", "--"], "version">, HelpText<"Print the version and exit.">; +def V : Flag<["-"], "V">, Alias; -- 2.11.4.GIT