[PATCH] D49226: Add --strip-all option back to llvm-strip.

Stephen Hines via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 12 02:56:18 PDT 2018


srhines created this revision.
Herald added subscribers: llvm-commits, jakehehrlich.
Herald added a reviewer: alexshap.

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.


Repository:
  rL LLVM

https://reviews.llvm.org/D49226

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


Index: tools/llvm-objcopy/llvm-objcopy.cpp
===================================================================
--- tools/llvm-objcopy/llvm-objcopy.cpp
+++ tools/llvm-objcopy/llvm-objcopy.cpp
@@ -655,6 +655,7 @@
 
   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;
Index: tools/llvm-objcopy/StripOpts.td
===================================================================
--- tools/llvm-objcopy/StripOpts.td
+++ tools/llvm-objcopy/StripOpts.td
@@ -11,6 +11,9 @@
               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">;
 
Index: test/tools/llvm-objcopy/strip-all.test
===================================================================
--- test/tools/llvm-objcopy/strip-all.test
+++ 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49226.155138.patch
Type: text/x-patch
Size: 1519 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180712/a58786ae/attachment.bin>


More information about the llvm-commits mailing list