diff --git a/lld/COFF/DebugTypes.cpp b/lld/COFF/DebugTypes.cpp --- a/lld/COFF/DebugTypes.cpp +++ b/lld/COFF/DebugTypes.cpp @@ -233,6 +233,7 @@ // debug info will simply be missing from the final PDB - that is the default // accepted behavior. void loadTypeServerSource(llvm::MemoryBufferRef m) { + TypeServerSource::instances.clear(); std::string path = normalizePdbPath(m.getBufferIdentifier()); Expected ts = TypeServerSource::getInstance(m); diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp --- a/lld/COFF/Writer.cpp +++ b/lld/COFF/Writer.cpp @@ -586,6 +586,7 @@ // The main function of the writer. void Writer::run() { + outputSections.clear(); ScopedTimer t1(codeLayoutTimer); createImportTables();