Patch from Cygwin to fix segfault when using the JIT compiler; see 
https://trac.sagemath.org/ticket/23291
--- a/sljit/sljitConfigInternal.h	2016-04-06 03:05:43.000000000 -0500
+++ b/sljit/sljitConfigInternal.h	2016-08-11 14:33:58.201820000 -0500
@@ -564,7 +564,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_free
 
 #elif (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
 
-#ifndef _WIN64
+#if !defined _WIN64 && !defined __CYGWIN__
 #define SLJIT_NUMBER_OF_REGISTERS 12
 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 6
 #define SLJIT_LOCALS_OFFSET_BASE (sizeof(sljit_sw))
@@ -572,7 +572,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_free
 #define SLJIT_NUMBER_OF_REGISTERS 12
 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 8
 #define SLJIT_LOCALS_OFFSET_BASE ((4 + 2) * sizeof(sljit_sw))
-#endif /* _WIN64 */
+#endif /* _WIN64 || __CYGWIN__ */
 
 #elif (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
 
@@ -644,7 +644,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_free
 	(SLJIT_NUMBER_OF_REGISTERS - SLJIT_NUMBER_OF_SAVED_REGISTERS)
 
 #define SLJIT_NUMBER_OF_FLOAT_REGISTERS 6
-#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) && (defined _WIN64)
+#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) && (defined _WIN64 || defined __CYGWIN__)
 #define SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS 1
 #else
 #define SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS 0
--- a/sljit/sljitNativeX86_32.c	2016-02-29 11:00:26.000000000 -0600
+++ b/sljit/sljitNativeX86_32.c	2016-08-11 14:34:29.121178600 -0500
@@ -164,7 +164,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 #endif
 
 	compiler->local_size = local_size;
