summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2014-05-23 01:53:21 +0400
committerIvan Maidanski <ivmai@mail.ru>2014-05-23 10:57:41 +0400
commita75dfe9f74ea7ffe49e15e91be9b2bac7b6020c7 (patch)
tree6cd3ec2a96c20d22ebaaaf7594fce56ea31a44ff
parent86bf95d0689b48c8a2240b9307b3c1c7e81fa45f (diff)
downloadbdwgc-a75dfe9f74ea7ffe49e15e91be9b2bac7b6020c7.tar.gz
Fix (enable) Cygwin-64 build
* include/gc.h (GC_DATASTART, GC_DATAEND): Define for Cygwin-64. * include/private/gcconfig.h (X86_64): Likewise. * include/private/gcconfig.h (OS_TYPE, DATASTART, DATAEND, STACK_GRAN, NEED_FIND_LIMIT, USE_MMAP_ANON): Define for Cygwin-64 (code copied from Cygwin-32 block). * os_dep.c (GC_get_stack_base): Get the stack base for Cygwin-64 (implementation based on NtCurrentTeb call).
-rw-r--r--include/gc.h2
-rw-r--r--include/private/gcconfig.h17
-rw-r--r--os_dep.c12
3 files changed, 25 insertions, 6 deletions
diff --git a/include/gc.h b/include/gc.h
index 3715df31..2ed29184 100644
--- a/include/gc.h
+++ b/include/gc.h
@@ -1592,7 +1592,7 @@ GC_API int GC_CALL GC_get_force_unmap_on_gcollect(void);
/* THREAD_LOCAL_ALLOC defined and the initial allocation call is not */
/* to GC_malloc() or GC_malloc_atomic(). */
-#ifdef __CYGWIN32__
+#if defined(__CYGWIN32__) || defined(__CYGWIN__)
/* Similarly gnu-win32 DLLs need explicit initialization from the */
/* main program, as does AIX. */
extern int _data_start__[], _data_end__[], _bss_start__[], _bss_end__[];
diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
index f866cc4e..c753cc2b 100644
--- a/include/private/gcconfig.h
+++ b/include/private/gcconfig.h
@@ -481,7 +481,11 @@
# define mach_type_known
# endif
# if defined(__CYGWIN32__) || defined(__CYGWIN__)
-# define I386
+# if defined(__LP64__)
+# define X86_64
+# else
+# define I386
+# endif
# define CYGWIN32
# define mach_type_known
# endif
@@ -1892,6 +1896,17 @@
# endif /* __INTEL_COMPILER */
# endif
# endif
+# ifdef CYGWIN32
+# define OS_TYPE "CYGWIN32"
+# define DATASTART ((ptr_t)GC_DATASTART) /* From gc.h */
+# define DATAEND ((ptr_t)GC_DATAEND)
+# undef STACK_GRAN
+# define STACK_GRAN 0x10000
+# ifdef USE_MMAP
+# define NEED_FIND_LIMIT
+# define USE_MMAP_ANON
+# endif
+# endif
# ifdef MSWIN32
/* FIXME: This is a very partial guess. There is no port, yet. */
# define OS_TYPE "MSWIN32"
diff --git a/os_dep.c b/os_dep.c
index 2ff72efa..08c501df 100644
--- a/os_dep.c
+++ b/os_dep.c
@@ -795,11 +795,15 @@ GC_INNER word GC_page_size = 0;
/* gcc version of boehm-gc). */
GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *sb)
{
- void * _tlsbase;
+# ifdef X86_64
+ sb -> mem_base = ((NT_TIB*)NtCurrentTeb())->StackBase;
+# else
+ void * _tlsbase;
- __asm__ ("movl %%fs:4, %0"
- : "=r" (_tlsbase));
- sb -> mem_base = _tlsbase;
+ __asm__ ("movl %%fs:4, %0"
+ : "=r" (_tlsbase));
+ sb -> mem_base = _tlsbase;
+# endif
return GC_SUCCESS;
}
# endif /* CYGWIN32 */