[llvm] r314772 - [llvm-readobj][RISCV] Pretty-print RISCV e_flags
Alex Bradbury via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 3 01:41:59 PDT 2017
Author: asb
Date: Tue Oct 3 01:41:59 2017
New Revision: 314772
URL: http://llvm.org/viewvc/llvm-project?rev=314772&view=rev
Log:
[llvm-readobj][RISCV] Pretty-print RISCV e_flags
Modified:
llvm/trunk/test/Object/RISCV/elf-flags.yaml
llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
Modified: llvm/trunk/test/Object/RISCV/elf-flags.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/RISCV/elf-flags.yaml?rev=314772&r1=314771&r2=314772&view=diff
==============================================================================
--- llvm/trunk/test/Object/RISCV/elf-flags.yaml (original)
+++ llvm/trunk/test/Object/RISCV/elf-flags.yaml Tue Oct 3 01:41:59 2017
@@ -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
Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=314772&r1=314771&r2=314772&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Tue Oct 3 01:41:59 2017
@@ -1242,6 +1242,14 @@ static const EnumEntry<unsigned> ElfHead
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<ELF
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);
More information about the llvm-commits
mailing list