[ELFYAML] Group ELF header falgs to target specific blocks. Handle flags

which are corresponding to the current target read from the ELF file.

This fix cannot be tested until obj2yaml does not support ELF format.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207905 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Simon Atanasyan 2014-05-03 11:39:50 +00:00
parent e6982bfe51
commit e26759bd66

View File

@ -243,7 +243,11 @@ void ScalarEnumerationTraits<ELFYAML::ELF_ELFOSABI>::enumeration(
void ScalarBitSetTraits<ELFYAML::ELF_EF>::bitset(IO &IO,
ELFYAML::ELF_EF &Value) {
const auto *Object = static_cast<ELFYAML::Object *>(IO.getContext());
assert(Object && "The IO context is not initialized");
#define BCase(X) IO.bitSetCase(Value, #X, ELF::X);
switch (Object->Header.Machine) {
case ELF::EM_ARM:
BCase(EF_ARM_SOFT_FLOAT)
BCase(EF_ARM_VFP_FLOAT)
BCase(EF_ARM_EABI_UNKNOWN)
@ -252,7 +256,8 @@ void ScalarBitSetTraits<ELFYAML::ELF_EF>::bitset(IO &IO,
BCase(EF_ARM_EABI_VER3)
BCase(EF_ARM_EABI_VER4)
BCase(EF_ARM_EABI_VER5)
BCase(EF_ARM_EABIMASK)
break;
case ELF::EM_MIPS:
BCase(EF_MIPS_NOREORDER)
BCase(EF_MIPS_PIC)
BCase(EF_MIPS_CPIC)
@ -270,16 +275,20 @@ void ScalarBitSetTraits<ELFYAML::ELF_EF>::bitset(IO &IO,
BCase(EF_MIPS_ARCH_64)
BCase(EF_MIPS_ARCH_32R2)
BCase(EF_MIPS_ARCH_64R2)
BCase(EF_MIPS_ARCH)
break;
case ELF::EM_HEXAGON:
BCase(EF_HEXAGON_MACH_V2)
BCase(EF_HEXAGON_MACH_V3)
BCase(EF_HEXAGON_MACH_V4)
BCase(EF_HEXAGON_MACH_V5)
BCase(EF_HEXAGON_ISA_MACH)
BCase(EF_HEXAGON_ISA_V2)
BCase(EF_HEXAGON_ISA_V3)
BCase(EF_HEXAGON_ISA_V4)
BCase(EF_HEXAGON_ISA_V5)
break;
default:
llvm_unreachable("Unsupported architecture");
}
#undef BCase
}