};
static const EnumEntry<unsigned> ElfSymbolBindings[] = {
- { "Local", ELF::STB_LOCAL },
- { "Global", ELF::STB_GLOBAL },
- { "Weak", ELF::STB_WEAK }
+ { "Local", ELF::STB_LOCAL },
+ { "Global", ELF::STB_GLOBAL },
+ { "Weak", ELF::STB_WEAK },
+ { "Unique", ELF::STB_GNU_UNIQUE }
};
static const EnumEntry<unsigned> ElfSymbolTypes[] = {
switch (Type) {
LLVM_READOBJ_ENUM_CASE(ELF, SHT_MIPS_REGINFO);
LLVM_READOBJ_ENUM_CASE(ELF, SHT_MIPS_OPTIONS);
+ LLVM_READOBJ_ENUM_CASE(ELF, SHT_MIPS_ABIFLAGS);
}
}
}
}
- if (opts::SectionData) {
+ if (opts::SectionData && Section->sh_type != ELF::SHT_NOBITS) {
ArrayRef<uint8_t> Data = errorOrDefault(Obj->getSectionContents(Section));
W.printBinaryBlock("SectionData",
StringRef((const char *)Data.data(), Data.size()));
DictScope Group(W, "Relocation");
W.printHex("Offset", Rel.r_offset);
W.printNumber("Type", RelocName, (int)Rel.getType(Obj->isMips64EL()));
- W.printString("Symbol", SymbolName.size() > 0 ? SymbolName : "-");
+ W.printNumber("Symbol", SymbolName.size() > 0 ? SymbolName : "-",
+ Rel.getSymbol(Obj->isMips64EL()));
W.printHex("Addend", Rel.r_addend);
} else {
raw_ostream& OS = W.startLine();
MipsGOTParser(const ObjectFile *Obj, StreamWriter &W) : Obj(Obj), W(W) {}
- void ParseGOT(const Elf_Shdr &GOTShdr);
+ void parseGOT(const Elf_Shdr &GOTShdr);
private:
typedef typename ObjectFile::Elf_Sym_Iter Elf_Sym_Iter;
const ObjectFile *Obj;
StreamWriter &W;
- std::size_t GetGOTTotal(ArrayRef<uint8_t> GOT) const;
- GOTIter MakeGOTIter(ArrayRef<uint8_t> GOT, std::size_t EntryNum);
+ std::size_t getGOTTotal(ArrayRef<uint8_t> GOT) const;
+ GOTIter makeGOTIter(ArrayRef<uint8_t> GOT, std::size_t EntryNum);
bool getGOTTags(uint64_t &LocalGotNum, uint64_t &GotSym);
void printGotEntry(uint64_t GotAddr, GOTIter BeginIt, GOTIter It);
}
template <class ELFT>
-void MipsGOTParser<ELFT>::ParseGOT(const Elf_Shdr &GOTShdr) {
+void MipsGOTParser<ELFT>::parseGOT(const Elf_Shdr &GOTShdr) {
// See "Global Offset Table" in Chapter 5 in the following document
// for detailed GOT description.
// ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
if (!getGOTTags(DtLocalGotNum, DtGotSym))
return;
- if (DtLocalGotNum > GetGOTTotal(*GOT)) {
+ if (DtLocalGotNum > getGOTTotal(*GOT)) {
W.startLine() << "MIPS_LOCAL_GOTNO exceeds a number of GOT entries.\n";
return;
}
Elf_Sym_Iter DynSymEnd = Obj->end_dynamic_symbols();
std::size_t DynSymTotal = std::size_t(std::distance(DynSymBegin, DynSymEnd));
- if (DtGotSym + 1 > DynSymTotal) {
+ if (DtGotSym > DynSymTotal) {
W.startLine() << "MIPS_GOTSYM exceeds a number of dynamic symbols.\n";
return;
}
std::size_t GlobalGotNum = DynSymTotal - DtGotSym;
- if (DtLocalGotNum + GlobalGotNum > GetGOTTotal(*GOT)) {
+ if (DtLocalGotNum + GlobalGotNum > getGOTTotal(*GOT)) {
W.startLine() << "Number of global GOT entries exceeds the size of GOT.\n";
return;
}
- GOTIter GotBegin = MakeGOTIter(*GOT, 0);
- GOTIter GotLocalEnd = MakeGOTIter(*GOT, DtLocalGotNum);
+ GOTIter GotBegin = makeGOTIter(*GOT, 0);
+ GOTIter GotLocalEnd = makeGOTIter(*GOT, DtLocalGotNum);
GOTIter It = GotBegin;
DictScope GS(W, "Primary GOT");
{
ListScope GS(W, "Global entries");
- GOTIter GotGlobalEnd = MakeGOTIter(*GOT, DtLocalGotNum + GlobalGotNum);
+ GOTIter GotGlobalEnd = makeGOTIter(*GOT, DtLocalGotNum + GlobalGotNum);
Elf_Sym_Iter GotDynSym = DynSymBegin + DtGotSym;
for (; It != GotGlobalEnd; ++It) {
DictScope D(W, "Entry");
}
}
- std::size_t SpecGotNum = GetGOTTotal(*GOT) - DtLocalGotNum - GlobalGotNum;
+ std::size_t SpecGotNum = getGOTTotal(*GOT) - DtLocalGotNum - GlobalGotNum;
W.printNumber("Number of TLS and multi-GOT entries", uint64_t(SpecGotNum));
}
template <class ELFT>
-std::size_t MipsGOTParser<ELFT>::GetGOTTotal(ArrayRef<uint8_t> GOT) const {
+std::size_t MipsGOTParser<ELFT>::getGOTTotal(ArrayRef<uint8_t> GOT) const {
return GOT.size() / sizeof(GOTEntry);
}
template <class ELFT>
typename MipsGOTParser<ELFT>::GOTIter
-MipsGOTParser<ELFT>::MakeGOTIter(ArrayRef<uint8_t> GOT, std::size_t EntryNum) {
+MipsGOTParser<ELFT>::makeGOTIter(ArrayRef<uint8_t> GOT, std::size_t EntryNum) {
const char *Data = reinterpret_cast<const char *>(GOT.data());
return GOTIter(sizeof(GOTEntry), Data + EntryNum * sizeof(GOTEntry));
}
return;
}
- MipsGOTParser<ELFT>(Obj, W).ParseGOT(*GotShdr);
+ MipsGOTParser<ELFT>(Obj, W).parseGOT(*GotShdr);
}