From df4581eddcf789e6f55696d2693cf243659f59d5 Mon Sep 17 00:00:00 2001 From: Stephen Hines Date: Thu, 12 Jul 2018 17:42:17 +0000 Subject: [PATCH] Add --strip-all option back to llvm-strip. Summary: This option appears to have been dropped as part of the refactoring in r331663. Unfortunately, if we want to use llvm-strip as a drop-in replacement for strip, this option should still be available. Reviewers: alexshap Reviewed By: alexshap Subscribers: meikeb, kongyi, chh, jakehehrlich, llvm-commits, pirama Differential Revision: https://reviews.llvm.org/D49226 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336921 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/tools/llvm-objcopy/strip-all.test | 8 ++++++++ tools/llvm-objcopy/StripOpts.td | 3 +++ tools/llvm-objcopy/llvm-objcopy.cpp | 1 + 3 files changed, 12 insertions(+) diff --git a/test/tools/llvm-objcopy/strip-all.test b/test/tools/llvm-objcopy/strip-all.test index d650ab790b8..71e024de072 100644 --- a/test/tools/llvm-objcopy/strip-all.test +++ b/test/tools/llvm-objcopy/strip-all.test @@ -27,6 +27,14 @@ # RUN: llvm-ar p %t.a > %t6 # RUN: cmp %t2 %t6 +# RUN: cp %t %t7 +# RUN: llvm-strip -strip-all %t7 +# RUN: cmp %t2 %t7 + +# RUN: cp %t %t8 +# RUN: llvm-strip --strip-all %t8 +# RUN: cmp %t2 %t8 + !ELF FileHeader: Class: ELFCLASS64 diff --git a/tools/llvm-objcopy/StripOpts.td b/tools/llvm-objcopy/StripOpts.td index 5825f23297c..333b0d288ef 100644 --- a/tools/llvm-objcopy/StripOpts.td +++ b/tools/llvm-objcopy/StripOpts.td @@ -11,6 +11,9 @@ defm output : Eq<"o">, MetaVarName<"output">, HelpText<"Write output to ">; +def strip_all : Flag<["-", "--"], "strip-all">, + HelpText<"Remove non-allocated sections other than .gnu.warning* sections">; + def strip_debug : Flag<["-", "--"], "strip-debug">, HelpText<"Remove debugging symbols only">; diff --git a/tools/llvm-objcopy/llvm-objcopy.cpp b/tools/llvm-objcopy/llvm-objcopy.cpp index c28862f073a..a4936ddfa4a 100644 --- a/tools/llvm-objcopy/llvm-objcopy.cpp +++ b/tools/llvm-objcopy/llvm-objcopy.cpp @@ -655,6 +655,7 @@ CopyConfig ParseStripOptions(ArrayRef ArgsArr) { Config.DiscardAll = InputArgs.hasArg(STRIP_discard_all); Config.StripUnneeded = InputArgs.hasArg(STRIP_strip_unneeded); + Config.StripAll = InputArgs.hasArg(STRIP_strip_all); if (!Config.StripDebug && !Config.StripUnneeded && !Config.DiscardAll) Config.StripAll = true; -- 2.50.1