Skip to content

Commit 54f5a4e

Browse files
baszalmstramstorsjo
authored andcommitted
[LLD][COFF] Reset outputSections for successive runs
The global variable outputSections in the COFF writer was not cleared between runs which caused successive calls to lld::coff::link to generate invalid binaries. These binaries when loaded would result in "invalid win32 applications" and/or "bad image" errors. Differential Revision: https://reviews.llvm.org/D86401
1 parent 207d449 commit 54f5a4e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lld/COFF/Writer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,9 @@ void Writer::finalizeAddresses() {
601601
void Writer::run() {
602602
ScopedTimer t1(codeLayoutTimer);
603603

604+
// First, clear the output sections from previous runs
605+
outputSections.clear();
606+
604607
createImportTables();
605608
createSections();
606609
createMiscChunks();

0 commit comments

Comments
 (0)