1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

llvm-readobj: ELF: Make DT tags machine aware

llvm-svn: 290623
This commit is contained in:
Hemant Kulkarni 2016-12-27 19:59:29 +00:00
parent 647bec73f9
commit 2cd4d50d15
2 changed files with 29 additions and 13 deletions

View File

@ -1143,6 +1143,11 @@ enum {
DT_VERNEED = 0X6FFFFFFE, // The address of the version Dependency table.
DT_VERNEEDNUM = 0X6FFFFFFF, // The number of entries in DT_VERNEED.
// Hexagon specific dynamic table entries
DT_HEXAGON_SYMSZ = 0x70000000,
DT_HEXAGON_VER = 0x70000001,
DT_HEXAGON_PLT = 0x70000002,
// Mips specific dynamic table entry tags.
DT_MIPS_RLD_VERSION = 0x70000001, // 32 bit version number for runtime
// linker interface.

View File

@ -1504,7 +1504,29 @@ template <class ELFT> void ELFDumper<ELFT>::printNotes() {
#define LLVM_READOBJ_TYPE_CASE(name) \
case DT_##name: return #name
static const char *getTypeString(uint64_t Type) {
static const char *getTypeString(unsigned Arch, uint64_t Type) {
switch (Arch) {
case EM_HEXAGON:
switch (Type) {
LLVM_READOBJ_TYPE_CASE(HEXAGON_SYMSZ);
LLVM_READOBJ_TYPE_CASE(HEXAGON_VER);
LLVM_READOBJ_TYPE_CASE(HEXAGON_PLT);
}
case EM_MIPS:
switch (Type) {
LLVM_READOBJ_TYPE_CASE(MIPS_RLD_MAP_REL);
LLVM_READOBJ_TYPE_CASE(MIPS_RLD_VERSION);
LLVM_READOBJ_TYPE_CASE(MIPS_FLAGS);
LLVM_READOBJ_TYPE_CASE(MIPS_BASE_ADDRESS);
LLVM_READOBJ_TYPE_CASE(MIPS_LOCAL_GOTNO);
LLVM_READOBJ_TYPE_CASE(MIPS_SYMTABNO);
LLVM_READOBJ_TYPE_CASE(MIPS_UNREFEXTNO);
LLVM_READOBJ_TYPE_CASE(MIPS_GOTSYM);
LLVM_READOBJ_TYPE_CASE(MIPS_RLD_MAP);
LLVM_READOBJ_TYPE_CASE(MIPS_PLTGOT);
LLVM_READOBJ_TYPE_CASE(MIPS_OPTIONS);
}
}
switch (Type) {
LLVM_READOBJ_TYPE_CASE(BIND_NOW);
LLVM_READOBJ_TYPE_CASE(DEBUG);
@ -1550,17 +1572,6 @@ static const char *getTypeString(uint64_t Type) {
LLVM_READOBJ_TYPE_CASE(GNU_HASH);
LLVM_READOBJ_TYPE_CASE(TLSDESC_PLT);
LLVM_READOBJ_TYPE_CASE(TLSDESC_GOT);
LLVM_READOBJ_TYPE_CASE(MIPS_RLD_VERSION);
LLVM_READOBJ_TYPE_CASE(MIPS_RLD_MAP_REL);
LLVM_READOBJ_TYPE_CASE(MIPS_FLAGS);
LLVM_READOBJ_TYPE_CASE(MIPS_BASE_ADDRESS);
LLVM_READOBJ_TYPE_CASE(MIPS_LOCAL_GOTNO);
LLVM_READOBJ_TYPE_CASE(MIPS_SYMTABNO);
LLVM_READOBJ_TYPE_CASE(MIPS_UNREFEXTNO);
LLVM_READOBJ_TYPE_CASE(MIPS_GOTSYM);
LLVM_READOBJ_TYPE_CASE(MIPS_RLD_MAP);
LLVM_READOBJ_TYPE_CASE(MIPS_PLTGOT);
LLVM_READOBJ_TYPE_CASE(MIPS_OPTIONS);
LLVM_READOBJ_TYPE_CASE(AUXILIARY);
default: return "unknown";
}
@ -1793,7 +1804,7 @@ void ELFDumper<ELFT>::printDynamicTable() {
uintX_t Tag = Entry.getTag();
++I;
W.startLine() << " " << format_hex(Tag, Is64 ? 18 : 10, opts::Output != opts::GNU) << " "
<< format("%-21s", getTypeString(Tag));
<< format("%-21s", getTypeString(Obj->getHeader()->e_machine, Tag));
printValue(Tag, Entry.getVal());
OS << "\n";
}