Skip to content

Commit

Permalink
Add --strip-all option back to llvm-strip.
Browse files Browse the repository at this point in the history
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

llvm-svn: 336921
  • Loading branch information
stephenhines committed Jul 12, 2018
1 parent 773c7c4 commit e8c3c5f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions llvm/test/tools/llvm-objcopy/strip-all.test
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions llvm/tools/llvm-objcopy/StripOpts.td
Expand Up @@ -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">;

Expand Down
1 change: 1 addition & 0 deletions llvm/tools/llvm-objcopy/llvm-objcopy.cpp
Expand Up @@ -655,6 +655,7 @@ CopyConfig ParseStripOptions(ArrayRef<const char *> 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;
Expand Down

0 comments on commit e8c3c5f

Please sign in to comment.