mirror of
git://repo.or.cz/tinycc.git
synced 2026-06-17 23:54:16 +08:00
tccpe.c: - fix arm64 unwind codes (to make native set/longjmp() work) sizeof(RUNTIME_FUNCTION) is 8 on arm64 in the first place no need to note stack slots if we don't save any registers anyway arm64-gen.c: - fix long double reg-move - fix arm64_hfa() for structs with float arrays - gfunc_prolog(): setup stackframe eariler (simplifies unwind codes) - new function gv_addr(RC); win32/include/setjmp.h: - provide correct definition for setjmo() (frameoffset = 224) tccasm.c: - support ".quad" with symbol & relocation - support ".size" - fix ". - symbol" arithmetic win32/lib/crt1.c and win32/include/stdlib.h: - do not write to __argc/__argv which reside in msvcrt.dll (msvcrt.dll on arm64 does not like that, crashes on unload) tcc.c,libtcc.c: - new functions tcc_fopen/fclose to avoid different stdio unstances in tcc.exe & libtcc.dll tests & github workflow: - add test-win32.bat to run tests with a tcc compiled by build-tcc.bat - add msvcrt_start.c for gcc/clang to use the same runtime as tcc the problem is that newer gcc as well as clang and cl are linking to newer runtimes (such as UCRT) that have partially different printf format behavior which makes tcctest fail. the solution here is to force these compilers to link with msvcrt.dll just like tcc. Also, there is no gcc on arm64-win32 currently at all. Anyway, this approach to running the github CI tests does not require msys2. But It does rely on gnumake as well as on some 'sh' shell though which seems to be installed somewhere (maybe it is the one from git).
75 lines
1.8 KiB
Batchfile
75 lines
1.8 KiB
Batchfile
@echo off
|
|
setlocal
|
|
set CC=gcc
|
|
set TESTS=
|
|
if "%1"=="/?" goto :usage
|
|
goto :p0
|
|
|
|
:usage
|
|
echo usage: test-win32.bat [options...] [tests...]
|
|
echo options:
|
|
echo -c compiler reference compiler (gcc or clang)
|
|
echo -p path prepend path to PATH
|
|
echo tests tests to run (default all)
|
|
echo requires: make, gcc/clang, and sh in the PATH
|
|
exit /B 1
|
|
|
|
:p2
|
|
shift
|
|
:p1
|
|
shift
|
|
:p0
|
|
if "%1"=="-c" set CC=%2&&goto p2
|
|
if "%1"=="-p" set PATH=%2;%PATH%&&goto p2
|
|
if not "%1"=="" set TESTS=%TESTS% %1&&goto p1
|
|
if "%TESTS%"=="" set TESTS=all -k
|
|
|
|
set PATH=%CD%\..\win32;%PATH%
|
|
|
|
for /f "delims=-" %%a in ('tcc.exe -dumpmachine') do set ARCH=%%a
|
|
set ARCH=%ARCH:aarch=arm%
|
|
set MACH=%ARCH:i386=x86%
|
|
set MACH=%MACH:x86_64=amd64%
|
|
rem echo ARCH:%ARCH% MACHINE:%MACH%
|
|
|
|
set CRTLIB=c:/windows/system32/msvcrt.dll
|
|
set LIBTCC=libtcc.dll
|
|
set LGCC=-lgcc
|
|
if %CC%==gcc goto :c2
|
|
|
|
set CRTLIB=msvcrt.lib
|
|
set LIBTCC=libtcc.lib
|
|
set LGCC=
|
|
if exist %CRTLIB% goto :c3
|
|
tcc -impdef msvcrt.dll
|
|
lib >nul /def:msvcrt.def /out:%CRTLIB% /machine:%MACH%
|
|
:c2
|
|
if not exist %CRTLIB% echo test-win32.bat: error: %CRTLIB% not found&&exit /b 1
|
|
:c3
|
|
|
|
set REF_LINK=-nostdlib msvcrt_start.c %LGCC% -lkernel32 %CRTLIB%
|
|
set CFG_MAK=..\config.mak
|
|
set CFG_H=..\config.h
|
|
|
|
echo>>%CFG_H% #define CC_NAME CC_%CC%
|
|
echo>>%CFG_H% #define GCC_MAJOR 15
|
|
|
|
if exist %CFG_MAK% del %CFG_MAK%
|
|
echo>>%CFG_MAK% CC = %CC%.exe
|
|
echo>>%CFG_MAK% CC_NAME = %CC%
|
|
echo>>%CFG_MAK% ARCH = %ARCH%
|
|
echo>>%CFG_MAK% CFLAGS = -Wall -O0
|
|
echo>>%CFG_MAK% LDFLAGS =
|
|
echo>>%CFG_MAK% LIBSUF = .lib
|
|
echo>>%CFG_MAK% prefix = $(TOP)/bin
|
|
echo>>%CFG_MAK% EXESUF = .exe
|
|
echo>>%CFG_MAK% DLLSUF = .dll
|
|
echo>>%CFG_MAK% TARGETOS = WIN32
|
|
echo>>%CFG_MAK% CONFIG_WIN32 = yes
|
|
echo>>%CFG_MAK% TOPSRC = $(TOP)
|
|
echo>>%CFG_MAK% SHELL = sh
|
|
echo>>%CFG_MAK% test.ref: CFLAGS += %REF_LINK%
|
|
|
|
set GMAKE=make
|
|
%GMAKE% TCC_LOCAL=tcc.exe LIBTCC=win32/%LIBTCC% %TESTS%
|