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;
182 return BBRanges->front().BaseAddress;
275 std::optional<llvm::yaml::Hex64>
Size;
289 virtual std::vector<std::pair<StringRef, bool>>
getEntries()
const {
341 std::optional<std::vector<SectionHeader>>
Sections;
342 std::optional<std::vector<SectionHeader>>
Excluded;
359 std::optional<std::vector<BBAddrMapEntry>>
Entries;
364 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
365 return {{
"Entries",
Entries.has_value()}};
374 std::optional<std::vector<StackSizeEntry>>
Entries;
378 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
379 return {{
"Entries",
Entries.has_value()}};
387 return Name ==
".stack_sizes";
392 std::optional<std::vector<DynamicEntry>>
Entries;
396 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
397 return {{
"Entries",
Entries.has_value()}};
404 std::optional<llvm::yaml::Hex64>
Info;
423 std::optional<std::vector<ELFYAML::NoteEntry>>
Notes;
427 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
428 return {{
"Notes",
Notes.has_value()}};
435 std::optional<std::vector<uint32_t>>
Bucket;
436 std::optional<std::vector<uint32_t>>
Chain;
438 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
439 return {{
"Bucket",
Bucket.has_value()}, {
"Chain",
Chain.has_value()}};
480 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
481 return {{
"Header",
Header.has_value()},
500 std::vector<VernauxEntry>
AuxV;
505 std::optional<llvm::yaml::Hex64>
Info;
509 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
510 return {{
"Dependencies",
VerneedV.has_value()}};
519 std::optional<std::vector<YAMLFlowString>>
Symbols;
523 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
524 return {{
"Symbols",
Symbols.has_value()}};
536 std::optional<std::vector<LinkerOption>>
Options;
540 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
541 return {{
"Options",
Options.has_value()}};
550 std::optional<std::vector<YAMLFlowString>>
Libs;
554 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
555 return {{
"Libraries",
Libs.has_value()}};
570 std::optional<std::vector<CallGraphEntryWeight>>
Entries;
574 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
575 return {{
"Entries",
Entries.has_value()}};
588 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
589 return {{
"Entries",
Entries.has_value()}};
605 std::optional<std::vector<VerdefEntry>>
Entries;
606 std::optional<llvm::yaml::Hex64>
Info;
610 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
611 return {{
"Entries",
Entries.has_value()}};
620 std::optional<std::vector<SectionOrType>>
Members;
625 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
626 return {{
"Members",
Members.has_value()}};
645 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
655 std::optional<std::vector<llvm::yaml::Hex64>>
Entries;
659 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
660 return {{
"Entries",
Entries.has_value()}};
673 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
674 return {{
"Entries",
Entries.has_value()}};
688 std::optional<std::vector<ARMIndexTableEntry>>
Entries;
692 std::vector<std::pair<StringRef, bool>>
getEntries()
const override {
693 return {{
"Entries",
Entries.has_value()}};
727 std::optional<llvm::yaml::Hex64>
Align;
744 std::vector<std::unique_ptr<Chunk>>
Chunks;
752 std::optional<DWARFYAML::Data>
DWARF;
755 std::vector<Section *> Ret;
756 for (
const std::unique_ptr<Chunk> &Sec :
Chunks)
757 if (
auto S = dyn_cast<ELFYAML::Section>(Sec.get()))
763 for (
const std::unique_ptr<Chunk> &
C :
Chunks)
764 if (
auto *S = dyn_cast<ELFYAML::SectionHeaderTable>(
C.get()))
774 const NoBitsSection &S);
786 llvm::ELFYAML::PGOAnalysisMapEntry::PGOBBEntry::SuccessorEntry)
805template <>
struct ScalarTraits<ELFYAML::YAMLIntUInt> {
806 static void output(
const ELFYAML::YAMLIntUInt &Val,
void *Ctx,
808 static StringRef input(StringRef Scalar,
void *Ctx,
809 ELFYAML::YAMLIntUInt &Val);
810 static QuotingType mustQuote(StringRef) {
return QuotingType::None; }
814struct ScalarEnumerationTraits<ELFYAML::ELF_ET> {
815 static void enumeration(IO &IO, ELFYAML::ELF_ET &Value);
818template <>
struct ScalarEnumerationTraits<ELFYAML::ELF_PT> {
819 static void enumeration(IO &IO, ELFYAML::ELF_PT &Value);
822template <>
struct ScalarEnumerationTraits<ELFYAML::ELF_NT> {
823 static void enumeration(IO &IO, ELFYAML::ELF_NT &Value);
827struct ScalarEnumerationTraits<ELFYAML::ELF_EM> {
828 static void enumeration(IO &IO, ELFYAML::ELF_EM &Value);
832struct ScalarEnumerationTraits<ELFYAML::ELF_ELFCLASS> {
833 static void enumeration(IO &IO, ELFYAML::ELF_ELFCLASS &Value);
837struct ScalarEnumerationTraits<ELFYAML::ELF_ELFDATA> {
838 static void enumeration(IO &IO, ELFYAML::ELF_ELFDATA &Value);
842struct ScalarEnumerationTraits<ELFYAML::ELF_ELFOSABI> {
843 static void enumeration(IO &IO, ELFYAML::ELF_ELFOSABI &Value);
847struct ScalarBitSetTraits<ELFYAML::ELF_EF> {
848 static void bitset(IO &IO, ELFYAML::ELF_EF &Value);
851template <>
struct ScalarBitSetTraits<ELFYAML::ELF_PF> {
852 static void bitset(IO &IO, ELFYAML::ELF_PF &Value);
856struct ScalarEnumerationTraits<ELFYAML::ELF_SHT> {
857 static void enumeration(IO &IO, ELFYAML::ELF_SHT &Value);
861struct ScalarBitSetTraits<ELFYAML::ELF_SHF> {
862 static void bitset(IO &IO, ELFYAML::ELF_SHF &Value);
865template <>
struct ScalarEnumerationTraits<ELFYAML::ELF_SHN> {
866 static void enumeration(IO &IO, ELFYAML::ELF_SHN &Value);
869template <>
struct ScalarEnumerationTraits<ELFYAML::ELF_STB> {
870 static void enumeration(IO &IO, ELFYAML::ELF_STB &Value);
874struct ScalarEnumerationTraits<ELFYAML::ELF_STT> {
875 static void enumeration(IO &IO, ELFYAML::ELF_STT &Value);
879struct ScalarEnumerationTraits<ELFYAML::ELF_REL> {
880 static void enumeration(IO &IO, ELFYAML::ELF_REL &Value);
884struct ScalarEnumerationTraits<ELFYAML::ELF_DYNTAG> {
885 static void enumeration(IO &IO, ELFYAML::ELF_DYNTAG &Value);
889struct ScalarEnumerationTraits<ELFYAML::ELF_RSS> {
890 static void enumeration(IO &IO, ELFYAML::ELF_RSS &Value);
894struct ScalarEnumerationTraits<ELFYAML::MIPS_AFL_REG> {
895 static void enumeration(IO &IO, ELFYAML::MIPS_AFL_REG &Value);
899struct ScalarEnumerationTraits<ELFYAML::MIPS_ABI_FP> {
900 static void enumeration(IO &IO, ELFYAML::MIPS_ABI_FP &Value);
904struct ScalarEnumerationTraits<ELFYAML::MIPS_AFL_EXT> {
905 static void enumeration(IO &IO, ELFYAML::MIPS_AFL_EXT &Value);
909struct ScalarEnumerationTraits<ELFYAML::MIPS_ISA> {
910 static void enumeration(IO &IO, ELFYAML::MIPS_ISA &Value);
914struct ScalarBitSetTraits<ELFYAML::MIPS_AFL_ASE> {
915 static void bitset(IO &IO, ELFYAML::MIPS_AFL_ASE &Value);
919struct ScalarBitSetTraits<ELFYAML::MIPS_AFL_FLAGS1> {
920 static void bitset(IO &IO, ELFYAML::MIPS_AFL_FLAGS1 &Value);
924struct MappingTraits<ELFYAML::FileHeader> {
925 static void mapping(IO &IO, ELFYAML::FileHeader &FileHdr);
928template <>
struct MappingTraits<ELFYAML::SectionHeader> {
929 static void mapping(IO &IO, ELFYAML::SectionHeader &SHdr);
932template <>
struct MappingTraits<ELFYAML::ProgramHeader> {
933 static void mapping(IO &IO, ELFYAML::ProgramHeader &FileHdr);
934 static std::string validate(IO &IO, ELFYAML::ProgramHeader &FileHdr);
938struct MappingTraits<ELFYAML::Symbol> {
939 static void mapping(IO &IO, ELFYAML::Symbol &Symbol);
940 static std::string validate(IO &IO, ELFYAML::Symbol &Symbol);
943template <>
struct MappingTraits<ELFYAML::StackSizeEntry> {
944 static void mapping(IO &IO, ELFYAML::StackSizeEntry &Rel);
947template <>
struct MappingTraits<ELFYAML::BBAddrMapEntry> {
948 static void mapping(IO &IO, ELFYAML::BBAddrMapEntry &
E);
951template <>
struct MappingTraits<ELFYAML::BBAddrMapEntry::BBRangeEntry> {
952 static void mapping(IO &IO, ELFYAML::BBAddrMapEntry::BBRangeEntry &
E);
955template <>
struct MappingTraits<ELFYAML::BBAddrMapEntry::BBEntry> {
956 static void mapping(IO &IO, ELFYAML::BBAddrMapEntry::BBEntry &
E);
959template <>
struct MappingTraits<ELFYAML::PGOAnalysisMapEntry> {
960 static void mapping(IO &IO, ELFYAML::PGOAnalysisMapEntry &Rel);
963template <>
struct MappingTraits<ELFYAML::PGOAnalysisMapEntry::PGOBBEntry> {
964 static void mapping(IO &IO, ELFYAML::PGOAnalysisMapEntry::PGOBBEntry &Rel);
968struct MappingTraits<ELFYAML::PGOAnalysisMapEntry::PGOBBEntry::SuccessorEntry> {
971 ELFYAML::PGOAnalysisMapEntry::PGOBBEntry::SuccessorEntry &Rel);
974template <>
struct MappingTraits<ELFYAML::GnuHashHeader> {
975 static void mapping(IO &IO, ELFYAML::GnuHashHeader &Rel);
978template <>
struct MappingTraits<ELFYAML::DynamicEntry> {
979 static void mapping(IO &IO, ELFYAML::DynamicEntry &Rel);
982template <>
struct MappingTraits<ELFYAML::NoteEntry> {
983 static void mapping(IO &IO, ELFYAML::NoteEntry &
N);
986template <>
struct MappingTraits<ELFYAML::VerdefEntry> {
987 static void mapping(IO &IO, ELFYAML::VerdefEntry &
E);
990template <>
struct MappingTraits<ELFYAML::VerneedEntry> {
991 static void mapping(IO &IO, ELFYAML::VerneedEntry &
E);
994template <>
struct MappingTraits<ELFYAML::VernauxEntry> {
995 static void mapping(IO &IO, ELFYAML::VernauxEntry &
E);
998template <>
struct MappingTraits<ELFYAML::LinkerOption> {
999 static void mapping(IO &IO, ELFYAML::LinkerOption &
Sym);
1002template <>
struct MappingTraits<ELFYAML::CallGraphEntryWeight> {
1003 static void mapping(IO &IO, ELFYAML::CallGraphEntryWeight &
E);
1006template <>
struct MappingTraits<ELFYAML::Relocation> {
1007 static void mapping(IO &IO, ELFYAML::Relocation &Rel);
1010template <>
struct MappingTraits<ELFYAML::ARMIndexTableEntry> {
1011 static void mapping(IO &IO, ELFYAML::ARMIndexTableEntry &
E);
1014template <>
struct MappingTraits<
std::unique_ptr<ELFYAML::Chunk>> {
1015 static void mapping(IO &IO, std::unique_ptr<ELFYAML::Chunk> &
C);
1016 static std::string validate(IO &io, std::unique_ptr<ELFYAML::Chunk> &
C);
1020struct MappingTraits<ELFYAML::Object> {
1021 static void mapping(IO &IO, ELFYAML::Object &Object);
1024template <>
struct MappingTraits<ELFYAML::SectionOrType> {
1025 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
std::optional< std::vector< llvm::yaml::Hex64 > > CallsiteEndOffsets
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
bool hasAnyCallsiteEndOffsets() const
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