[llvm-readobj][RISCV] Pretty-print RISCV e_flags

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314772 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alex Bradbury 2017-10-03 08:41:59 +00:00
parent b02d7df9d9
commit 7ef69e2f26
2 changed files with 17 additions and 0 deletions

View File

@ -1,6 +1,13 @@
# RUN: yaml2obj %s > %t
# RUN: llvm-readobj -file-headers %t | FileCheck -check-prefix=OBJ %s
# RUN: obj2yaml %t | FileCheck -check-prefix=YAML %s
# OBJ: Flags [ (0xD)
# OBJ-NEXT: EF_RISCV_FLOAT_ABI_DOUBLE (0x4)
# OBJ-NEXT: EF_RISCV_RVC (0x1)
# OBJ-NEXT: EF_RISCV_RVE (0x8)
# OBJ-NEXT: ]
# YAML: FileHeader:
# YAML-NEXT: Class: ELFCLASS32
# YAML-NEXT: Data: ELFDATA2LSB

View File

@ -1242,6 +1242,14 @@ static const EnumEntry<unsigned> ElfHeaderMipsFlags[] = {
LLVM_READOBJ_ENUM_ENT(ELF, EF_MIPS_ARCH_64R6)
};
static const EnumEntry<unsigned> ElfHeaderRISCVFlags[] = {
LLVM_READOBJ_ENUM_ENT(ELF, EF_RISCV_RVC),
LLVM_READOBJ_ENUM_ENT(ELF, EF_RISCV_FLOAT_ABI_SINGLE),
LLVM_READOBJ_ENUM_ENT(ELF, EF_RISCV_FLOAT_ABI_DOUBLE),
LLVM_READOBJ_ENUM_ENT(ELF, EF_RISCV_FLOAT_ABI_QUAD),
LLVM_READOBJ_ENUM_ENT(ELF, EF_RISCV_RVE)
};
static const EnumEntry<unsigned> ElfSymOtherFlags[] = {
LLVM_READOBJ_ENUM_ENT(ELF, STV_INTERNAL),
LLVM_READOBJ_ENUM_ENT(ELF, STV_HIDDEN),
@ -3552,6 +3560,8 @@ template <class ELFT> void LLVMStyle<ELFT>::printFileHeaders(const ELFO *Obj) {
W.printFlags("Flags", e->e_flags, makeArrayRef(ElfHeaderMipsFlags),
unsigned(ELF::EF_MIPS_ARCH), unsigned(ELF::EF_MIPS_ABI),
unsigned(ELF::EF_MIPS_MACH));
else if (e->e_machine == EM_RISCV)
W.printFlags("Flags", e->e_flags, makeArrayRef(ElfHeaderRISCVFlags));
else
W.printFlags("Flags", e->e_flags);
W.printNumber("HeaderSize", e->e_ehsize);