26 ELFYAML::ELF_ET &
Value) {
27 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
39 ELFYAML::ELF_EM &
Value) {
40 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
205 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
215 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
225 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
253 ELFYAML::ELF_EF &
Value) {
255 assert(Object &&
"The IO context is not initialized");
256 #define BCase(X) IO.bitSetCase(Value, #X, ELF::X);
257 #define BCaseMask(X, M) IO.maskedBitSetCase(Value, #X, ELF::X, ELF::M);
258 switch (Object->Header.Machine) {
356 assert(Object &&
"The IO context is not initialized");
357 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
384 switch (Object->Header.Machine) {
411 ELFYAML::ELF_SHF &
Value) {
413 #define BCase(X) IO.bitSetCase(Value, #X, ELF::X);
425 switch(Object->Header.Machine) {
460 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
474 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
483 ELFYAML::ELF_STO &
Value) {
485 assert(Object &&
"The IO context is not initialized");
486 #define BCase(X) IO.bitSetCase(Value, #X, ELF::X);
487 switch (Object->Header.Machine) {
503 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
514 assert(Object &&
"The IO context is not initialized");
515 #define ELF_RELOC(X, Y) IO.enumCase(Value, #X, ELF::X);
516 switch (Object->Header.Machine) {
518 #include "llvm/Support/ELFRelocs/x86_64.def"
521 #include "llvm/Support/ELFRelocs/Mips.def"
524 #include "llvm/Support/ELFRelocs/Hexagon.def"
528 #include "llvm/Support/ELFRelocs/i386.def"
531 #include "llvm/Support/ELFRelocs/AArch64.def"
534 #include "llvm/Support/ELFRelocs/ARM.def"
537 #include "llvm/Support/ELFRelocs/RISCV.def"
540 #include "llvm/Support/ELFRelocs/Lanai.def"
543 #include "llvm/Support/ELFRelocs/AMDGPU.def"
546 #include "llvm/Support/ELFRelocs/BPF.def"
556 #define ECase(X) IO.enumCase(Value, #X, Mips::AFL_##X);
566 #define ECase(X) IO.enumCase(Value, #X, Mips::Val_GNU_MIPS_ABI_##X);
580 #define ECase(X) IO.enumCase(Value, #X, Mips::AFL_##X);
585 ECase(EXT_LOONGSON_3A)
598 ECase(EXT_LOONGSON_2E)
599 ECase(EXT_LOONGSON_2F)
617 #define BCase(X) IO.bitSetCase(Value, #X, Mips::AFL_ASE_##X);
635 IO &
IO, ELFYAML::MIPS_AFL_FLAGS1 &
Value) {
636 #define BCase(X) IO.bitSetCase(Value, #X, Mips::AFL_FLAGS1_##X);
653 struct NormalizedOther {
654 NormalizedOther(
IO &)
656 NormalizedOther(IO &, uint8_t Original)
674 IO.
mapOptional(
"Visibility", Keys->Visibility, ELFYAML::ELF_STV(0));
675 IO.
mapOptional(
"Other", Keys->Other, ELFYAML::ELF_STO(0));
742 IO &
IO, std::unique_ptr<ELFYAML::Section> &
Section) {
743 ELFYAML::ELF_SHT sectionType;
745 sectionType = Section->Type;
749 switch (sectionType) {
754 sectionMapping(IO, *cast<ELFYAML::RelocationSection>(Section.get()));
774 sectionMapping(IO, *cast<ELFYAML::RawContentSection>(Section.get()));
779 IO &io, std::unique_ptr<ELFYAML::Section> &
Section) {
781 if (!RawSection || RawSection->Size >= RawSection->Content.binary_size())
783 return "Section size must be greater or equal to the content size";
787 struct NormalizedMips64RelType {
788 NormalizedMips64RelType(
IO &)
789 :
Type(ELFYAML::ELF_REL(ELF::R_MIPS_NONE)),
790 Type2(ELFYAML::ELF_REL(ELF::R_MIPS_NONE)),
791 Type3(ELFYAML::ELF_REL(ELF::R_MIPS_NONE)),
793 NormalizedMips64RelType(IO &, ELFYAML::ELF_REL Original)
794 :
Type(Original & 0xFF),
Type2(Original >> 8 & 0xFF),
795 Type3(Original >> 16 & 0xFF),
SpecSym(Original >> 24 & 0xFF) {}
797 ELFYAML::ELF_REL denormalize(IO &) {
812 assert(Object &&
"The IO context is not initialized");
817 if (Object->Header.Machine == ELFYAML::ELF_EM(
ELF::EM_MIPS) &&
822 IO.
mapOptional(
"Type2", Key->Type2, ELFYAML::ELF_REL(ELF::R_MIPS_NONE));
823 IO.
mapOptional(
"Type3", Key->Type3, ELFYAML::ELF_REL(ELF::R_MIPS_NONE));
static void sectionMapping(IO &IO, ELFYAML::MipsABIFlags &Section)
ArrayRef< uint8_t >::size_type binary_size() const
The number of bytes that are represented by this BinaryRef.
This file declares classes for handling the YAML representation of ELF.
void mapOptional(const char *Key, T &Val)
llvm::yaml::Hex16 Version
llvm::yaml::Hex64 Address
ELFYAML::ELF_STV Visibility
LocalGlobalWeakSymbols Symbols
llvm::yaml::Hex64 AddressAlign
std::vector< Symbol > Weak
static void groupSectionMapping(IO &IO, ELFYAML::Group &group)
void enumFallback(T &Val)
StringRef sectionNameOrType
This class should be specialized by any type that needs to be converted to/from a YAML mapping...
std::vector< Symbol > Global
virtual bool mapTag(StringRef Tag, bool Default=false)=0
void enumCase(T &Val, const char *Str, const T ConstVal)
static void commonSectionMapping(IO &IO, ELFYAML::Section &Section)
The instances of the Type class are immutable: once they are created, they are never changed...
std::vector< std::unique_ptr< Section > > Sections
std::vector< Symbol > Local
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
llvm::yaml::Hex8 ISARevision
This class should be specialized by any integral type that converts to/from a YAML scalar where there...
#define LLVM_YAML_STRONG_TYPEDEF(_base, _type)
YAML I/O does conversion based on types.
std::vector< SectionOrType > Members
MIPS_AFL_EXT ISAExtension
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
virtual bool outputting()=0
This class should be specialized by any integer type that is a union of bit values and the YAML repre...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
StringRef - Represent a constant reference to a string, i.e.
void mapRequired(const char *Key, T &Val)
std::vector< Relocation > Relocations