[PATCH v4 1/2] bfd: fill in PE load config directory entry.

LIU Hao lh_mouse@126.com
Wed Apr 2 08:27:30 GMT 2025


在 2025-4-2 15:57, Jan Beulich 写道:
> "While the Microsoft PE format documentation says that, for compatibility with
>   Windows XP and earlier, the size must be 64 for x86 images, we don't check or
>   enforce this here."

Oh please don't do that. mingw-w64 will provide a load config directory in libmingwex, so it will be 
horrible breakage if anyone wants to build programs for XP: They will have to clear loadcfg.S and rebuild 
mingw-w64.

The `Subsystem`, `MajorSubsystemVersion` and `MinorSubsystemVersion` fields are filled in 
`_bfd_XXi_swap_aouthdr_in()`, and it's possible to retrieve them from the output BFD. As mentioned 
earlier, if `f_magic` contains `IMAGE_FILE_MACHINE_I386` and `Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI || 
Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI` and `MajorSubsystemVersion * 256 + MinorSubsystemVersionthen <= 
0x0501` then it has to be a special case.


-- 
Best regards,
LIU Hao
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://sourceware.org/pipermail/binutils/attachments/20250402/d9c42749/attachment-0001.sig>


More information about the Binutils mailing list