binutils Newspaper
OCTOBER 6, 2026
ld — Proposed

ld: Align PDB DBI source-info substream

Patch aligns the PDB DBI source-info substream to 4-byte boundaries and adds a test case.

Oleg Tolmatcev proposes a patch for the GNU linker (ld) that ensures the PDB (Program Database) Debug Information (DBI) source-info substream is properly aligned to 4-byte boundaries. This involves rounding up the substream size and zeroing out any padding. A corresponding test case is also added to verify this behavior.

In the Thread 1 participant
  1. Oleg Tolmatcev <oleg.tolmatcev@gmail.com> proposer

    Submits a patch to align the PDB DBI source-info substream and extends the test suite.

    “Round the source-info substream size up to four bytes and zero the padding. Extend the test to exercise this case.”

In Details

This patch addresses alignment requirements for the Program Database (PDB) file format generated by the GNU linker (ld), specifically within the Debug Information (DBI) stream. The create_source_info_substream function in ld/pdb.c is modified to ensure that the substream size is a multiple of four bytes, a common alignment requirement for structured data in PDB files. Padding bytes are zeroed to maintain data integrity. A new test case in ld/testsuite/ld-pe/pdb3b.s is introduced to specifically trigger and verify this alignment behavior.

For Context
PDB
Program Database. A file format used by Microsoft for storing debugging information about a program. GNU linker can generate PDB files for Windows executables.
DBI
Debug Information. Data embedded within an executable or accompanying file that allows debuggers to map machine code back to source code elements.
Substream
A distinct part or section within a larger data structure. In the context of PDBs, different types of debug information are organized into substreams.
Alignment
The practice of arranging data in memory or in files at addresses that are multiples of a specific number (e.g., 4-byte alignment means data starts at an address divisible by 4). Proper alignment can improve performance and is sometimes required by hardware or file format specifications.
ld
The GNU linker, responsible for combining object files and libraries into an executable or shared library.
Filed Under: binutilslinkerPDBdebuggingpatch