[llvm-readobj] Fix output of MIPS GOT without local and global entries.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212374 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Simon Atanasyan 2014-07-05 19:28:49 +00:00
parent db8cb2223d
commit ad720cfde4
3 changed files with 26 additions and 1 deletions

Binary file not shown.

View File

@ -6,6 +6,8 @@ RUN: llvm-readobj -mips-plt-got %p/Inputs/dynamic-table-so.mips | \
RUN: FileCheck %s -check-prefix GOT-SO
RUN: llvm-readobj -mips-plt-got %p/Inputs/got-tls.so.elf-mips64el | \
RUN: FileCheck %s -check-prefix GOT-TLS
RUN: llvm-readobj -mips-plt-got %p/Inputs/got-empty.exe.mipsel | \
RUN: FileCheck %s -check-prefix GOT-EMPTY
GOT-OBJ: Cannot find PLTGOT dynamic table tag.
@ -304,3 +306,26 @@ GOT-TLS-NEXT: }
GOT-TLS-NEXT: ]
GOT-TLS-NEXT: Number of TLS and multi-GOT entries: 4
GOT-TLS-NEXT: }
GOT-EMPTY: Primary GOT {
GOT-EMPTY-NEXT: Canonical gp value: 0x409FF0
GOT-EMPTY-NEXT: Reserved entries [
GOT-EMPTY-NEXT: Entry {
GOT-EMPTY-NEXT: Address: 0x402000
GOT-EMPTY-NEXT: Access: -32752
GOT-EMPTY-NEXT: Initial: 0x0
GOT-EMPTY-NEXT: Purpose: Lazy resolver
GOT-EMPTY-NEXT: }
GOT-EMPTY-NEXT: Entry {
GOT-EMPTY-NEXT: Address: 0x402004
GOT-EMPTY-NEXT: Access: -32748
GOT-EMPTY-NEXT: Initial: 0x80000000
GOT-EMPTY-NEXT: Purpose: Module pointer (GNU extension)
GOT-EMPTY-NEXT: }
GOT-EMPTY-NEXT: ]
GOT-EMPTY-NEXT: Local entries [
GOT-EMPTY-NEXT: ]
GOT-EMPTY-NEXT: Global entries [
GOT-EMPTY-NEXT: ]
GOT-EMPTY-NEXT: Number of TLS and multi-GOT entries: 2
GOT-EMPTY-NEXT: }

View File

@ -1087,7 +1087,7 @@ void MipsGOTParser<ELFT>::parseGOT(const Elf_Shdr &GOTShdr) {
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;
}