Skip to content

Commit 279621f

Browse files
committedJul 26, 2018
[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
1 parent cb6a933 commit 279621f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed
 

‎lld/COFF/Driver.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ bool link(ArrayRef<const char *> Args, bool CanExitEarly, raw_ostream &Diag) {
7575
exitLld(errorCount() ? 1 : 0);
7676

7777
freeArena();
78+
ObjFile::Instances.clear();
79+
ImportFile::Instances.clear();
80+
BitcodeFile::Instances.clear();
7881
return !errorCount();
7982
}
8083

0 commit comments

Comments
 (0)
Please sign in to comment.