3 Commits

5 changed files with 202 additions and 1 deletions

49
win32/build-tcc3232.bat Executable file
View File

@ -0,0 +1,49 @@
@rem ----------------------------------------------------
@rem batch file to build tcc using mingw gcc
@rem ----------------------------------------------------
@set /p VERSION= < ..\VERSION
echo>..\config.h #define TCC_VERSION "%VERSION%"
@set target=-DTCC_TARGET_PE -DTCC_TARGET_I386
@set CC=c:\cygwin64\bin\i686-w64-mingw32-gcc.exe -Os -s -fno-strict-aliasing
@set P=32
:tools
%CC% %target% tools/tiny_impdef.c -o tiny_impdef.exe
%CC% %target% tools/tiny_libmaker.c -o tiny_libmaker.exe
:libtcc
if not exist libtcc\nul mkdir libtcc
copy ..\libtcc.h libtcc\libtcc.h
%CC% %target% -shared -DLIBTCC_AS_DLL -DONE_SOURCE ../libtcc.c -o libtcc.dll -Wl,-out-implib,libtcc/libtcc.a -static-libgcc
tiny_impdef libtcc.dll -o libtcc/libtcc.def
:tcc
%CC% %target% ../tcc.c -o tcc.exe -ltcc -Llibtcc
:copy_std_includes
copy ..\include\*.h include
:libtcc1.a
.\tcc %target% -c ../lib/libtcc1.c
.\tcc %target% -c lib/crt1.c
.\tcc %target% -c lib/wincrt1.c
.\tcc %target% -c lib/dllcrt1.c
.\tcc %target% -c lib/dllmain.c
.\tcc %target% -c lib/chkstk.S
goto lib%P%
:lib32
.\tcc %target% -c ../lib/alloca86.S
.\tcc %target% -c ../lib/alloca86-bt.S
.\tcc %target% -c ../lib/bcheck.c
tiny_libmaker lib/libtcc1.a libtcc1.o alloca86.o alloca86-bt.o crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o bcheck.o
@goto the_end
:lib64
.\tcc %target% -c ../lib/alloca86_64.S
tiny_libmaker lib/libtcc1.a libtcc1.o alloca86_64.o crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
:the_end
del *.o

49
win32/build-tcc3264.bat Executable file
View File

@ -0,0 +1,49 @@
@rem ----------------------------------------------------
@rem batch file to build tcc using mingw gcc
@rem ----------------------------------------------------
@set /p VERSION= < ..\VERSION
echo>..\config.h #define TCC_VERSION "%VERSION%"
@set target=-DTCC_TARGET_PE -DTCC_TARGET_I386
@set CC=c:\cygwin64\bin\x86_64-w64-mingw32-gcc.exe -O0 -s -fno-strict-aliasing
@set P=32
:tools
%CC% %target% tools/tiny_impdef.c -o tiny_impdef.exe
%CC% %target% tools/tiny_libmaker.c -o tiny_libmaker.exe
:libtcc
if not exist libtcc\nul mkdir libtcc
copy ..\libtcc.h libtcc\libtcc.h
%CC% %target% -shared -DLIBTCC_AS_DLL -DONE_SOURCE ../libtcc.c -o libtcc.dll -Wl,-out-implib,libtcc/libtcc.a -static-libgcc
tiny_impdef libtcc.dll -o libtcc/libtcc.def
:tcc
%CC% %target% ../tcc.c -o tcc.exe -ltcc -Llibtcc
:copy_std_includes
copy ..\include\*.h include
:libtcc1.a
.\tcc %target% -c ../lib/libtcc1.c
.\tcc %target% -c lib/crt1.c
.\tcc %target% -c lib/wincrt1.c
.\tcc %target% -c lib/dllcrt1.c
.\tcc %target% -c lib/dllmain.c
.\tcc %target% -c lib/chkstk.S
goto lib%P%
:lib32
.\tcc %target% -c ../lib/alloca86.S
.\tcc %target% -c ../lib/alloca86-bt.S
.\tcc %target% -c ../lib/bcheck.c
tiny_libmaker lib/libtcc1.a libtcc1.o alloca86.o alloca86-bt.o crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o bcheck.o
@goto the_end
:lib64
.\tcc %target% -c ../lib/alloca86_64.S
tiny_libmaker lib/libtcc1.a libtcc1.o alloca86_64.o crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
:the_end
del *.o

49
win32/build-tcc6432.bat Executable file
View File

