[PATCH] bfd/pdb: Increase the PDB block size to 4096
Mark Harmstone
mark@harmstone.com
Tue Nov 24 21:59:10 GMT 2026
On 24/11/2026 9.49 pm, Oleg Tolmatcev wrote:
> пт, 16 окт. 2026 г. в 15:20, Jan Beulich <jbeulich@suse.com>:
>>
>> On 30.09.2026 21:37, Oleg Tolmatcev wrote:
>>> The block map of the stream directory is itself a single block, so with
>>> 1024 byte blocks it can only hold 256 block numbers, which limits a PDB
>>> file to about 64 MB. Writing a larger one fails partway through and
>>> leaves a truncated file behind, which llvm-pdbutil rejects with "Too
>>> many directory blocks".
>>
>> That sounds pretty limiting, making me wonder why it was done like that.
>> Mark?
>>
>>> 4096 is what MSVC uses, and is the largest block size that both our
>>> reader and LLVM accept. It raises the limit to about 4 GB.
>>
>> The claim on what MSVC uses could do with some reference / proof. And
>> then, while surely many will say disk space is cheap, isn't this a little
>> wasteful for smallish PDBs? I.e. ...
>>
>>> --- a/bfd/pdb.c
>>> +++ b/bfd/pdb.c
>>> @@ -713,7 +713,7 @@ static bool
>>> pdb_write_contents (bfd *abfd)
>>> {
>>> char tmp[sizeof (uint32_t)];
>>> - const uint32_t block_size = 0x400;
>>> + const uint32_t block_size = 0x1000;
>>> uint32_t block_map_addr;
>>> uint32_t num_blocks;
>>> uint32_t num_files = 0;
>>
>> ... may this want to become dynamically determined?
>>
>> Jan
>
> What do I need to do to get this accepted? This is a real problem that
> occurs in practice.
>
> Oleg
Sorry, I think I forgot to reply to this.
The block size I chose was what the version of MSVC I had the time was
doing (2015?), but I think Oleg is right that more recent versions use 4K.
I've no objections to this, particularly if it's causing real-world
problems. Having the block size the same as the most common page size
and sector size is probably also desirable in itself.
Mark
More information about the Binutils
mailing list