[PATCH] D86401: [LLD][COFF] Reset outputSections for successive runs
    Bas Zalmstra via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Sat Aug 22 09:59:45 PDT 2020
    
    
  
baszalmstra created this revision.
baszalmstra added reviewers: rnk, ruiu.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
baszalmstra requested review of this revision.
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.
Repository:
  rG LLVM Github Monorepo
https://reviews.llvm.org/D86401
Files:
  lld/COFF/Writer.cpp
Index: lld/COFF/Writer.cpp
===================================================================
--- lld/COFF/Writer.cpp
+++ lld/COFF/Writer.cpp
@@ -601,6 +601,9 @@
 void Writer::run() {
   ScopedTimer t1(codeLayoutTimer);
+  // First, clear the output sections from previous runs
+  outputSections.clear();
+
   createImportTables();
   createSections();
   createMiscChunks();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86401.287198.patch
Type: text/x-patch
Size: 378 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200822/6dc0421c/attachment.bin>
    
    
More information about the llvm-commits
mailing list