From f332bb3bcad242428eb91bd97767ca2c1c10d00f Mon Sep 17 00:00:00 2001 From: grischka Date: Sat, 27 Nov 2010 15:02:57 +0100 Subject: [PATCH] tccpe: typedef unsigned int DWORD for cross compilers. This fixes the i386-win32-tcc cross-compiler on x86-64 linux platform. I verified that it produces identical binaries for 'hello_win.exe' and 'tcc.exe' (tcc compiled by itself) compared to the output of the native tcc on windows. --- tccpe.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tccpe.c b/tccpe.c index ff5368f0..6631473c 100644 --- a/tccpe.c +++ b/tccpe.c @@ -62,7 +62,7 @@ void dbg_printf (const char *fmt, ...) typedef unsigned char BYTE; typedef unsigned short WORD; -typedef unsigned long DWORD; +typedef unsigned int DWORD; typedef unsigned long long ULONGLONG; #pragma pack(push, 1) @@ -600,7 +600,7 @@ static int pe_write(struct pe_info *pe) printf("-------------------------------" "\n virt file size section" "\n"); for (i = 0; i < pe->sec_count; ++i) { - unsigned long addr, size; + DWORD addr, size; const char *sh_name; si = pe->sec_info + i; @@ -610,8 +610,8 @@ static int pe_write(struct pe_info *pe) psh = &si->ish; if (2 == pe->s1->verbose) - printf("%6lx %6lx %6lx %s\n", - addr, file_offset, size, sh_name); + printf("%6x %6x %6x %s\n", + (unsigned)addr, (unsigned)file_offset, (unsigned)size, sh_name); switch (si->cls) { case sec_text: @@ -706,7 +706,7 @@ static int pe_write(struct pe_info *pe) if (2 == pe->s1->verbose) printf("-------------------------------\n"); if (pe->s1->verbose) - printf("<- %s (%lu bytes)\n", pe->filename, file_offset); + printf("<- %s (%u bytes)\n", pe->filename, (unsigned)file_offset); return 0; }