[PATCH] D61092: [llvm-strip] Have --discard-all imply --strip-debug

Sid Manning via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 3 07:12:03 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL359887: Let --discard-all imply --strip-debug. (authored by sidneym, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D61092?vs=196897&id=197999#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61092/new/

https://reviews.llvm.org/D61092

Files:
  llvm/trunk/test/tools/llvm-objcopy/ELF/discard-all-debug.test
  llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp


Index: llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp
===================================================================
--- llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp
+++ llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp
@@ -584,6 +584,8 @@
   Config.KeepFileSymbols = InputArgs.hasArg(OBJCOPY_keep_file_symbols);
   Config.DecompressDebugSections =
       InputArgs.hasArg(OBJCOPY_decompress_debug_sections);
+  if (Config.DiscardMode == DiscardType::All)
+    Config.StripDebug = true;
   for (auto Arg : InputArgs.filtered(OBJCOPY_localize_symbol))
     Config.SymbolsToLocalize.emplace_back(Arg->getValue(), UseRegex);
   for (auto Arg : InputArgs.filtered(OBJCOPY_localize_symbols))
@@ -753,6 +755,9 @@
       !Config.StripAllGNU && Config.SymbolsToRemove.empty())
     Config.StripAll = true;
 
+  if (Config.DiscardMode == DiscardType::All)
+    Config.StripDebug = true;
+
   Config.DeterministicArchives =
       InputArgs.hasFlag(STRIP_enable_deterministic_archives,
                         STRIP_disable_deterministic_archives, /*default=*/true);
Index: llvm/trunk/test/tools/llvm-objcopy/ELF/discard-all-debug.test
===================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/discard-all-debug.test
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/discard-all-debug.test
@@ -0,0 +1,5 @@
+# RUN: cp %p/Inputs/dwarf.dwo %t
+# RUN: llvm-strip --keep-symbol=.L.str --discard-all %t -o %t1
+# RUN: llvm-readobj --file-headers --sections %t1 | FileCheck --implicit-check-not=.debug_ %s
+# RUN: llvm-objcopy --keep-symbol=.L.str --discard-all %t %t2
+# RUN: llvm-readobj --file-headers --sections %t2 | FileCheck --implicit-check-not=.debug_ %s


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61092.197999.patch
Type: text/x-patch
Size: 1692 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190503/d5140068/attachment.bin>


More information about the llvm-commits mailing list