[PATCH v5 3/3] bfd: add load config size workaround for i386 XP and earlier.

LIU Hao lh_mouse@126.com
Thu Apr 3 04:03:02 GMT 2025


在 2025-4-3 06:56, Jeremy Drake 写道:
> Per the Microsoft PE documentation, XP and earlier on i686 require the
> Size field to be 64, rather than the actual size as required on other
> architectures.  I have confirmed Windows 11 accepts either 64 or the
> actual size for i386 images, but only the actual size for x86_64 images.
> 
> Signed-off-by: Jeremy Drake <sourceware-bugzilla@jdrake.com>
> ---
> I decided to go ahead and send v5 of the patch series.  I figure you can
> take or leave patch 3, depending on how convincing LIU Hao's argument for
> supporting XP is.
> 
>   bfd/peXXigen.c | 26 +++++++++++++++++---------
>   1 file changed, 17 insertions(+), 9 deletions(-)
> 

These changes look good to me.

```
MINGW32 ~/Desktop
$ gcc hello.c -Wl,--subsystem,windows:5.1 -Wl,--undefined,__load_config_used \
 > && objdump -p a.exe | grep -Fi "load configuration directory"
Entry a 000042ec 00000040 Load Configuration Directory

MINGW32 ~/Desktop
$ gcc hello.c -Wl,--subsystem,windows:5.2 -Wl,--undefined,__load_config_used \
 > && objdump -p a.exe | grep -Fi "load configuration directory"
Entry a 000042ec 000000bc Load Configuration Directory

MINGW64 ~/Desktop
$ gcc hello.c -Wl,--subsystem,windows:5.1 -Wl,--undefined,_load_config_used \
 > && objdump -p a.exe | grep -Fi "load configuration directory"
Entry a 0000000000004348 00000138 Load Configuration Directory

MINGW64 ~/Desktop
$ gcc hello.c -Wl,--subsystem,windows:5.2 -Wl,--undefined,_load_config_used \
 > && objdump -p a.exe | grep -Fi "load configuration directory"
Entry a 0000000000004348 00000138 Load Configuration Directory
```




-- 
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/20250403/05b848a3/attachment.sig>


More information about the Binutils mailing list