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 | ifneq ($(CONFIG_debug),yes) | 33 | ifneq ($(CONFIG_debug),yes) |
| 34 | LDFLAGS += -s | 34 | LDFLAGS += -s |
| 35 | endif | 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 | else | 37 | else |
| 38 | CFG = -unx | 38 | CFG = -unx |
| 39 | LIBS+=-lm | 39 | LIBS+=-lm |
| @@ -113,6 +113,7 @@ DEF-arm64-osx = $(DEF-arm64) -DTCC_TARGET_MACHO · 73 unmodified lines | |||
| 113 | DEF-arm64-FreeBSD = $(DEF-arm64) -DTARGETOS_FreeBSD | 113 | DEF-arm64-FreeBSD = $(DEF-arm64) -DTARGETOS_FreeBSD |
| 114 | DEF-arm64-NetBSD = $(DEF-arm64) -DTARGETOS_NetBSD | 114 | DEF-arm64-NetBSD = $(DEF-arm64) -DTARGETOS_NetBSD |
| 115 | DEF-arm64-OpenBSD = $(DEF-arm64) -DTARGETOS_OpenBSD | 115 | DEF-arm64-OpenBSD = $(DEF-arm64) -DTARGETOS_OpenBSD |
| 116 | DEF-arm64-win32 = $(DEF-arm64) -DTCC_TARGET_PE | ||
| 116 | DEF-riscv64 = -DTCC_TARGET_RISCV64 | 117 | DEF-riscv64 = -DTCC_TARGET_RISCV64 |
| 117 | DEF-c67 = -DTCC_TARGET_C67 -w # disable warnigs | 118 | DEF-c67 = -DTCC_TARGET_C67 -w # disable warnigs |
| 118 | DEF-x86_64-FreeBSD = $(DEF-x86_64) -DTARGETOS_FreeBSD | 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 | all: $(PROGS) $(TCCLIBS) $(TCCDOCS) | 131 | all: $(PROGS) $(TCCLIBS) $(TCCDOCS) |
| 131 | 132 | ||
| 132 | # cross compiler targets to build | 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 | TCC_X += riscv64 arm64-osx | 135 | TCC_X += riscv64 arm64-osx |
| 135 | # TCC_X += arm-fpa arm-fpa-ld arm-vfp arm-eabi | 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 | arm-vfp_FILES = $(arm_FILES) | 213 | arm-vfp_FILES = $(arm_FILES) |
| 213 | arm-eabi_FILES = $(arm_FILES) | 214 | arm-eabi_FILES = $(arm_FILES) |
| 214 | arm-eabihf_FILES = $(arm_FILES) | 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 | arm64-osx_FILES = $(arm64_FILES) tccmacho.c | 217 | arm64-osx_FILES = $(arm64_FILES) tccmacho.c |
| 218 | arm64-win32_FILES = $(arm64_FILES) tccpe.c | ||
| 217 | c67_FILES = $(CORE_FILES) c67-gen.c c67-link.c tcccoff.c | 219 | c67_FILES = $(CORE_FILES) c67-gen.c c67-link.c tcccoff.c |
| 218 | riscv64_FILES = $(CORE_FILES) riscv64-gen.c riscv64-link.c riscv64-asm.c | 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 | case $buildos in | 266 | case $buildos in |
| 267 | Windows_NT|MINGW*|MSYS*|CYGWIN*) | 267 | Windows_NT|MINGW*|MSYS*|CYGWIN*) |
| 268 | buildos="WIN32" | 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 | Linux) | 275 | Linux) |
| 272 | if test "$(uname -o)" = "Android"; then | 276 | if test "$(uname -o)" = "Android"; then |
| @@ -65,6 +65,7 @@ OBJ-i386-win32 = $(I386_O) chkstk.o $(WIN_O) · 64 unmodified lines | |||
| 65 | OBJ-x86_64-win32 = $(X86_64_O) chkstk.o $(WIN_O) | 65 | OBJ-x86_64-win32 = $(X86_64_O) chkstk.o $(WIN_O) |
| 66 | OBJ-arm64 = $(ARM64_O) $(LIN_O) | 66 | OBJ-arm64 = $(ARM64_O) $(LIN_O) |
| 67 | OBJ-arm64-osx = $(ARM64_O) $(OSX_O) | 67 | OBJ-arm64-osx = $(ARM64_O) $(OSX_O) |
| 68 | OBJ-arm64-win32 = $(ARM64_O) chkstk.o $(WIN_O) | ||
| 68 | OBJ-arm = $(ARM_O) $(LIN_O) | 69 | OBJ-arm = $(ARM_O) $(LIN_O) |
| 69 | OBJ-arm-fpa = $(OBJ-arm) | 70 | OBJ-arm-fpa = $(OBJ-arm) |
| 70 | OBJ-arm-fpa-ld = $(OBJ-arm) | 71 | OBJ-arm-fpa-ld = $(OBJ-arm) |
| @@ -309,6 +309,7 @@ CROSS-TGTS = \ · 308 unmodified lines | |||
| 309 | arm-NetBSD \ | 309 | arm-NetBSD \ |
| 310 | arm-wince \ | 310 | arm-wince \ |
| 311 | arm64 \ | 311 | arm64 \ |
| 312 | arm64-win32 \ | ||
| 312 | arm64-osx \ | 313 | arm64-osx \ |
| 313 | arm64-FreeBSD \ | 314 | arm64-FreeBSD \ |
| 314 | arm64-NetBSD \ | 315 | arm64-NetBSD \ |
| @@ -46,6 +46,7 @@ clean: · 45 unmodified lines | |||
| 46 | rm -f *.output | 46 | rm -f *.output |
| 47 | 47 | ||
| 48 | 02.test : DIFF_OPTS += -w | 48 | 02.test : DIFF_OPTS += -w |
| 49 | 16.test : DIFF_OPTS += -B | ||
| 49 | # 15.test : DIFF_OPTS += -I"^XXX:" | 50 | # 15.test : DIFF_OPTS += -I"^XXX:" |
| 50 | 51 | ||
| 51 | # diff options: | 52 | # diff options: |
| @@ -48,6 +48,21 @@ ifeq (-$(CONFIG_WIN32)-,-yes-) · 47 unmodified lines | |||
| 48 | SKIP += 117_builtins.test # win32 port doesn't define __builtins | 48 | SKIP += 117_builtins.test # win32 port doesn't define __builtins |
| 49 | SKIP += 124_atomic_counter.test # No pthread support | 49 | SKIP += 124_atomic_counter.test # No pthread support |
| 50 | endif | 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 | ifneq (,$(filter OpenBSD FreeBSD NetBSD,$(TARGETOS))) | 66 | ifneq (,$(filter OpenBSD FreeBSD NetBSD,$(TARGETOS))) |
| 52 | SKIP += 106_versym.test # no pthread_condattr_setpshared | 67 | SKIP += 106_versym.test # no pthread_condattr_setpshared |
| 53 | SKIP += 114_bound_signal.test # libc problem signal/fork | 68 | SKIP += 114_bound_signal.test # libc problem signal/fork |
| @@ -73,6 +88,7 @@ endif · 19 unmodified lines | |||
| 73 | 88 | ||
| 74 | # These tests run several snippets from the same file one by one | 89 | # These tests run several snippets from the same file one by one |
| 75 | 60_errors_and_warnings.test : FLAGS += -dt | 90 | 60_errors_and_warnings.test : FLAGS += -dt |
| 91 | 139_arm64_errors.test : FLAGS += -dt | ||
| 76 | 96_nodata_wanted.test : FLAGS += -dt | 92 | 96_nodata_wanted.test : FLAGS += -dt |
| 77 | 93 | ||
| 78 | # Always generate certain .expects (don't put these in the GIT), | 94 | # Always generate certain .expects (don't put these in the GIT), |