Lines Matching refs:Obj

65 static bool onlyKeepDWOPred(const Object &Obj, const SectionBase &Sec) {  in onlyKeepDWOPred()  argument
67 if (&Sec == Obj.SectionNames) in onlyKeepDWOPred()
137 Object &Obj, raw_ostream &Out, in createELFWriter() argument
142 return std::make_unique<ELFWriter<ELF32LE>>(Obj, Out, !Config.StripSections, in createELFWriter()
145 return std::make_unique<ELFWriter<ELF64LE>>(Obj, Out, !Config.StripSections, in createELFWriter()
148 return std::make_unique<ELFWriter<ELF32BE>>(Obj, Out, !Config.StripSections, in createELFWriter()
151 return std::make_unique<ELFWriter<ELF64BE>>(Obj, Out, !Config.StripSections, in createELFWriter()
158 Object &Obj, raw_ostream &Out, in createWriter() argument
162 return std::make_unique<BinaryWriter>(Obj, Out); in createWriter()
164 return std::make_unique<IHexWriter>(Obj, Out); in createWriter()
166 return createELFWriter(Config, Obj, Out, OutputElfType); in createWriter()
178 Object &Obj) { in dumpSectionToFile() argument
179 for (auto &Sec : Obj.sections()) { in dumpSectionToFile()
207 Object &Obj, SectionPred &RemovePred, in replaceDebugSections() argument
214 for (auto &Sec : Obj.sections()) in replaceDebugSections()
231 for (auto &Sec : Obj.sections()) in replaceDebugSections()
247 static Error updateAndRemoveSymbols(const CommonConfig &Config, Object &Obj) { in updateAndRemoveSymbols() argument
250 if (!Obj.SymbolTable) in updateAndRemoveSymbols()
253 Obj.SymbolTable->updateSymbols([&](Symbol &Sym) { in updateAndRemoveSymbols()
301 for (SectionBase &Sec : Obj.sections()) in updateAndRemoveSymbols()
328 (!Obj.isRelocatable() || isUnneededSymbol(Sym))) in updateAndRemoveSymbols()
339 return Obj.removeSymbols(RemoveSymbolsPred); in updateAndRemoveSymbols()
342 static Error replaceAndRemoveSections(const CommonConfig &Config, Object &Obj) { in replaceAndRemoveSections() argument
358 RemovePred = [RemovePred, &Obj](const SectionBase &Sec) { in replaceAndRemoveSections()
359 return onlyKeepDWOPred(Obj, Sec) || RemovePred(Sec); in replaceAndRemoveSections()
363 RemovePred = [RemovePred, &Obj](const SectionBase &Sec) { in replaceAndRemoveSections()
368 if (&Sec == Obj.SectionNames) in replaceAndRemoveSections()
393 RemovePred = [RemovePred, &Obj](const SectionBase &Sec) { in replaceAndRemoveSections()
396 if (&Sec == Obj.SectionNames) in replaceAndRemoveSections()
402 RemovePred = [RemovePred, &Obj](const SectionBase &Sec) { in replaceAndRemoveSections()
405 if (&Sec == Obj.SectionNames) in replaceAndRemoveSections()
432 RemovePred = [&Config, RemovePred, &Obj](const SectionBase &Sec) { in replaceAndRemoveSections()
442 if (Obj.SectionNames == &Sec) in replaceAndRemoveSections()
444 if (Obj.SymbolTable == &Sec || in replaceAndRemoveSections()
445 (Obj.SymbolTable && Obj.SymbolTable->getStrTab() == &Sec)) in replaceAndRemoveSections()
469 Obj.SymbolTable && !Obj.SymbolTable->empty()) { in replaceAndRemoveSections()
470 RemovePred = [&Obj, RemovePred](const SectionBase &Sec) { in replaceAndRemoveSections()
471 if (&Sec == Obj.SymbolTable || &Sec == Obj.SymbolTable->getStrTab()) in replaceAndRemoveSections()
479 Obj, RemovePred, isCompressable, in replaceAndRemoveSections()
480 [&Config, &Obj](const SectionBase *S) -> Expected<SectionBase *> { in replaceAndRemoveSections()
486 return &Obj.addSection<CompressedSection>(std::move(*NewSection)); in replaceAndRemoveSections()
491 Obj, RemovePred, in replaceAndRemoveSections()
493 [&Obj](const SectionBase *S) { in replaceAndRemoveSections()
495 return &Obj.addSection<DecompressedSection>(*CS); in replaceAndRemoveSections()
500 return Obj.removeSections(Config.AllowBrokenLinks, RemovePred); in replaceAndRemoveSections()
504 static void addSymbol(Object &Obj, const NewSymbolInfo &SymInfo, in addSymbol() argument
506 SectionBase *Sec = Obj.findSection(SymInfo.SectionName); in addSymbol()
552 Obj.SymbolTable->addSymbol( in addSymbol()
565 Object &Obj) { in handleArgs() argument
567 Obj.Machine = Config.OutputArch.getValue().EMachine; in handleArgs()
568 Obj.OSABI = Config.OutputArch.getValue().OSABI; in handleArgs()
572 return Obj.removeSections( in handleArgs()
574 [&Obj](const SectionBase &Sec) { return onlyKeepDWOPred(Obj, Sec); }); in handleArgs()
582 if (Error E = dumpSectionToFile(SectionName, FileName, Obj)) in handleArgs()
590 if (Error E = replaceAndRemoveSections(Config, Obj)) in handleArgs()
593 if (Error E = updateAndRemoveSymbols(Config, Obj)) in handleArgs()
597 for (SectionBase &Sec : Obj.sections()) { in handleArgs()
613 for (SectionBase &Sec : Obj.sections()) { in handleArgs()
654 for (SectionBase &Sec : Obj.sections()) { in handleArgs()
662 for (auto &Sec : Obj.sections()) in handleArgs()
679 Obj.addSection<OwnedDataSection>(SecName, Data); in handleArgs()
685 Obj.addSection<GnuDebugLinkSection>(Config.AddGnuDebugLink, in handleArgs()
690 if (!Obj.SymbolTable && !Config.SymbolsToAdd.empty()) in handleArgs()
691 if (Error E = Obj.addNewSymbolTable()) in handleArgs()
695 addSymbol(Obj, SI, ELFConfig.NewSymbolVisibility); in handleArgs()
699 for (auto &Sec : Obj.sections()) { in handleArgs()
709 Obj.Entry = Config.EntryExpr(Obj.Entry); in handleArgs()
713 static Error writeOutput(const CommonConfig &Config, Object &Obj, in writeOutput() argument
716 createWriter(Config, Obj, Out, OutputElfType); in writeOutput()
726 Expected<std::unique_ptr<Object>> Obj = Reader.create(true); in executeObjcopyOnIHex() local
727 if (!Obj) in executeObjcopyOnIHex()
728 return Obj.takeError(); in executeObjcopyOnIHex()
732 if (Error E = handleArgs(Config, ELFConfig, **Obj)) in executeObjcopyOnIHex()
734 return writeOutput(Config, **Obj, Out, OutputElfType); in executeObjcopyOnIHex()
742 Expected<std::unique_ptr<Object>> Obj = Reader.create(true); in executeObjcopyOnRawBinary() local
743 if (!Obj) in executeObjcopyOnRawBinary()
744 return Obj.takeError(); in executeObjcopyOnRawBinary()
750 if (Error E = handleArgs(Config, ELFConfig, **Obj)) in executeObjcopyOnRawBinary()
752 return writeOutput(Config, **Obj, Out, OutputElfType); in executeObjcopyOnRawBinary()
760 Expected<std::unique_ptr<Object>> Obj = in executeObjcopyOnBinary() local
762 if (!Obj) in executeObjcopyOnBinary()
763 return Obj.takeError(); in executeObjcopyOnBinary()
769 if (Error E = handleArgs(Config, ELFConfig, **Obj)) in executeObjcopyOnBinary()
772 if (Error E = writeOutput(Config, **Obj, Out, OutputElfType)) in executeObjcopyOnBinary()