Lines Matching refs:ELFYAML

204   ELFYAML::Object &Doc;
214 std::vector<Elf_Sym> toELFSymbols(ArrayRef<ELFYAML::Symbol> Symbols,
223 StringRef SecName, ELFYAML::Section *YAMLSec);
228 ELFYAML::Section *YAMLSec);
232 ELFYAML::Section *YAMLSec);
235 ELFYAML::Section *YAMLSec);
240 getPhdrFragments(const ELFYAML::ProgramHeader &Phdr,
246 const ELFYAML::NoBitsSection &Section,
249 const ELFYAML::RawContentSection &Section,
252 const ELFYAML::RelocationSection &Section,
255 const ELFYAML::RelrSection &Section,
258 const ELFYAML::GroupSection &Group,
261 const ELFYAML::SymtabShndxSection &Shndx,
264 const ELFYAML::SymverSection &Section,
267 const ELFYAML::VerneedSection &Section,
270 const ELFYAML::VerdefSection &Section,
273 const ELFYAML::ARMIndexTableSection &Section,
276 const ELFYAML::MipsABIFlags &Section,
279 const ELFYAML::DynamicSection &Section,
282 const ELFYAML::StackSizesSection &Section,
285 const ELFYAML::BBAddrMapSection &Section,
288 const ELFYAML::HashSection &Section,
291 const ELFYAML::AddrsigSection &Section,
294 const ELFYAML::NoteSection &Section,
297 const ELFYAML::GnuHashSection &Section,
300 const ELFYAML::LinkerOptionsSection &Section,
303 const ELFYAML::DependentLibrariesSection &Section,
306 const ELFYAML::CallGraphProfileSection &Section,
309 void writeFill(ELFYAML::Fill &Fill, ContiguousBlobAccumulator &CBA);
311 ELFState(ELFYAML::Object &D, yaml::ErrorHandler EH);
313 void assignSectionAddress(Elf_Shdr &SHeader, ELFYAML::Section *YAMLSec);
324 static bool writeELF(raw_ostream &OS, ELFYAML::Object &Doc,
340 ELFState<ELFT>::ELFState(ELFYAML::Object &D, yaml::ErrorHandler EH) in ELFState()
354 std::vector<ELFYAML::Section *> Sections = Doc.getSections(); in ELFState()
359 std::make_unique<ELFYAML::Section>( in ELFState()
360 ELFYAML::Chunk::ChunkKind::RawContent, /*IsImplicit=*/true)); in ELFState()
363 ELFYAML::SectionHeaderTable *SecHdrTable = nullptr; in ELFState()
365 const std::unique_ptr<ELFYAML::Chunk> &C = Doc.Chunks[I]; in ELFState()
368 if (auto S = dyn_cast<ELFYAML::SectionHeaderTable>(C.get())) { in ELFState()
379 std::string NewName = ELFYAML::appendUniqueSuffix( in ELFState()
382 assert(ELFYAML::dropUniqueSuffix(C->Name).empty()); in ELFState()
426 std::unique_ptr<ELFYAML::Section> Sec = std::make_unique<ELFYAML::Section>( in ELFState()
427 ELFYAML::Chunk::ChunkKind::RawContent, true /*IsImplicit*/); in ELFState()
454 std::make_unique<ELFYAML::SectionHeaderTable>(/*IsImplicit=*/true)); in ELFState()
508 const ELFYAML::SectionHeaderTable &SectionHeaders = in writeELFHeader()
536 DenseMap<StringRef, ELFYAML::Fill *> NameToFill; in initProgramHeaders()
539 if (auto S = dyn_cast<ELFYAML::Fill>(Doc.Chunks[I].get())) in initProgramHeaders()
544 std::vector<ELFYAML::Section *> Sections = Doc.getSections(); in initProgramHeaders()
546 ELFYAML::ProgramHeader &YamlPhdr = Doc.ProgramHeaders[I]; in initProgramHeaders()
598 const ELFYAML::SectionHeaderTable &SectionHeaders = in toSectionIndex()
635 static void overrideFields(ELFYAML::Section *From, typename ELFT::Shdr &To) { in overrideFields()
655 ELFYAML::Section *YAMLSec) { in initImplicitHeader()
673 if (YAMLSec && !isa<ELFYAML::RawContentSection>(YAMLSec)) in initImplicitHeader()
689 std::string llvm::ELFYAML::appendUniqueSuffix(StringRef Name, in appendUniqueSuffix()
696 StringRef llvm::ELFYAML::dropUniqueSuffix(StringRef S) { in dropUniqueSuffix()
765 for (const std::unique_ptr<ELFYAML::Chunk> &D : Doc.Chunks) { in initSectionHeaders()
766 if (ELFYAML::Fill *S = dyn_cast<ELFYAML::Fill>(D.get())) { in initSectionHeaders()
773 if (ELFYAML::SectionHeaderTable *S = in initSectionHeaders()
774 dyn_cast<ELFYAML::SectionHeaderTable>(D.get())) { in initSectionHeaders()
792 ELFYAML::Section *Sec = cast<ELFYAML::Section>(D.get()); in initSectionHeaders()
811 SHeader.sh_entsize = ELFYAML::getDefaultShEntSize<ELFT>( in initSectionHeaders()
826 getSectionNameOffset(ELFYAML::dropUniqueSuffix(Sec->Name)); in initSectionHeaders()
840 if (auto RawSec = dyn_cast<ELFYAML::RawContentSection>(Sec)) { in initSectionHeaders()
853 if (!isa<ELFYAML::NoBitsSection>(Sec) && (Sec->Content || Sec->Size)) in initSectionHeaders()
856 if (auto S = dyn_cast<ELFYAML::RawContentSection>(Sec)) { in initSectionHeaders()
858 } else if (auto S = dyn_cast<ELFYAML::SymtabShndxSection>(Sec)) { in initSectionHeaders()
860 } else if (auto S = dyn_cast<ELFYAML::RelocationSection>(Sec)) { in initSectionHeaders()
862 } else if (auto S = dyn_cast<ELFYAML::RelrSection>(Sec)) { in initSectionHeaders()
864 } else if (auto S = dyn_cast<ELFYAML::GroupSection>(Sec)) { in initSectionHeaders()
866 } else if (auto S = dyn_cast<ELFYAML::ARMIndexTableSection>(Sec)) { in initSectionHeaders()
868 } else if (auto S = dyn_cast<ELFYAML::MipsABIFlags>(Sec)) { in initSectionHeaders()
870 } else if (auto S = dyn_cast<ELFYAML::NoBitsSection>(Sec)) { in initSectionHeaders()
872 } else if (auto S = dyn_cast<ELFYAML::DynamicSection>(Sec)) { in initSectionHeaders()
874 } else if (auto S = dyn_cast<ELFYAML::SymverSection>(Sec)) { in initSectionHeaders()
876 } else if (auto S = dyn_cast<ELFYAML::VerneedSection>(Sec)) { in initSectionHeaders()
878 } else if (auto S = dyn_cast<ELFYAML::VerdefSection>(Sec)) { in initSectionHeaders()
880 } else if (auto S = dyn_cast<ELFYAML::StackSizesSection>(Sec)) { in initSectionHeaders()
882 } else if (auto S = dyn_cast<ELFYAML::HashSection>(Sec)) { in initSectionHeaders()
884 } else if (auto S = dyn_cast<ELFYAML::AddrsigSection>(Sec)) { in initSectionHeaders()
886 } else if (auto S = dyn_cast<ELFYAML::LinkerOptionsSection>(Sec)) { in initSectionHeaders()
888 } else if (auto S = dyn_cast<ELFYAML::NoteSection>(Sec)) { in initSectionHeaders()
890 } else if (auto S = dyn_cast<ELFYAML::GnuHashSection>(Sec)) { in initSectionHeaders()
892 } else if (auto S = dyn_cast<ELFYAML::DependentLibrariesSection>(Sec)) { in initSectionHeaders()
894 } else if (auto S = dyn_cast<ELFYAML::CallGraphProfileSection>(Sec)) { in initSectionHeaders()
896 } else if (auto S = dyn_cast<ELFYAML::BBAddrMapSection>(Sec)) { in initSectionHeaders()
911 ELFYAML::Section *YAMLSec) { in assignSectionAddress()
930 static size_t findFirstNonGlobal(ArrayRef<ELFYAML::Symbol> Symbols) { in findFirstNonGlobal()
939 ELFState<ELFT>::toELFSymbols(ArrayRef<ELFYAML::Symbol> Symbols, in toELFSymbols()
945 for (const ELFYAML::Symbol &Sym : Symbols) { in toELFSymbols()
954 Symbol.st_name = Strtab.getOffset(ELFYAML::dropUniqueSuffix(Sym.Name)); in toELFSymbols()
974 ELFYAML::Section *YAMLSec) { in initSymtabSectionHeader()
977 ArrayRef<ELFYAML::Symbol> Symbols; in initSymtabSectionHeader()
983 ELFYAML::RawContentSection *RawSec = in initSymtabSectionHeader()
984 dyn_cast_or_null<ELFYAML::RawContentSection>(YAMLSec); in initSymtabSectionHeader()
1039 ELFYAML::Section *YAMLSec) { in initStrtabSectionHeader()
1040 SHeader.sh_name = getSectionNameOffset(ELFYAML::dropUniqueSuffix(Name)); in initStrtabSectionHeader()
1044 ELFYAML::RawContentSection *RawSec = in initStrtabSectionHeader()
1045 dyn_cast_or_null<ELFYAML::RawContentSection>(YAMLSec); in initStrtabSectionHeader()
1097 ELFYAML::Section *YAMLSec) { in initDWARFSectionHeader()
1098 SHeader.sh_name = getSectionNameOffset(ELFYAML::dropUniqueSuffix(Name)); in initDWARFSectionHeader()
1104 ELFYAML::RawContentSection *RawSec = in initDWARFSectionHeader()
1105 dyn_cast_or_null<ELFYAML::RawContentSection>(YAMLSec); in initDWARFSectionHeader()
1148 ELFState<ELFT>::getPhdrFragments(const ELFYAML::ProgramHeader &Phdr, in getPhdrFragments()
1151 for (const ELFYAML::Chunk *C : Phdr.Chunks) { in getPhdrFragments()
1152 if (const ELFYAML::Fill *F = dyn_cast<ELFYAML::Fill>(C)) { in getPhdrFragments()
1158 const ELFYAML::Section *S = cast<ELFYAML::Section>(C); in getPhdrFragments()
1223 bool llvm::ELFYAML::shouldAllocateFileSpace( in shouldAllocateFileSpace()
1224 ArrayRef<ELFYAML::ProgramHeader> Phdrs, const ELFYAML::NoBitsSection &S) { in shouldAllocateFileSpace()
1225 for (const ELFYAML::ProgramHeader &PH : Phdrs) { in shouldAllocateFileSpace()
1227 PH.Chunks, [&](ELFYAML::Chunk *C) { return C->Name == S.Name; }); in shouldAllocateFileSpace()
1228 if (std::any_of(It, PH.Chunks.end(), [](ELFYAML::Chunk *C) { in shouldAllocateFileSpace()
1229 return (isa<ELFYAML::Fill>(C) || in shouldAllocateFileSpace()
1230 cast<ELFYAML::Section>(C)->Type != ELF::SHT_NOBITS); in shouldAllocateFileSpace()
1239 const ELFYAML::NoBitsSection &S, in writeSectionContent()
1255 Elf_Shdr &SHeader, const ELFYAML::RawContentSection &Section, in writeSectionContent()
1261 static bool isMips64EL(const ELFYAML::Object &Obj) { in isMips64EL()
1263 Obj.Header.Class == ELFYAML::ELF_ELFCLASS(ELF::ELFCLASS64) && in isMips64EL()
1264 Obj.Header.Data == ELFYAML::ELF_ELFDATA(ELF::ELFDATA2LSB); in isMips64EL()
1269 Elf_Shdr &SHeader, const ELFYAML::RelocationSection &Section, in writeSectionContent()
1282 for (const ELFYAML::Relocation &Rel : *Section.Relocations) { in writeSectionContent()
1308 const ELFYAML::RelrSection &Section, in writeSectionContent()
1325 Elf_Shdr &SHeader, const ELFYAML::SymtabShndxSection &Shndx, in writeSectionContent()
1342 const ELFYAML::GroupSection &Section, in writeSectionContent()
1354 for (const ELFYAML::SectionOrType &Member : *Section.Members) { in writeSectionContent()
1367 const ELFYAML::SymverSection &Section, in writeSectionContent()
1379 Elf_Shdr &SHeader, const ELFYAML::StackSizesSection &Section, in writeSectionContent()
1384 for (const ELFYAML::StackSizeEntry &E : *Section.Entries) { in writeSectionContent()
1392 Elf_Shdr &SHeader, const ELFYAML::BBAddrMapSection &Section, in writeSectionContent()
1402 const std::vector<ELFYAML::PGOAnalysisMapEntry> *PGOAnalyses = nullptr; in writeSectionContent()
1439 for (const ELFYAML::BBAddrMapEntry::BBEntry &BBE : *E.BBEntries) { in writeSectionContent()
1450 const ELFYAML::PGOAnalysisMapEntry &PGOEntry = PGOAnalyses->at(Idx); in writeSectionContent()
1481 Elf_Shdr &SHeader, const ELFYAML::LinkerOptionsSection &Section, in writeSectionContent()
1486 for (const ELFYAML::LinkerOption &LO : *Section.Options) { in writeSectionContent()
1497 Elf_Shdr &SHeader, const ELFYAML::DependentLibrariesSection &Section, in writeSectionContent()
1535 Elf_Shdr &SHeader, const ELFYAML::CallGraphProfileSection &Section, in writeSectionContent()
1540 for (const ELFYAML::CallGraphEntryWeight &E : *Section.Entries) { in writeSectionContent()
1548 const ELFYAML::HashSection &Section, in writeSectionContent()
1570 const ELFYAML::VerdefSection &Section, in writeSectionContent()
1583 const ELFYAML::VerdefEntry &E = (*Section.Entries)[I]; in writeSectionContent()
1616 const ELFYAML::VerneedSection &Section, in writeSectionContent()
1628 const ELFYAML::VerneedEntry &VE = (*Section.VerneedV)[I]; in writeSectionContent()
1643 const ELFYAML::VernauxEntry &VAuxE = VE.AuxV[J]; in writeSectionContent()
1664 Elf_Shdr &SHeader, const ELFYAML::ARMIndexTableSection &Section, in writeSectionContent()
1669 for (const ELFYAML::ARMIndexTableEntry &E : *Section.Entries) { in writeSectionContent()
1678 const ELFYAML::MipsABIFlags &Section, in writeSectionContent()
1703 const ELFYAML::DynamicSection &Section, in writeSectionContent()
1711 for (const ELFYAML::DynamicEntry &DE : *Section.Entries) { in writeSectionContent()
1720 const ELFYAML::AddrsigSection &Section, in writeSectionContent()
1732 const ELFYAML::NoteSection &Section, in writeSectionContent()
1738 for (const ELFYAML::NoteEntry &NE : *Section.Notes) { in writeSectionContent()
1773 const ELFYAML::GnuHashSection &Section, in writeSectionContent()
1823 void ELFState<ELFT>::writeFill(ELFYAML::Fill &Fill, in writeFill()
1840 const ELFYAML::SectionHeaderTable &SectionHeaders = in buildSectionHeaderReorderMap()
1850 auto AddSection = [&](const ELFYAML::SectionHeader &Hdr) { in buildSectionHeaderReorderMap()
1858 for (const ELFYAML::SectionHeader &Hdr : *SectionHeaders.Sections) in buildSectionHeaderReorderMap()
1862 for (const ELFYAML::SectionHeader &Hdr : *SectionHeaders.Excluded) in buildSectionHeaderReorderMap()
1865 for (const ELFYAML::Section *S : Doc.getSections()) { in buildSectionHeaderReorderMap()
1890 std::vector<ELFYAML::Section *> Sections = Doc.getSections(); in buildSectionIndex()
1891 const ELFYAML::SectionHeaderTable &SectionHeaders = in buildSectionIndex()
1894 for (const ELFYAML::SectionHeader &Hdr : *SectionHeaders.Excluded) in buildSectionIndex()
1899 for (const ELFYAML::Section *S : Sections) in buildSectionIndex()
1904 for (const ELFYAML::Section *S : Sections) { in buildSectionIndex()
1912 ShStrtabStrings->add(ELFYAML::dropUniqueSuffix(S->Name)); in buildSectionIndex()
1917 auto Build = [this](ArrayRef<ELFYAML::Symbol> V, NameToIdxMap &Map) { in buildSymbolIndexes()
1919 const ELFYAML::Symbol &Sym = V[I]; in buildSymbolIndexes()
1934 for (const ELFYAML::Symbol &Sym : *Doc.Symbols) in finalizeStrings()
1935 DotStrtab.add(ELFYAML::dropUniqueSuffix(Sym.Name)); in finalizeStrings()
1940 for (const ELFYAML::Symbol &Sym : *Doc.DynamicSymbols) in finalizeStrings()
1941 DotDynstr.add(ELFYAML::dropUniqueSuffix(Sym.Name)); in finalizeStrings()
1945 for (const ELFYAML::Chunk *Sec : Doc.getSections()) { in finalizeStrings()
1946 if (auto VerNeed = dyn_cast<ELFYAML::VerneedSection>(Sec)) { in finalizeStrings()
1948 for (const ELFYAML::VerneedEntry &VE : *VerNeed->VerneedV) { in finalizeStrings()
1950 for (const ELFYAML::VernauxEntry &Aux : VE.AuxV) in finalizeStrings()
1954 } else if (auto VerDef = dyn_cast<ELFYAML::VerdefSection>(Sec)) { in finalizeStrings()
1956 for (const ELFYAML::VerdefEntry &E : *VerDef->Entries) in finalizeStrings()
1971 bool ELFState<ELFT>::writeELF(raw_ostream &OS, ELFYAML::Object &Doc, in writeELF()
2027 const ELFYAML::SectionHeaderTable &SHT = Doc.getSectionHeaderTable(); in writeELF()
2039 bool yaml2elf(llvm::ELFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH, in yaml2elf()
2041 bool IsLE = Doc.Header.Data == ELFYAML::ELF_ELFDATA(ELF::ELFDATA2LSB); in yaml2elf()
2042 bool Is64Bit = Doc.Header.Class == ELFYAML::ELF_ELFCLASS(ELF::ELFCLASS64); in yaml2elf()