[PATCH] D65787: [llvm-strip] Support --strip-sections with the llvm-strip command.
Wolfgang Pieb via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 7 17:34:45 PDT 2019
This revision was automatically updated to reflect the committed changes.
wolfgangp marked an inline comment as done.
Closed by commit rL368241: [llvm-strip] Support --strip-sections (authored by wolfgangp, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D65787?vs=213948&id=214042#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65787/new/
https://reviews.llvm.org/D65787
Files:
llvm/trunk/test/tools/llvm-objcopy/ELF/strip-sections.test
llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp
llvm/trunk/tools/llvm-objcopy/StripOpts.td
Index: llvm/trunk/test/tools/llvm-objcopy/ELF/strip-sections.test
===================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/strip-sections.test
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/strip-sections.test
@@ -8,6 +8,11 @@
# RUN: llvm-objcopy %t %t3
# RUN: od -t x1 -j 4096 -N 12 %t3 | FileCheck %s --check-prefix=VALIDATE
+## Check that llvm-strip --strip-sections is equivalent to
+## llvm-objcopy --strip-sections.
+# RUN: llvm-strip --strip-sections %t -o %t4
+# RUN: cmp %t2 %t4
+
!ELF
FileHeader:
Class: ELFCLASS64
Index: llvm/trunk/tools/llvm-objcopy/StripOpts.td
===================================================================
--- llvm/trunk/tools/llvm-objcopy/StripOpts.td
+++ llvm/trunk/tools/llvm-objcopy/StripOpts.td
@@ -52,6 +52,9 @@
def d : Flag<["-"], "d">, Alias<strip_debug>;
def g : Flag<["-"], "g">, Alias<strip_debug>;
def S : Flag<["-"], "S">, Alias<strip_debug>;
+def strip_sections
+ : Flag<["--"], "strip-sections">,
+ HelpText<"Remove all section headers and all sections not in segments">;
def strip_unneeded : Flag<["--"], "strip-unneeded">,
HelpText<"Remove all symbols not needed by relocations">;
Index: llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp
===================================================================
--- llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp
+++ llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp
@@ -810,6 +810,7 @@
InputArgs.hasFlag(STRIP_discard_all, STRIP_discard_locals)
? DiscardType::All
: DiscardType::Locals;
+ Config.StripSections = InputArgs.hasArg(STRIP_strip_sections);
Config.StripUnneeded = InputArgs.hasArg(STRIP_strip_unneeded);
if (auto Arg = InputArgs.getLastArg(STRIP_strip_all, STRIP_no_strip_all))
Config.StripAll = Arg->getOption().getID() == STRIP_strip_all;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65787.214042.patch
Type: text/x-patch
Size: 1892 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190808/da1d2c03/attachment.bin>
More information about the llvm-commits
mailing list