Index: llvm/tools/llvm-objcopy/CopyConfig.cpp =================================================================== --- llvm/tools/llvm-objcopy/CopyConfig.cpp +++ llvm/tools/llvm-objcopy/CopyConfig.cpp @@ -596,6 +596,10 @@ return std::move(E); for (auto Arg : InputArgs.filtered(OBJCOPY_keep_symbol)) Config.SymbolsToKeep.emplace_back(Arg->getValue(), UseRegex); + for (auto Arg : InputArgs.filtered(OBJCOPY_keep_symbols)) + if (Error E = addSymbolsFromFile(Config.SymbolsToKeep, DC.Alloc, + Arg->getValue(), UseRegex)) + return std::move(E); for (auto Arg : InputArgs.filtered(OBJCOPY_add_symbol)) { Expected NSI = parseNewSymbolInfo(Arg->getValue()); if (!NSI) Index: llvm/tools/llvm-objcopy/ObjcopyOpts.td =================================================================== --- llvm/tools/llvm-objcopy/ObjcopyOpts.td +++ llvm/tools/llvm-objcopy/ObjcopyOpts.td @@ -207,6 +207,15 @@ MetaVarName<"symbol">; def K : JoinedOrSeparate<["-"], "K">, Alias; +defm keep_symbols + : Eq<"keep-symbols", + "Reads a list of symbols from and runs as if " + "--keep-symbol= is set for each one. " + "contains one symbol per line and may contain comments beginning with " + "'#'. Leading and trailing whitespace is stripped from each line. May " + "be repeated to read symbols from many files.">, + MetaVarName<"filename">; + def only_keep_debug : Flag<["-", "--"], "only-keep-debug">, HelpText<"Clear sections that would not be stripped by --strip-debug. "