[llvm] r336921 - Add --strip-all option back to llvm-strip.

Stephen Hines via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 12 10:42:17 PDT 2018


Author: srhines
Date: Thu Jul 12 10:42:17 2018
New Revision: 336921

URL: http://llvm.org/viewvc/llvm-project?rev=336921&view=rev
Log:
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

Modified:
    llvm/trunk/test/tools/llvm-objcopy/strip-all.test
    llvm/trunk/tools/llvm-objcopy/StripOpts.td
    llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp

Modified: llvm/trunk/test/tools/llvm-objcopy/strip-all.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/strip-all.test?rev=336921&r1=336920&r2=336921&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/strip-all.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/strip-all.test Thu Jul 12 10:42:17 2018
@@ -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

Modified: llvm/trunk/tools/llvm-objcopy/StripOpts.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/StripOpts.td?rev=336921&r1=336920&r2=336921&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/StripOpts.td (original)
+++ llvm/trunk/tools/llvm-objcopy/StripOpts.td Thu Jul 12 10:42:17 2018
@@ -11,6 +11,9 @@ defm output : Eq<"o">,
               MetaVarName<"output">,
               HelpText<"Write output to <file>">;
 
+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">;
 

Modified: llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp?rev=336921&r1=336920&r2=336921&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp (original)
+++ llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp Thu Jul 12 10:42:17 2018
@@ -655,6 +655,7 @@ CopyConfig ParseStripOptions(ArrayRef<co
 
   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;




More information about the llvm-commits mailing list