15#ifndef LLVM_OBJECTYAML_ELFYAML_H
16#define LLVM_OBJECTYAML_ELFYAML_H
85 return sizeof(
typename ELFT::Sym);
87 return sizeof(
typename ELFT::Word);
89 return sizeof(
typename ELFT::Rel);
91 return sizeof(
typename ELFT::Rela);
93 return sizeof(
typename ELFT::Relr);
95 return sizeof(
typename ELFT::Dyn);
97 return sizeof(
typename ELFT::Word);
99 return sizeof(
typename ELFT::Word);
101 return sizeof(
typename ELFT::Half);
105 if (SecName ==
".debug_str")
143 std::optional<llvm::yaml::Hex64>
Value;
144 std::optional<llvm::yaml::Hex64>
Size;
181 return BBRanges->front().BaseAddress;
260 std::optional<llvm::yaml::Hex64>
Size;
274 virtual std::vector<std::pair<StringRef, bool>>
getEntries()
const {
326 std::optional<std::vector<SectionHeader>>
Sections;
327 std::optional<std::vector<SectionHeader>>
Excluded;
344 std::optional<std::vector<BBAddrMapEntry>>
Entries;
349 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
350 return {{
"Entries",
Entries.has_value()}};
359 std::optional<std::vector<StackSizeEntry>>
Entries;
363 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
364 return {{
"Entries",
Entries.has_value()}};
372 return Name ==
".stack_sizes";
377 std::optional<std::vector<DynamicEntry>>
Entries;
381 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
382 return {{
"Entries",
Entries.has_value()}};
389 std::optional<llvm::yaml::Hex64>
Info;
408 std::optional<std::vector<ELFYAML::NoteEntry>>
Notes;
412 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
413 return {{
"Notes",
Notes.has_value()}};
420 std::optional<std::vector<uint32_t>>
Bucket;
421 std::optional<std::vector<uint32_t>>
Chain;
423 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
424 return {{
"Bucket",
Bucket.has_value()}, {
"Chain",
Chain.has_value()}};
465 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
466 return {{
"Header",
Header.has_value()},
485 std::vector<VernauxEntry>
AuxV;
490 std::optional<llvm::yaml::Hex64>
Info;
494 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
495 return {{
"Dependencies",
VerneedV.has_value()}};
504 std::optional<std::vector<YAMLFlowString>>
Symbols;
508 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
509 return {{
"Symbols",
Symbols.has_value()}};
521 std::optional<std::vector<LinkerOption>>
Options;
525 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
526 return {{
"Options",
Options.has_value()}};
535 std::optional<std::vector<YAMLFlowString>>
Libs;
539 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
540 return {{
"Libraries",
Libs.has_value()}};
555 std::optional<std::vector<CallGraphEntryWeight>>
Entries;
559 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
560 return {{
"Entries",
Entries.has_value()}};
573 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
574 return {{
"Entries",
Entries.has_value()}};
590 std::optional<std::vector<VerdefEntry>>
Entries;
591 std::optional<llvm::yaml::Hex64>
Info;
595 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
596 return {{
"Entries",
Entries.has_value()}};
605 std::optional<std::vector<SectionOrType>>
Members;
610 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
611 return {{
"Members",
Members.has_value()}};
630 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
640 std::optional<std::vector<llvm::yaml::Hex64>>
Entries;
644 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
645 return {{
"Entries",
Entries.has_value()}};
658 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
659 return {{
"Entries",
Entries.has_value()}};
673 std::optional<std::vector<ARMIndexTableEntry>>
Entries;
677 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
678 return {{
"Entries",
Entries.has_value()}};
712 std::optional<llvm::yaml::Hex64>
Align;
729 std::vector<std::unique_ptr<Chunk>>
Chunks;
737 std::optional<DWARFYAML::Data>
DWARF;
740 std::vector<Section *> Ret;
741 for (
const std::unique_ptr<Chunk> &Sec :
Chunks)
742 if (
auto S = dyn_cast<ELFYAML::Section>(Sec.get()))
748 for (
const std::unique_ptr<Chunk> &
C :
Chunks)
749 if (
auto *S = dyn_cast<ELFYAML::SectionHeaderTable>(
C.get()))
759 const NoBitsSection &S);
771 llvm::ELFYAML::PGOAnalysisMapEntry::PGOBBEntry::SuccessorEntry)
790template <>
struct ScalarTraits<ELFYAML::YAMLIntUInt> {
791 static void output(
const ELFYAML::YAMLIntUInt &Val,
void *Ctx,
793 static StringRef input(StringRef Scalar,
void *Ctx,
794 ELFYAML::YAMLIntUInt &Val);
795 static QuotingType mustQuote(StringRef) {
return QuotingType::None; }
799struct ScalarEnumerationTraits<ELFYAML::ELF_ET> {
800 static void enumeration(IO &IO, ELFYAML::ELF_ET &Value);
803template <>
struct ScalarEnumerationTraits<ELFYAML::ELF_PT> {
804 static void enumeration(IO &IO, ELFYAML::ELF_PT &Value);
807template <>
struct ScalarEnumerationTraits<ELFYAML::ELF_NT> {
808 static void enumeration(IO &IO, ELFYAML::ELF_NT &Value);
812struct ScalarEnumerationTraits<ELFYAML::ELF_EM> {
813 static void enumeration(IO &IO, ELFYAML::ELF_EM &Value);
817struct ScalarEnumerationTraits<ELFYAML::ELF_ELFCLASS> {
818 static void enumeration(IO &IO, ELFYAML::ELF_ELFCLASS &Value);
822struct ScalarEnumerationTraits<ELFYAML::ELF_ELFDATA> {
823 static void enumeration(IO &IO, ELFYAML::ELF_ELFDATA &Value);
827struct ScalarEnumerationTraits<ELFYAML::ELF_ELFOSABI> {
828 static void enumeration(IO &IO, ELFYAML::ELF_ELFOSABI &Value);
832struct ScalarBitSetTraits<ELFYAML::ELF_EF> {
833 static void bitset(IO &IO, ELFYAML::ELF_EF &Value);
836template <>
struct ScalarBitSetTraits<ELFYAML::ELF_PF> {
837 static void bitset(IO &IO, ELFYAML::ELF_PF &Value);
841struct ScalarEnumerationTraits<ELFYAML::ELF_SHT> {
842 static void enumeration(IO &IO, ELFYAML::ELF_SHT &Value);
846struct ScalarBitSetTraits<ELFYAML::ELF_SHF> {
847 static void bitset(IO &IO, ELFYAML::ELF_SHF &Value);
850template <>
struct ScalarEnumerationTraits<ELFYAML::ELF_SHN> {
851 static void enumeration(IO &IO, ELFYAML::ELF_SHN &Value);
854template <>
struct ScalarEnumerationTraits<ELFYAML::ELF_STB> {
855 static void enumeration(IO &IO, ELFYAML::ELF_STB &Value);
859struct ScalarEnumerationTraits<ELFYAML::ELF_STT> {
860 static void enumeration(IO &IO, ELFYAML::ELF_STT &Value);
864struct ScalarEnumerationTraits<ELFYAML::ELF_REL> {
865 static void enumeration(IO &IO, ELFYAML::ELF_REL &Value);
869struct ScalarEnumerationTraits<ELFYAML::ELF_DYNTAG> {
870 static void enumeration(IO &IO, ELFYAML::ELF_DYNTAG &Value);
874struct ScalarEnumerationTraits<ELFYAML::ELF_RSS> {
875 static void enumeration(IO &IO, ELFYAML::ELF_RSS &Value);
879struct ScalarEnumerationTraits<ELFYAML::MIPS_AFL_REG> {
880 static void enumeration(IO &IO, ELFYAML::MIPS_AFL_REG &Value);
884struct ScalarEnumerationTraits<ELFYAML::MIPS_ABI_FP> {
885 static void enumeration(IO &IO, ELFYAML::MIPS_ABI_FP &Value);
889struct ScalarEnumerationTraits<ELFYAML::MIPS_AFL_EXT> {
890 static void enumeration(IO &IO, ELFYAML::MIPS_AFL_EXT &Value);
894struct ScalarEnumerationTraits<ELFYAML::MIPS_ISA> {
895 static void enumeration(IO &IO, ELFYAML::MIPS_ISA &Value);
899struct ScalarBitSetTraits<ELFYAML::MIPS_AFL_ASE> {
900 static void bitset(IO &IO, ELFYAML::MIPS_AFL_ASE &Value);
904struct ScalarBitSetTraits<ELFYAML::MIPS_AFL_FLAGS1> {
905 static void bitset(IO &IO, ELFYAML::MIPS_AFL_FLAGS1 &Value);
909struct MappingTraits<ELFYAML::FileHeader> {
910 static void mapping(IO &IO, ELFYAML::FileHeader &FileHdr);
913template <>
struct MappingTraits<ELFYAML::SectionHeader> {
914 static void mapping(IO &IO, ELFYAML::SectionHeader &SHdr);
917template <>
struct MappingTraits<ELFYAML::ProgramHeader> {
918 static void mapping(IO &IO, ELFYAML::ProgramHeader &FileHdr);
919 static std::string validate(IO &IO, ELFYAML::ProgramHeader &FileHdr);
923struct MappingTraits<ELFYAML::Symbol> {
924 static void mapping(IO &IO, ELFYAML::Symbol &Symbol);
925 static std::string validate(IO &IO, ELFYAML::Symbol &Symbol);
928template <>
struct MappingTraits<ELFYAML::StackSizeEntry> {
929 static void mapping(IO &IO, ELFYAML::StackSizeEntry &Rel);
932template <>
struct MappingTraits<ELFYAML::BBAddrMapEntry> {
933 static void mapping(IO &IO, ELFYAML::BBAddrMapEntry &
E);
936template <>
struct MappingTraits<ELFYAML::BBAddrMapEntry::BBRangeEntry> {
937 static void mapping(IO &IO, ELFYAML::BBAddrMapEntry::BBRangeEntry &
E);
940template <>
struct MappingTraits<ELFYAML::BBAddrMapEntry::BBEntry> {
941 static void mapping(IO &IO, ELFYAML::BBAddrMapEntry::BBEntry &
E);
944template <>
struct MappingTraits<ELFYAML::PGOAnalysisMapEntry> {
945 static void mapping(IO &IO, ELFYAML::PGOAnalysisMapEntry &Rel);
948template <>
struct MappingTraits<ELFYAML::PGOAnalysisMapEntry::PGOBBEntry> {
949 static void mapping(IO &IO, ELFYAML::PGOAnalysisMapEntry::PGOBBEntry &Rel);
953struct MappingTraits<ELFYAML::PGOAnalysisMapEntry::PGOBBEntry::SuccessorEntry> {
956 ELFYAML::PGOAnalysisMapEntry::PGOBBEntry::SuccessorEntry &Rel);
959template <>
struct MappingTraits<ELFYAML::GnuHashHeader> {
960 static void mapping(IO &IO, ELFYAML::GnuHashHeader &Rel);
963template <>
struct MappingTraits<ELFYAML::DynamicEntry> {
964 static void mapping(IO &IO, ELFYAML::DynamicEntry &Rel);
967template <>
struct MappingTraits<ELFYAML::NoteEntry> {
968 static void mapping(IO &IO, ELFYAML::NoteEntry &
N);
971template <>
struct MappingTraits<ELFYAML::VerdefEntry> {
972 static void mapping(IO &IO, ELFYAML::VerdefEntry &
E);
975template <>
struct MappingTraits<ELFYAML::VerneedEntry> {
976 static void mapping(IO &IO, ELFYAML::VerneedEntry &
E);
979template <>
struct MappingTraits<ELFYAML::VernauxEntry> {
980 static void mapping(IO &IO, ELFYAML::VernauxEntry &
E);
983template <>
struct MappingTraits<ELFYAML::LinkerOption> {
984 static void mapping(IO &IO, ELFYAML::LinkerOption &
Sym);
987template <>
struct MappingTraits<ELFYAML::CallGraphEntryWeight> {
988 static void mapping(IO &IO, ELFYAML::CallGraphEntryWeight &
E);
991template <>
struct MappingTraits<ELFYAML::Relocation> {
992 static void mapping(IO &IO, ELFYAML::Relocation &Rel);
995template <>
struct MappingTraits<ELFYAML::ARMIndexTableEntry> {
996 static void mapping(IO &IO, ELFYAML::ARMIndexTableEntry &
E);
999template <>
struct MappingTraits<
std::unique_ptr<ELFYAML::Chunk>> {
1000 static void mapping(IO &IO, std::unique_ptr<ELFYAML::Chunk> &
C);
1001 static std::string validate(IO &io, std::unique_ptr<ELFYAML::Chunk> &
C);
1005struct MappingTraits<ELFYAML::Object> {
1006 static void mapping(IO &IO, ELFYAML::Object &Object);
1009template <>
struct MappingTraits<ELFYAML::SectionOrType> {
1010 static void mapping(IO &IO, ELFYAML::SectionOrType §ionOrType);
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file declares classes for handling the YAML representation of DWARF Debug Info.
#define LLVM_YAML_IS_SEQUENCE_VECTOR(type)
#define LLVM_YAML_STRONG_TYPEDEF(_base, _type)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
StringRef - Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Specialized YAMLIO scalar type for representing a binary blob.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
std::string appendUniqueSuffix(StringRef Name, const Twine &Msg)
unsigned getDefaultShEntSize(unsigned EMachine, ELF_SHT SecType, StringRef SecName)
StringRef dropUniqueSuffix(StringRef S)
bool shouldAllocateFileSpace(ArrayRef< ProgramHeader > Phdrs, const NoBitsSection &S)
@ SHT_LLVM_CALL_GRAPH_PROFILE
This is an optimization pass for GlobalISel generic memory operations.
Implement std::hash so that hash_code can be used in STL containers.
std::vector< std::pair< StringRef, bool > > getEntries() const override
static bool classof(const Chunk *S)
std::optional< std::vector< ARMIndexTableEntry > > Entries
std::optional< std::vector< YAMLFlowString > > Symbols
std::vector< std::pair< StringRef, bool > > getEntries() const override
static bool classof(const Chunk *S)
llvm::yaml::Hex64 Metadata
llvm::yaml::Hex64 AddressOffset
std::optional< uint64_t > NumBlocks
llvm::yaml::Hex64 BaseAddress
std::optional< std::vector< BBEntry > > BBEntries
llvm::yaml::Hex64 getFunctionAddress() const
std::optional< uint64_t > NumBBRanges
std::optional< std::vector< BBRangeEntry > > BBRanges
std::vector< std::pair< StringRef, bool > > getEntries() const override
static bool classof(const Chunk *S)
std::optional< std::vector< BBAddrMapEntry > > Entries
std::optional< std::vector< PGOAnalysisMapEntry > > PGOAnalyses
std::optional< std::vector< CallGraphEntryWeight > > Entries
CallGraphProfileSection()
std::vector< std::pair< StringRef, bool > > getEntries() const override
static bool classof(const Chunk *S)
Chunk(ChunkKind K, bool Implicit)
std::optional< llvm::yaml::Hex64 > Offset
std::vector< std::pair< StringRef, bool > > getEntries() const override
DependentLibrariesSection()
static bool classof(const Chunk *S)
std::optional< std::vector< YAMLFlowString > > Libs
std::vector< std::pair< StringRef, bool > > getEntries() const override
static bool classof(const Chunk *S)
std::optional< std::vector< DynamicEntry > > Entries
std::optional< yaml::BinaryRef > Pattern
static bool classof(const Chunk *S)
std::optional< std::vector< llvm::yaml::Hex64 > > BloomFilter
std::optional< std::vector< llvm::yaml::Hex32 > > HashBuckets
std::vector< std::pair< StringRef, bool > > getEntries() const override
static bool classof(const Chunk *S)
std::optional< GnuHashHeader > Header
std::optional< std::vector< llvm::yaml::Hex32 > > HashValues
static bool classof(const Chunk *S)
std::optional< std::vector< SectionOrType > > Members
std::vector< std::pair< StringRef, bool > > getEntries() const override
std::optional< StringRef > Signature
std::optional< std::vector< uint32_t > > Chain
std::vector< std::pair< StringRef, bool > > getEntries() const override
std::optional< llvm::yaml::Hex64 > NChain
static bool classof(const Chunk *S)
std::optional< std::vector< uint32_t > > Bucket
std::optional< llvm::yaml::Hex64 > NBucket
std::optional< std::vector< LinkerOption > > Options
static bool classof(const Chunk *S)
std::vector< std::pair< StringRef, bool > > getEntries() const override
llvm::yaml::Hex16 Version
static bool classof(const Chunk *S)
llvm::yaml::Hex8 ISARevision
MIPS_AFL_EXT ISAExtension
static bool classof(const Chunk *S)
std::vector< std::pair< StringRef, bool > > getEntries() const override
std::optional< std::vector< ELFYAML::NoteEntry > > Notes
static bool classof(const Chunk *S)
std::optional< std::vector< Symbol > > DynamicSymbols
unsigned getMachine() const
std::optional< DWARFYAML::Data > DWARF
const SectionHeaderTable & getSectionHeaderTable() const
std::vector< std::unique_ptr< Chunk > > Chunks
ELF_ELFOSABI getOSAbi() const
std::vector< ProgramHeader > ProgramHeaders
std::optional< std::vector< Symbol > > Symbols
std::vector< Section * > getSections()
std::optional< std::vector< SuccessorEntry > > Successors
std::optional< uint64_t > BBFreq
std::optional< std::vector< PGOBBEntry > > PGOBBEntries
std::optional< uint64_t > FuncEntryCount
static bool classof(const Chunk *S)
std::optional< llvm::yaml::Hex64 > Info
std::optional< std::vector< uint8_t > > ContentBuf
std::vector< std::pair< StringRef, bool > > getEntries() const override
std::optional< std::vector< Relocation > > Relocations
static bool classof(const Chunk *S)
std::optional< StringRef > Symbol
static bool classof(const Chunk *S)
std::vector< std::pair< StringRef, bool > > getEntries() const override
std::optional< std::vector< llvm::yaml::Hex64 > > Entries
StringRef sectionNameOrType
std::optional< llvm::yaml::Hex64 > Address
std::optional< StringRef > Link
Section(ChunkKind Kind, bool IsImplicit=false)
std::optional< llvm::yaml::Hex64 > Size
static bool classof(const Chunk *S)
std::optional< llvm::yaml::Hex64 > ShAddrAlign
llvm::yaml::Hex64 AddressAlign
std::optional< ELF_SHF > Flags
std::optional< ELF_SHT > ShType
std::optional< llvm::yaml::Hex64 > ShOffset
virtual std::vector< std::pair< StringRef, bool > > getEntries() const
std::optional< llvm::yaml::Hex64 > ShFlags
std::optional< llvm::yaml::Hex64 > ShName
std::optional< yaml::BinaryRef > Content
std::optional< llvm::yaml::Hex64 > EntSize
std::optional< llvm::yaml::Hex64 > ShSize
llvm::yaml::Hex64 Address
static bool classof(const Chunk *S)
static bool nameMatches(StringRef Name)
std::vector< std::pair< StringRef, bool > > getEntries() const override
std::optional< std::vector< StackSizeEntry > > Entries
std::optional< ELF_SHN > Index
std::optional< StringRef > Section
std::optional< uint8_t > Other
std::optional< uint32_t > StName
std::optional< llvm::yaml::Hex64 > Value
std::optional< llvm::yaml::Hex64 > Size
std::vector< std::pair< StringRef, bool > > getEntries() const override
static bool classof(const Chunk *S)
std::optional< std::vector< uint32_t > > Entries
std::optional< std::vector< uint16_t > > Entries
std::vector< std::pair< StringRef, bool > > getEntries() const override
static bool classof(const Chunk *S)
std::optional< uint16_t > Flags
std::optional< uint16_t > VDAux
std::vector< StringRef > VerNames
std::optional< uint16_t > VersionNdx
std::optional< uint16_t > Version
std::optional< uint32_t > Hash
static bool classof(const Chunk *S)
std::vector< std::pair< StringRef, bool > > getEntries() const override
std::optional< llvm::yaml::Hex64 > Info
std::optional< std::vector< VerdefEntry > > Entries
std::vector< VernauxEntry > AuxV
std::vector< std::pair< StringRef, bool > > getEntries() const override
std::optional< llvm::yaml::Hex64 > Info
static bool classof(const Chunk *S)
std::optional< std::vector< VerneedEntry > > VerneedV