summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Object')
-rw-r--r--llvm/lib/Object/COFFObjectFile.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp
index 1ae8059a021..ed63f3a64e0 100644
--- a/llvm/lib/Object/COFFObjectFile.cpp
+++ b/llvm/lib/Object/COFFObjectFile.cpp
@@ -171,6 +171,14 @@ ErrorOr<uint64_t> COFFObjectFile::getSymbolAddress(DataRefImpl Ref) const {
if (std::error_code EC = getSection(SectionNumber, Section))
return EC;
Result += Section->VirtualAddress;
+
+ // The section VirtualAddress does not include ImageBase, and we want to
+ // return virtual addresses.
+ if (PE32Header)
+ Result += PE32Header->ImageBase;
+ else if (PE32PlusHeader)
+ Result += PE32Header->ImageBase;
+
return Result;
}
OpenPOWER on IntegriCloud