[PATCH] PE image checksum

Casper Hornstrup chorns@users.sourceforge.net
Thu Dec 20 08:59:00 GMT 2001


On Wednesday 19 December 2001 23:23, you wrote:
> Have you tried this patch?  It looks to me like you're trying to
> compute the checksum of the file before the file is even written out
> (only the initial header is written at that point).

AFAICS coff_write_object_contents () writes the last of the PE image.
I have built an Windows NT device driver using ld with the this patch 
applied. Objdump -p shows the checksum value of the PE image and I have used 
an utility (found somewhere on the Internet) that tests wether the PE 
checksum is correct to verify the checksum. Windows NT loads the device 
driver when the PE image checksum is there, but not when it is zero.

> EXEC_P means that there's an aoutheader.  Use COFF_IMAGE_WITH_PE to
> conditionalize code for PE executables.

So the patch should be within #ifdef COFF_IMAGE_WITH_PE?

Casper Hornstrup



More information about the Binutils mailing list