[llvm] r352878 - [llvm-strip] Implement --keep-file-symbols
Eugene Leviant via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 1 07:25:15 PST 2019
Author: evgeny777
Date: Fri Feb 1 07:25:15 2019
New Revision: 352878
URL: http://llvm.org/viewvc/llvm-project?rev=352878&view=rev
Log:
[llvm-strip] Implement --keep-file-symbols
Differential revision: https://reviews.llvm.org/D57582
Modified:
llvm/trunk/test/tools/llvm-objcopy/ELF/keep-file-symbols.test
llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp
llvm/trunk/tools/llvm-objcopy/StripOpts.td
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/keep-file-symbols.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/keep-file-symbols.test?rev=352878&r1=352877&r2=352878&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/keep-file-symbols.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/keep-file-symbols.test Fri Feb 1 07:25:15 2019
@@ -4,6 +4,11 @@
# RUN: llvm-objcopy --keep-file-symbols --strip-symbol foo %t %t2
# RUN: llvm-readobj --symbols %t2 | FileCheck %s --check-prefix=STRIP
+# RUN: llvm-strip --keep-file-symbols %t -o %t3
+# RUN: llvm-readobj --symbols %t3 | FileCheck %s --check-prefix=STRIPALL
+# RUN: llvm-strip --keep-file-symbols --strip-symbol foo %t -o %t4
+# RUN: llvm-readobj --symbols %t4 | FileCheck %s --check-prefix=STRIP
+
!ELF
FileHeader:
Class: ELFCLASS64
Modified: llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp?rev=352878&r1=352877&r2=352878&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp (original)
+++ llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp Fri Feb 1 07:25:15 2019
@@ -479,6 +479,7 @@ DriverConfig parseStripOptions(ArrayRef<
Config.StripUnneeded = InputArgs.hasArg(STRIP_strip_unneeded);
Config.StripAll = InputArgs.hasArg(STRIP_strip_all);
Config.StripAllGNU = InputArgs.hasArg(STRIP_strip_all_gnu);
+ Config.KeepFileSymbols = InputArgs.hasArg(STRIP_keep_file_symbols);
for (auto Arg : InputArgs.filtered(STRIP_keep_section))
Config.KeepSection.push_back(Arg->getValue());
Modified: llvm/trunk/tools/llvm-objcopy/StripOpts.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/StripOpts.td?rev=352878&r1=352877&r2=352878&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/StripOpts.td (original)
+++ llvm/trunk/tools/llvm-objcopy/StripOpts.td Fri Feb 1 07:25:15 2019
@@ -59,6 +59,9 @@ defm keep_section : Eq<"keep-section", "
MetaVarName<"section">;
defm keep_symbol : Eq<"keep-symbol", "Do not remove symbol <symbol>">,
MetaVarName<"symbol">;
+def keep_file_symbols : Flag<["-", "--"], "keep-file-symbols">,
+ HelpText<"Do not remove file symbols">;
+
def K : JoinedOrSeparate<["-"], "K">, Alias<keep_symbol>;
def discard_locals : Flag<["-", "--"], "discard-locals">,
More information about the llvm-commits
mailing list