Lines Matching refs:Config
95 static std::unique_ptr<Writer> createWriter(const CopyConfig &Config, in createWriter() argument
98 if (Config.OutputFormat == "binary") { in createWriter()
105 !Config.StripSections); in createWriter()
108 !Config.StripSections); in createWriter()
111 !Config.StripSections); in createWriter()
114 !Config.StripSections); in createWriter()
150 static void linkToBuildIdDir(const CopyConfig &Config, StringRef ToLink, in linkToBuildIdDir() argument
152 SmallString<128> Path = Config.BuildIdLinkDir; in linkToBuildIdDir()
171 static void splitDWOToFile(const CopyConfig &Config, const Reader &Reader, in splitDWOToFile() argument
176 if (Config.OutputArch) in splitDWOToFile()
177 DWOFile->Machine = Config.OutputArch.getValue().EMachine; in splitDWOToFile()
179 auto Writer = createWriter(Config, *DWOFile, FB, OutputElfType); in splitDWOToFile()
223 const CopyConfig &Config, Object &Obj, SectionPred &RemovePred, in replaceDebugSections() argument
260 static void handleArgs(const CopyConfig &Config, Object &Obj, in handleArgs() argument
263 if (!Config.SplitDWO.empty()) { in handleArgs()
264 splitDWOToFile(Config, Reader, Config.SplitDWO, OutputElfType); in handleArgs()
266 if (Config.OutputArch) in handleArgs()
267 Obj.Machine = Config.OutputArch.getValue().EMachine; in handleArgs()
274 ((Config.LocalizeHidden && in handleArgs()
276 is_contained(Config.SymbolsToLocalize, Sym.Name))) in handleArgs()
289 if (!Config.SymbolsToKeepGlobal.empty() && in handleArgs()
290 !is_contained(Config.SymbolsToKeepGlobal, Sym.Name) && in handleArgs()
294 if (is_contained(Config.SymbolsToGlobalize, Sym.Name) && in handleArgs()
298 if (is_contained(Config.SymbolsToWeaken, Sym.Name) && in handleArgs()
302 if (Config.Weaken && Sym.Binding == STB_GLOBAL && in handleArgs()
306 const auto I = Config.SymbolsToRename.find(Sym.Name); in handleArgs()
307 if (I != Config.SymbolsToRename.end()) in handleArgs()
310 if (!Config.SymbolsPrefix.empty() && Sym.Type != STT_SECTION) in handleArgs()
311 Sym.Name = (Config.SymbolsPrefix + Sym.Name).str(); in handleArgs()
317 if (Config.StripUnneeded) { in handleArgs()
323 if (is_contained(Config.SymbolsToKeep, Sym.Name) || in handleArgs()
324 (Config.KeepFileSymbols && Sym.Type == STT_FILE)) in handleArgs()
327 if (Config.DiscardAll && Sym.Binding == STB_LOCAL && in handleArgs()
332 if (Config.StripAll || Config.StripAllGNU) in handleArgs()
335 if (is_contained(Config.SymbolsToRemove, Sym.Name)) in handleArgs()
338 if (Config.StripUnneeded && !Sym.Referenced && in handleArgs()
350 if (!Config.ToRemove.empty()) { in handleArgs()
351 RemovePred = [&Config](const SectionBase &Sec) { in handleArgs()
352 return is_contained(Config.ToRemove, Sec.Name); in handleArgs()
356 if (Config.StripDWO || !Config.SplitDWO.empty()) in handleArgs()
361 if (Config.ExtractDWO) in handleArgs()
366 if (Config.StripAllGNU) in handleArgs()
384 if (Config.StripSections) { in handleArgs()
390 if (Config.StripDebug) { in handleArgs()
396 if (Config.StripNonAlloc) in handleArgs()
405 if (Config.StripAll) in handleArgs()
417 if (!Config.OnlySection.empty()) { in handleArgs()
418 RemovePred = [&Config, RemovePred, &Obj](const SectionBase &Sec) { in handleArgs()
420 if (is_contained(Config.OnlySection, Sec.Name)) in handleArgs()
439 if (!Config.KeepSection.empty()) { in handleArgs()
440 RemovePred = [&Config, RemovePred](const SectionBase &Sec) { in handleArgs()
442 if (is_contained(Config.KeepSection, Sec.Name)) in handleArgs()
454 if ((!Config.SymbolsToKeep.empty() || Config.KeepFileSymbols) && in handleArgs()
463 if (Config.CompressionType != DebugCompressionType::None) in handleArgs()
464 replaceDebugSections(Config, Obj, RemovePred, isCompressable, in handleArgs()
465 [&Config, &Obj](const SectionBase *S) { in handleArgs()
467 *S, Config.CompressionType); in handleArgs()
469 else if (Config.DecompressDebugSections) in handleArgs()
471 Config, Obj, RemovePred, in handleArgs()
480 if (!Config.SectionsToRename.empty()) { in handleArgs()
482 const auto Iter = Config.SectionsToRename.find(Sec.Name); in handleArgs()
483 if (Iter != Config.SectionsToRename.end()) { in handleArgs()
500 if (!Config.AddSection.empty()) { in handleArgs()
501 for (const auto &Flag : Config.AddSection) { in handleArgs()
520 if (!Config.DumpSection.empty()) { in handleArgs()
521 for (const auto &Flag : Config.DumpSection) { in handleArgs()
526 reportError(Config.InputFilename, std::move(E)); in handleArgs()
530 if (!Config.AddGnuDebugLink.empty()) in handleArgs()
531 Obj.addSection<GnuDebugLinkSection>(Config.AddGnuDebugLink); in handleArgs()
534 void executeObjcopyOnRawBinary(const CopyConfig &Config, MemoryBuffer &In, in executeObjcopyOnRawBinary() argument
536 BinaryReader Reader(Config.BinaryArch, &In); in executeObjcopyOnRawBinary()
542 Config.OutputArch ? Config.OutputArch.getValue() : Config.BinaryArch); in executeObjcopyOnRawBinary()
543 handleArgs(Config, *Obj, Reader, OutputElfType); in executeObjcopyOnRawBinary()
545 createWriter(Config, *Obj, Out, OutputElfType); in executeObjcopyOnRawBinary()
550 void executeObjcopyOnBinary(const CopyConfig &Config, in executeObjcopyOnBinary() argument
556 Config.OutputArch ? getOutputElfType(Config.OutputArch.getValue()) in executeObjcopyOnBinary()
560 if (!Config.BuildIdLinkDir.empty()) { in executeObjcopyOnBinary()
563 error("build ID in file '" + Config.InputFilename + in executeObjcopyOnBinary()
567 if (!Config.BuildIdLinkDir.empty() && Config.BuildIdLinkInput) { in executeObjcopyOnBinary()
568 linkToBuildIdDir(Config, Config.InputFilename, in executeObjcopyOnBinary()
569 Config.BuildIdLinkInput.getValue(), BuildIdBytes); in executeObjcopyOnBinary()
571 handleArgs(Config, *Obj, Reader, OutputElfType); in executeObjcopyOnBinary()
573 createWriter(Config, *Obj, Out, OutputElfType); in executeObjcopyOnBinary()
576 if (!Config.BuildIdLinkDir.empty() && Config.BuildIdLinkOutput) { in executeObjcopyOnBinary()
577 linkToBuildIdDir(Config, Config.OutputFilename, in executeObjcopyOnBinary()
578 Config.BuildIdLinkOutput.getValue(), BuildIdBytes); in executeObjcopyOnBinary()