bfd/pdb: Increase the PDB block size to 4096

Message ID 20260930193657.733-12-oleg.tolmatcev@gmail.com
State New
Headers
Series bfd/pdb: Increase the PDB block size to 4096 |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed

Commit Message

Oleg Tolmatcev Sept. 30, 2026, 7:37 p.m. UTC
  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".

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.

bfd/
	* pdb.c (pdb_write_contents): Use a block size of 4096.
---
 bfd/pdb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/bfd/pdb.c b/bfd/pdb.c
index 78f64c5b175..6c32a7c87f7 100644
--- 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;