[lld] r338042 - [COFF] clean up global resources after completion

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 26 10:11:24 PDT 2018


Author: ruiu
Date: Thu Jul 26 10:11:24 2018
New Revision: 338042

URL: http://llvm.org/viewvc/llvm-project?rev=338042&view=rev
Log:
[COFF] clean up global resources after completion

Patch by Andrew Kelley.

Previously, running lld::coff::link() twice in the same process would
access stale pointers because of these global variables not being reset.
After this patch, lld::coff::link() can be called any number of times,
just like its ELF and MACH-O counterparts.

Differential Revision: https://reviews.llvm.org/D49856

Modified:
    lld/trunk/COFF/Driver.cpp

Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=338042&r1=338041&r2=338042&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Thu Jul 26 10:11:24 2018
@@ -75,6 +75,9 @@ bool link(ArrayRef<const char *> Args, b
     exitLld(errorCount() ? 1 : 0);
 
   freeArena();
+  ObjFile::Instances.clear();
+  ImportFile::Instances.clear();
+  BitcodeFile::Instances.clear();
   return !errorCount();
 }
 




More information about the llvm-commits mailing list