summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2014-11-26 22:17:25 +0000
committerRui Ueyama <ruiu@google.com>2014-11-26 22:17:25 +0000
commit98fe58a3a7e209002b8ecfd94f1419973a29028c (patch)
treeb9937cbfd63a5540a46e8b6c16ef60f300f66f81 /llvm/lib/Object
parent0a18fca00749cf06429a6339ece15811478fe056 (diff)
downloadbcm5719-llvm-98fe58a3a7e209002b8ecfd94f1419973a29028c.tar.gz
bcm5719-llvm-98fe58a3a7e209002b8ecfd94f1419973a29028c.zip
Object/COFF: Fix off-by-one error for object having lots of relocations
llvm-objdump printed out an error message for this off-by-one error, but because it always exits with 0 whether or not it found an error, the test (llvm-objdump/coff-many-relocs.test) succeeded. I made llvm-objdump exit with EXIT_FAILURE when an error is found. llvm-svn: 222852
Diffstat (limited to 'llvm/lib/Object')
-rw-r--r--llvm/lib/Object/COFFObjectFile.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp
index 04cd61698c6..92f920da1fa 100644
--- a/llvm/lib/Object/COFFObjectFile.cpp
+++ b/llvm/lib/Object/COFFObjectFile.cpp
@@ -414,7 +414,8 @@ static uint32_t getNumberOfRelocations(const coff_section *Sec,
if (getObject(FirstReloc, M, reinterpret_cast<const coff_relocation*>(
base + Sec->PointerToRelocations)))
return 0;
- return FirstReloc->VirtualAddress;
+ // -1 to exclude this first relocation entry.
+ return FirstReloc->VirtualAddress - 1;
}
return Sec->NumberOfRelocations;
}
OpenPOWER on IntegriCloud