@ -0,0 +1,49 @@
@rem ----------------------------------------------------
@rem batch file to build tcc using mingw gcc
@rem ----------------------------------------------------
@set /p VERSION= < ..\VERSION
echo>..\config.h #define TCC_VERSION "%VERSION%"
@set target=-DTCC_TARGET_PE -DTCC_TARGET_X86_64
@rem mingw 64 has an ICE with -Os
@set CC=c:\cygwin64\bin\i686-w64-mingw32-gcc.exe -Os -s -fno-strict-aliasing
@set P=64
%CC% %target% tools/tiny_impdef.c -o tiny_impdef.exe
%CC% %target% tools/tiny_libmaker.c -o tiny_libmaker.exe
:libtcc
if not exist libtcc\nul mkdir libtcc
copy ..\libtcc.h libtcc\libtcc.h
%CC% %target% -shared -DLIBTCC_AS_DLL -DONE_SOURCE ../libtcc.c -o libtcc.dll -Wl,-out-implib,libtcc/libtcc.a -static-libgcc
tiny_impdef libtcc.dll -o libtcc/libtcc.def
:tcc
%CC% %target% ../tcc.c -o tcc.exe -ltcc -Llibtcc
:copy_std_includes
copy ..\include\*.h include
:libtcc1.a
.\tcc %target% -c ../lib/libtcc1.c
.\tcc %target% -c lib/crt1.c
.\tcc %target% -c lib/wincrt1.c
.\tcc %target% -c lib/dllcrt1.c
.\tcc %target% -c lib/dllmain.c
.\tcc %target% -c lib/chkstk.S
goto lib%P%
:lib32
.\tcc %target% -c ../lib/alloca86.S
.\tcc %target% -c ../lib/alloca86-bt.S
.\tcc %target% -c ../lib/bcheck.c
tiny_libmaker lib/libtcc1.a libtcc1.o alloca86.o alloca86-bt.o crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o bcheck.o
@goto the_end
:lib64
.\tcc %target% -c ../lib/alloca86_64.S
tiny_libmaker lib/libtcc1.a libtcc1.o alloca86_64.o crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
:the_end
del *.o

49
win32/build-tcc6464.bat Executable file
View File

@ -0,0 +1,49 @@
@rem ----------------------------------------------------
@rem batch file to build tcc using mingw gcc
@rem ----------------------------------------------------
@set /p VERSION= < ..\VERSION
echo>..\config.h #define TCC_VERSION "%VERSION%"
@set target=-DTCC_TARGET_PE -DTCC_TARGET_X86_64
@rem mingw 64 has an ICE with -Os
@set CC=c:\cygwin64\bin\x86_64-w64-mingw32-gcc.exe -O0 -s -fno-strict-aliasing
@set P=64
%CC% %target% tools/tiny_impdef.c -o tiny_impdef.exe
%CC% %target% tools/tiny_libmaker.c -o tiny_libmaker.exe
:libtcc
if not exist libtcc\nul mkdir libtcc
copy ..\libtcc.h libtcc\libtcc.h
%CC% %target% -shared -DLIBTCC_AS_DLL -DONE_SOURCE ../libtcc.c -o libtcc.dll -Wl,-out-implib,libtcc/libtcc.a -static-libgcc
tiny_impdef libtcc.dll -o libtcc/libtcc.def
:tcc
%CC% %target% ../tcc.c -o tcc.exe -ltcc -Llibtcc
:copy_std_includes
copy ..\include\*.h include
:libtcc1.a
.\tcc %target% -c ../lib/libtcc1.c
.\tcc %target% -c lib/crt1.c
.\tcc %target% -c lib/wincrt1.c
.\tcc %target% -c lib/dllcrt1.c
.\tcc %target% -c lib/dllmain.c
.\tcc %target% -c lib/chkstk.S
goto lib%P%
:lib32
.\tcc %target% -c ../lib/alloca86.S
.\tcc %target% -c ../lib/alloca86-bt.S
.\tcc %target% -c ../lib/bcheck.c
tiny_libmaker lib/libtcc1.a libtcc1.o alloca86.o alloca86-bt.o crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o bcheck.o
@goto the_end
:lib64
.\tcc %target% -c ../lib/alloca86_64.S
tiny_libmaker lib/libtcc1.a libtcc1.o alloca86_64.o crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
:the_end
del *.o

View File

@ -750,7 +750,12 @@ void gfunc_prolog(CType *func_type)
bt = type->t & VT_BTYPE; bt = type->t & VT_BTYPE;
if (reg_param_index < REGN) { if (reg_param_index < REGN) {
/* save arguments passed by register */ /* save arguments passed by register */
gen_modrm64(0x89, arg_regs[reg_param_index], VT_LOCAL, NULL, addr); if ((bt == VT_FLOAT) || (bt == VT_DOUBLE)) {
o(0xd60f66); /* movq */
gen_modrm(reg_param_index, VT_LOCAL, NULL, addr);
} else {
gen_modrm64(0x89, arg_regs[reg_param_index], VT_LOCAL, NULL, addr);
}
} }
if (bt == VT_STRUCT || bt == VT_LDOUBLE) { if (bt == VT_STRUCT || bt == VT_LDOUBLE) {
sym_push(sym->v & ~SYM_FIELD, type, VT_LOCAL | VT_LVAL | VT_REF, addr); sym_push(sym->v & ~SYM_FIELD, type, VT_LOCAL | VT_LVAL | VT_REF, addr);