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);
201 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
211 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
221 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
248 ELFYAML::ELF_EF &
Value) {
250 assert(Object &&
"The IO context is not initialized");
251 #define BCase(X) IO.bitSetCase(Value, #X, ELF::X);
252 #define BCaseMask(X, M) IO.maskedBitSetCase(Value, #X, ELF::X, ELF::M);
253 switch (Object->Header.Machine) {
329 assert(Object &&
"The IO context is not initialized");
330 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
357 switch (Object->Header.Machine) {
384 ELFYAML::ELF_SHF &
Value) {
385 #define BCase(X) IO.bitSetCase(Value, #X, ELF::X);
402 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
416 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
425 ELFYAML::ELF_STO &
Value) {
427 assert(Object &&
"The IO context is not initialized");
428 #define BCase(X) IO.bitSetCase(Value, #X, ELF::X);
429 switch (Object->Header.Machine) {
445 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
456 assert(Object &&
"The IO context is not initialized");
457 #define ELF_RELOC(X, Y) IO.enumCase(Value, #X, ELF::X);
458 switch (Object->Header.Machine) {
460 #include "llvm/Support/ELFRelocs/x86_64.def"
463 #include "llvm/Support/ELFRelocs/Mips.def"
466 #include "llvm/Support/ELFRelocs/Hexagon.def"
469 #include "llvm/Support/ELFRelocs/i386.def"
472 #include "llvm/Support/ELFRelocs/AArch64.def"
475 #include "llvm/Support/ELFRelocs/ARM.def"
485 #define ECase(X) IO.enumCase(Value, #X, Mips::AFL_##X);
495 #define ECase(X) IO.enumCase(Value, #X, Mips::Val_GNU_MIPS_ABI_##X);
509 #define ECase(X) IO.enumCase(Value, #X, Mips::AFL_##X);
514 ECase(EXT_LOONGSON_3A)
527 ECase(EXT_LOONGSON_2E)
528 ECase(EXT_LOONGSON_2F)
546 #define BCase(X) IO.bitSetCase(Value, #X, Mips::AFL_ASE_##X);
564 IO &
IO, ELFYAML::MIPS_AFL_FLAGS1 &
Value) {
565 #define BCase(X) IO.bitSetCase(Value, #X, Mips::AFL_FLAGS1_##X);
582 struct NormalizedOther {
583 NormalizedOther(
IO &)
585 NormalizedOther(IO &, uint8_t Original)
603 IO.
mapOptional(
"Visibility", Keys->Visibility, ELFYAML::ELF_STV(0));
604 IO.
mapOptional(
"Other", Keys->Other, ELFYAML::ELF_STO(0));
671 IO &
IO, std::unique_ptr<ELFYAML::Section> &
Section) {
672 ELFYAML::ELF_SHT sectionType;
674 sectionType = Section->Type;
678 switch (sectionType) {
683 sectionMapping(IO, *cast<ELFYAML::RelocationSection>(Section.get()));
703 sectionMapping(IO, *cast<ELFYAML::RawContentSection>(Section.get()));
708 IO &io, std::unique_ptr<ELFYAML::Section> &
Section) {
710 if (!RawSection || RawSection->Size >= RawSection->Content.binary_size())
712 return "Section size must be greater or equal to the content size";
716 struct NormalizedMips64RelType {
717 NormalizedMips64RelType(
IO &)
718 :
Type(ELFYAML::ELF_REL(ELF::R_MIPS_NONE)),
719 Type2(ELFYAML::ELF_REL(ELF::R_MIPS_NONE)),
720 Type3(ELFYAML::ELF_REL(ELF::R_MIPS_NONE)),
722 NormalizedMips64RelType(IO &, ELFYAML::ELF_REL Original)
723 :
Type(Original & 0xFF),
Type2(Original >> 8 & 0xFF),
724 Type3(Original >> 16 & 0xFF),
SpecSym(Original >> 24 & 0xFF) {}
726 ELFYAML::ELF_REL denormalize(IO &) {
741 assert(Object &&
"The IO context is not initialized");
746 if (Object->Header.Machine == ELFYAML::ELF_EM(
ELF::EM_MIPS) &&
751 IO.
mapOptional(
"Type2", Key->Type2, ELFYAML::ELF_REL(ELF::R_MIPS_NONE));
752 IO.
mapOptional(
"Type3", Key->Type3, ELFYAML::ELF_REL(ELF::R_MIPS_NONE));
761 assert(!IO.
getContext() &&
"The IO context is initialized already");
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.
std::enable_if< has_SequenceTraits< T >::value, void >::type mapOptional(const char *Key, T &Val)
This file declares classes for handling the YAML representation of ELF.
llvm::yaml::Hex16 Version
llvm::yaml::Hex64 Address
ELFYAML::ELF_STV Visibility
LocalGlobalWeakSymbols Symbols
llvm::yaml::Hex64 AddressAlign
std::vector< Symbol > Weak
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
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
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
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
LLVM_ATTRIBUTE_UNUSED_RESULT std::enable_if< !is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
MIPS_AFL_EXT ISAExtension
virtual bool outputting()=0
This class should be specialized by any integer type that is a union of bit values and the YAML repre...
LLVM Value Representation.
StringRef - Represent a constant reference to a string, i.e.
void mapRequired(const char *Key, T &Val)
std::vector< Relocation > Relocations