Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions lld/COFF/Chunks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,12 +422,6 @@ void SectionChunk::writeTo(uint8_t *buf) const {

applyRelocation(buf + rel.VirtualAddress, rel);
}

// Write the offset to EC entry thunk preceding section contents. The low bit
// is always set, so it's effectively an offset from the last byte of the
// offset.
if (Defined *entryThunk = getEntryThunk())
write32le(buf - sizeof(uint32_t), entryThunk->getRVA() - rva + 1);
}

void SectionChunk::applyRelocation(uint8_t *off,
Expand Down
10 changes: 9 additions & 1 deletion lld/COFF/Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2544,7 +2544,15 @@ void Writer::writeSections() {
}

parallelForEach(sec->chunks, [&](Chunk *c) {
c->writeTo(secBuf + c->getRVA() - sec->getRVA());
uint8_t *buf = secBuf + c->getRVA() - sec->getRVA();
c->writeTo(buf);

// Write the offset to EC entry thunk preceding section contents. The low
// bit is always set, so it's effectively an offset from the last byte of
// the offset.
if (Defined *entryThunk = c->getEntryThunk())
write32le(buf - sizeof(uint32_t),
entryThunk->getRVA() - c->getRVA() + 1);
});
}
}
Expand Down