aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-readobj/ELFDumper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvm-readobj/ELFDumper.cpp')
-rw-r--r--tools/llvm-readobj/ELFDumper.cpp34
1 files changed, 31 insertions, 3 deletions
diff --git a/tools/llvm-readobj/ELFDumper.cpp b/tools/llvm-readobj/ELFDumper.cpp
index 0931cb70f6d8..99969fd469f9 100644
--- a/tools/llvm-readobj/ELFDumper.cpp
+++ b/tools/llvm-readobj/ELFDumper.cpp
@@ -58,6 +58,7 @@ public:
void printAttributes() override;
void printMipsPLTGOT() override;
void printMipsABIFlags() override;
+ void printMipsReginfo() override;
private:
typedef ELFFile<ELFT> ELFO;
@@ -147,12 +148,12 @@ getSectionNameIndex(const ELFO &Obj, typename ELFO::Elf_Sym_Iter Symbol,
SectionName = "Processor Specific";
else if (Symbol->isOSSpecific())
SectionName = "Operating System Specific";
- else if (Symbol->isReserved())
- SectionName = "Reserved";
else if (Symbol->isAbsolute())
SectionName = "Absolute";
else if (Symbol->isCommon())
SectionName = "Common";
+ else if (Symbol->isReserved() && SectionIndex != SHN_XINDEX)
+ SectionName = "Reserved";
else {
if (SectionIndex == SHN_XINDEX)
SectionIndex = Obj.getSymbolTableIndex(&*Symbol);
@@ -233,7 +234,7 @@ static const EnumEntry<unsigned> ElfMachineType[] = {
LLVM_READOBJ_ENUM_ENT(ELF, EM_386 ),
LLVM_READOBJ_ENUM_ENT(ELF, EM_68K ),
LLVM_READOBJ_ENUM_ENT(ELF, EM_88K ),
- LLVM_READOBJ_ENUM_ENT(ELF, EM_486 ),
+ LLVM_READOBJ_ENUM_ENT(ELF, EM_IAMCU ),
LLVM_READOBJ_ENUM_ENT(ELF, EM_860 ),
LLVM_READOBJ_ENUM_ENT(ELF, EM_MIPS ),
LLVM_READOBJ_ENUM_ENT(ELF, EM_S370 ),
@@ -1424,3 +1425,30 @@ template <class ELFT> void ELFDumper<ELFT>::printMipsABIFlags() {
W.printFlags("Flags 1", Flags->flags1, makeArrayRef(ElfMipsFlags1));
W.printHex("Flags 2", Flags->flags2);
}
+
+template <class ELFT> void ELFDumper<ELFT>::printMipsReginfo() {
+ const Elf_Shdr *Shdr = findSectionByName(*Obj, ".reginfo");
+ if (!Shdr) {
+ W.startLine() << "There is no .reginfo section in the file.\n";
+ return;
+ }
+ ErrorOr<ArrayRef<uint8_t>> Sec = Obj->getSectionContents(Shdr);
+ if (!Sec) {
+ W.startLine() << "The .reginfo section is empty.\n";
+ return;
+ }
+ if (Sec->size() != sizeof(Elf_Mips_RegInfo<ELFT>)) {
+ W.startLine() << "The .reginfo section has a wrong size.\n";
+ return;
+ }
+
+ auto *Reginfo = reinterpret_cast<const Elf_Mips_RegInfo<ELFT> *>(Sec->data());
+
+ DictScope GS(W, "MIPS RegInfo");
+ W.printHex("GP", Reginfo->ri_gp_value);
+ W.printHex("General Mask", Reginfo->ri_gprmask);
+ W.printHex("Co-Proc Mask0", Reginfo->ri_cprmask[0]);
+ W.printHex("Co-Proc Mask1", Reginfo->ri_cprmask[1]);
+ W.printHex("Co-Proc Mask2", Reginfo->ri_cprmask[2]);
+ W.printHex("Co-Proc Mask3", Reginfo->ri_cprmask[3]);
+}