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.
Unified · Split
| @@ -62,7 +62,7 @@ void dbg_printf (const char *fmt, ...) · 61 unmodified lines | |||
| 62 | 62 | ||
| 63 | typedef unsigned char BYTE; | 63 | typedef unsigned char BYTE; |
| 64 | typedef unsigned short WORD; | 64 | typedef unsigned short WORD; |
| 65 | typedef unsigned long DWORD; | 65 | typedef unsigned int DWORD; |
| 66 | typedef unsigned long long ULONGLONG; | 66 | typedef unsigned long long ULONGLONG; |
| 67 | #pragma pack(push, 1) | 67 | #pragma pack(push, 1) |
| 68 | 68 | ||
| @@ -600,7 +600,7 @@ static int pe_write(struct pe_info *pe) · 531 unmodified lines | |||
| 600 | printf("-------------------------------" | 600 | printf("-------------------------------" |
| 601 | "\n virt file size section" "\n"); | 601 | "\n virt file size section" "\n"); |
| 602 | for (i = 0; i < pe->sec_count; ++i) { | 602 | for (i = 0; i < pe->sec_count; ++i) { |
| 603 | unsigned long addr, size; | 603 | DWORD addr, size; |
| 604 | const char *sh_name; | 604 | const char *sh_name; |
| 605 | 605 | ||
| 606 | si = pe->sec_info + i; | 606 | si = pe->sec_info + i; |
| @@ -610,8 +610,8 @@ static int pe_write(struct pe_info *pe) · 3 unmodified lines | |||
| 610 | psh = &si->ish; | 610 | psh = &si->ish; |
| 611 | 611 | ||
| 612 | if (2 == pe->s1->verbose) | 612 | if (2 == pe->s1->verbose) |
| 613 | printf("%6lx %6lx %6lx %s\n", | 613 | printf("%6x %6x %6x %s\n", |
| 614 | addr, file_offset, size, sh_name); | 614 | (unsigned)addr, (unsigned)file_offset, (unsigned)size, sh_name); |
| 615 | 615 | ||
| 616 | switch (si->cls) { | 616 | switch (si->cls) { |
| 617 | case sec_text: | 617 | case sec_text: |
| @@ -706,7 +706,7 @@ static int pe_write(struct pe_info *pe) · 88 unmodified lines | |||
| 706 | if (2 == pe->s1->verbose) | 706 | if (2 == pe->s1->verbose) |
| 707 | printf("-------------------------------\n"); | 707 | printf("-------------------------------\n"); |
| 708 | if (pe->s1->verbose) | 708 | if (pe->s1->verbose) |
| 709 | printf("<- %s (%lu bytes)\n", pe->filename, file_offset); | 709 | printf("<- %s (%u bytes)\n", pe->filename, (unsigned)file_offset); |
| 710 | 710 | ||
| 711 | return 0; | 711 | return 0; |
| 712 | } | 712 | } |