From 6a44e6b5fd93c575684baf7ed576353507f9d7ff Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Sat, 19 May 2018 09:50:23 +0300 Subject: [PATCH] Enable compilation for Cygwin with MPROTECT_VDB Note: It just compiles but not working. * include/private/gc_priv.h [GC_WIN32_THREADS && MPROTECT_VDB] (GC_set_write_fault_handler): Do not declare if CYGWIN32. * os_dep.c [MPROTECT_VDB && !DARWIN && !USE_WINALLOC]: Do not include sys/syscall.h if CYGWIN32. * os_dep.c [MPROTECT_VDB && CYGWIN32] (CODE_OK): Define (to true). * os_dep.c [MPROTECT_VDB && GC_WIN32_THREADS] (GC_set_write_fault_handler): Do not define if CYGWIN32. * win32_threads.c [MPROTECT_VDB] (GC_register_my_thread_inner): Do not call GC_gww_dirty_init() and GC_set_write_fault_handler() if CYGWIN32. --- include/private/gc_priv.h | 2 +- os_dep.c | 6 +++--- win32_threads.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index 8bcd690..953a31f 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -2405,7 +2405,7 @@ GC_INNER void *GC_store_debug_info_inner(void *p, word sz, const char *str, #ifdef GC_WIN32_THREADS GC_INNER void GC_get_next_stack(char *start, char * limit, char **lo, char **hi); -# ifdef MPROTECT_VDB +# if defined(MPROTECT_VDB) && !defined(CYGWIN32) GC_INNER void GC_set_write_fault_handler(void); # endif # if defined(WRAP_MARK_SOME) && !defined(GC_PTHREADS) diff --git a/os_dep.c b/os_dep.c index 17478ec..c84a4d8 100644 --- a/os_dep.c +++ b/os_dep.c @@ -3094,7 +3094,7 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void) # elif !defined(USE_WINALLOC) # include # include -# if !defined(HAIKU) +# if !defined(CYGWIN32) && !defined(HAIKU) # include # endif @@ -3272,7 +3272,7 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void) # define CODE_OK (si -> si_code == 2 /* experimentally determined */) # elif defined(IRIX5) # define CODE_OK (si -> si_code == EACCES) -# elif defined(HAIKU) || defined(HURD) +# elif defined(CYGWIN32) || defined(HAIKU) || defined(HURD) # define CODE_OK TRUE # elif defined(LINUX) # define CODE_OK TRUE @@ -3411,7 +3411,7 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void) # endif } -# ifdef GC_WIN32_THREADS +# if defined(GC_WIN32_THREADS) && !defined(CYGWIN32) GC_INNER void GC_set_write_fault_handler(void) { SetUnhandledExceptionFilter(GC_write_fault_handler); diff --git a/win32_threads.c b/win32_threads.c index a298534..17df544 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -392,7 +392,7 @@ STATIC GC_thread GC_register_my_thread_inner(const struct GC_stack_base *sb, /* The following should be a no-op according to the win32 */ /* documentation. There is empirical evidence that it */ /* isn't. - HB */ -# if defined(MPROTECT_VDB) +# if defined(MPROTECT_VDB) && !defined(CYGWIN32) if (GC_incremental # ifdef GWW_VDB && !GC_gww_dirty_init() -- 2.7.4