[Mips] Add support for DT_MIPS_RLD_MAP and DT_MIPS_PLTGOT dynamic

section tags to the llvm-readobj.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198561 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Simon Atanasyan 2014-01-05 13:40:27 +00:00
parent 89573af249
commit 9de1c5fcb4
4 changed files with 45 additions and 1 deletions

Binary file not shown.

View File

@ -1,7 +1,9 @@
// clang -target mipsel-linux-gnu -shared -fPIC -lc dynamic-table.c \
// -o dynamic-table-so.mips
// clang -target mipsel-linux-gnu -lc dynamic-table.c \
// -o dynamic-table-exe.mips
int puts(const char *);
void foo(void) {
int main(void) {
puts("Hello, World");
}

View File

@ -32,3 +32,41 @@ ELF-MIPS: 0x6FFFFFFF VERNEEDNUM 1
ELF-MIPS: 0x6FFFFFF0 VERSYM 0x4C0
ELF-MIPS: 0x00000000 NULL 0x0
ELF-MIPS: ]
// Check dynamic section tags in case of non-pic executable file.
RUN: llvm-readobj -dynamic-table %p/Inputs/dynamic-table-exe.mips \
RUN: | FileCheck %s -check-prefix ELF-MIPS-EXE
ELF-MIPS-EXE: Format: ELF32-mips
ELF-MIPS-EXE: Arch: mipsel
ELF-MIPS-EXE: AddressSize: 32bit
ELF-MIPS-EXE: LoadName:
ELF-MIPS-EXE: DynamicSection [ (26 entries)
ELF-MIPS-EXE: Tag Type Name/Value
ELF-MIPS-EXE: 0x00000001 NEEDED SharedLibrary (libc.so.6)
ELF-MIPS-EXE: 0x0000000C INIT 0x400418
ELF-MIPS-EXE: 0x0000000D FINI 0x4007B0
ELF-MIPS-EXE: 0x00000004 HASH 0x4002B8
ELF-MIPS-EXE: 0x00000005 STRTAB 0x40036C
ELF-MIPS-EXE: 0x00000006 SYMTAB 0x4002EC
ELF-MIPS-EXE: 0x0000000A STRSZ 107 (bytes)
ELF-MIPS-EXE: 0x0000000B SYMENT 16 (bytes)
ELF-MIPS-EXE: 0x70000016 MIPS_RLD_MAP 0x410880
ELF-MIPS-EXE: 0x00000015 DEBUG 0x0
ELF-MIPS-EXE: 0x00000003 PLTGOT 0x410890
ELF-MIPS-EXE: 0x70000001 MIPS_RLD_VERSION 1
ELF-MIPS-EXE: 0x70000005 MIPS_FLAGS 0x2
ELF-MIPS-EXE: 0x70000006 MIPS_BASE_ADDRESS 0x400000
ELF-MIPS-EXE: 0x7000000A MIPS_LOCAL_GOTNO 5
ELF-MIPS-EXE: 0x70000011 MIPS_SYMTABNO 8
ELF-MIPS-EXE: 0x70000012 MIPS_UNREFEXTNO 32
ELF-MIPS-EXE: 0x70000013 MIPS_GOTSYM 0x7
ELF-MIPS-EXE: 0x00000014 PLTREL REL
ELF-MIPS-EXE: 0x00000017 JMPREL 0x400408
ELF-MIPS-EXE: 0x00000002 PLTRELSZ 16 (bytes)
ELF-MIPS-EXE: 0x70000032 MIPS_PLTGOT 0x410854
ELF-MIPS-EXE: 0x6FFFFFFE VERNEED 0x4003E8
ELF-MIPS-EXE: 0x6FFFFFFF VERNEEDNUM 1
ELF-MIPS-EXE: 0x6FFFFFF0 VERSYM 0x4003D8
ELF-MIPS-EXE: 0x00000000 NULL 0x0
ELF-MIPS-EXE: ]

View File

@ -693,6 +693,8 @@ static const char *getTypeString(uint64_t Type) {
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);
default: return "unknown";
}
}
@ -731,6 +733,8 @@ static void printValue(const ELFFile<ELFT> *O, uint64_t Type, uint64_t Value,
case DT_MIPS_FLAGS:
case DT_MIPS_BASE_ADDRESS:
case DT_MIPS_GOTSYM:
case DT_MIPS_RLD_MAP:
case DT_MIPS_PLTGOT:
OS << format("0x%" PRIX64, Value);
break;
case DT_VERNEEDNUM: