arm64-win32 support : configure & Makefiles

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: 8b5ab1bb01

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
This commit is contained in:
Benjamin Oldenburg 2026-04-04 16:29:28 +02:00 committed by grischka
parent d9a6d9aec0
commit ff5d3b4874
6 changed files with 29 additions and 4 deletions

View File

@ -33,7 +33,7 @@ ifdef CONFIG_WIN32
ifneq ($(CONFIG_debug),yes) ifneq ($(CONFIG_debug),yes)
LDFLAGS += -s LDFLAGS += -s
endif endif
NATIVE_TARGET = $(ARCH)-win$(if $(findstring arm,$(ARCH)),ce,32) NATIVE_TARGET = $(if $(findstring arm64,$(ARCH)),arm64-win32,$(ARCH)-win$(if $(findstring arm,$(ARCH)),ce,32))
else else
CFG = -unx CFG = -unx
LIBS+=-lm LIBS+=-lm
@ -113,6 +113,7 @@ DEF-arm64-osx = $(DEF-arm64) -DTCC_TARGET_MACHO
DEF-arm64-FreeBSD = $(DEF-arm64) -DTARGETOS_FreeBSD DEF-arm64-FreeBSD = $(DEF-arm64) -DTARGETOS_FreeBSD
DEF-arm64-NetBSD = $(DEF-arm64) -DTARGETOS_NetBSD DEF-arm64-NetBSD = $(DEF-arm64) -DTARGETOS_NetBSD
DEF-arm64-OpenBSD = $(DEF-arm64) -DTARGETOS_OpenBSD DEF-arm64-OpenBSD = $(DEF-arm64) -DTARGETOS_OpenBSD
DEF-arm64-win32 = $(DEF-arm64) -DTCC_TARGET_PE
DEF-riscv64 = -DTCC_TARGET_RISCV64 DEF-riscv64 = -DTCC_TARGET_RISCV64
DEF-c67 = -DTCC_TARGET_C67 -w # disable warnigs DEF-c67 = -DTCC_TARGET_C67 -w # disable warnigs
DEF-x86_64-FreeBSD = $(DEF-x86_64) -DTARGETOS_FreeBSD DEF-x86_64-FreeBSD = $(DEF-x86_64) -DTARGETOS_FreeBSD
@ -130,7 +131,7 @@ TCCDOCS = tcc.1 tcc-doc.html tcc-doc.info
all: $(PROGS) $(TCCLIBS) $(TCCDOCS) all: $(PROGS) $(TCCLIBS) $(TCCDOCS)
# cross compiler targets to build # cross compiler targets to build
TCC_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince c67 TCC_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm64-win32 arm-wince c67
TCC_X += riscv64 arm64-osx TCC_X += riscv64 arm64-osx
# TCC_X += arm-fpa arm-fpa-ld arm-vfp arm-eabi # TCC_X += arm-fpa arm-fpa-ld arm-vfp arm-eabi
@ -212,8 +213,9 @@ arm-fpa-ld_FILES = $(arm_FILES)
arm-vfp_FILES = $(arm_FILES) arm-vfp_FILES = $(arm_FILES)
arm-eabi_FILES = $(arm_FILES) arm-eabi_FILES = $(arm_FILES)
arm-eabihf_FILES = $(arm_FILES) arm-eabihf_FILES = $(arm_FILES)
arm64_FILES = $(CORE_FILES) arm64-gen.c arm64-link.c arm64-asm.c arm64_FILES = $(CORE_FILES) arm64-gen.c arm64-link.c arm64-asm.c arm64-tok.h
arm64-osx_FILES = $(arm64_FILES) tccmacho.c arm64-osx_FILES = $(arm64_FILES) tccmacho.c
arm64-win32_FILES = $(arm64_FILES) tccpe.c
c67_FILES = $(CORE_FILES) c67-gen.c c67-link.c tcccoff.c c67_FILES = $(CORE_FILES) c67-gen.c c67-link.c tcccoff.c
riscv64_FILES = $(CORE_FILES) riscv64-gen.c riscv64-link.c riscv64-asm.c riscv64_FILES = $(CORE_FILES) riscv64-gen.c riscv64-link.c riscv64-asm.c

6
configure vendored
View File

@ -266,7 +266,11 @@ default os_release "$(uname -r)"
case $buildos in case $buildos in
Windows_NT|MINGW*|MSYS*|CYGWIN*) Windows_NT|MINGW*|MSYS*|CYGWIN*)
buildos="WIN32" buildos="WIN32"
test "$MSYSTEM" = "MINGW32" && cpu_sys=i386 case "$MSYSTEM" in
MINGW32) cpu_sys=i386 ;;
MINGW64) cpu_sys=x86_64 ;;
CLANGARM64|MINGW_ARM64) cpu_sys=arm64 ;;
esac
;; ;;
Linux) Linux)
if test "$(uname -o)" = "Android"; then if test "$(uname -o)" = "Android"; then

View File

@ -65,6 +65,7 @@ OBJ-i386-win32 = $(I386_O) chkstk.o $(WIN_O)
OBJ-x86_64-win32 = $(X86_64_O) chkstk.o $(WIN_O) OBJ-x86_64-win32 = $(X86_64_O) chkstk.o $(WIN_O)
OBJ-arm64 = $(ARM64_O) $(LIN_O) OBJ-arm64 = $(ARM64_O) $(LIN_O)
OBJ-arm64-osx = $(ARM64_O) $(OSX_O) OBJ-arm64-osx = $(ARM64_O) $(OSX_O)
OBJ-arm64-win32 = $(ARM64_O) chkstk.o $(WIN_O)
OBJ-arm = $(ARM_O) $(LIN_O) OBJ-arm = $(ARM_O) $(LIN_O)
OBJ-arm-fpa = $(OBJ-arm) OBJ-arm-fpa = $(OBJ-arm)
OBJ-arm-fpa-ld = $(OBJ-arm) OBJ-arm-fpa-ld = $(OBJ-arm)

View File

@ -309,6 +309,7 @@ CROSS-TGTS = \
arm-NetBSD \ arm-NetBSD \
arm-wince \ arm-wince \
arm64 \ arm64 \
arm64-win32 \
arm64-osx \ arm64-osx \
arm64-FreeBSD \ arm64-FreeBSD \
arm64-NetBSD \ arm64-NetBSD \

View File

@ -46,6 +46,7 @@ clean:
rm -f *.output rm -f *.output
02.test : DIFF_OPTS += -w 02.test : DIFF_OPTS += -w
16.test : DIFF_OPTS += -B
# 15.test : DIFF_OPTS += -I"^XXX:" # 15.test : DIFF_OPTS += -I"^XXX:"
# diff options: # diff options:

View File

@ -48,6 +48,21 @@ ifeq (-$(CONFIG_WIN32)-,-yes-)
SKIP += 117_builtins.test # win32 port doesn't define __builtins SKIP += 117_builtins.test # win32 port doesn't define __builtins
SKIP += 124_atomic_counter.test # No pthread support SKIP += 124_atomic_counter.test # No pthread support
endif endif
ifneq (,$(filter arm% riscv%,$(ARCH)))
SKIP += 85_asm-outside-function.test
SKIP += 98_al_ax_extend.test
SKIP += 99_fastcall.test
SKIP += 127_asm_goto.test
endif
ifeq (,$(filter arm64 aarch64,$(ARCH)))
SKIP += 138_arm64_encoding.test
SKIP += 139_arm64_errors.test
endif
ifneq (,$(findstring win32,$(CROSS_TARGET)))
SKIP += 106_versym.test
SKIP += 114_bound_signal.test
SKIP += 124_atomic_counter.test
endif
ifneq (,$(filter OpenBSD FreeBSD NetBSD,$(TARGETOS))) ifneq (,$(filter OpenBSD FreeBSD NetBSD,$(TARGETOS)))
SKIP += 106_versym.test # no pthread_condattr_setpshared SKIP += 106_versym.test # no pthread_condattr_setpshared
SKIP += 114_bound_signal.test # libc problem signal/fork SKIP += 114_bound_signal.test # libc problem signal/fork
@ -73,6 +88,7 @@ endif
# These tests run several snippets from the same file one by one # These tests run several snippets from the same file one by one
60_errors_and_warnings.test : FLAGS += -dt 60_errors_and_warnings.test : FLAGS += -dt
139_arm64_errors.test : FLAGS += -dt
96_nodata_wanted.test : FLAGS += -dt 96_nodata_wanted.test : FLAGS += -dt
# Always generate certain .expects (don't put these in the GIT), # Always generate certain .expects (don't put these in the GIT),