summaryrefslogtreecommitdiff
path: root/tools/llvm-readobj
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2014-05-01 11:07:19 +0000
committerSimon Atanasyan <simon@atanasyan.com>2014-05-01 11:07:19 +0000
commited37b773e1bc87a7e5280943e60451f4adc5abcb (patch)
treee64ab4afdc256a11194ef0b24b267de21c02ef77 /tools/llvm-readobj
parentb6fdca612dedef69d7f5d9a40c36c37f0f7cfb47 (diff)
[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
Diffstat (limited to 'tools/llvm-readobj')
-rw-r--r--tools/llvm-readobj/ELFDumper.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/tools/llvm-readobj/ELFDumper.cpp b/tools/llvm-readobj/ELFDumper.cpp
index ab898327ca2..21f9866035f 100644
--- a/tools/llvm-readobj/ELFDumper.cpp
+++ b/tools/llvm-readobj/ELFDumper.cpp
@@ -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);