summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2015-02-19 04:22:27 +0000
committerRui Ueyama <ruiu@google.com>2015-02-19 04:22:27 +0000
commit3966c6153693ed9c0acea78318b1a91bbe4220bf (patch)
tree18fc982c434288b7e08bf17509facb6c04d500b6 /lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
parent07236733bef823361cea231406d4a3f31a5bfb6b (diff)
downloadbcm5719-llvm-3966c6153693ed9c0acea78318b1a91bbe4220bf.tar.gz
bcm5719-llvm-3966c6153693ed9c0acea78318b1a91bbe4220bf.zip
PECOFF: Fix base relocation for an absolute symbol.
Previously we wrongly emitted a base relocation entry for an absolute symbol. That made the loader to rewrite some instruction operands with wrong values only when a DLL is not loaded at the default address. That caused a misterious crash of some executable. Absolute symbols will of course never change value wherever the binary is loaded to memory. We shouldn't emit base relocations for absolute symbols. llvm-svn: 229816
Diffstat (limited to 'lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp')
-rw-r--r--lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
index c85482032bd..8dcfcc142a9 100644
--- a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
@@ -784,6 +784,8 @@ void AtomChunk::addBaseRelocations(BaseRelocationList &relocSites) const {
for (const Reference *ref : *atom) {
if (ref->kindNamespace() != Reference::KindNamespace::COFF)
continue;
+ if (isa<AbsoluteAtom>(ref->target()))
+ continue;
uint64_t address = layout->_virtualAddr + ref->offsetInAtom();
switch (_machineType) {
OpenPOWER on IntegriCloud