--- /dev/null
+# 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
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))
!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);