[PATCH] D98788: [lld-link] emit an error when writing a PDB > 4 GiB
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 17 12:15:32 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG605a503f3506: [lld-link] emit an error when writing a PDB > 4 GiB (authored by thakis).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98788/new/
https://reviews.llvm.org/D98788
Files:
llvm/lib/DebugInfo/MSF/MSFBuilder.cpp
Index: llvm/lib/DebugInfo/MSF/MSFBuilder.cpp
===================================================================
--- llvm/lib/DebugInfo/MSF/MSFBuilder.cpp
+++ llvm/lib/DebugInfo/MSF/MSFBuilder.cpp
@@ -341,7 +341,17 @@
Layout = std::move(*L);
- uint64_t FileSize = Layout.SB->BlockSize * Layout.SB->NumBlocks;
+ uint64_t FileSize = uint64_t(Layout.SB->BlockSize) * Layout.SB->NumBlocks;
+ if (FileSize > UINT32_MAX) {
+ // FIXME: Changing the BinaryStream classes to use 64-bit numbers lets
+ // us create PDBs larger than 4 GiB successfully. The file format is
+ // block-based and as long as each stream is small enough, PDBs larger than
+ // 4 GiB might work. Check if tools can handle these large PDBs, and if so
+ // add support for writing them.
+ return make_error<MSFError>(msf_error_code::invalid_format,
+ "Output larger than 4 GiB");
+ }
+
auto OutFileOrError = FileOutputBuffer::create(Path, FileSize);
if (auto EC = OutFileOrError.takeError())
return std::move(EC);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98788.331341.patch
Type: text/x-patch
Size: 1049 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210317/e463d1c6/attachment.bin>
More information about the llvm-commits
mailing list