[Gc] [RFC] patch, MPROTECT_VDB support for Darwin

Andreas Tobler toa at pop.agri.ch
Thu Feb 8 12:57:33 PST 2007


Andreas Tobler wrote:
> Boehm, Hans wrote:
>> This looks OK to me, thanks.
>>
>> But I'm not an expert on either Darwin or autoconf conventions.  Other
>> opinions would be useful.
> 
> Thanks Hans.
> 
> Regarding the autoconf variant I will work out a proposal which does 
> only affect the configure and the Makefile files.
> 
> In the gcc/libjava we do it this way. It may simplify the readability if 
> we introduce an extra_ldflags_libgc and have it only in those files.

Here it is, it's now on you to decide which one is preferable.

Thanks,
Andreas

P.S, CL will be adapted if needed.


-------------- next part --------------
Index: Makefile.am
===================================================================
RCS file: /cvsroot/bdwgc/bdwgc/Makefile.am,v
retrieving revision 1.8
diff -u -r1.8 Makefile.am
--- Makefile.am	7 Jul 2006 21:10:07 -0000	1.8
+++ Makefile.am	8 Feb 2007 20:55:38 -0000
@@ -87,11 +87,13 @@
 libgc_la_SOURCES += atomic_ops_sysdeps.S
 endif
 
+extra_ldflags_libgc = @extra_ldflags_libgc@
+
 # Include THREADDLLIBS here to ensure that the correct versions of
 # linuxthread semaphore functions get linked:
 libgc_la_LIBADD = @addobjs@ $(THREADDLLIBS) $(UNWINDLIBS)
 libgc_la_DEPENDENCIES = @addobjs@
-libgc_la_LDFLAGS = -version-info 1:2:0
+libgc_la_LDFLAGS = $(extra_ldflags_libgc) -version-info 1:2:0
 
 EXTRA_libgc_la_SOURCES = alpha_mach_dep.S \
     mips_sgi_mach_dep.s mips_ultrix_mach_dep.s \
Index: configure.ac
===================================================================
RCS file: /cvsroot/bdwgc/bdwgc/configure.ac,v
retrieving revision 1.20
diff -u -r1.20 configure.ac
--- configure.ac	25 Jan 2007 23:43:10 -0000	1.20
+++ configure.ac	8 Feb 2007 20:55:39 -0000
@@ -293,11 +293,19 @@
 # dyld calls anyway
 case "$host" in
   *-*-darwin*) ;;
-  *) 
+  *)
     AC_CHECK_LIB(dl, dlopen, THREADDLLIBS="$THREADDLLIBS -ldl")
     ;;
 esac
 
+# extra LD Flags which are required for targets
+case "${host}" in
+  *-*-darwin*)
+    extra_ldflags_libgc=-Wl,-single_module
+    ;;
+esac
+AC_SUBST(extra_ldflags_libgc)
+
 AC_SUBST(EXTRA_TEST_LIBS)
 
 target_all=libgc.la
Index: include/private/gcconfig.h
===================================================================
RCS file: /cvsroot/bdwgc/bdwgc/include/private/gcconfig.h,v
retrieving revision 1.22
diff -u -r1.22 gcconfig.h
--- include/private/gcconfig.h	11 Jan 2007 19:32:44 -0000	1.22
+++ include/private/gcconfig.h	8 Feb 2007 20:55:41 -0000
@@ -748,25 +748,28 @@
 #     define DATAEND (_end)
 #   endif
 #   ifdef DARWIN
+#     define OS_TYPE "DARWIN"
+#     define DYNAMIC_LOADING
 #     if defined(__ppc64__)
 #       define ALIGNMENT 8
 #       define CPP_WORDSZ 64
+#       define STACKBOTTOM ((ptr_t) 0x7fff5fc00000)
+#       define CACHE_LINE_SIZE 64
+#       ifndef HBLKSIZE
+#         define HBLKSIZE 4096
+#       endif
 #     else
 #       define ALIGNMENT 4
+#       define STACKBOTTOM ((ptr_t) 0xc0000000)
 #     endif
-#     define OS_TYPE "DARWIN"
-#     define DYNAMIC_LOADING
       /* XXX: see get_end(3), get_etext() and get_end() should not be used.
 	 These aren't used when dyld support is enabled (it is by default) */
 #     define DATASTART ((ptr_t) get_etext())
 #     define DATAEND	((ptr_t) get_end())
-#     define STACKBOTTOM ((ptr_t) 0xc0000000)
 #     define USE_MMAP
 #     define USE_MMAP_ANON
 #     ifdef GC_DARWIN_THREADS
-       /* This is potentially buggy. It needs more testing. See the comments in
-	  os_dep.c.  It relies on threads to track writes. */
-/* #       define MPROTECT_VDB */
+#       define MPROTECT_VDB
 #     endif
 #     include <unistd.h>
 #     define GETPAGESIZE() getpagesize()
@@ -1282,10 +1285,8 @@
 #     define STACKBOTTOM ((ptr_t) 0xc0000000)
 #     define USE_MMAP
 #     define USE_MMAP_ANON
-      /* This is potentially buggy. It needs more testing. See the comments in
-	 os_dep.c.  It relies on threads to track writes. */
 #     ifdef GC_DARWIN_THREADS
-/* #       define MPROTECT_VDB -- disabled for now.  May work for some apps. */
+#       define MPROTECT_VDB
 #     endif
 #     include <unistd.h>
 #     define GETPAGESIZE() getpagesize()
@@ -1880,8 +1881,6 @@
 #     define USE_MMAP
 #     define USE_MMAP_ANON
 #     ifdef GC_DARWIN_THREADS
-       /* This is potentially buggy. It needs more testing. See the comments in
-	  os_dep.c.  It relies on threads to track writes. */
 #       define MPROTECT_VDB
 #     endif
 #     include <unistd.h>


More information about the Gc mailing list