diff --git a/include/stddef.h b/include/stddef.h index 791ba31..31b60dd 100644 --- a/include/stddef.h +++ b/include/stddef.h @@ -8,8 +8,9 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; typedef __PTRDIFF_TYPE__ intptr_t; typedef __SIZE_TYPE__ uintptr_t; -#ifndef __int8_t_defined +#if !defined(__int8_t_defined) && !defined(___int8_t_defined) #define __int8_t_defined +#define ___int8_t_defined typedef signed char int8_t; typedef signed short int int16_t; typedef signed int int32_t; diff --git a/lib/bcheck.c b/lib/bcheck.c index 18415cd..e3a8ef2 100644 --- a/lib/bcheck.c +++ b/lib/bcheck.c @@ -17,10 +17,10 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include +#include #if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) \ && !defined(__DragonFly__) && !defined(__OpenBSD__) && !defined(__NetBSD__) #include @@ -47,7 +47,7 @@ extern void *sbrk (intptr_t __delta); #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \ || defined(__DragonFly__) || defined(__dietlibc__) \ || defined(__UCLIBC__) || defined(__OpenBSD__) || defined(__NetBSD__) \ - || defined(_WIN32) || defined(TCC_UCLIBC) + || defined(_WIN32) || defined(TCC_UCLIBC) || defined(__CYGWIN__) #warning Bound checking does not support malloc (etc.) in this environment. #undef CONFIG_TCC_MALLOC_HOOKS #undef HAVE_MEMALIGN diff --git a/libtcc.c b/libtcc.c index 7d9a058..a5ec7f3 100644 --- a/libtcc.c +++ b/libtcc.c @@ -1170,6 +1170,8 @@ LIBTCCAPI TCCState *tcc_new(void) # ifdef TCC_TARGET_X86_64 tcc_define_symbol(s, "_WIN64", NULL); # endif +#elif defined(__CYGWIN__) + tcc_define_symbol(s, "__CYGWIN__", NULL); #else tcc_define_symbol(s, "__unix__", NULL); tcc_define_symbol(s, "__unix", NULL); diff --git a/tccrun.c b/tccrun.c index 52d3015..72c62e9 100644 --- a/tccrun.c +++ b/tccrun.c @@ -502,7 +502,7 @@ static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level) *paddr = uc->uc_mcontext->__ss.__eip; #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) *paddr = uc->uc_mcontext.mc_eip; -#elif defined(__dietlibc__) +#elif defined(__dietlibc__) || defined(__CYGWIN__) *paddr = uc->uc_mcontext.eip; #elif defined(__NetBSD__) *paddr = uc->uc_mcontext.__gregs[_REG_EIP]; @@ -515,7 +515,7 @@ static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level) fp = uc->uc_mcontext->__ss.__ebp; #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) fp = uc->uc_mcontext.mc_ebp; -#elif defined(__dietlibc__) +#elif defined(__dietlibc__) || defined(__CYGWIN__) fp = uc->uc_mcontext.ebp; #elif defined(__NetBSD__) fp = uc->uc_mcontext.__gregs[_REG_EBP];