[PATCH] D49856: [COFF] clean up global resources after completion

Andrew Kelley via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 26 08:15:13 PDT 2018


andrewrk created this revision.
andrewrk added a reviewer: ruiu.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D49856

Files:
  lld/COFF/Driver.cpp


Index: lld/COFF/Driver.cpp
===================================================================
--- lld/COFF/Driver.cpp
+++ lld/COFF/Driver.cpp
@@ -72,6 +72,9 @@
     exitLld(errorCount() ? 1 : 0);
 
   freeArena();
+  ObjFile::Instances.clear();
+  ImportFile::Instances.clear();
+  BitcodeFile::Instances.clear();
   return !errorCount();
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49856.157488.patch
Type: text/x-patch
Size: 345 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180726/0b88769f/attachment.bin>


More information about the llvm-commits mailing list