Lines Matching refs:ELFYAML
202 ELFYAML::Object &Doc;
212 std::vector<Elf_Sym> toELFSymbols(ArrayRef<ELFYAML::Symbol> Symbols,
221 StringRef SecName, ELFYAML::Section *YAMLSec);
226 ELFYAML::Section *YAMLSec);
230 ELFYAML::Section *YAMLSec);
233 ELFYAML::Section *YAMLSec);
238 getPhdrFragments(const ELFYAML::ProgramHeader &Phdr,
244 const ELFYAML::NoBitsSection &Section,
247 const ELFYAML::RawContentSection &Section,
250 const ELFYAML::RelocationSection &Section,
253 const ELFYAML::RelrSection &Section,
256 const ELFYAML::GroupSection &Group,
259 const ELFYAML::SymtabShndxSection &Shndx,
262 const ELFYAML::SymverSection &Section,
265 const ELFYAML::VerneedSection &Section,
268 const ELFYAML::VerdefSection &Section,
271 const ELFYAML::ARMIndexTableSection &Section,
274 const ELFYAML::MipsABIFlags &Section,
277 const ELFYAML::DynamicSection &Section,
280 const ELFYAML::StackSizesSection &Section,
283 const ELFYAML::BBAddrMapSection &Section,
286 const ELFYAML::HashSection &Section,
289 const ELFYAML::AddrsigSection &Section,
292 const ELFYAML::NoteSection &Section,
295 const ELFYAML::GnuHashSection &Section,
298 const ELFYAML::LinkerOptionsSection &Section,
301 const ELFYAML::DependentLibrariesSection &Section,
304 const ELFYAML::CallGraphProfileSection &Section,
307 void writeFill(ELFYAML::Fill &Fill, ContiguousBlobAccumulator &CBA);
309 ELFState(ELFYAML::Object &D, yaml::ErrorHandler EH);
311 void assignSectionAddress(Elf_Shdr &SHeader, ELFYAML::Section *YAMLSec);
322 static bool writeELF(raw_ostream &OS, ELFYAML::Object &Doc,
338 ELFState<ELFT>::ELFState(ELFYAML::Object &D, yaml::ErrorHandler EH) in ELFState()
352 std::vector<ELFYAML::Section *> Sections = Doc.getSections(); in ELFState()
357 std::make_unique<ELFYAML::Section>( in ELFState()
358 ELFYAML::Chunk::ChunkKind::RawContent, /*IsImplicit=*/true)); in ELFState()
361 ELFYAML::SectionHeaderTable *SecHdrTable = nullptr; in ELFState()
363 const std::unique_ptr<ELFYAML::Chunk> &C = Doc.Chunks[I]; in ELFState()
366 if (auto S = dyn_cast<ELFYAML::SectionHeaderTable>(C.get())) { in ELFState()
377 std::string NewName = ELFYAML::appendUniqueSuffix( in ELFState()
380 assert(ELFYAML::dropUniqueSuffix(C->Name).empty()); in ELFState()
424 std::unique_ptr<ELFYAML::Section> Sec = std::make_unique<ELFYAML::Section>( in ELFState()
425 ELFYAML::Chunk::ChunkKind::RawContent, true /*IsImplicit*/); in ELFState()
452 std::make_unique<ELFYAML::SectionHeaderTable>(/*IsImplicit=*/true)); in ELFState()
506 const ELFYAML::SectionHeaderTable &SectionHeaders = in writeELFHeader()
534 DenseMap<StringRef, ELFYAML::Fill *> NameToFill; in initProgramHeaders()
537 if (auto S = dyn_cast<ELFYAML::Fill>(Doc.Chunks[I].get())) in initProgramHeaders()
542 std::vector<ELFYAML::Section *> Sections = Doc.getSections(); in initProgramHeaders()
544 ELFYAML::ProgramHeader &YamlPhdr = Doc.ProgramHeaders[I]; in initProgramHeaders()
596 const ELFYAML::SectionHeaderTable &SectionHeaders = in toSectionIndex()
633 static void overrideFields(ELFYAML::Section *From, typename ELFT::Shdr &To) { in overrideFields()
653 ELFYAML::Section *YAMLSec) { in initImplicitHeader()
671 if (YAMLSec && !isa<ELFYAML::RawContentSection>(YAMLSec)) in initImplicitHeader()
687 std::string llvm::ELFYAML::appendUniqueSuffix(StringRef Name, in appendUniqueSuffix()
694 StringRef llvm::ELFYAML::dropUniqueSuffix(StringRef S) { in dropUniqueSuffix()
763 for (const std::unique_ptr<ELFYAML::Chunk> &D : Doc.Chunks) { in initSectionHeaders()
764 if (ELFYAML::Fill *S = dyn_cast<ELFYAML::Fill>(D.get())) { in initSectionHeaders()
771 if (ELFYAML::SectionHeaderTable *S = in initSectionHeaders()
772 dyn_cast<ELFYAML::SectionHeaderTable>(D.get())) { in initSectionHeaders()
790 ELFYAML::Section *Sec = cast<ELFYAML::Section>(D.get()); in initSectionHeaders()
809 SHeader.sh_entsize = ELFYAML::getDefaultShEntSize<ELFT>( in initSectionHeaders()
824 getSectionNameOffset(ELFYAML::dropUniqueSuffix(Sec->Name)); in initSectionHeaders()
838 if (auto RawSec = dyn_cast<ELFYAML::RawContentSection>(Sec)) { in initSectionHeaders()
851 if (!isa<ELFYAML::NoBitsSection>(Sec) && (Sec->Content || Sec->Size)) in initSectionHeaders()
854 if (auto S = dyn_cast<ELFYAML::RawContentSection>(Sec)) { in initSectionHeaders()
856 } else if (auto S = dyn_cast<ELFYAML::SymtabShndxSection>(Sec)) { in initSectionHeaders()
858 } else if (auto S = dyn_cast<ELFYAML::RelocationSection>(Sec)) { in initSectionHeaders()
860 } else if (auto S = dyn_cast<ELFYAML::RelrSection>(Sec)) { in initSectionHeaders()
862 } else if (auto S = dyn_cast<ELFYAML::GroupSection>(Sec)) { in initSectionHeaders()
864 } else if (auto S = dyn_cast<ELFYAML::ARMIndexTableSection>(Sec)) { in initSectionHeaders()
866 } else if (auto S = dyn_cast<ELFYAML::MipsABIFlags>(Sec)) { in initSectionHeaders()
868 } else if (auto S = dyn_cast<ELFYAML::NoBitsSection>(Sec)) { in initSectionHeaders()
870 } else if (auto S = dyn_cast<ELFYAML::DynamicSection>(Sec)) { in initSectionHeaders()
872 } else if (auto S = dyn_cast<ELFYAML::SymverSection>(Sec)) { in initSectionHeaders()
874 } else if (auto S = dyn_cast<ELFYAML::VerneedSection>(Sec)) { in initSectionHeaders()
876 } else if (auto S = dyn_cast<ELFYAML::VerdefSection>(Sec)) { in initSectionHeaders()
878 } else if (auto S = dyn_cast<ELFYAML::StackSizesSection>(Sec)) { in initSectionHeaders()
880 } else if (auto S = dyn_cast<ELFYAML::HashSection>(Sec)) { in initSectionHeaders()
882 } else if (auto S = dyn_cast<ELFYAML::AddrsigSection>(Sec)) { in initSectionHeaders()
884 } else if (auto S = dyn_cast<ELFYAML::LinkerOptionsSection>(Sec)) { in initSectionHeaders()
886 } else if (auto S = dyn_cast<ELFYAML::NoteSection>(Sec)) { in initSectionHeaders()
888 } else if (auto S = dyn_cast<ELFYAML::GnuHashSection>(Sec)) { in initSectionHeaders()
890 } else if (auto S = dyn_cast<ELFYAML::DependentLibrariesSection>(Sec)) { in initSectionHeaders()
892 } else if (auto S = dyn_cast<ELFYAML::CallGraphProfileSection>(Sec)) { in initSectionHeaders()
894 } else if (auto S = dyn_cast<ELFYAML::BBAddrMapSection>(Sec)) { in initSectionHeaders()
909 ELFYAML::Section *YAMLSec) { in assignSectionAddress()
928 static size_t findFirstNonGlobal(ArrayRef<ELFYAML::Symbol> Symbols) { in findFirstNonGlobal()
937 ELFState<ELFT>::toELFSymbols(ArrayRef<ELFYAML::Symbol> Symbols, in toELFSymbols()
943 for (const ELFYAML::Symbol &Sym : Symbols) { in toELFSymbols()
952 Symbol.st_name = Strtab.getOffset(ELFYAML::dropUniqueSuffix(Sym.Name)); in toELFSymbols()
972 ELFYAML::Section *YAMLSec) { in initSymtabSectionHeader()
975 ArrayRef<ELFYAML::Symbol> Symbols; in initSymtabSectionHeader()
981 ELFYAML::RawContentSection *RawSec = in initSymtabSectionHeader()
982 dyn_cast_or_null<ELFYAML::RawContentSection>(YAMLSec); in initSymtabSectionHeader()
1037 ELFYAML::Section *YAMLSec) { in initStrtabSectionHeader()
1038 SHeader.sh_name = getSectionNameOffset(ELFYAML::dropUniqueSuffix(Name)); in initStrtabSectionHeader()
1042 ELFYAML::RawContentSection *RawSec = in initStrtabSectionHeader()
1043 dyn_cast_or_null<ELFYAML::RawContentSection>(YAMLSec); in initStrtabSectionHeader()
1095 ELFYAML::Section *YAMLSec) { in initDWARFSectionHeader()
1096 SHeader.sh_name = getSectionNameOffset(ELFYAML::dropUniqueSuffix(Name)); in initDWARFSectionHeader()
1102 ELFYAML::RawContentSection *RawSec = in initDWARFSectionHeader()
1103 dyn_cast_or_null<ELFYAML::RawContentSection>(YAMLSec); in initDWARFSectionHeader()
1146 ELFState<ELFT>::getPhdrFragments(const ELFYAML::ProgramHeader &Phdr, in getPhdrFragments()
1149 for (const ELFYAML::Chunk *C : Phdr.Chunks) { in getPhdrFragments()
1150 if (const ELFYAML::Fill *F = dyn_cast<ELFYAML::Fill>(C)) { in getPhdrFragments()
1156 const ELFYAML::Section *S = cast<ELFYAML::Section>(C); in getPhdrFragments()
1221 bool llvm::ELFYAML::shouldAllocateFileSpace( in shouldAllocateFileSpace()
1222 ArrayRef<ELFYAML::ProgramHeader> Phdrs, const ELFYAML::NoBitsSection &S) { in shouldAllocateFileSpace()
1223 for (const ELFYAML::ProgramHeader &PH : Phdrs) { in shouldAllocateFileSpace()
1225 PH.Chunks, [&](ELFYAML::Chunk *C) { return C->Name == S.Name; }); in shouldAllocateFileSpace()
1226 if (std::any_of(It, PH.Chunks.end(), [](ELFYAML::Chunk *C) { in shouldAllocateFileSpace()
1227 return (isa<ELFYAML::Fill>(C) || in shouldAllocateFileSpace()
1228 cast<ELFYAML::Section>(C)->Type != ELF::SHT_NOBITS); in shouldAllocateFileSpace()
1237 const ELFYAML::NoBitsSection &S, in writeSectionContent()
1253 Elf_Shdr &SHeader, const ELFYAML::RawContentSection &Section, in writeSectionContent()
1259 static bool isMips64EL(const ELFYAML::Object &Obj) { in isMips64EL()
1261 Obj.Header.Class == ELFYAML::ELF_ELFCLASS(ELF::ELFCLASS64) && in isMips64EL()
1262 Obj.Header.Data == ELFYAML::ELF_ELFDATA(ELF::ELFDATA2LSB); in isMips64EL()
1267 Elf_Shdr &SHeader, const ELFYAML::RelocationSection &Section, in writeSectionContent()
1280 for (const ELFYAML::Relocation &Rel : *Section.Relocations) { in writeSectionContent()
1306 const ELFYAML::RelrSection &Section, in writeSectionContent()
1323 Elf_Shdr &SHeader, const ELFYAML::SymtabShndxSection &Shndx, in writeSectionContent()
1340 const ELFYAML::GroupSection &Section, in writeSectionContent()
1352 for (const ELFYAML::SectionOrType &Member : *Section.Members) { in writeSectionContent()
1365 const ELFYAML::SymverSection &Section, in writeSectionContent()
1377 Elf_Shdr &SHeader, const ELFYAML::StackSizesSection &Section, in writeSectionContent()
1382 for (const ELFYAML::StackSizeEntry &E : *Section.Entries) { in writeSectionContent()
1390 Elf_Shdr &SHeader, const ELFYAML::BBAddrMapSection &Section, in writeSectionContent()
1395 for (const ELFYAML::BBAddrMapEntry &E : *Section.Entries) { in writeSectionContent()
1416 for (const ELFYAML::BBAddrMapEntry::BBEntry &BBE : *E.BBEntries) in writeSectionContent()
1425 Elf_Shdr &SHeader, const ELFYAML::LinkerOptionsSection &Section, in writeSectionContent()
1430 for (const ELFYAML::LinkerOption &LO : *Section.Options) { in writeSectionContent()
1441 Elf_Shdr &SHeader, const ELFYAML::DependentLibrariesSection &Section, in writeSectionContent()
1479 Elf_Shdr &SHeader, const ELFYAML::CallGraphProfileSection &Section, in writeSectionContent()
1484 for (const ELFYAML::CallGraphEntryWeight &E : *Section.Entries) { in writeSectionContent()
1492 const ELFYAML::HashSection &Section, in writeSectionContent()
1514 const ELFYAML::VerdefSection &Section, in writeSectionContent()
1527 const ELFYAML::VerdefEntry &E = (*Section.Entries)[I]; in writeSectionContent()
1560 const ELFYAML::VerneedSection &Section, in writeSectionContent()
1572 const ELFYAML::VerneedEntry &VE = (*Section.VerneedV)[I]; in writeSectionContent()
1587 const ELFYAML::VernauxEntry &VAuxE = VE.AuxV[J]; in writeSectionContent()
1608 Elf_Shdr &SHeader, const ELFYAML::ARMIndexTableSection &Section, in writeSectionContent()
1613 for (const ELFYAML::ARMIndexTableEntry &E : *Section.Entries) { in writeSectionContent()
1622 const ELFYAML::MipsABIFlags &Section, in writeSectionContent()
1647 const ELFYAML::DynamicSection &Section, in writeSectionContent()
1655 for (const ELFYAML::DynamicEntry &DE : *Section.Entries) { in writeSectionContent()
1664 const ELFYAML::AddrsigSection &Section, in writeSectionContent()
1676 const ELFYAML::NoteSection &Section, in writeSectionContent()
1682 for (const ELFYAML::NoteEntry &NE : *Section.Notes) { in writeSectionContent()
1717 const ELFYAML::GnuHashSection &Section, in writeSectionContent()
1767 void ELFState<ELFT>::writeFill(ELFYAML::Fill &Fill, in writeFill()
1784 const ELFYAML::SectionHeaderTable &SectionHeaders = in buildSectionHeaderReorderMap()
1794 auto AddSection = [&](const ELFYAML::SectionHeader &Hdr) { in buildSectionHeaderReorderMap()
1802 for (const ELFYAML::SectionHeader &Hdr : *SectionHeaders.Sections) in buildSectionHeaderReorderMap()
1806 for (const ELFYAML::SectionHeader &Hdr : *SectionHeaders.Excluded) in buildSectionHeaderReorderMap()
1809 for (const ELFYAML::Section *S : Doc.getSections()) { in buildSectionHeaderReorderMap()
1834 std::vector<ELFYAML::Section *> Sections = Doc.getSections(); in buildSectionIndex()
1835 const ELFYAML::SectionHeaderTable &SectionHeaders = in buildSectionIndex()
1838 for (const ELFYAML::SectionHeader &Hdr : *SectionHeaders.Excluded) in buildSectionIndex()
1843 for (const ELFYAML::Section *S : Sections) in buildSectionIndex()
1848 for (const ELFYAML::Section *S : Sections) { in buildSectionIndex()
1856 ShStrtabStrings->add(ELFYAML::dropUniqueSuffix(S->Name)); in buildSectionIndex()
1861 auto Build = [this](ArrayRef<ELFYAML::Symbol> V, NameToIdxMap &Map) { in buildSymbolIndexes()
1863 const ELFYAML::Symbol &Sym = V[I]; in buildSymbolIndexes()
1878 for (const ELFYAML::Symbol &Sym : *Doc.Symbols) in finalizeStrings()
1879 DotStrtab.add(ELFYAML::dropUniqueSuffix(Sym.Name)); in finalizeStrings()
1884 for (const ELFYAML::Symbol &Sym : *Doc.DynamicSymbols) in finalizeStrings()
1885 DotDynstr.add(ELFYAML::dropUniqueSuffix(Sym.Name)); in finalizeStrings()
1889 for (const ELFYAML::Chunk *Sec : Doc.getSections()) { in finalizeStrings()
1890 if (auto VerNeed = dyn_cast<ELFYAML::VerneedSection>(Sec)) { in finalizeStrings()
1892 for (const ELFYAML::VerneedEntry &VE : *VerNeed->VerneedV) { in finalizeStrings()
1894 for (const ELFYAML::VernauxEntry &Aux : VE.AuxV) in finalizeStrings()
1898 } else if (auto VerDef = dyn_cast<ELFYAML::VerdefSection>(Sec)) { in finalizeStrings()
1900 for (const ELFYAML::VerdefEntry &E : *VerDef->Entries) in finalizeStrings()
1915 bool ELFState<ELFT>::writeELF(raw_ostream &OS, ELFYAML::Object &Doc, in writeELF()
1971 const ELFYAML::SectionHeaderTable &SHT = Doc.getSectionHeaderTable(); in writeELF()
1983 bool yaml2elf(llvm::ELFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH, in yaml2elf()
1985 bool IsLE = Doc.Header.Data == ELFYAML::ELF_ELFDATA(ELF::ELFDATA2LSB); in yaml2elf()
1986 bool Is64Bit = Doc.Header.Class == ELFYAML::ELF_ELFCLASS(ELF::ELFCLASS64); in yaml2elf()