1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

[llvm-strip] Expose --strip-unneeded option

Differential Revision: https://reviews.llvm.org/D47818

llvm-svn: 334182
This commit is contained in:
Paul Semel 2018-06-07 10:05:25 +00:00
parent 1944ea0dcb
commit e9cbc4c61c
3 changed files with 13 additions and 3 deletions

View File

@ -1,7 +1,14 @@
# RUN: yaml2obj %s > %t
# RUN: cp %t %t1
# RUN: llvm-objcopy --strip-unneeded %t %t2
# Verify that llvm-objcopy has not modified the input.
# RUN: cmp %t %t1
# RUN: llvm-readobj -symbols %t2 | FileCheck %s
# Verify that llvm-strip modifies the symbol table the same way.
# RUN: llvm-strip --strip-unneeded %t
# RUN: cmp %t %t2
!ELF
FileHeader:
Class: ELFCLASS64

View File

@ -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">;

View File

@ -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))