summaryrefslogtreecommitdiffstats
path: root/lld/COFF/Chunks.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/COFF/Chunks.cpp')
-rw-r--r--lld/COFF/Chunks.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/lld/COFF/Chunks.cpp b/lld/COFF/Chunks.cpp
index 7a068eebf10..bd7b1aebbf3 100644
--- a/lld/COFF/Chunks.cpp
+++ b/lld/COFF/Chunks.cpp
@@ -58,7 +58,8 @@ void SectionChunk::writeTo(uint8_t *Buf) {
// Apply relocations.
for (const coff_relocation &Rel : Relocs) {
uint8_t *Off = Buf + FileOff + Rel.VirtualAddress;
- SymbolBody *Body = File->getSymbolBody(Rel.SymbolTableIndex);
+ SymbolBody *Body =
+ File->getSymbolBody(Rel.SymbolTableIndex)->getReplacement();
uint64_t S = cast<Defined>(Body)->getRVA();
uint64_t P = RVA + Rel.VirtualAddress;
switch (Rel.Type) {
@@ -85,7 +86,7 @@ void SectionChunk::mark() {
// Mark all symbols listed in the relocation table for this section.
for (const coff_relocation &Rel : Relocs) {
- SymbolBody *B = File->getSymbolBody(Rel.SymbolTableIndex);
+ SymbolBody *B = File->getSymbolBody(Rel.SymbolTableIndex)->getReplacement();
if (auto *D = dyn_cast<DefinedRegular>(B))
D->markLive();
}
@@ -114,7 +115,8 @@ void SectionChunk::getBaserels(std::vector<uint32_t> *Res, Defined *ImageBase) {
// address never changes even if image is relocated.
if (Rel.Type != IMAGE_REL_AMD64_ADDR64)
continue;
- SymbolBody *Body = File->getSymbolBody(Rel.SymbolTableIndex);
+ SymbolBody *Body =
+ File->getSymbolBody(Rel.SymbolTableIndex)->getReplacement();
if (Body == ImageBase)
continue;
Res->push_back(RVA + Rel.VirtualAddress);
@@ -186,8 +188,9 @@ bool SectionChunk::equals(const SectionChunk *X) const {
return false;
if (R1.VirtualAddress != R2.VirtualAddress)
return false;
- SymbolBody *B1 = File->getSymbolBody(R1.SymbolTableIndex);
- SymbolBody *B2 = X->File->getSymbolBody(R2.SymbolTableIndex);
+ SymbolBody *B1 = File->getSymbolBody(R1.SymbolTableIndex)->getReplacement();
+ SymbolBody *B2 =
+ X->File->getSymbolBody(R2.SymbolTableIndex)->getReplacement();
if (B1 == B2)
return true;
auto *D1 = dyn_cast<DefinedRegular>(B1);
OpenPOWER on IntegriCloud