--- Comment #3 from Florin Saftoiu <> ---
Hi Nick,

Thanks for your reply.

You're right about the entry point, it is correct. But Windows still wouldn't
run my program so I took another look at the file.

The problem is in fact with the SizeOfImage and SizeOfHeaders fields.
If I call the data section .rdata, then I get a SizeOfImage of 0x4000 and a
SizeOfHeaders of 0x200 which is correct.
But if I call the data section .data, then I get a SizeOfImage of 0x3000 and a
SizeOfHeaders of 0x400.

Microsoft says
that SizeOfImage should be "The size (in bytes) of the image, including all
headers, as the image is loaded in memory. It must be a multiple of
SectionAlignment." and SizeOfHeaders should be "The combined size of an MS-DOS
stub, PE header, and section headers rounded up to a multiple of

It seems that ld considers the empty 512 bytes, from the discarded .rdata
section, as part of the header. I've no hypothesis about why the SizeOfImage is
messed up.

Hope this helps.

Best regards,

You are receiving this mail because:
You are on the CC list for the bug.
bug-binutils mailing list

Reply via email to