[PATCH] D57582: [llvm-strip] Add --keep-file-symbols
Eugene Leviant via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 1 05:57:37 PST 2019
evgeny777 created this revision.
evgeny777 added reviewers: jhenderson, rupprecht.
Herald added subscribers: jakehehrlich, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: alexshap.
https://reviews.llvm.org/D57582
Files:
test/tools/llvm-objcopy/ELF/keep-file-symbols.test
tools/llvm-objcopy/CopyConfig.cpp
tools/llvm-objcopy/StripOpts.td
Index: tools/llvm-objcopy/StripOpts.td
===================================================================
--- tools/llvm-objcopy/StripOpts.td
+++ tools/llvm-objcopy/StripOpts.td
@@ -59,6 +59,9 @@
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">,
Index: tools/llvm-objcopy/CopyConfig.cpp
===================================================================
--- tools/llvm-objcopy/CopyConfig.cpp
+++ tools/llvm-objcopy/CopyConfig.cpp
@@ -479,6 +479,7 @@
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());
Index: test/tools/llvm-objcopy/ELF/keep-file-symbols.test
===================================================================
--- test/tools/llvm-objcopy/ELF/keep-file-symbols.test
+++ test/tools/llvm-objcopy/ELF/keep-file-symbols.test
@@ -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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57582.184733.patch
Type: text/x-patch
Size: 1890 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190201/341b64db/attachment.bin>
More information about the llvm-commits
mailing list