Increase PDB block size to 4096 bytes
Binutils PDB writer now uses 4096-byte blocks, supporting larger PDB files up to 4GB.
The PDB stream directory’s block map was limited to 256 block numbers with a 1024-byte block size, restricting PDB files to about 64MB. This change increases the block size to 4096 bytes, matching MSVC’s standard and raising the PDB file size limit to approximately 4GB. Larger files were previously truncated and rejected by tools like llvm-pdbutil.
In Details
The bfd/pdb module handles writing PDB (Program Database) files, which store debugging information. The commit modifies the pdb_write_contents function in bfd/pdb.c to increase the block_size from 1024 to 4096 bytes. This directly impacts the maximum PDB file size, as the stream directory's block map resides within a single block. The previous limit of ~64MB was insufficient for larger debugging symbol sets.
- PDB
- Program Database files store debugging and project-specific information. Binutils uses the BFD library to read and write PDB files, enabling debuggers and other tools to understand program structure and symbols.
- BFD
- The Binary File Descriptor library is a low-level interface for reading and writing various binary file formats, including executable and object files. It provides a common API for tools like binutils and GDB.
- Stream directory
- Within a PDB file, a stream directory manages access to different data streams. This commit specifically addresses the size limitation of the block map within this directory.
- Block size
- The fundamental unit of data allocation and transfer within a file format. Increasing the block size in PDB files allows for larger overall file sizes and potentially more efficient storage for large amounts of debugging data.