[PATCH] D103297: [LLD][COFF] Reduce the maximum size of the GHASH table
Alexandre Ganea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 27 18:56:59 PDT 2021
aganea created this revision.
aganea added reviewers: rnk, akhuang.
aganea requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Before this patch, the maximum size of the GHASH table was `2^31` buckets. However we were storing the bucket index into a `TypeIndex` which has an input limit of `(2^31)-4095` indices, see this link <https://github.com/llvm/llvm-project/blob/d480f968ad8b56d3ee4a6b6df5532d485b0ad01e/llvm/include/llvm/DebugInfo/CodeView/TypeIndex.h#L123>. Any value above that limit will improperly set the `TypeIndex`'s high bit, which is interpreted as `DecoratedItemIdMask`. This used to cause bad indices on extraction when calling `TypeIndex::toArrayIndex()`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D103297
Files:
lld/COFF/DebugTypes.cpp
Index: lld/COFF/DebugTypes.cpp
===================================================================
--- lld/COFF/DebugTypes.cpp
+++ 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<uint32_t>(tableSize));
// Insert ghashes in parallel. During concurrent insertion, we cannot observe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103297.348427.patch
Type: text/x-patch
Size: 626 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210528/872a5b70/attachment.bin>
More information about the llvm-commits
mailing list