summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2014-01-31 04:49:13 +0000
committerRui Ueyama <ruiu@google.com>2014-01-31 04:49:13 +0000
commitea7e9306c15ff0ae702544d06339cc986eeee490 (patch)
treeb265e06bd3c49b591a0ca81689403914a83f1c92 /lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
parent286d1b929d6e1c868f38cbe590ee30b3b7bd5d88 (diff)
downloadbcm5719-llvm-ea7e9306c15ff0ae702544d06339cc986eeee490.tar.gz
bcm5719-llvm-ea7e9306c15ff0ae702544d06339cc986eeee490.zip
[PECOFF] Default image base address for PE32+ is 0x140000000, not 0x400000.
llvm-svn: 200511
Diffstat (limited to 'lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp')
-rw-r--r--lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp b/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
index 9c929db6d3b..067fd5ccd24 100644
--- a/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
@@ -48,9 +48,9 @@ bool PECOFFLinkingContext::validateImpl(raw_ostream &diagnostics) {
}
// It's an error if the base address is not multiple of 64K.
- if (_baseAddress & 0xffff) {
+ if (getBaseAddress() & 0xffff) {
diagnostics << "Base address have to be multiple of 64K, but got "
- << _baseAddress << "\n";
+ << getBaseAddress() << "\n";
return false;
}
@@ -201,8 +201,13 @@ StringRef PECOFFLinkingContext::undecorateSymbol(StringRef name) const {
return name.substr(1);
}
-Writer &PECOFFLinkingContext::writer() const { return *_writer; }
+uint64_t PECOFFLinkingContext::getBaseAddress() const {
+ if (_baseAddress == invalidBaseAddress)
+ return is64Bit() ? 0x140000000UL : 0x400000UL;
+ return _baseAddress;
+}
+Writer &PECOFFLinkingContext::writer() const { return *_writer; }
void PECOFFLinkingContext::setSectionSetMask(StringRef sectionName,
uint32_t newFlags) {
OpenPOWER on IntegriCloud