Re: [Gc] Boehm-GC Patch for Cygwin-64
Bernd Edlinger <[email protected]> Tue, 20 May 2014 10:05:53 +0200
| Newsgroups | gmane.comp.programming.garbage-collection.boehmgc |
|---|---|
| Message-ID | <[email protected]> |
Hi Ivan, On Wed, 14 May 2014 10:14:55, Ivan Maidanski wrote: > > > Hi Bernd, > > To be included in the upstream, please make the patch against fresh > master of bdwgc.git > > Thanks > > -- > OK, I did that now. Please see the attached patch which is against last week's bdwgc_master. I tested it on Cygwin-32 and Cygwin-64, all tests in the "make check" pass. I linked it against libatomic_ops7.2e. As a side note, I'd like to mention, that the libtool makes it nearly impossible to create a shared libgc, using a static libatomic_ops under cygwin-32 and -64. That seems to be a known issue under cygwin, see: https://www.mail-archive.com/bug-libtool-mXXj517/[email protected]/msg01323.html The only way I found, how to bypass this is using this configure option: ./configure --prefix=<where to install libgc> ATOMIC_OPS_CFLAGS=-I<path to atomic_ops>/include ATOMIC_OPS_LIBS=<path to atomic_ops>/lib/libatomic_ops.a This works, but just by chance. Although the libatimoc_ops.a is given with full path, libtool throws it on the floor afterwards. However the build succeeds because nothing from that library is actually referenced. Thanks Bernd. _______________________________________________ bdwgc mailing list [email protected] https://lists.opendylan.org/mailman/listinfo/bdwgc
bdwgc-cygwin64.diff
(application/octet-stream, 2.1 KB)
2014-05-20 Bernd Edlinger <[email protected]> Fix current cygwin-64 build problems. * include/private/gcconfig.h: Define X86_64 instead of I386 for cygwin-64. Copy the CYGWIN32 block from the I386 section to the X86_64 section. * os_dep.c (GC_get_stack_base): Get the stack base for X86_64. diff -pur bdwgc-master.orig/include/private/gcconfig.h bdwgc-master/include/private/gcconfig.h --- bdwgc-master.orig/include/private/gcconfig.h 2014-05-03 22:30:13.000000000 +0200 +++ bdwgc-master/include/private/gcconfig.h 2014-05-19 12:27:58.000000000 +0200 @@ -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 @@ -1888,6 +1892,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 -pur bdwgc-master.orig/os_dep.c bdwgc-master/os_dep.c --- bdwgc-master.orig/os_dep.c 2014-05-03 22:30:13.000000000 +0200 +++ bdwgc-master/os_dep.c 2014-05-19 12:37:55.000000000 +0200 @@ -795,11 +795,15 @@ /* 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 */