diff options
author | Thomas Preud'homme <robotux@celest.fr> | 2012-01-05 12:34:51 +0100 |
---|---|---|
committer | Thomas Preud'homme <robotux@celest.fr> | 2012-01-05 12:34:51 +0100 |
commit | d178eb7650ef7356ca4e6d9d64ac242dcff64811 (patch) | |
tree | 9f2084d9f6ace2c57691d8efd9ea2cc9bff8d197 /win32 | |
parent | cfef8921f4b5dfa31fd2336484d86e24e3beb2f3 (diff) |
Imported Upstream version 0.9.26~git20120104.83d57c0
Diffstat (limited to 'win32')
-rw-r--r-- | win32/build-tcc.bat | 17 | ||||
-rw-r--r-- | win32/include/_mingw.h | 7 | ||||
-rw-r--r-- | win32/include/malloc.h | 6 | ||||
-rw-r--r-- | win32/include/time.h | 15 | ||||
-rw-r--r-- | win32/lib/chkstk.S | 8 | ||||
-rw-r--r-- | win32/lib/kernel32.def | 2 | ||||
-rw-r--r-- | win32/tools/tiny_libmaker.c | 12 |
7 files changed, 37 insertions, 30 deletions
diff --git a/win32/build-tcc.bat b/win32/build-tcc.bat index 42dc8f6..21bf3a8 100644 --- a/win32/build-tcc.bat +++ b/win32/build-tcc.bat @@ -3,14 +3,12 @@ @rem ---------------------------------------------------- echo>..\config.h #define TCC_VERSION "0.9.25" -echo>>..\config.h #define CONFIG_TCCDIR "." -echo>>..\config.h #define CONFIG_SYSROOT "" @if _%PROCESSOR_ARCHITEW6432%_==_AMD64_ goto x86_64 @if _%PROCESSOR_ARCHITECTURE%_==_AMD64_ goto x86_64 @set target=-DTCC_TARGET_PE -DTCC_TARGET_I386 -@set CC=gcc -Os -s +@set CC=gcc -Os -s -fno-strict-aliasing @set AR=ar @set P=32 @goto tools @@ -18,7 +16,7 @@ echo>>..\config.h #define CONFIG_SYSROOT "" :x86_64 @set target=-DTCC_TARGET_PE -DTCC_TARGET_X86_64 @rem mingw 64 has an ICE with -Os -@set CC=x86_64-pc-mingw32-gcc -O0 -s +@set CC=x86_64-pc-mingw32-gcc -O0 -s -fno-strict-aliasing @set AR=x86_64-pc-mingw32-ar @set P=64 @@ -29,11 +27,14 @@ echo>>..\config.h #define CONFIG_SYSROOT "" :libtcc if not exist libtcc\nul mkdir libtcc copy ..\libtcc.h libtcc\libtcc.h -%CC% %target% -fno-strict-aliasing ../libtcc.c -c -o libtcc.o +%CC% %target% -DONE_SOURCE ../libtcc.c -c -o libtcc.o %AR% rcs libtcc/libtcc.a libtcc.o +:libtcc.dll +%CC% %target% -shared -DLIBTCC_AS_DLL -DONE_SOURCE ../libtcc.c -o libtcc.dll +tiny_impdef libtcc.dll -o lib/libtcc.def :tcc -%CC% %target% -fno-strict-aliasing ../tcc.c -o tcc.exe -DTCC_USE_LIBTCC -ltcc -Llibtcc +%CC% %target% ../tcc.c -o tcc.exe -ltcc -Llibtcc :copy_std_includes copy ..\include\*.h include @@ -60,3 +61,7 @@ tiny_libmaker lib/libtcc1.a libtcc1.o alloca86_64.o crt1.o wincrt1.o dllcrt1.o d :the_end del *.o + +:libtcc_test +.\tcc -v -I libtcc -ltcc ../tests/libtcc_test.c +.\libtcc_test diff --git a/win32/include/_mingw.h b/win32/include/_mingw.h index e8e9561..00ff2fc 100644 --- a/win32/include/_mingw.h +++ b/win32/include/_mingw.h @@ -38,9 +38,8 @@ #define __unaligned __attribute__((packed)) #define __fastcall __attribute__((fastcall)) -// #define __MINGW_IMPORT extern __declspec(dllimport) +#define __MINGW_IMPORT extern __declspec(dllimport) #undef _MSVCRT_ -#undef __MINGW_IMPORT #define __MINGW_ATTRIB_NORETURN #define __MINGW_ATTRIB_CONST #define __MINGW_ATTRIB_DEPRECATED @@ -124,10 +123,12 @@ typedef struct localeinfo_struct _locale_tstruct,*_locale_t; #define _ANONYMOUS_STRUCT #define DECLSPEC_NORETURN #define DECLARE_STDCALL_P(type) __stdcall type -#define WIN32_LEAN_AND_MEAN #define NOSERVICE 1 #define NOMCX 1 #define NOIME 1 +#ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN 1 +#endif #ifndef WINVER # define WINVER 0x0502 #endif diff --git a/win32/include/malloc.h b/win32/include/malloc.h index bd9ad11..8426600 100644 --- a/win32/include/malloc.h +++ b/win32/include/malloc.h @@ -144,13 +144,9 @@ extern "C" { #endif /* RC_INVOKED */ #ifndef NO_OLDNAMES -#undef alloca #ifdef __GNUC__ +#undef alloca #define alloca(x) __builtin_alloca((x)) -#else -#ifndef __TINYC__ //gr -#define alloca _alloca -#endif #endif #endif diff --git a/win32/include/time.h b/win32/include/time.h index 9852fc7..6c72e26 100644 --- a/win32/include/time.h +++ b/win32/include/time.h @@ -119,10 +119,10 @@ extern "C" { #define CLOCKS_PER_SEC 1000 -//!__TINYC__: __MINGW_IMPORT int _daylight; -//!__TINYC__: __MINGW_IMPORT long _dstbias; -//!__TINYC__: __MINGW_IMPORT long _timezone; -//!__TINYC__: __MINGW_IMPORT char * _tzname[2]; + __MINGW_IMPORT int _daylight; + __MINGW_IMPORT long _dstbias; + __MINGW_IMPORT long _timezone; + __MINGW_IMPORT char * _tzname[2]; _CRTIMP errno_t __cdecl _get_daylight(int *_Daylight); _CRTIMP errno_t __cdecl _get_dstbias(long *_Daylight_savings_bias); _CRTIMP errno_t __cdecl _get_timezone(long *_Timezone); @@ -242,9 +242,10 @@ __CRT_INLINE time_t __cdecl time(time_t *_Time) { return _time64(_Time); } #if !defined(NO_OLDNAMES) || defined(_POSIX) #define CLK_TCK CLOCKS_PER_SEC - _CRTIMP extern int daylight; - _CRTIMP extern long timezone; - _CRTIMP extern char *tzname[2]; + __MINGW_IMPORT int daylight; + __MINGW_IMPORT long dstbias; + __MINGW_IMPORT long timezone; + __MINGW_IMPORT char *tzname[2]; void __cdecl tzset(void); #endif diff --git a/win32/lib/chkstk.S b/win32/lib/chkstk.S index d53b31e..2726061 100644 --- a/win32/lib/chkstk.S +++ b/win32/lib/chkstk.S @@ -57,17 +57,9 @@ P0: /* ---------------------------------------------- */ /* setjmp/longjmp support */ -.globl tinyc_no_getbp -tinyc_no_getbp: - .byte 0x90 - .globl tinyc_getbp tinyc_getbp: - xor %rax,%rax - cmp %al,tinyc_no_getbp(%rax) - je t1 mov %rbp,%rax -t1: ret /* ---------------------------------------------- */ diff --git a/win32/lib/kernel32.def b/win32/lib/kernel32.def index 85dd980..5d56705 100644 --- a/win32/lib/kernel32.def +++ b/win32/lib/kernel32.def @@ -549,7 +549,9 @@ ResetEvent ResetNLSUserInfoCache ResetWriteWatch ResumeThread +RtlAddFunctionTable RtlFillMemory +RtlInstallFunctionTableCallback RtlMoveMemory RtlUnwind RtlZeroMemory diff --git a/win32/tools/tiny_libmaker.c b/win32/tools/tiny_libmaker.c index c97b509..42373d8 100644 --- a/win32/tools/tiny_libmaker.c +++ b/win32/tools/tiny_libmaker.c @@ -27,6 +27,16 @@ #include "../../elf.h" +#ifdef TCC_TARGET_X86_64 +# define ELFCLASSW ELFCLASS64 +# define ElfW(type) Elf##64##_##type +# define ELFW(type) ELF##64##_##type +#else +# define ELFCLASSW ELFCLASS32 +# define ElfW(type) Elf##32##_##type +# define ELFW(type) ELF##32##_##type +#endif + #define ARMAG "!<arch>\n" #define ARFMAG "`\n" @@ -144,7 +154,7 @@ int main(int argc, char **argv) //printf("%s:\n", argv[iarg]); // elf header ehdr = (ElfW(Ehdr) *)buf; - if (ehdr->e_ident[4] != TCC_ELFCLASS) + if (ehdr->e_ident[4] != ELFCLASSW) { fprintf(stderr, "Unsupported Elf Class: %s\n", argv[iarg]); fclose(fo); |