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

Jan Beulich jbeulich@suse.com
Tue Sep 3 06:07:31 GMT 2024


On 02.09.2024 21:19, Mark Harmstone wrote:
> 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.

Oh, so you're talking of just read-only accesses. I was thinking of MS tools
further modifying such a .pdb. I'd appreciate if you reworded the description
to at least make clear that (perhaps) it is simply unknown what would have
happened if such a .pdb was further modified. Okay to put in then.

Jan

> [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