Still some more tabs to be taken care of. arm-gen.c and tcccoff.c have so many style issues that I'm just going to throw clang-format at them.
Showing the changes to tccpe.c (1 of 10 files). Show all
Unified · Split
| @@ -398,22 +398,22 @@ static int pe_find_import(TCCState * s1, ElfW(Sym) *sym) · 397 unmodified lines | |||
| 398 | s = pe_export_name(s1, sym); | 398 | s = pe_export_name(s1, sym); |
| 399 | if (n) { | 399 | if (n) { |
| 400 | /* second try: */ | 400 | /* second try: */ |
| 401 | if (sym->st_other & ST_PE_STDCALL) { | 401 | if (sym->st_other & ST_PE_STDCALL) { |
| 402 | /* try w/0 stdcall deco (windows API convention) */ | 402 | /* try w/0 stdcall deco (windows API convention) */ |
| 403 | p = strrchr(s, '@'); | 403 | p = strrchr(s, '@'); |
| 404 | if (!p || s[0] != '_') | 404 | if (!p || s[0] != '_') |
| 405 | break; | 405 | break; |
| 406 | strcpy(buffer, s+1)[p-s-1] = 0; | 406 | strcpy(buffer, s+1)[p-s-1] = 0; |
| 407 | } else if (s[0] != '_') { /* try non-ansi function */ | 407 | } else if (s[0] != '_') { /* try non-ansi function */ |
| 408 | buffer[0] = '_', strcpy(buffer + 1, s); | 408 | buffer[0] = '_', strcpy(buffer + 1, s); |
| 409 | } else if (0 == memcmp(s, "__imp__", 7)) { /* mingw 2.0 */ | 409 | } else if (0 == memcmp(s, "__imp__", 7)) { /* mingw 2.0 */ |
| 410 | strcpy(buffer, s + 6); | 410 | strcpy(buffer, s + 6); |
| 411 | } else if (0 == memcmp(s, "_imp___", 7)) { /* mingw 3.7 */ | 411 | } else if (0 == memcmp(s, "_imp___", 7)) { /* mingw 3.7 */ |
| 412 | strcpy(buffer, s + 6); | 412 | strcpy(buffer, s + 6); |
| 413 | } else { | 413 | } else { |
| 414 | break; | 414 | break; |
| 415 | } | 415 | } |
| 416 | s = buffer; | 416 | s = buffer; |
| 417 | } | 417 | } |
| 418 | sym_index = find_elf_sym(s1->dynsymtab_section, s); | 418 | sym_index = find_elf_sym(s1->dynsymtab_section, s); |
| 419 | // printf("find (%d) %d %s\n", n, sym_index, s); | 419 | // printf("find (%d) %d %s\n", n, sym_index, s); |
| @@ -565,9 +565,9 @@ static int pe_write(struct pe_info *pe) · 145 unmodified lines | |||
| 565 | #endif | 565 | #endif |
| 566 | /* NT additional fields. */ | 566 | /* NT additional fields. */ |
| 567 | #if defined(TCC_TARGET_ARM) | 567 | #if defined(TCC_TARGET_ARM) |
| 568 | 0x00100000, /*DWORD ImageBase; */ | 568 | 0x00100000, /*DWORD ImageBase; */ |
| 569 | #else | 569 | #else |
| 570 | 0x00400000, /*DWORD ImageBase; */ | 570 | 0x00400000, /*DWORD ImageBase; */ |
| 571 | #endif | 571 | #endif |
| 572 | 0x00001000, /*DWORD SectionAlignment; */ | 572 | 0x00001000, /*DWORD SectionAlignment; */ |
| 573 | 0x00000200, /*DWORD FileAlignment; */ | 573 | 0x00000200, /*DWORD FileAlignment; */ |
| @@ -1841,13 +1841,13 @@ ST_FUNC int pe_output_file(TCCState * s1, const char *filename) · 1267 unmodified lines | |||
| 1841 | pe.subsystem = s1->pe_subsystem; | 1841 | pe.subsystem = s1->pe_subsystem; |
| 1842 | 1842 | ||
| 1843 | /* set default file/section alignment */ | 1843 | /* set default file/section alignment */ |
| 1844 | if (pe.subsystem == 1) { | 1844 | if (pe.subsystem == 1) { |
| 1845 | pe.section_align = 0x20; | 1845 | pe.section_align = 0x20; |
| 1846 | pe.file_align = 0x20; | 1846 | pe.file_align = 0x20; |
| 1847 | } else { | 1847 | } else { |
| 1848 | pe.section_align = 0x1000; | 1848 | pe.section_align = 0x1000; |
| 1849 | pe.file_align = 0x200; | 1849 | pe.file_align = 0x200; |
| 1850 | } | 1850 | } |
| 1851 | 1851 | ||
| 1852 | if (s1->section_align != 0) | 1852 | if (s1->section_align != 0) |
| 1853 | pe.section_align = s1->section_align; | 1853 | pe.section_align = s1->section_align; |