diff --git a/lld/COFF/DebugTypes.cpp b/lld/COFF/DebugTypes.cpp --- a/lld/COFF/DebugTypes.cpp +++ b/lld/COFF/DebugTypes.cpp @@ -34,6 +34,10 @@ using namespace lld; using namespace lld::coff; +static codeview::GUID InvalidGuid{{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF}}; + namespace { class TypeServerIpiSource; @@ -55,9 +59,20 @@ if (!expectedInfo) return; Guid = expectedInfo->getGuid(); - auto it = ctx.typeServerSourceMappings.emplace(Guid, this); - assert(it.second); - (void)it; + // Don't store the PDB in the map here if the Guid just contains + // 0xFF since that will lead to many collisions. This happens with + // certain Visual Studio versions where the standard library contains + // PDB files with broken/invalid Guids. This will just lead to + // a path lookup fallback which works fine - but is slower. + if (Guid != InvalidGuid) { + auto it = ctx.typeServerSourceMappings.emplace(Guid, this); + if (!it.second) { + TypeServerSource *tSrc = (TypeServerSource *)it.first->second; + warn("GUID collision between " + file.getFilePath() + " and " + + tSrc->pdbInputFile->session->getPDBFile().getFilePath()); + } + (void)it; + } } Error mergeDebugT(TypeMerger *m) override;