[PATCH] D47674: [llvm-strip] Add missing aliases for --strip-debug

Alexander Shaposhnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 2 00:53:24 PDT 2018


alexshap created this revision.
alexshap added reviewers: jhenderson, paulsemel, jakehehrlich.

Add missing aliases for --strip-debug: -g, -S, -d.
https://sourceware.org/binutils/docs/binutils/strip.html
Test plan: make check-all


Repository:
  rL LLVM

https://reviews.llvm.org/D47674

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


Index: tools/llvm-objcopy/StripOpts.td
===================================================================
--- tools/llvm-objcopy/StripOpts.td
+++ tools/llvm-objcopy/StripOpts.td
@@ -14,6 +14,15 @@
 def strip_debug : Flag<["-", "--"], "strip-debug">,
                   HelpText<"Remove debugging symbols only">;
 
+def d : Flag<["-"], "d">,
+        Alias<strip_debug>;
+
+def g : Flag<["-"], "g">,
+        Alias<strip_debug>;
+
+def S : Flag<["-"], "S">,
+        Alias<strip_debug>;
+
 defm remove_section : Eq<"remove-section">,
                       MetaVarName<"section">,
                       HelpText<"Remove <section>">;
Index: test/tools/llvm-objcopy/strip-debug.test
===================================================================
--- test/tools/llvm-objcopy/strip-debug.test
+++ test/tools/llvm-objcopy/strip-debug.test
@@ -1,15 +1,26 @@
 # RUN: yaml2obj %s > %t
+# RUN: cp %t %t3
 # RUN: llvm-objcopy -strip-debug %t %t2
 # RUN: llvm-readobj -file-headers -sections -symbols %t2 | FileCheck %s
 
-# We run yaml2obj again rather than copy %t to avoid interfering 
-# with llvm-objcopy's test (which potentially could have corrupted/updated the binary).
+# Verify that the previous run of llvm-objcopy has not modified the input.
+# RUN: cmp %t %t3
 
-# RUN: yaml2obj %s > %t3
 # RUN: llvm-strip -strip-debug %t3
-# RUN: llvm-readobj -file-headers -sections -symbols %t3 | FileCheck %s
 # RUN: cmp %t2 %t3
 
+# RUN: cp %t %t4
+# RUN: llvm-strip -d %t4
+# RUN: cmp %t2 %t4
+
+# RUN: cp %t %t5
+# RUN: llvm-strip -g %t5
+# RUN: cmp %t2 %t5
+
+# RUN: cp %t %t6
+# RUN: llvm-strip -S %t6
+# RUN: cmp %t2 %t6
+
 !ELF
 FileHeader:
   Class:           ELFCLASS64


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47674.149606.patch
Type: text/x-patch
Size: 1675 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180602/d1ca11f1/attachment.bin>


More information about the llvm-commits mailing list