from: https://github.com/bold84/tinycc Author: Benjamin Oldenburg <benjamin.oldenburg@ordis.co.th> 2026-04-04 16:29:28 Committer: Benjamin Oldenburg <benjamin.oldenburg@ordis.co.th> 2026-04-04 16:29:28 Branch: win_arm64_clean Commit: 8b5ab1bb0141e66887bfbc4051688a3e478701a2 Also here: https://repo.or.cz/tinycc.git/shortlog/refs/mob/mob_bold84/win_arm64_clean This and the followup commits on mob is selected parts of that original branch. So it is not everything. It is not, for example: - unrelated whitespace changes in many files - a "pin msvcrt.dll" feature in tccpe.c (why that) - a native getenv() replacement in tcc.c (why that) - larger changes to the win32/lib runtime and tccrun.c (not needed) - a very gcc specific detail for struct alignent in tccgen.c - a custom set/longjmp implementation/replacement (not needed) - lots of rather basic test files in the win32 folder - a 'tests/asm' folder with some files (one file renamed to 140_test...c) - a .docs folder with one file
Unified · Split
| @@ -33,7 +33,7 @@ ifdef CONFIG_WIN32 · 32 unmodified lines | ||
| 33 | 33 | ifneq ($(CONFIG_debug),yes) |
| 34 | 34 | LDFLAGS += -s |
| 35 | 35 | endif |
| 36 | − NATIVE_TARGET = $(ARCH)-win$(if $(findstring arm,$(ARCH)),ce,32) | |
| 36 | + NATIVE_TARGET = $(if $(findstring arm64,$(ARCH)),arm64-win32,$(ARCH)-win$(if $(findstring arm,$(ARCH)),ce,32)) | |
| 37 | 37 | else |
| 38 | 38 | CFG = -unx |
| 39 | 39 | LIBS+=-lm |
| @@ -113,6 +113,7 @@ DEF-arm64-osx = $(DEF-arm64) -DTCC_TARGET_MACHO · 73 unmodified lines | ||
| 113 | 113 | DEF-arm64-FreeBSD = $(DEF-arm64) -DTARGETOS_FreeBSD |
| 114 | 114 | DEF-arm64-NetBSD = $(DEF-arm64) -DTARGETOS_NetBSD |
| 115 | 115 | DEF-arm64-OpenBSD = $(DEF-arm64) -DTARGETOS_OpenBSD |
| 116 | +DEF-arm64-win32 = $(DEF-arm64) -DTCC_TARGET_PE | |
| 116 | 117 | DEF-riscv64 = -DTCC_TARGET_RISCV64 |
| 117 | 118 | DEF-c67 = -DTCC_TARGET_C67 -w # disable warnigs |
| 118 | 119 | DEF-x86_64-FreeBSD = $(DEF-x86_64) -DTARGETOS_FreeBSD |
| @@ -130,7 +131,7 @@ TCCDOCS = tcc.1 tcc-doc.html tcc-doc.info · 11 unmodified lines | ||
| 130 | 131 | all: $(PROGS) $(TCCLIBS) $(TCCDOCS) |
| 131 | 132 | |
| 132 | 133 | # cross compiler targets to build |
| 133 | −TCC_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince c67 | |
| 134 | +TCC_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm64-win32 arm-wince c67 | |
| 134 | 135 | TCC_X += riscv64 arm64-osx |
| 135 | 136 | # TCC_X += arm-fpa arm-fpa-ld arm-vfp arm-eabi |
| 136 | 137 | |
| @@ -212,8 +213,9 @@ arm-fpa-ld_FILES = $(arm_FILES) · 75 unmodified lines | ||
| 212 | 213 | arm-vfp_FILES = $(arm_FILES) |
| 213 | 214 | arm-eabi_FILES = $(arm_FILES) |
| 214 | 215 | arm-eabihf_FILES = $(arm_FILES) |
| 215 | −arm64_FILES = $(CORE_FILES) arm64-gen.c arm64-link.c arm64-asm.c | |
| 216 | +arm64_FILES = $(CORE_FILES) arm64-gen.c arm64-link.c arm64-asm.c arm64-tok.h | |
| 216 | 217 | arm64-osx_FILES = $(arm64_FILES) tccmacho.c |
| 218 | +arm64-win32_FILES = $(arm64_FILES) tccpe.c | |
| 217 | 219 | c67_FILES = $(CORE_FILES) c67-gen.c c67-link.c tcccoff.c |
| 218 | 220 | riscv64_FILES = $(CORE_FILES) riscv64-gen.c riscv64-link.c riscv64-asm.c |
| 219 | 221 | |
| @@ -266,7 +266,11 @@ default os_release "$(uname -r)" · 265 unmodified lines | ||
| 266 | 266 | case $buildos in |
| 267 | 267 | Windows_NT|MINGW*|MSYS*|CYGWIN*) |
| 268 | 268 | buildos="WIN32" |
| 269 | − test "$MSYSTEM" = "MINGW32" && cpu_sys=i386 | |
| 269 | + case "$MSYSTEM" in | |
| 270 | + MINGW32) cpu_sys=i386 ;; | |
| 271 | + MINGW64) cpu_sys=x86_64 ;; | |
| 272 | + CLANGARM64|MINGW_ARM64) cpu_sys=arm64 ;; | |
| 273 | + esac | |
| 270 | 274 | ;; |
| 271 | 275 | Linux) |
| 272 | 276 | if test "$(uname -o)" = "Android"; then |
| @@ -65,6 +65,7 @@ OBJ-i386-win32 = $(I386_O) chkstk.o $(WIN_O) · 64 unmodified lines | ||
| 65 | 65 | OBJ-x86_64-win32 = $(X86_64_O) chkstk.o $(WIN_O) |
| 66 | 66 | OBJ-arm64 = $(ARM64_O) $(LIN_O) |
| 67 | 67 | OBJ-arm64-osx = $(ARM64_O) $(OSX_O) |
| 68 | +OBJ-arm64-win32 = $(ARM64_O) chkstk.o $(WIN_O) | |
| 68 | 69 | OBJ-arm = $(ARM_O) $(LIN_O) |
| 69 | 70 | OBJ-arm-fpa = $(OBJ-arm) |
| 70 | 71 | OBJ-arm-fpa-ld = $(OBJ-arm) |
| @@ -309,6 +309,7 @@ CROSS-TGTS = \ · 308 unmodified lines | ||
| 309 | 309 | arm-NetBSD \ |
| 310 | 310 | arm-wince \ |
| 311 | 311 | arm64 \ |
| 312 | + arm64-win32 \ | |
| 312 | 313 | arm64-osx \ |
| 313 | 314 | arm64-FreeBSD \ |
| 314 | 315 | arm64-NetBSD \ |
| @@ -46,6 +46,7 @@ clean: · 45 unmodified lines | ||
| 46 | 46 | rm -f *.output |
| 47 | 47 | |
| 48 | 48 | 02.test : DIFF_OPTS += -w |
| 49 | +16.test : DIFF_OPTS += -B | |
| 49 | 50 | # 15.test : DIFF_OPTS += -I"^XXX:" |
| 50 | 51 | |
| 51 | 52 | # diff options: |
| @@ -48,6 +48,21 @@ ifeq (-$(CONFIG_WIN32)-,-yes-) · 47 unmodified lines | ||
| 48 | 48 | SKIP += 117_builtins.test # win32 port doesn't define __builtins |
| 49 | 49 | SKIP += 124_atomic_counter.test # No pthread support |
| 50 | 50 | endif |
| 51 | +ifneq (,$(filter arm% riscv%,$(ARCH))) | |
| 52 | + SKIP += 85_asm-outside-function.test | |
| 53 | + SKIP += 98_al_ax_extend.test | |
| 54 | + SKIP += 99_fastcall.test | |
| 55 | + SKIP += 127_asm_goto.test | |
| 56 | +endif | |
| 57 | +ifeq (,$(filter arm64 aarch64,$(ARCH))) | |
| 58 | + SKIP += 138_arm64_encoding.test | |
| 59 | + SKIP += 139_arm64_errors.test | |
| 60 | +endif | |
| 61 | +ifneq (,$(findstring win32,$(CROSS_TARGET))) | |
| 62 | + SKIP += 106_versym.test | |
| 63 | + SKIP += 114_bound_signal.test | |
| 64 | + SKIP += 124_atomic_counter.test | |
| 65 | +endif | |
| 51 | 66 | ifneq (,$(filter OpenBSD FreeBSD NetBSD,$(TARGETOS))) |
| 52 | 67 | SKIP += 106_versym.test # no pthread_condattr_setpshared |
| 53 | 68 | SKIP += 114_bound_signal.test # libc problem signal/fork |
| @@ -73,6 +88,7 @@ endif · 19 unmodified lines | ||
| 73 | 88 | |
| 74 | 89 | # These tests run several snippets from the same file one by one |
| 75 | 90 | 60_errors_and_warnings.test : FLAGS += -dt |
| 91 | +139_arm64_errors.test : FLAGS += -dt | |
| 76 | 92 | 96_nodata_wanted.test : FLAGS += -dt |
| 77 | 93 | |
| 78 | 94 | # Always generate certain .expects (don't put these in the GIT), |