diff options
author | Alexander Shaposhnikov <shal1t712@gmail.com> | 2018-05-11 05:27:06 +0000 |
---|---|---|
committer | Alexander Shaposhnikov <shal1t712@gmail.com> | 2018-05-11 05:27:06 +0000 |
commit | 3e6c331c76667c16104d1eaccdcc0ec1c4af81e5 (patch) | |
tree | dfc58e5518953f83835349498047d9b88ac81a82 /tools/llvm-objcopy | |
parent | e12166f8ad8f1035434246cb282b1861f42d80c1 (diff) |
[llvm-strip] Add support for -remove-section
This diff adds support for -remove-section to llvm-strip.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D46567
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332081 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-objcopy')
-rw-r--r-- | tools/llvm-objcopy/StripOpts.td | 6 | ||||
-rw-r--r-- | tools/llvm-objcopy/llvm-objcopy.cpp | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/tools/llvm-objcopy/StripOpts.td b/tools/llvm-objcopy/StripOpts.td index 3266c89bda0..1d7a1aec14d 100644 --- a/tools/llvm-objcopy/StripOpts.td +++ b/tools/llvm-objcopy/StripOpts.td @@ -10,3 +10,9 @@ def help : Flag<["-", "--"], "help">; def strip_debug : Flag<["-", "--"], "strip-debug">, HelpText<"Remove debugging symbols only">; +defm remove_section : Eq<"remove-section">, + MetaVarName<"section">, + HelpText<"Remove <section>">; + +def R : JoinedOrSeparate<["-"], "R">, + Alias<remove_section>; diff --git a/tools/llvm-objcopy/llvm-objcopy.cpp b/tools/llvm-objcopy/llvm-objcopy.cpp index e08648ea0af..c71e2b94728 100644 --- a/tools/llvm-objcopy/llvm-objcopy.cpp +++ b/tools/llvm-objcopy/llvm-objcopy.cpp @@ -528,6 +528,10 @@ CopyConfig ParseStripOptions(ArrayRef<const char *> ArgsArr) { Config.StripDebug = InputArgs.hasArg(STRIP_strip_debug); if (!Config.StripDebug) Config.StripAll = true; + + for (auto Arg : InputArgs.filtered(STRIP_remove_section)) + Config.ToRemove.push_back(Arg->getValue()); + return Config; } |