Lines Matching refs:Obj
63 static bool onlyKeepDWOPred(const Object &Obj, const SectionBase &Sec) { in onlyKeepDWOPred() argument
65 if (&Sec == Obj.SectionNames) in onlyKeepDWOPred()
135 Object &Obj, raw_ostream &Out, in createELFWriter() argument
140 return std::make_unique<ELFWriter<ELF32LE>>(Obj, Out, !Config.StripSections, in createELFWriter()
143 return std::make_unique<ELFWriter<ELF64LE>>(Obj, Out, !Config.StripSections, in createELFWriter()
146 return std::make_unique<ELFWriter<ELF32BE>>(Obj, Out, !Config.StripSections, in createELFWriter()
149 return std::make_unique<ELFWriter<ELF64BE>>(Obj, Out, !Config.StripSections, in createELFWriter()
156 Object &Obj, raw_ostream &Out, in createWriter() argument
160 return std::make_unique<BinaryWriter>(Obj, Out); in createWriter()
162 return std::make_unique<IHexWriter>(Obj, Out); in createWriter()
164 return createELFWriter(Config, Obj, Out, OutputElfType); in createWriter()
176 Object &Obj) { in dumpSectionToFile() argument
177 for (auto &Sec : Obj.sections()) { in dumpSectionToFile()
205 Object &Obj, function_ref<bool(const SectionBase &)> ShouldReplace, in replaceDebugSections() argument
211 for (auto &Sec : Obj.sections()) in replaceDebugSections()
225 return Obj.replaceSections(FromTo); in replaceDebugSections()
250 static bool isRequiredByABISymbol(const Object &Obj, const Symbol &Sym) { in isRequiredByABISymbol() argument
251 switch (Obj.Machine) { in isRequiredByABISymbol()
254 return Obj.isRelocatable() && isAArch64MappingSymbol(Sym); in isRequiredByABISymbol()
257 return Obj.isRelocatable() && isArmMappingSymbol(Sym); in isRequiredByABISymbol()
270 const ELFConfig &ELFConfig, Object &Obj) { in updateAndRemoveSymbols() argument
273 if (!Obj.SymbolTable) in updateAndRemoveSymbols()
276 Obj.SymbolTable->updateSymbols([&](Symbol &Sym) { in updateAndRemoveSymbols()
325 for (SectionBase &Sec : Obj.sections()) in updateAndRemoveSymbols()
340 if (isRequiredByABISymbol(Obj, Sym)) in updateAndRemoveSymbols()
355 (!Obj.isRelocatable() || isUnneededSymbol(Sym))) in updateAndRemoveSymbols()
366 return Obj.removeSymbols(RemoveSymbolsPred); in updateAndRemoveSymbols()
370 const ELFConfig &ELFConfig, Object &Obj) { in replaceAndRemoveSections() argument
386 RemovePred = [RemovePred, &Obj](const SectionBase &Sec) { in replaceAndRemoveSections()
387 return onlyKeepDWOPred(Obj, Sec) || RemovePred(Sec); in replaceAndRemoveSections()
391 RemovePred = [RemovePred, &Obj](const SectionBase &Sec) { in replaceAndRemoveSections()
396 if (&Sec == Obj.SectionNames) in replaceAndRemoveSections()
421 RemovePred = [RemovePred, &Obj](const SectionBase &Sec) { in replaceAndRemoveSections()
424 if (&Sec == Obj.SectionNames) in replaceAndRemoveSections()
430 RemovePred = [RemovePred, &Obj](const SectionBase &Sec) { in replaceAndRemoveSections()
433 if (&Sec == Obj.SectionNames) in replaceAndRemoveSections()
460 RemovePred = [&Config, RemovePred, &Obj](const SectionBase &Sec) { in replaceAndRemoveSections()
470 if (Obj.SectionNames == &Sec) in replaceAndRemoveSections()
472 if (Obj.SymbolTable == &Sec || in replaceAndRemoveSections()
473 (Obj.SymbolTable && Obj.SymbolTable->getStrTab() == &Sec)) in replaceAndRemoveSections()
497 Obj.SymbolTable && !Obj.SymbolTable->empty()) { in replaceAndRemoveSections()
498 RemovePred = [&Obj, RemovePred](const SectionBase &Sec) { in replaceAndRemoveSections()
499 if (&Sec == Obj.SymbolTable || &Sec == Obj.SymbolTable->getStrTab()) in replaceAndRemoveSections()
505 if (Error E = Obj.removeSections(ELFConfig.AllowBrokenLinks, RemovePred)) in replaceAndRemoveSections()
510 Obj, isCompressable, in replaceAndRemoveSections()
511 [&Config, &Obj](const SectionBase *S) -> Expected<SectionBase *> { in replaceAndRemoveSections()
512 return &Obj.addSection<CompressedSection>( in replaceAndRemoveSections()
518 Obj, in replaceAndRemoveSections()
520 [&Obj](const SectionBase *S) { in replaceAndRemoveSections()
522 return &Obj.addSection<DecompressedSection>(*CS); in replaceAndRemoveSections()
531 static void addSymbol(Object &Obj, const NewSymbolInfo &SymInfo, in addSymbol() argument
533 SectionBase *Sec = Obj.findSection(SymInfo.SectionName); in addSymbol()
579 Obj.SymbolTable->addSymbol( in addSymbol()
601 Object &Obj) { in handleArgs() argument
603 Obj.Machine = Config.OutputArch.value().EMachine; in handleArgs()
604 Obj.OSABI = Config.OutputArch.value().OSABI; in handleArgs()
608 return Obj.removeSections( in handleArgs()
610 [&Obj](const SectionBase &Sec) { return onlyKeepDWOPred(Obj, Sec); }); in handleArgs()
618 if (Error E = dumpSectionToFile(SectionName, FileName, Obj)) in handleArgs()
626 if (Error E = replaceAndRemoveSections(Config, ELFConfig, Obj)) in handleArgs()
629 if (Error E = updateAndRemoveSymbols(Config, ELFConfig, Obj)) in handleArgs()
633 for (SectionBase &Sec : Obj.sections()) { in handleArgs()
641 for (auto &Sec : Obj.sections()) in handleArgs()
648 Obj.addSection<OwnedDataSection>(Name, Data); in handleArgs()
659 return Obj.updateSection(Name, Data); in handleArgs()
666 Obj.addSection<GnuDebugLinkSection>(Config.AddGnuDebugLink, in handleArgs()
671 if (!Obj.SymbolTable && !Config.SymbolsToAdd.empty()) in handleArgs()
672 if (Error E = Obj.addNewSymbolTable()) in handleArgs()
676 addSymbol(Obj, SI, ELFConfig.NewSymbolVisibility); in handleArgs()
680 for (auto &Sec : Obj.sections()) { in handleArgs()
695 for (SectionBase &Sec : Obj.sections()) { in handleArgs()
727 for (SectionBase &Sec : Obj.sections()) { in handleArgs()
757 Obj.Entry = ELFConfig.EntryExpr(Obj.Entry); in handleArgs()
761 static Error writeOutput(const CommonConfig &Config, Object &Obj, in writeOutput() argument
764 createWriter(Config, Obj, Out, OutputElfType); in writeOutput()
774 Expected<std::unique_ptr<Object>> Obj = Reader.create(true); in executeObjcopyOnIHex() local
775 if (!Obj) in executeObjcopyOnIHex()
776 return Obj.takeError(); in executeObjcopyOnIHex()
780 if (Error E = handleArgs(Config, ELFConfig, **Obj)) in executeObjcopyOnIHex()
782 return writeOutput(Config, **Obj, Out, OutputElfType); in executeObjcopyOnIHex()
790 Expected<std::unique_ptr<Object>> Obj = Reader.create(true); in executeObjcopyOnRawBinary() local
791 if (!Obj) in executeObjcopyOnRawBinary()
792 return Obj.takeError(); in executeObjcopyOnRawBinary()
798 if (Error E = handleArgs(Config, ELFConfig, **Obj)) in executeObjcopyOnRawBinary()
800 return writeOutput(Config, **Obj, Out, OutputElfType); in executeObjcopyOnRawBinary()
808 Expected<std::unique_ptr<Object>> Obj = in executeObjcopyOnBinary() local
810 if (!Obj) in executeObjcopyOnBinary()
811 return Obj.takeError(); in executeObjcopyOnBinary()
817 if (Error E = handleArgs(Config, ELFConfig, **Obj)) in executeObjcopyOnBinary()
820 if (Error E = writeOutput(Config, **Obj, Out, OutputElfType)) in executeObjcopyOnBinary()