diff --git a/lld/COFF/DebugTypes.cpp b/lld/COFF/DebugTypes.cpp --- a/lld/COFF/DebugTypes.cpp +++ b/lld/COFF/DebugTypes.cpp @@ -1069,7 +1069,8 @@ // Cap the table size so that we can use 32-bit cell indices. Type indices are // also 32-bit, so this is an inherent PDB file format limit anyway. - tableSize = std::min(size_t(INT32_MAX), tableSize); + tableSize = + std::min(size_t(INT32_MAX) - TypeIndex::FirstNonSimpleIndex, tableSize); ghashState.table.init(static_cast(tableSize)); // Insert ghashes in parallel. During concurrent insertion, we cannot observe