Lines Matching refs:Obj

62 static bool onlyKeepDWOPred(const Object &Obj, const SectionBase &Sec) {  in onlyKeepDWOPred()  argument
64 if (&Sec == Obj.SectionNames) in onlyKeepDWOPred()
158 Object &Obj, raw_ostream &Out, in createELFWriter() argument
163 return std::make_unique<ELFWriter<ELF32LE>>(Obj, Out, !Config.StripSections, in createELFWriter()
166 return std::make_unique<ELFWriter<ELF64LE>>(Obj, Out, !Config.StripSections, in createELFWriter()
169 return std::make_unique<ELFWriter<ELF32BE>>(Obj, Out, !Config.StripSections, in createELFWriter()
172 return std::make_unique<ELFWriter<ELF64BE>>(Obj, Out, !Config.StripSections, in createELFWriter()
179 Object &Obj, raw_ostream &Out, in createWriter() argument
183 return std::make_unique<BinaryWriter>(Obj, Out, Config); in createWriter()
185 return std::make_unique<IHexWriter>(Obj, Out); in createWriter()
187 return createELFWriter(Config, Obj, Out, OutputElfType); in createWriter()
192 Object &Obj) { in dumpSectionToFile() argument
193 for (auto &Sec : Obj.sections()) { in dumpSectionToFile()
221 Object &Obj, function_ref<bool(const SectionBase &)> ShouldReplace, in replaceDebugSections() argument
227 for (auto &Sec : Obj.sections()) in replaceDebugSections()
241 return Obj.replaceSections(FromTo); in replaceDebugSections()
266 static bool isRequiredByABISymbol(const Object &Obj, const Symbol &Sym) { in isRequiredByABISymbol() argument
267 switch (Obj.Machine) { in isRequiredByABISymbol()
270 return Obj.isRelocatable() && isAArch64MappingSymbol(Sym); in isRequiredByABISymbol()
273 return Obj.isRelocatable() && isArmMappingSymbol(Sym); in isRequiredByABISymbol()
286 const ELFConfig &ELFConfig, Object &Obj) { in updateAndRemoveSymbols() argument
289 if (!Obj.SymbolTable) in updateAndRemoveSymbols()
292 Obj.SymbolTable->updateSymbols([&](Symbol &Sym) { in updateAndRemoveSymbols()
341 for (SectionBase &Sec : Obj.sections()) in updateAndRemoveSymbols()
356 if (isRequiredByABISymbol(Obj, Sym)) in updateAndRemoveSymbols()
371 (!Obj.isRelocatable() || isUnneededSymbol(Sym))) in updateAndRemoveSymbols()
382 return Obj.removeSymbols(RemoveSymbolsPred); in updateAndRemoveSymbols()
386 const ELFConfig &ELFConfig, Object &Obj) { in replaceAndRemoveSections() argument
402 RemovePred = [RemovePred, &Obj](const SectionBase &Sec) { in replaceAndRemoveSections()
403 return onlyKeepDWOPred(Obj, Sec) || RemovePred(Sec); in replaceAndRemoveSections()
407 RemovePred = [RemovePred, &Obj](const SectionBase &Sec) { in replaceAndRemoveSections()
412 if (&Sec == Obj.SectionNames) in replaceAndRemoveSections()
437 RemovePred = [RemovePred, &Obj](const SectionBase &Sec) { in replaceAndRemoveSections()
440 if (&Sec == Obj.SectionNames) in replaceAndRemoveSections()
446 RemovePred = [RemovePred, &Obj](const SectionBase &Sec) { in replaceAndRemoveSections()
449 if (&Sec == Obj.SectionNames) in replaceAndRemoveSections()
476 RemovePred = [&Config, RemovePred, &Obj](const SectionBase &Sec) { in replaceAndRemoveSections()
486 if (Obj.SectionNames == &Sec) in replaceAndRemoveSections()
488 if (Obj.SymbolTable == &Sec || in replaceAndRemoveSections()
489 (Obj.SymbolTable && Obj.SymbolTable->getStrTab() == &Sec)) in replaceAndRemoveSections()
513 Obj.SymbolTable && !Obj.SymbolTable->empty()) { in replaceAndRemoveSections()
514 RemovePred = [&Obj, RemovePred](const SectionBase &Sec) { in replaceAndRemoveSections()
515 if (&Sec == Obj.SymbolTable || &Sec == Obj.SymbolTable->getStrTab()) in replaceAndRemoveSections()
521 if (Error E = Obj.removeSections(ELFConfig.AllowBrokenLinks, RemovePred)) in replaceAndRemoveSections()
526 Obj, isCompressable, in replaceAndRemoveSections()
527 [&Config, &Obj](const SectionBase *S) -> Expected<SectionBase *> { in replaceAndRemoveSections()
528 return &Obj.addSection<CompressedSection>( in replaceAndRemoveSections()
529 CompressedSection(*S, Config.CompressionType, Obj.Is64Bits)); in replaceAndRemoveSections()
534 Obj, in replaceAndRemoveSections()
536 [&Obj](const SectionBase *S) { in replaceAndRemoveSections()
538 return &Obj.addSection<DecompressedSection>(*CS); in replaceAndRemoveSections()
547 static void addSymbol(Object &Obj, const NewSymbolInfo &SymInfo, in addSymbol() argument
549 SectionBase *Sec = Obj.findSection(SymInfo.SectionName); in addSymbol()
595 Obj.SymbolTable->addSymbol( in addSymbol()
617 Object &Obj) { in handleArgs() argument
619 Obj.Machine = Config.OutputArch->EMachine; in handleArgs()
620 Obj.OSABI = Config.OutputArch->OSABI; in handleArgs()
624 return Obj.removeSections( in handleArgs()
626 [&Obj](const SectionBase &Sec) { return onlyKeepDWOPred(Obj, Sec); }); in handleArgs()
634 if (Error E = dumpSectionToFile(SectionName, FileName, Obj)) in handleArgs()
642 if (Error E = replaceAndRemoveSections(Config, ELFConfig, Obj)) in handleArgs()
645 if (Error E = updateAndRemoveSymbols(Config, ELFConfig, Obj)) in handleArgs()
649 for (SectionBase &Sec : Obj.sections()) { in handleArgs()
657 for (auto &Sec : Obj.sections()) in handleArgs()
664 Obj.addSection<OwnedDataSection>(Name, Data); in handleArgs()
675 return Obj.updateSection(Name, Data); in handleArgs()
682 Obj.addSection<GnuDebugLinkSection>(Config.AddGnuDebugLink, in handleArgs()
687 if (!Obj.SymbolTable && !Config.SymbolsToAdd.empty()) in handleArgs()
688 if (Error E = Obj.addNewSymbolTable()) in handleArgs()
692 addSymbol(Obj, SI, ELFConfig.NewSymbolVisibility); in handleArgs()
696 for (auto &Sec : Obj.sections()) { in handleArgs()
700 if (Error E = setSectionFlagsAndType(Sec, SFU.NewFlags, Obj.Machine)) in handleArgs()
712 for (SectionBase &Sec : Obj.sections()) { in handleArgs()
719 if (Error E = setSectionFlagsAndType(Sec, *SR.NewFlags, Obj.Machine)) in handleArgs()
746 for (SectionBase &Sec : Obj.sections()) { in handleArgs()
776 Obj.Entry = ELFConfig.EntryExpr(Obj.Entry); in handleArgs()
780 static Error writeOutput(const CommonConfig &Config, Object &Obj, in writeOutput() argument
783 createWriter(Config, Obj, Out, OutputElfType); in writeOutput()
793 Expected<std::unique_ptr<Object>> Obj = Reader.create(true); in executeObjcopyOnIHex() local
794 if (!Obj) in executeObjcopyOnIHex()
795 return Obj.takeError(); in executeObjcopyOnIHex()
799 if (Error E = handleArgs(Config, ELFConfig, **Obj)) in executeObjcopyOnIHex()
801 return writeOutput(Config, **Obj, Out, OutputElfType); in executeObjcopyOnIHex()
809 Expected<std::unique_ptr<Object>> Obj = Reader.create(true); in executeObjcopyOnRawBinary() local
810 if (!Obj) in executeObjcopyOnRawBinary()
811 return Obj.takeError(); in executeObjcopyOnRawBinary()
817 if (Error E = handleArgs(Config, ELFConfig, **Obj)) in executeObjcopyOnRawBinary()
819 return writeOutput(Config, **Obj, Out, OutputElfType); in executeObjcopyOnRawBinary()
827 Expected<std::unique_ptr<Object>> Obj = in executeObjcopyOnBinary() local
829 if (!Obj) in executeObjcopyOnBinary()
830 return Obj.takeError(); in executeObjcopyOnBinary()
836 if (Error E = handleArgs(Config, ELFConfig, **Obj)) in executeObjcopyOnBinary()
839 if (Error E = writeOutput(Config, **Obj, Out, OutputElfType)) in executeObjcopyOnBinary()