[llvm] [pdb] Provide a better error message when overflowing the public/global symbol record stream (PR #140884)

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Thu May 22 06:41:02 PDT 2025


================
@@ -319,7 +320,14 @@ Error GSIStreamBuilder::finalizeMsfLayout() {
     return Idx.takeError();
   PublicsStreamIndex = *Idx;
 
-  uint32_t RecordBytes = PSH->RecordByteSize + GSH->RecordByteSize;
+  uint64_t RecordBytes = PSH->RecordByteSize + GSH->RecordByteSize;
+  if (RecordBytes > UINT32_MAX)
+    return make_error<StringError>(
+        formatv("the public ({0} bytes) and global ({1} bytes) "
+                "symbols are too large to fit in a PDB file; "
+                "the maximum total is {2} bytes.",
----------------
nico wrote:

nit: "The public and global symbols are too large" can be read as if this is about two symbols, the public symbol and the global symbol. Maybe just "The public symbols and global symbols"? "The public and global symbol tables?" (I think that suggestion, while not being ambiguous, is incorrect, but I'm not sure. If it is, we obviously shouldn't use it :P)

Sorry for the bikeshed; feel free to ignore if you're happy with this as-is.

https://github.com/llvm/llvm-project/pull/140884


More information about the llvm-commits mailing list