Skip to content

Commit

Permalink
[llvm-readobj] Fix output of MIPS GOT without local and global entries.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212374 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
atanasyan committed Jul 5, 2014
1 parent db8cb22 commit ad720cf
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
Binary file not shown.
25 changes: 25 additions & 0 deletions test/tools/llvm-readobj/mips-got.test
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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: }
2 changes: 1 addition & 1 deletion tools/llvm-readobj/ELFDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit ad720cf

Please sign in to comment.