From: Rui Ueyama Date: Thu, 26 Jul 2018 17:11:24 +0000 (+0000) Subject: [COFF] clean up global resources after completion X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=279621fbf0ab3758784bf79139711ae3424f69ec;p=platform%2Fupstream%2Fllvm.git [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 llvm-svn: 338042 --- diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index 2f7afaa..eefdb48 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -75,6 +75,9 @@ bool link(ArrayRef Args, bool CanExitEarly, raw_ostream &Diag) { exitLld(errorCount() ? 1 : 0); freeArena(); + ObjFile::Instances.clear(); + ImportFile::Instances.clear(); + BitcodeFile::Instances.clear(); return !errorCount(); }