Fix Cygwin support. Note: this is not a supported target.

Contributed by Yaakov Selkowitz.
This commit is contained in:
Mike Pall 2015-09-20 19:17:02 +02:00
parent 8715ae65c1
commit 076d625dc6
3 changed files with 10 additions and 4 deletions

View File

@ -194,7 +194,7 @@ static LJ_AINLINE void *CALL_MMAP(size_t size)
return ptr;
}
#elif LJ_TARGET_OSX || LJ_TARGET_PS4 || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__sun__)
#elif LJ_TARGET_OSX || LJ_TARGET_PS4 || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__sun__) || defined(__CYGWIN__)
/* OSX and FreeBSD mmap() use a naive first-fit linear search.
** That's perfect for us. Except that -pagezero_size must be set for OSX,

View File

@ -151,7 +151,11 @@
#define LJ_ARCH_NAME "x64"
#define LJ_ARCH_BITS 64
#define LJ_ARCH_ENDIAN LUAJIT_LE
#define LJ_ABI_WIN LJ_TARGET_WINDOWS
#if LJ_TARGET_WINDOWS || __CYGWIN__
#define LJ_ABI_WIN 1
#else
#define LJ_ABI_WIN 0
#endif
#define LJ_TARGET_X64 1
#define LJ_TARGET_X86ORX64 1
#define LJ_TARGET_EHRETREG 0

View File

@ -186,7 +186,7 @@ static void *err_unwind(lua_State *L, void *stopcf, int errcode)
/* -- External frame unwinding -------------------------------------------- */
#if defined(__GNUC__) && !LJ_NO_UNWIND && !LJ_TARGET_WINDOWS
#if defined(__GNUC__) && !LJ_NO_UNWIND && !LJ_ABI_WIN
/*
** We have to use our own definitions instead of the mandatory (!) unwind.h,
@ -352,7 +352,7 @@ LJ_FUNCA int lj_err_unwind_arm(int state, void *ucb, _Unwind_Context *ctx)
#endif
#elif LJ_TARGET_X64 && LJ_TARGET_WINDOWS
#elif LJ_TARGET_X64 && LJ_ABI_WIN
/*
** Someone in Redmond owes me several days of my life. A lot of this is
@ -417,7 +417,9 @@ LJ_FUNCA EXCEPTION_DISPOSITION lj_err_unwind_win64(EXCEPTION_RECORD *rec,
if (cf2) { /* We catch it, so start unwinding the upper frames. */
if (rec->ExceptionCode == LJ_MSVC_EXCODE ||
rec->ExceptionCode == LJ_GCC_EXCODE) {
#if LJ_TARGET_WINDOWS
__DestructExceptionObject(rec, 1);
#endif
setstrV(L, L->top++, lj_err_str(L, LJ_ERR_ERRCPP));
} else if (!LJ_EXCODE_CHECK(rec->ExceptionCode)) {
/* Don't catch access violations etc. */