ld: Align the PDB DBI source-info substream
Align PDB DBI source-info substream to 4 bytes and fix integer type in alignment calculation.
Jan Beulich requests a reference for the 4-byte alignment requirement of PDB DBI substreams and suggests code refinements. The proposed changes aim to align the source-info substream and correct the integer type used in the alignment calculation, ensuring proper formatting for debugging information.
- proposer
Requests a reference for the 4-byte alignment requirement and suggests omitting a blank line and correcting the integer type in the alignment calculation.
“Please can you add a reference here to where this is specified? Please omit the blank line between the comment and the new statement. (Ftoad the other blank line you add should indeed stay.) Oh, and: The ~3u wants to be just ~3, to be correct regardless of the type "size" points to.”
- contributor
Submitted a patch to round the source-info substream size up to four bytes and zero the padding, extending the test.
“Round the source-info substream size up to four bytes and zero the padding. Extend the test to exercise this case.”
Technical Tradeoffs
- Ensures proper formatting of PDB debug information.
- Requires adding a reference to specification for the alignment rule.
In Details
This change modifies ld/pdb.c to ensure that the source-info substream within PDB (Program Database) files is 4-byte aligned. This is a common requirement for structured debugging information formats to maintain consistency and facilitate parsing by debuggers.
- PDB
- Program Database file format, used by Microsoft Windows for storing debugging and type information for executable files.
- DBI
- Debug Support Information, a component of the PDB format.
- substream
- A distinct section or chunk of data within a larger file format, such as PDB.
- ld
- The GNU linker, responsible for combining object files and libraries into an executable or library.