[PATCH] D52182: [llvm-objcopy] Make -S an alias for --strip-all

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 17 12:05:30 PDT 2018


jakehehrlich created this revision.
jakehehrlich added reviewers: tpimh, jhenderson, alexshap.
Herald added a subscriber: rupprecht.

-S should be an alias for --strip-all not an alias for --strip-all-gnu which at best has imaginary use cases. llvm-objcopy's --strip-all has proven to be compatible with the uses of --strip-all in GNU objcopy in huge code bases with no complaints. llvm-objcopy's --strip-all makes binaries smaller and has a more principled definition.


Repository:
  rL LLVM

https://reviews.llvm.org/D52182

Files:
  llvm/test/tools/llvm-objcopy/strip-all-gnu.test
  llvm/test/tools/llvm-objcopy/strip-all.test
  llvm/tools/llvm-objcopy/ObjcopyOpts.td


Index: llvm/tools/llvm-objcopy/ObjcopyOpts.td
===================================================================
--- llvm/tools/llvm-objcopy/ObjcopyOpts.td
+++ llvm/tools/llvm-objcopy/ObjcopyOpts.td
@@ -65,10 +65,10 @@
                    HelpText<"Make a section named <section> with the contents of <file>.">;
 def strip_all : Flag<["-", "--"], "strip-all">,
                 HelpText<"Remove non-allocated sections other than .gnu.warning* sections">;
+def S : Flag<["-"], "S">,
+        Alias<strip_all>;
 def strip_all_gnu : Flag<["-", "--"], "strip-all-gnu">,
                     HelpText<"Compaitable with GNU objcopy's --strip-all">;
-def S : Flag<["-"], "S">,
-        Alias<strip_all_gnu>;
 def strip_debug : Flag<["-", "--"], "strip-debug">,
                   HelpText<"Remove all debug information">;
 def strip_dwo : Flag<["-", "--"], "strip-dwo">,
Index: llvm/test/tools/llvm-objcopy/strip-all.test
===================================================================
--- llvm/test/tools/llvm-objcopy/strip-all.test
+++ llvm/test/tools/llvm-objcopy/strip-all.test
@@ -35,6 +35,10 @@
 # RUN: llvm-strip --strip-all %t8
 # RUN: cmp %t2 %t8
 
+# RUN: cp %t %t9
+# RUN: llvm-objcopy -S %t9 %t9
+# RUN: cmp %t2 %t9
+
 # Verify that a non-existent symbol table (after first call to llvm-strip)
 # can be handled correctly.
 # RUN: cp %t %t9
Index: llvm/test/tools/llvm-objcopy/strip-all-gnu.test
===================================================================
--- llvm/test/tools/llvm-objcopy/strip-all-gnu.test
+++ llvm/test/tools/llvm-objcopy/strip-all-gnu.test
@@ -2,8 +2,6 @@
 # RUN: cp %t %t1
 # RUN: llvm-objcopy --strip-all-gnu %t %t2
 # RUN: llvm-readobj -file-headers -sections %t2 | FileCheck %s
-# RUN: llvm-objcopy -S %t1 %t3
-# RUN: cmp %t2 %t3
 
 !ELF
 FileHeader:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52182.165802.patch
Type: text/x-patch
Size: 1793 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180917/7796c4b6/attachment.bin>


More information about the llvm-commits mailing list