-#ifdef _WIN32
+#if defined _WIN32 || defined __CYGWIN__
 	if (local_size > 1024) {
 #if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
 		FAIL_IF(emit_do_imm(compiler, MOV_r_i32 + reg_map[SLJIT_R0], local_size));
--- a/sljit/sljitNativeX86_64.c	2016-02-29 11:00:26.000000000 -0600
+++ b/sljit/sljitNativeX86_64.c	2016-08-11 14:35:57.151763100 -0500
@@ -131,7 +131,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 
 		INC_SIZE(size);
 
-#ifndef _WIN64
+#if !defined _WIN64 && !defined __CYGWIN__
 		if (args > 0) {
 			*inst++ = REX_W;
 			*inst++ = MOV_r_rm;
@@ -169,7 +169,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 	local_size = ((local_size + SLJIT_LOCALS_OFFSET + saved_register_size + 15) & ~15) - saved_register_size;
 	compiler->local_size = local_size;
 
-#ifdef _WIN64
+#if defined _WIN64 || defined __CYGWIN__
 	if (local_size > 1024) {
 		/* Allocate stack for the callback, which grows the stack. */
 		inst = (sljit_u8*)ensure_buf(compiler, 1 + 4 + (3 + sizeof(sljit_s32)));
@@ -223,7 +223,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 		inst += sizeof(sljit_s32);
 	}
 
-#ifdef _WIN64
+#if defined _WIN64 || defined __CYGWIN__
 	/* Save xmm6 register: movaps [rsp + 0x20], xmm6 */
 	if (fscratches >= 6 || fsaveds >= 1) {
 		inst = (sljit_u8*)ensure_buf(compiler, 1 + 5);
@@ -264,7 +264,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 	compiler->flags_saved = 0;
 	FAIL_IF(emit_mov_before_return(compiler, op, src, srcw));
 
-#ifdef _WIN64
+#if defined _WIN64 || defined __CYGWIN__
 	/* Restore xmm6 register: movaps xmm6, [rsp + 0x20] */
 	if (compiler->fscratches >= 6 || compiler->fsaveds >= 1) {
 		inst = (sljit_u8*)ensure_buf(compiler, 1 + 5);
@@ -557,7 +557,7 @@ static SLJIT_INLINE sljit_s32 call_with_
 {
 	sljit_u8 *inst;
 
-#ifndef _WIN64
+#if !defined _WIN64 && !defined __CYGWIN__
 	SLJIT_COMPILE_ASSERT(reg_map[SLJIT_R1] == 6 && reg_map[SLJIT_R0] < 8 && reg_map[SLJIT_R2] < 8, args_registers);
 
 	inst = (sljit_u8*)ensure_buf(compiler, 1 + ((type < SLJIT_CALL3) ? 3 : 6));
--- a/sljit/sljitNativeX86_common.c	2016-03-04 03:20:25.000000000 -0600
+++ b/sljit/sljitNativeX86_common.c	2016-08-11 14:39:01.993876900 -0500
@@ -87,7 +87,7 @@ static const sljit_u8 reg_map[SLJIT_NUMB
 /* Note: r12 & 0x7 == 0b100, which decoded as SIB byte present
    Note: avoid to use r12 and r13 for memory addessing
    therefore r12 is better for SAVED_EREG than SAVED_REG. */
-#ifndef _WIN64
+#if !defined _WIN64 && !defined __CYGWIN__
 /* 1st passed in rdi, 2nd argument passed in rsi, 3rd in rdx. */
 static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 5] = {
 	0, 0, 6, 1, 8, 11, 10, 12, 5, 13, 14, 15, 3, 4, 2, 7, 9
@@ -628,7 +628,7 @@ static SLJIT_INLINE sljit_s32 emit_resto
 	return SLJIT_SUCCESS;
 }
 
-#ifdef _WIN32
+#if defined _WIN32 || defined __CYGWIN__
 #include <malloc.h>
 
 static void SLJIT_CALL sljit_grow_stack(sljit_sw local_size)
@@ -750,7 +750,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 	case SLJIT_DIV_SW:
 		compiler->flags_saved = 0;
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-#ifdef _WIN64
+#if defined _WIN64 || defined __CYGWIN__
 		SLJIT_COMPILE_ASSERT(
 			reg_map[SLJIT_R0] == 0
 			&& reg_map[SLJIT_R1] == 2
@@ -769,7 +769,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 
 		op = GET_OPCODE(op);
 		if ((op | 0x2) == SLJIT_DIV_UW) {
-#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || defined(_WIN64)
+#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || defined(_WIN64) || defined(__CYGWIN__)
 			EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_R1, 0);
 			inst = emit_x86_instruction(compiler, 1, SLJIT_R1, 0, SLJIT_R1, 0);
 #else
@@ -780,7 +780,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 		}
 
 		if ((op | 0x2) == SLJIT_DIV_SW) {
-#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || defined(_WIN64)
+#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || defined(_WIN64) || defined(__CYGWIN__)
 			EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_R1, 0);
 #endif
 
@@ -812,7 +812,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 		*inst++ = GROUP_F7;
 		*inst = MOD_REG | ((op >= SLJIT_DIVMOD_UW) ? reg_map[TMP_REG1] : reg_map[SLJIT_R1]);
 #else
-#ifdef _WIN64
+#if defined _WIN64 || defined __CYGWIN__
 		size = (!compiler->mode32 || op >= SLJIT_DIVMOD_UW) ? 3 : 2;
 #else
 		size = (!compiler->mode32) ? 3 : 2;
@@ -820,7 +820,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 		inst = (sljit_u8*)ensure_buf(compiler, 1 + size);
 		FAIL_IF(!inst);
 		INC_SIZE(size);
-#ifdef _WIN64
+#if defined _WIN64 || defined __CYGWIN__
 		if (!compiler->mode32)
 			*inst++ = REX_W | ((op >= SLJIT_DIVMOD_UW) ? REX_B : 0);
 		else if (op >= SLJIT_DIVMOD_UW)
@@ -850,7 +850,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 			*inst |= IDIV;
 			break;
 		}
-#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) && !defined(_WIN64)
+#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) && !defined(_WIN64) && !defined(__CYGWIN__)
 		if (op <= SLJIT_DIVMOD_SW)
 			EMIT_MOV(compiler, SLJIT_R1, 0, TMP_REG1, 0);
 #else
@@ -2616,7 +2616,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 			srcw += sizeof(sljit_sw);
 #endif
 #endif
-#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) && defined(_WIN64)
+#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) && (defined(_WIN64) || defined(__CYGWIN__))
 		if (src == SLJIT_R2) {
 			EMIT_MOV(compiler, TMP_REG1, 0, src, 0);
 			src = TMP_REG1;
