[PATCH] bfd/pdb: fix bitmap generation in pdb_write_bitmap

Mark Harmstone mark@harmstone.com
Mon Sep 2 19:19:01 GMT 2024


Thanks Jan. Pedantic because there's not really a reason for checking the
free-space bitmap, if you're opening a file readonly. The validation
function that was failing, MSF_HB::checkInvariants in msdia140.dll, is
behind an #ifdef _DEBUG in the open-source version,[0] which makes me think
that it's not there deliberately.

Mark

[0] https://github.com/Microsoft/microsoft-pdb/blob/master/PDB/msf/msf.cpp#L1385

On 02/09/2024 08:46, Jan Beulich wrote:
> On 01.09.2024 18:47, Mark Harmstone wrote:
>> MSVC 2022 is more pedantic than MSVC 2019 when it comes to loading PDB
>> files, and was rejecting PDB files generated by binutils because of
>> their invalid free-space bitmaps. This patch fixes pdb_write_bitmap so
>> we generate files that MSVC will accept.
>>
>> Specifically there were three things we were doing wrong:
>>
>> - We weren't including the superblock (block 0)
>>
>> - We were setting bits in bytes backwards (MSB to LSB, rather than LSB to MSB)
> 
> This doesn't look to be merely a matter of being pedantic. Any explanation
> of how things ended up appearing to work, despite this inversion? (Patch
> generally looks okay, yet I'd like to understand this aspect, which may
> call for a change to the description.)
> 
> Jan



More information about the Binutils mailing list