[llvm-readobj] Add support for Mips specific ELF header e_flags.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207744 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Simon Atanasyan 2014-05-01 11:07:19 +00:00
parent b6fdca612d
commit ed37b773e1
2 changed files with 34 additions and 5 deletions

View File

@ -5,12 +5,13 @@ FileHeader:
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Flags: [ EF_MIPS_NOREORDER, EF_MIPS_ABI_O32 ]
Flags: [ EF_MIPS_NOREORDER, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ]
# CHECK: Format: ELF32-mips
# CHECK: Arch: mipsel
# CHECK: Machine: EM_MIPS
# CHECK: Flags [ (0x1001)
# CHECK-NEXT: 0x1
# CHECK-NEXT: 0x1000
# CHECK: Flags [ (0x70001001)
# CHECK-NEXT: EF_MIPS_ABI_O32 (0x1000)
# CHECK-NEXT: EF_MIPS_ARCH_32R2 (0x70000000)
# CHECK-NEXT: EF_MIPS_NOREORDER (0x1)
# CHECK-NEXT: ]

View File

@ -437,6 +437,27 @@ static const EnumEntry<unsigned> ElfSegmentFlags[] = {
LLVM_READOBJ_ENUM_ENT(ELF, PF_R)
};
static const EnumEntry<unsigned> ElfHeaderMipsFlags[] = {
LLVM_READOBJ_ENUM_ENT(ELF, EF_MIPS_NOREORDER),
LLVM_READOBJ_ENUM_ENT(ELF, EF_MIPS_PIC),
LLVM_READOBJ_ENUM_ENT(ELF, EF_MIPS_CPIC),
LLVM_READOBJ_ENUM_ENT(ELF, EF_MIPS_ABI2),
LLVM_READOBJ_ENUM_ENT(ELF, EF_MIPS_32BITMODE),
LLVM_READOBJ_ENUM_ENT(ELF, EF_MIPS_NAN2008),
LLVM_READOBJ_ENUM_ENT(ELF, EF_MIPS_ABI_O32),
LLVM_READOBJ_ENUM_ENT(ELF, EF_MIPS_MICROMIPS),
LLVM_READOBJ_ENUM_ENT(ELF, EF_MIPS_ARCH_ASE_M16),
LLVM_READOBJ_ENUM_ENT(ELF, EF_MIPS_ARCH_1),
LLVM_READOBJ_ENUM_ENT(ELF, EF_MIPS_ARCH_2),
LLVM_READOBJ_ENUM_ENT(ELF, EF_MIPS_ARCH_3),
LLVM_READOBJ_ENUM_ENT(ELF, EF_MIPS_ARCH_4),
LLVM_READOBJ_ENUM_ENT(ELF, EF_MIPS_ARCH_5),
LLVM_READOBJ_ENUM_ENT(ELF, EF_MIPS_ARCH_32),
LLVM_READOBJ_ENUM_ENT(ELF, EF_MIPS_ARCH_64),
LLVM_READOBJ_ENUM_ENT(ELF, EF_MIPS_ARCH_32R2),
LLVM_READOBJ_ENUM_ENT(ELF, EF_MIPS_ARCH_64R2)
};
template<class ELFT>
void ELFDumper<ELFT>::printFileHeaders() {
const typename ELFO::Elf_Ehdr *Header = Obj->getHeader();
@ -464,7 +485,14 @@ void ELFDumper<ELFT>::printFileHeaders() {
W.printHex ("Entry", Header->e_entry);
W.printHex ("ProgramHeaderOffset", Header->e_phoff);
W.printHex ("SectionHeaderOffset", Header->e_shoff);
W.printFlags ("Flags", Header->e_flags);
switch (Header->e_machine) {
case EM_MIPS:
W.printFlags("Flags", Header->e_flags, makeArrayRef(ElfHeaderMipsFlags),
unsigned(ELF::EF_MIPS_ARCH));
break;
default:
W.printFlags("Flags", Header->e_flags);
}
W.printNumber("HeaderSize", Header->e_ehsize);
W.printNumber("ProgramHeaderEntrySize", Header->e_phentsize);
W.printNumber("ProgramHeaderCount", Header->e_phnum);