diff options
Diffstat (limited to 'llvm/tools/llvm-objcopy')
-rw-r--r-- | llvm/tools/llvm-objcopy/StripOpts.td | 3 | ||||
-rw-r--r-- | llvm/tools/llvm-objcopy/llvm-objcopy.cpp | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/llvm/tools/llvm-objcopy/StripOpts.td b/llvm/tools/llvm-objcopy/StripOpts.td index 27fdfee8f5b..5825f23297c 100644 --- a/llvm/tools/llvm-objcopy/StripOpts.td +++ b/llvm/tools/llvm-objcopy/StripOpts.td @@ -41,3 +41,6 @@ def discard_all : Flag<["-", "--"], "discard-all">, HelpText<"Remove all local symbols except file and section symbols">; def x : Flag<["-"], "x">, Alias<discard_all>; + +def strip_unneeded : Flag<["-", "--"], "strip-unneeded">, + HelpText<"Remove all symbols not needed by relocations">; diff --git a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp index 46769838aba..bf58f342ee4 100644 --- a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp +++ b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp @@ -583,12 +583,12 @@ CopyConfig ParseStripOptions(ArrayRef<const char *> ArgsArr) { Config.OutputFilename = InputArgs.getLastArgValue(STRIP_output, Positional[0]); - // Strip debug info only. Config.StripDebug = InputArgs.hasArg(STRIP_strip_debug); Config.DiscardAll = InputArgs.hasArg(STRIP_discard_all); - - if (!Config.StripDebug && !Config.DiscardAll) + Config.StripUnneeded = InputArgs.hasArg(STRIP_strip_unneeded); + + if (!Config.StripDebug && !Config.StripUnneeded && !Config.DiscardAll) Config.StripAll = true; for (auto Arg : InputArgs.filtered(STRIP_remove_section)) |