diff options
Diffstat (limited to 'include/llvm/ObjectYAML/ELFYAML.h')
-rw-r--r-- | include/llvm/ObjectYAML/ELFYAML.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/include/llvm/ObjectYAML/ELFYAML.h b/include/llvm/ObjectYAML/ELFYAML.h index 9d62ec27ad31..ed455311696e 100644 --- a/include/llvm/ObjectYAML/ELFYAML.h +++ b/include/llvm/ObjectYAML/ELFYAML.h @@ -16,8 +16,12 @@ #ifndef LLVM_OBJECTYAML_ELFYAML_H #define LLVM_OBJECTYAML_ELFYAML_H -#include "llvm/BinaryFormat/ELF.h" +#include "llvm/ADT/StringRef.h" #include "llvm/ObjectYAML/YAML.h" +#include "llvm/Support/YAMLTraits.h" +#include <cstdint> +#include <memory> +#include <vector> namespace llvm { namespace ELFYAML { @@ -66,6 +70,7 @@ struct FileHeader { ELF_EF Flags; llvm::yaml::Hex64 Entry; }; + struct Symbol { StringRef Name; ELF_STT Type; @@ -74,6 +79,7 @@ struct Symbol { llvm::yaml::Hex64 Size; uint8_t Other; }; + struct LocalGlobalWeakSymbols { std::vector<Symbol> Local; std::vector<Symbol> Global; @@ -100,13 +106,16 @@ struct Section { StringRef Link; StringRef Info; llvm::yaml::Hex64 AddressAlign; + Section(SectionKind Kind) : Kind(Kind) {} virtual ~Section(); }; struct RawContentSection : Section { yaml::BinaryRef Content; llvm::yaml::Hex64 Size; + RawContentSection() : Section(SectionKind::RawContent) {} + static bool classof(const Section *S) { return S->Kind == SectionKind::RawContent; } @@ -114,7 +123,9 @@ struct RawContentSection : Section { struct NoBitsSection : Section { llvm::yaml::Hex64 Size; + NoBitsSection() : Section(SectionKind::NoBits) {} + static bool classof(const Section *S) { return S->Kind == SectionKind::NoBits; } @@ -124,7 +135,9 @@ struct Group : Section { // Members of a group contain a flag and a list of section indices // that are part of the group. std::vector<SectionOrType> Members; + Group() : Section(SectionKind::Group) {} + static bool classof(const Section *S) { return S->Kind == SectionKind::Group; } @@ -136,9 +149,12 @@ struct Relocation { ELF_REL Type; StringRef Symbol; }; + struct RelocationSection : Section { std::vector<Relocation> Relocations; + RelocationSection() : Section(SectionKind::Relocation) {} + static bool classof(const Section *S) { return S->Kind == SectionKind::Relocation; } @@ -157,7 +173,9 @@ struct MipsABIFlags : Section { MIPS_AFL_ASE ASEs; MIPS_AFL_FLAGS1 Flags1; llvm::yaml::Hex32 Flags2; + MipsABIFlags() : Section(SectionKind::MipsABIFlags) {} + static bool classof(const Section *S) { return S->Kind == SectionKind::MipsABIFlags; } @@ -316,4 +334,4 @@ template <> struct MappingTraits<ELFYAML::SectionOrType> { } // end namespace yaml } // end namespace llvm -#endif +#endif // LLVM_OBJECTYAML_ELFYAML_H |