binutils Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ld/pdb

ld/pdb: Terminate the string list in S_ENVBLOCK

Ensures S_ENVBLOCK symbols in PDB files are correctly null-terminated, preventing read errors.

Symbol information in PDB files, specifically within S_ENVBLOCK records, requires a null-terminated string list. Previously, the linker omitted this terminator. This omission could lead to readers (like llvm-pdbutil) running past the end of the record when the strings happened to align on a 4-byte boundary, causing stream errors. The change adds the necessary null terminator.

In Details

The S_ENVBLOCK symbol type in PDB files expects its list of environment strings to be terminated by an empty string. The create_linker_symbols function was omitting this terminator. When the string data naturally aligned on a 4-byte boundary without needing explicit padding, readers that expect the terminator would incorrectly parse beyond the end of the record. This fix adds a null byte after the last string to signify the end of the list.

For Context
S_ENVBLOCK
A type of linker symbol in PDB files that represents environment variables used during the build process.
llvm-pdbutil
A command-line utility from the LLVM project used for inspecting and manipulating PDB files.
4-byte boundary
A memory address that is an exact multiple of 4. Data structures are often aligned to these boundaries for performance reasons on many architectures.
Filed Under: ldpdbbugfixinteroperability