Lines Matching refs:ELFYAML

53   Expected<std::vector<ELFYAML::ProgramHeader>>
54 dumpProgramHeaders(ArrayRef<std::unique_ptr<ELFYAML::Chunk>> Sections);
57 dumpDWARFSections(std::vector<std::unique_ptr<ELFYAML::Chunk>> &Sections);
60 Optional<std::vector<ELFYAML::Symbol>> &Symbols);
62 StringRef StrTable, ELFYAML::Symbol &S);
63 Expected<std::vector<std::unique_ptr<ELFYAML::Chunk>>> dumpSections();
64 Error dumpCommonSection(const Elf_Shdr *Shdr, ELFYAML::Section &S);
66 ELFYAML::RelocationSection &S);
69 ELFYAML::Relocation &R);
71 Expected<ELFYAML::AddrsigSection *> dumpAddrsigSection(const Elf_Shdr *Shdr);
72 Expected<ELFYAML::LinkerOptionsSection *>
74 Expected<ELFYAML::DependentLibrariesSection *>
76 Expected<ELFYAML::CallGraphProfileSection *>
78 Expected<ELFYAML::DynamicSection *> dumpDynamicSection(const Elf_Shdr *Shdr);
79 Expected<ELFYAML::RelocationSection *> dumpRelocSection(const Elf_Shdr *Shdr);
80 Expected<ELFYAML::RelrSection *> dumpRelrSection(const Elf_Shdr *Shdr);
81 Expected<ELFYAML::RawContentSection *>
83 Expected<ELFYAML::SymtabShndxSection *>
85 Expected<ELFYAML::NoBitsSection *> dumpNoBitsSection(const Elf_Shdr *Shdr);
86 Expected<ELFYAML::HashSection *> dumpHashSection(const Elf_Shdr *Shdr);
87 Expected<ELFYAML::NoteSection *> dumpNoteSection(const Elf_Shdr *Shdr);
88 Expected<ELFYAML::GnuHashSection *> dumpGnuHashSection(const Elf_Shdr *Shdr);
89 Expected<ELFYAML::VerdefSection *> dumpVerdefSection(const Elf_Shdr *Shdr);
90 Expected<ELFYAML::SymverSection *> dumpSymverSection(const Elf_Shdr *Shdr);
91 Expected<ELFYAML::VerneedSection *> dumpVerneedSection(const Elf_Shdr *Shdr);
92 Expected<ELFYAML::GroupSection *> dumpGroupSection(const Elf_Shdr *Shdr);
93 Expected<ELFYAML::ARMIndexTableSection *>
95 Expected<ELFYAML::MipsABIFlags *> dumpMipsABIFlags(const Elf_Shdr *Shdr);
96 Expected<ELFYAML::StackSizesSection *>
98 Expected<ELFYAML::BBAddrMapSection *>
100 Expected<ELFYAML::RawContentSection *>
103 bool shouldPrintSection(const ELFYAML::Section &S, const Elf_Shdr &SHdr,
108 Expected<ELFYAML::Object *> dump();
139 Ret = ELFYAML::appendUniqueSuffix(Name, Twine(++It.first->second)); in getUniquedSectionName()
173 ELFYAML::appendUniqueSuffix(Name, Twine(++It.first->second)); in getUniquedSymbolName()
183 bool ELFDumper<ELFT>::shouldPrintSection(const ELFYAML::Section &S, in shouldPrintSection()
202 if (const ELFYAML::RawContentSection *RawSec = in shouldPrintSection()
203 dyn_cast<const ELFYAML::RawContentSection>(&S)) { in shouldPrintSection()
209 ELFYAML::ELF_SHF ShFlags = RawSec->Flags.value_or(ELFYAML::ELF_SHF(0)); in shouldPrintSection()
212 return ShFlags != ELFYAML::ELF_SHF(ELF::SHF_MERGE | ELF::SHF_STRINGS); in shouldPrintSection()
214 return ShFlags != ELFYAML::ELF_SHF{0}; in shouldPrintSection()
229 return S.Size || S.Flags.value_or(ELFYAML::ELF_SHF(0)) & ELF::SHF_ALLOC; in shouldPrintSection()
237 ArrayRef<ELFYAML::ProgramHeader> Phdrs, in dumpSectionOffsets()
238 std::vector<std::unique_ptr<ELFYAML::Chunk>> &V, in dumpSectionOffsets()
249 for (const std::unique_ptr<ELFYAML::Chunk> &C : in dumpSectionOffsets()
251 ELFYAML::Section &Sec = *cast<ELFYAML::Section>(C.get()); in dumpSectionOffsets()
264 !ELFYAML::shouldAllocateFileSpace(Phdrs, in dumpSectionOffsets()
265 *cast<ELFYAML::NoBitsSection>(&Sec))) in dumpSectionOffsets()
272 template <class ELFT> Expected<ELFYAML::Object *> ELFDumper<ELFT>::dump() { in dump()
273 auto Y = std::make_unique<ELFYAML::Object>(); in dump()
278 Y->Header.Class = ELFYAML::ELF_ELFCLASS(Obj.getHeader().getFileClass()); in dump()
279 Y->Header.Data = ELFYAML::ELF_ELFDATA(Obj.getHeader().getDataEncoding()); in dump()
284 Y->Header.Machine = ELFYAML::ELF_EM(Obj.getHeader().e_machine); in dump()
353 Expected<std::vector<std::unique_ptr<ELFYAML::Chunk>>> ChunksOrErr = in dump()
357 std::vector<std::unique_ptr<ELFYAML::Chunk>> Chunks = std::move(*ChunksOrErr); in dump()
359 std::vector<ELFYAML::Section *> OriginalOrder; in dump()
361 for (const std::unique_ptr<ELFYAML::Chunk> &C : in dump()
363 OriginalOrder.push_back(cast<ELFYAML::Section>(C.get())); in dump()
367 llvm::stable_sort(Chunks, [&](const std::unique_ptr<ELFYAML::Chunk> &A, in dump()
368 const std::unique_ptr<ELFYAML::Chunk> &B) { in dump()
369 return Sections[cast<ELFYAML::Section>(A.get())->OriginalSecNdx].sh_offset < in dump()
370 Sections[cast<ELFYAML::Section>(B.get())->OriginalSecNdx].sh_offset; in dump()
374 Expected<std::vector<ELFYAML::ProgramHeader>> PhdrsOrErr = in dump()
389 llvm::is_sorted(Chunks, [&](const std::unique_ptr<ELFYAML::Chunk> &A, in dump()
390 const std::unique_ptr<ELFYAML::Chunk> &B) { in dump()
391 return cast<ELFYAML::Section>(A.get())->OriginalSecNdx < in dump()
392 cast<ELFYAML::Section>(B.get())->OriginalSecNdx; in dump()
395 std::unique_ptr<ELFYAML::SectionHeaderTable> SHT = in dump()
396 std::make_unique<ELFYAML::SectionHeaderTable>(/*IsImplicit=*/false); in dump()
398 for (ELFYAML::Section *S : OriginalOrder) in dump()
403 llvm::erase_if(Chunks, [this, &Y](const std::unique_ptr<ELFYAML::Chunk> &C) { in dump()
404 if (isa<ELFYAML::SectionHeaderTable>(*C.get())) in dump()
407 const ELFYAML::Section &S = cast<ELFYAML::Section>(*C.get()); in dump()
439 static bool isInSegment(const ELFYAML::Section &Sec, in isInSegment()
473 Expected<std::vector<ELFYAML::ProgramHeader>>
475 ArrayRef<std::unique_ptr<ELFYAML::Chunk>> Chunks) { in dumpProgramHeaders()
476 std::vector<ELFYAML::ProgramHeader> Ret; in dumpProgramHeaders()
482 ELFYAML::ProgramHeader PH; in dumpProgramHeaders()
496 for (const std::unique_ptr<ELFYAML::Chunk> &C : Chunks) { in dumpProgramHeaders()
497 ELFYAML::Section &S = cast<ELFYAML::Section>(*C.get()); in dumpProgramHeaders()
514 std::vector<std::unique_ptr<ELFYAML::Chunk>> &Sections) { in dumpDWARFSections()
516 for (std::unique_ptr<ELFYAML::Chunk> &C : Sections) { in dumpDWARFSections()
520 if (ELFYAML::RawContentSection *RawSec = in dumpDWARFSections()
521 dyn_cast<ELFYAML::RawContentSection>(C.get())) { in dumpDWARFSections()
557 Expected<ELFYAML::RawContentSection *>
559 auto S = std::make_unique<ELFYAML::RawContentSection>(); in dumpPlaceholderSection()
573 Expected<std::vector<std::unique_ptr<ELFYAML::Chunk>>>
575 std::vector<std::unique_ptr<ELFYAML::Chunk>> Ret; in dumpSections()
576 auto Add = [&](Expected<ELFYAML::Chunk *> SecOrErr) -> Error { in dumpSections()
584 -> std::function<Expected<ELFYAML::Chunk *>(const Elf_Shdr *)> { in dumpSections()
647 if (std::function<Expected<ELFYAML::Chunk *>(const Elf_Shdr *)> DumpFn = in dumpSections()
660 if (ELFYAML::StackSizesSection::nameMatches(*NameOrErr)) { in dumpSections()
676 const Elf_Shdr *Symtab, Optional<std::vector<ELFYAML::Symbol>> &Symbols) { in dumpSymbols()
698 ELFYAML::Symbol S; in dumpSymbols()
709 StringRef StrTable, ELFYAML::Symbol &S) { in dumpSymbol()
725 S.Index = (ELFYAML::ELF_SHN)Sym->st_shndx; in dumpSymbol()
747 ELFYAML::Relocation &R) { in dumpRelocation()
780 ELFYAML::Section &S) { in dumpCommonSection()
785 S.Flags = static_cast<ELFYAML::ELF_SHF>(Shdr->sh_flags); in dumpCommonSection()
797 if (Shdr->sh_entsize != ELFYAML::getDefaultShEntSize<ELFT>( in dumpCommonSection()
820 const Elf_Shdr *Shdr, ELFYAML::RelocationSection &S) { in dumpCommonRelocationSection()
842 Expected<ELFYAML::StackSizesSection *>
844 auto S = std::make_unique<ELFYAML::StackSizesSection>(); in dumpStackSizesSection()
855 std::vector<ELFYAML::StackSizeEntry> Entries; in dumpStackSizesSection()
875 Expected<ELFYAML::BBAddrMapSection *>
877 auto S = std::make_unique<ELFYAML::BBAddrMapSection>(); in dumpBBAddrMapSection()
891 std::vector<ELFYAML::BBAddrMapEntry> Entries; in dumpBBAddrMapSection()
907 std::vector<ELFYAML::BBAddrMapEntry::BBEntry> BBEntries; in dumpBBAddrMapSection()
931 Expected<ELFYAML::AddrsigSection *>
933 auto S = std::make_unique<ELFYAML::AddrsigSection>(); in dumpAddrsigSection()
944 std::vector<ELFYAML::YAMLFlowString> Symbols; in dumpAddrsigSection()
972 Expected<ELFYAML::LinkerOptionsSection *>
974 auto S = std::make_unique<ELFYAML::LinkerOptionsSection>(); in dumpLinkerOptionsSection()
1003 Expected<ELFYAML::DependentLibrariesSection *>
1005 auto DL = std::make_unique<ELFYAML::DependentLibrariesSection>(); in dumpDependentLibrariesSection()
1030 Expected<ELFYAML::CallGraphProfileSection *>
1032 auto S = std::make_unique<ELFYAML::CallGraphProfileSection>(); in dumpCallGraphProfileSection()
1040 const uint32_t SizeOfEntry = ELFYAML::getDefaultShEntSize<ELFT>( in dumpCallGraphProfileSection()
1051 std::vector<ELFYAML::CallGraphEntryWeight> Entries(Content.size() / in dumpCallGraphProfileSection()
1055 auto ReadEntry = [&](ELFYAML::CallGraphEntryWeight &E) { in dumpCallGraphProfileSection()
1064 for (ELFYAML::CallGraphEntryWeight &E : Entries) { in dumpCallGraphProfileSection()
1076 Expected<ELFYAML::DynamicSection *>
1078 auto S = std::make_unique<ELFYAML::DynamicSection>(); in dumpDynamicSection()
1088 S->Entries->push_back({(ELFYAML::ELF_DYNTAG)Dyn.getTag(), Dyn.getVal()}); in dumpDynamicSection()
1094 Expected<ELFYAML::RelocationSection *>
1096 auto S = std::make_unique<ELFYAML::RelocationSection>(); in dumpRelocSection()
1112 ELFYAML::Relocation R; in dumpRelocSection()
1122 ELFYAML::Relocation R; in dumpRelocSection()
1134 Expected<ELFYAML::RelrSection *>
1136 auto S = std::make_unique<ELFYAML::RelrSection>(); in dumpRelrSection()
1158 Expected<ELFYAML::RawContentSection *>
1160 auto S = std::make_unique<ELFYAML::RawContentSection>(); in dumpContentSection()
1182 Expected<ELFYAML::SymtabShndxSection *>
1184 auto S = std::make_unique<ELFYAML::SymtabShndxSection>(); in dumpSymtabShndxSection()
1199 Expected<ELFYAML::NoBitsSection *>
1201 auto S = std::make_unique<ELFYAML::NoBitsSection>(); in dumpNoBitsSection()
1210 Expected<ELFYAML::NoteSection *>
1212 auto S = std::make_unique<ELFYAML::NoteSection>(); in dumpNoteSection()
1220 std::vector<ELFYAML::NoteEntry> Entries; in dumpNoteSection()
1236 {Note.getName(), Note.getDesc(), (ELFYAML::ELF_NT)Note.getType()}); in dumpNoteSection()
1246 Expected<ELFYAML::HashSection *>
1248 auto S = std::make_unique<ELFYAML::HashSection>(); in dumpHashSection()
1287 Expected<ELFYAML::GnuHashSection *>
1289 auto S = std::make_unique<ELFYAML::GnuHashSection>(); in dumpGnuHashSection()
1301 ELFYAML::GnuHashHeader Header; in dumpGnuHashSection()
1338 Expected<ELFYAML::VerdefSection *>
1340 auto S = std::make_unique<ELFYAML::VerdefSection>(); in dumpVerdefSection()
1362 ELFYAML::VerdefEntry Entry; in dumpVerdefSection()
1397 Expected<ELFYAML::SymverSection *>
1399 auto S = std::make_unique<ELFYAML::SymverSection>(); in dumpSymverSection()
1415 Expected<ELFYAML::VerneedSection *>
1417 auto S = std::make_unique<ELFYAML::VerneedSection>(); in dumpVerneedSection()
1440 ELFYAML::VerneedEntry Entry; in dumpVerneedSection()
1450 ELFYAML::VernauxEntry Aux; in dumpVerneedSection()
1490 Expected<ELFYAML::GroupSection *>
1492 auto S = std::make_unique<ELFYAML::GroupSection>(); in dumpGroupSection()
1525 Expected<ELFYAML::ARMIndexTableSection *>
1527 auto S = std::make_unique<ELFYAML::ARMIndexTableSection>(); in dumpARMIndexTableSection()
1552 Expected<ELFYAML::MipsABIFlags *>
1556 auto S = std::make_unique<ELFYAML::MipsABIFlags>(); in dumpMipsABIFlags()
1584 Expected<ELFYAML::Object *> YAMLOrErr = Dumper.dump(); in elf2yaml()
1588 std::unique_ptr<ELFYAML::Object> YAML(YAMLOrErr.get()); in elf2yaml()