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()}};
589 std::optional<std::vector<VerdefEntry>>
Entries;
590 std::optional<llvm::yaml::Hex64>
Info;
594 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
595 return {{
"Entries",
Entries.has_value()}};
604 std::optional<std::vector<SectionOrType>>
Members;
609 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
610 return {{
"Members",
Members.has_value()}};
629 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
639 std::optional<std::vector<llvm::yaml::Hex64>>
Entries;
643 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
644 return {{
"Entries",
Entries.has_value()}};
657 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
658 return {{
"Entries",
Entries.has_value()}};
672 std::optional<std::vector<ARMIndexTableEntry>>
Entries;
676 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
677 return {{
"Entries",
Entries.has_value()}};
711 std::optional<llvm::yaml::Hex64>
Align;
728 std::vector<std::unique_ptr<Chunk>>
Chunks;
736 std::optional<DWARFYAML::Data>
DWARF;
739 std::vector<Section *> Ret;
740 for (
const std::unique_ptr<Chunk> &Sec :
Chunks)
741 if (
auto S = dyn_cast<ELFYAML::Section>(Sec.get()))
747 for (
const std::unique_ptr<Chunk> &
C :
Chunks)
748 if (
auto *S = dyn_cast<ELFYAML::SectionHeaderTable>(
C.get()))
758 const NoBitsSection &S);
770 llvm::ELFYAML::PGOAnalysisMapEntry::PGOBBEntry::SuccessorEntry)
789template <>
struct ScalarTraits<ELFYAML::YAMLIntUInt> {
790 static void output(
const ELFYAML::YAMLIntUInt &Val,
void *Ctx,
792 static StringRef input(StringRef Scalar,
void *Ctx,
793 ELFYAML::YAMLIntUInt &Val);
794 static QuotingType mustQuote(StringRef) {
return QuotingType::None; }
798struct ScalarEnumerationTraits<ELFYAML::ELF_ET> {
799 static void enumeration(IO &IO, ELFYAML::ELF_ET &Value);
802template <>
struct ScalarEnumerationTraits<ELFYAML::ELF_PT> {
803 static void enumeration(IO &IO, ELFYAML::ELF_PT &Value);
806template <>
struct ScalarEnumerationTraits<ELFYAML::ELF_NT> {
807 static void enumeration(IO &IO, ELFYAML::ELF_NT &Value);
811struct ScalarEnumerationTraits<ELFYAML::ELF_EM> {
812 static void enumeration(IO &IO, ELFYAML::ELF_EM &Value);
816struct ScalarEnumerationTraits<ELFYAML::ELF_ELFCLASS> {
817 static void enumeration(IO &IO, ELFYAML::ELF_ELFCLASS &Value);
821struct ScalarEnumerationTraits<ELFYAML::ELF_ELFDATA> {
822 static void enumeration(IO &IO, ELFYAML::ELF_ELFDATA &Value);
826struct ScalarEnumerationTraits<ELFYAML::ELF_ELFOSABI> {
827 static void enumeration(IO &IO, ELFYAML::ELF_ELFOSABI &Value);
831struct ScalarBitSetTraits<ELFYAML::ELF_EF> {
832 static void bitset(IO &IO, ELFYAML::ELF_EF &Value);
835template <>
struct ScalarBitSetTraits<ELFYAML::ELF_PF> {
836 static void bitset(IO &IO, ELFYAML::ELF_PF &Value);
840struct ScalarEnumerationTraits<ELFYAML::ELF_SHT> {
841 static void enumeration(IO &IO, ELFYAML::ELF_SHT &Value);
845struct ScalarBitSetTraits<ELFYAML::ELF_SHF> {
846 static void bitset(IO &IO, ELFYAML::ELF_SHF &Value);
849template <>
struct ScalarEnumerationTraits<ELFYAML::ELF_SHN> {
850 static void enumeration(IO &IO, ELFYAML::ELF_SHN &Value);
853template <>
struct ScalarEnumerationTraits<ELFYAML::ELF_STB> {
854 static void enumeration(IO &IO, ELFYAML::ELF_STB &Value);
858struct ScalarEnumerationTraits<ELFYAML::ELF_STT> {
859 static void enumeration(IO &IO, ELFYAML::ELF_STT &Value);
863struct ScalarEnumerationTraits<ELFYAML::ELF_REL> {
864 static void enumeration(IO &IO, ELFYAML::ELF_REL &Value);
868struct ScalarEnumerationTraits<ELFYAML::ELF_DYNTAG> {
869 static void enumeration(IO &IO, ELFYAML::ELF_DYNTAG &Value);
873struct ScalarEnumerationTraits<ELFYAML::ELF_RSS> {
874 static void enumeration(IO &IO, ELFYAML::ELF_RSS &Value);
878struct ScalarEnumerationTraits<ELFYAML::MIPS_AFL_REG> {
879 static void enumeration(IO &IO, ELFYAML::MIPS_AFL_REG &Value);
883struct ScalarEnumerationTraits<ELFYAML::MIPS_ABI_FP> {
884 static void enumeration(IO &IO, ELFYAML::MIPS_ABI_FP &Value);
888struct ScalarEnumerationTraits<ELFYAML::MIPS_AFL_EXT> {
889 static void enumeration(IO &IO, ELFYAML::MIPS_AFL_EXT &Value);
893struct ScalarEnumerationTraits<ELFYAML::MIPS_ISA> {
894 static void enumeration(IO &IO, ELFYAML::MIPS_ISA &Value);
898struct ScalarBitSetTraits<ELFYAML::MIPS_AFL_ASE> {
899 static void bitset(IO &IO, ELFYAML::MIPS_AFL_ASE &Value);
903struct ScalarBitSetTraits<ELFYAML::MIPS_AFL_FLAGS1> {
904 static void bitset(IO &IO, ELFYAML::MIPS_AFL_FLAGS1 &Value);
908struct MappingTraits<ELFYAML::FileHeader> {
909 static void mapping(IO &IO, ELFYAML::FileHeader &FileHdr);
912template <>
struct MappingTraits<ELFYAML::SectionHeader> {
913 static void mapping(IO &IO, ELFYAML::SectionHeader &SHdr);
916template <>
struct MappingTraits<ELFYAML::ProgramHeader> {
917 static void mapping(IO &IO, ELFYAML::ProgramHeader &FileHdr);
918 static std::string validate(IO &IO, ELFYAML::ProgramHeader &FileHdr);
922struct MappingTraits<ELFYAML::Symbol> {
923 static void mapping(IO &IO, ELFYAML::Symbol &Symbol);
924 static std::string validate(IO &IO, ELFYAML::Symbol &Symbol);
927template <>
struct MappingTraits<ELFYAML::StackSizeEntry> {
928 static void mapping(IO &IO, ELFYAML::StackSizeEntry &Rel);
931template <>
struct MappingTraits<ELFYAML::BBAddrMapEntry> {
932 static void mapping(IO &IO, ELFYAML::BBAddrMapEntry &
E);
935template <>
struct MappingTraits<ELFYAML::BBAddrMapEntry::BBRangeEntry> {
936 static void mapping(IO &IO, ELFYAML::BBAddrMapEntry::BBRangeEntry &
E);
939template <>
struct MappingTraits<ELFYAML::BBAddrMapEntry::BBEntry> {
940 static void mapping(IO &IO, ELFYAML::BBAddrMapEntry::BBEntry &
E);
943template <>
struct MappingTraits<ELFYAML::PGOAnalysisMapEntry> {
944 static void mapping(IO &IO, ELFYAML::PGOAnalysisMapEntry &Rel);
947template <>
struct MappingTraits<ELFYAML::PGOAnalysisMapEntry::PGOBBEntry> {
948 static void mapping(IO &IO, ELFYAML::PGOAnalysisMapEntry::PGOBBEntry &Rel);
952struct MappingTraits<ELFYAML::PGOAnalysisMapEntry::PGOBBEntry::SuccessorEntry> {
955 ELFYAML::PGOAnalysisMapEntry::PGOBBEntry::SuccessorEntry &Rel);
958template <>
struct MappingTraits<ELFYAML::GnuHashHeader> {
959 static void mapping(IO &IO, ELFYAML::GnuHashHeader &Rel);
962template <>
struct MappingTraits<ELFYAML::DynamicEntry> {
963 static void mapping(IO &IO, ELFYAML::DynamicEntry &Rel);
966template <>
struct MappingTraits<ELFYAML::NoteEntry> {
967 static void mapping(IO &IO, ELFYAML::NoteEntry &
N);
970template <>
struct MappingTraits<ELFYAML::VerdefEntry> {
971 static void mapping(IO &IO, ELFYAML::VerdefEntry &
E);
974template <>
struct MappingTraits<ELFYAML::VerneedEntry> {
975 static void mapping(IO &IO, ELFYAML::VerneedEntry &
E);
978template <>
struct MappingTraits<ELFYAML::VernauxEntry> {
979 static void mapping(IO &IO, ELFYAML::VernauxEntry &
E);
982template <>
struct MappingTraits<ELFYAML::LinkerOption> {
983 static void mapping(IO &IO, ELFYAML::LinkerOption &
Sym);
986template <>
struct MappingTraits<ELFYAML::CallGraphEntryWeight> {
987 static void mapping(IO &IO, ELFYAML::CallGraphEntryWeight &
E);
990template <>
struct MappingTraits<ELFYAML::Relocation> {
991 static void mapping(IO &IO, ELFYAML::Relocation &Rel);
994template <>
struct MappingTraits<ELFYAML::ARMIndexTableEntry> {
995 static void mapping(IO &IO, ELFYAML::ARMIndexTableEntry &
E);
998template <>
struct MappingTraits<
std::unique_ptr<ELFYAML::Chunk>> {
999 static void mapping(IO &IO, std::unique_ptr<ELFYAML::Chunk> &
C);
1000 static std::string validate(IO &io, std::unique_ptr<ELFYAML::Chunk> &
C);
1004struct MappingTraits<ELFYAML::Object> {
1005 static void mapping(IO &IO, ELFYAML::Object &Object);
1008template <>
struct MappingTraits<ELFYAML::SectionOrType> {
1009 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::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