Boehm garbage collector.
authorRichard W.M. Jones <rjones@redhat.com>
Fri, 24 Oct 2008 14:59:25 +0000 (15:59 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Fri, 24 Oct 2008 14:59:25 +0000 (15:59 +0100)
.hgignore
gc/gc-7.1-dont_add_byte.patch [new file with mode: 0644]
gc/gc-7.1-gcinit.patch [new file with mode: 0644]
gc/gc-7.1-sparc.patch [new file with mode: 0644]
gc/mingw32-gc-7.1-set-win32-threads.patch [new file with mode: 0644]
gc/mingw32-gc.spec [new file with mode: 0644]

index 1f723fa..49aefa9 100644 (file)
--- a/.hgignore
+++ b/.hgignore
@@ -15,6 +15,7 @@ cairo/svgspacewar.exe
 fontconfig/fontconfig-2.6.0.tar.gz
 freetype/freetype-2.3.7.tar.bz2
 freetype/freetype-doc-2.3.7.tar.bz2
+gc/gc-7.1.tar.gz
 gcc/gcc-core-4.3.2.tar.bz2
 gcc/gcc-g++-4.3.2.tar.bz2
 gdbm/gdbm-1.8.0.tar.gz
diff --git a/gc/gc-7.1-dont_add_byte.patch b/gc/gc-7.1-dont_add_byte.patch
new file mode 100644 (file)
index 0000000..6161973
--- /dev/null
@@ -0,0 +1,23 @@
+diff -up gc-7.1/thread_local_alloc.c.dont_add_byte gc-7.1/thread_local_alloc.c
+--- gc-7.1/thread_local_alloc.c.dont_add_byte  2007-10-24 19:22:37.000000000 -0500
++++ gc-7.1/thread_local_alloc.c        2008-09-08 06:53:20.000000000 -0500
+@@ -291,14 +291,16 @@ void GC_mark_thread_local_fls_for(GC_tlf
+     ptr_t q;
+     int j;
+     
+-    for (j = 1; j < TINY_FREELISTS; ++j) {
++    for (j = 0; j < TINY_FREELISTS; ++j) {
+       q = p -> ptrfree_freelists[j];
+       if ((word)q > HBLKSIZE) GC_set_fl_marks(q);
+       q = p -> normal_freelists[j];
+       if ((word)q > HBLKSIZE) GC_set_fl_marks(q);
+ #     ifdef GC_GCJ_SUPPORT
+-        q = p -> gcj_freelists[j];
+-        if ((word)q > HBLKSIZE) GC_set_fl_marks(q);
++      if (j > 0) {
++         q = p -> gcj_freelists[j];
++         if ((word)q > HBLKSIZE) GC_set_fl_marks(q);
++      }
+ #     endif /* GC_GCJ_SUPPORT */
+     }
+ }
diff --git a/gc/gc-7.1-gcinit.patch b/gc/gc-7.1-gcinit.patch
new file mode 100644 (file)
index 0000000..ba6492c
--- /dev/null
@@ -0,0 +1,26 @@
+diff -up gc-7.1/thread_local_alloc.c.gcinit gc-7.1/thread_local_alloc.c
+--- gc-7.1/thread_local_alloc.c.gcinit 2007-10-24 19:22:37.000000000 -0500
++++ gc-7.1/thread_local_alloc.c        2008-10-15 07:13:45.000000000 -0500
+@@ -141,6 +141,9 @@ void * GC_malloc(size_t bytes)
+     void *result;
+     void **tiny_fl;
++    if (!GC_is_initialized)
++      GC_init();
++
+ #   if !defined(USE_PTHREAD_SPECIFIC) && !defined(USE_WIN32_SPECIFIC)
+       GC_key_t k = GC_thread_key;
+       if (EXPECT(0 == k, 0)) {
+diff -up gc-7.1/malloc.c.gcinit gc-7.1/malloc.c
+--- gc-7.1/malloc.c.gcinit     2008-03-10 00:33:41.000000000 -0500
++++ gc-7.1/malloc.c    2008-10-15 07:12:31.000000000 -0500
+@@ -263,6 +263,9 @@ void * GC_generic_malloc(size_t lb, int 
+     size_t lg;
+     DCL_LOCK_STATE;
++    if (!GC_is_initialized)
++      GC_init();
++
+     if(SMALL_OBJ(lb)) {
+       lg = GC_size_map[lb];
+       opp = (void **)&(GC_objfreelist[lg]);
diff --git a/gc/gc-7.1-sparc.patch b/gc/gc-7.1-sparc.patch
new file mode 100644 (file)
index 0000000..d2f34eb
--- /dev/null
@@ -0,0 +1,41 @@
+diff -up gc-7.1/configure.sparc gc-7.1/configure
+--- gc-7.1/configure.sparc     2008-05-03 19:52:50.000000000 -0500
++++ gc-7.1/configure   2008-10-15 07:01:18.000000000 -0500
+@@ -6161,6 +6161,9 @@ _ACEOF
+  sparc-*-netbsd*)
+     machdep="mach_dep.lo sparc_netbsd_mach_dep.lo"
+     ;;
++ sparc*-*-linux*)
++    machdep="mach_dep.lo sparc_mach_dep.lo"
++    ;;
+  sparc-sun-solaris2.3)
+     machdep="mach_dep.lo sparc_mach_dep.lo"
+     cat >>confdefs.h <<\_ACEOF
+diff -up gc-7.1/configure.ac.sparc gc-7.1/configure.ac
+--- gc-7.1/configure.ac.sparc  2008-05-03 19:52:06.000000000 -0500
++++ gc-7.1/configure.ac        2008-10-15 07:01:18.000000000 -0500
+@@ -405,6 +405,9 @@ case "$host" in
+  sparc-*-netbsd*)
+     machdep="mach_dep.lo sparc_netbsd_mach_dep.lo"
+     ;;
++ sparc*-*-linux*)
++    machdep="mach_dep.lo sparc_mach_dep.lo"
++    ;;
+  sparc-sun-solaris2.3)
+     machdep="mach_dep.lo sparc_mach_dep.lo"
+     AC_DEFINE(SUNOS53_SHARED_LIB)
+diff -up gc-7.1/mach_dep.c.sparc gc-7.1/mach_dep.c
+--- gc-7.1/mach_dep.c.sparc    2007-08-13 16:49:11.000000000 -0500
++++ gc-7.1/mach_dep.c  2008-10-15 07:03:35.000000000 -0500
+@@ -175,9 +175,10 @@ void GC_with_callee_saves_pushed(void (*
+ #   if defined(HAVE_PUSH_REGS)
+       GC_push_regs();
+ #   elif defined(UNIX_LIKE) && !defined(DARWIN) && !defined(ARM32) && \
+-       !defined(HURD)
++       !defined(HURD) && !defined(SPARC)
+       /* Older versions of Darwin seem to lack getcontext(). */
+       /* ARM Linux often doesn't support a real getcontext(). */
++      /* SPARC 32bit Linux doesn't support getcontext(). */
+       ucontext_t ctxt;
+       if (getcontext(&ctxt) < 0)
+       ABORT ("Getcontext failed: Use another register retrieval method?");
diff --git a/gc/mingw32-gc-7.1-set-win32-threads.patch b/gc/mingw32-gc-7.1-set-win32-threads.patch
new file mode 100644 (file)
index 0000000..0265a57
--- /dev/null
@@ -0,0 +1,10 @@
+--- gc-7.1/configure.ac.orig   2008-10-24 15:44:08.000000000 +0100
++++ gc-7.1/configure.ac        2008-10-24 15:43:43.000000000 +0100
+@@ -189,6 +189,7 @@
+     AC_DEFINE(GC_WIN32_THREADS)
+     dnl Wine getenv may not return NULL for missing entry
+     AC_DEFINE(NO_GETENV)
++    win32_threads=true
+     ;;
+  dgux386)
+     THREADS=dgux386
diff --git a/gc/mingw32-gc.spec b/gc/mingw32-gc.spec
new file mode 100644 (file)
index 0000000..772a22d
--- /dev/null
@@ -0,0 +1,115 @@
+%define __strip %{_mingw32_strip}
+%define __objdump %{_mingw32_objdump}
+%define _use_internal_dependency_generator 0
+%define __find_requires %{_mingw32_findrequires}
+%define __find_provides %{_mingw32_findprovides}
+
+Name:           mingw32-gc
+Version:        7.1
+Release:        1%{?dist}
+Summary:        MinGW Windows port of GC garbage collector for C and C++
+
+License:        BSD
+Group:          Development/Libraries
+URL:            http://www.hpl.hp.com/personal/Hans_Boehm/gc/
+Source0:        http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc-%{version}.tar.gz
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildArch:      noarch
+
+# To be more backward-compatible abi-wise, TODO: upstream ml reference
+Patch1:         gc-7.1-gcinit.patch
+Patch3:         gc-7.1-sparc.patch
+## upstream patches
+# http://www.hpl.hp.com/hosted/linux/mail-archives/gc/2008-May/002206.html
+Patch100:       gc-7.1-dont_add_byte.patch
+
+# MinGW-specific patches.
+Patch1000:      mingw32-gc-7.1-set-win32-threads.patch
+
+BuildRequires:  mingw32-filesystem >= 30
+BuildRequires:  mingw32-gcc
+BuildRequires:  mingw32-binutils
+
+# XXX Native package uses a separate libatomic_ops library.
+# We don't have this for MinGW yet, so gc will use its own
+# copy of this library during the build.
+
+BuildRequires:  automake, libtool
+
+Requires:       pkgconfig
+
+
+%description
+The Boehm-Demers-Weiser conservative garbage collector can be 
+used as a garbage collecting replacement for C malloc or C++ new.
+
+
+%prep
+%setup -q -n gc-%{version}
+
+# FIXME? -- Rex
+%if 0%{?rhel} < 6 && 0%{?fedora} < 10
+%patch1 -p1 -b .gcinit
+%endif
+%patch3 -p1 -b .sparc
+
+%patch100 -p1 -b .dont_add_byte
+
+%patch1000 -p1 -b .set_win32_threads
+
+# refresh auto*/libtool to purge rpaths
+rm -f libtool libtool.m4
+libtoolize --force
+autoreconf -i
+
+
+%build
+%{_mingw32_configure} \
+  --disable-dependency-tracking \
+  --disable-static \
+  --enable-cplusplus \
+  --enable-large-config \
+  --enable-parallel-mark \
+  --enable-threads=win32
+make
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make DESTDIR=$RPM_BUILD_ROOT install
+
+# The docs duplicate what is already in the native gc-devel
+# package, except for README.win32 which is not in that
+# package but useful for Windows developers.
+mkdir -p $RPM_BUILD_ROOT%{_mingw32_docdir}/%{name}-%{version}
+mv $RPM_BUILD_ROOT%{_mingw32_datadir}/gc/README.win* \
+  $RPM_BUILD_ROOT%{_mingw32_docdir}/%{name}-%{version}/
+rm -r $RPM_BUILD_ROOT%{_mingw32_datadir}/gc
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%files
+%defattr(-,root,root)
+%{_mingw32_bindir}/libcord-1.dll
+%{_mingw32_bindir}/libgc-1.dll
+%{_mingw32_bindir}/libgccpp-1.dll
+%{_mingw32_libdir}/libcord.dll.a
+%{_mingw32_libdir}/libgc.dll.a
+%{_mingw32_libdir}/libgccpp.dll.a
+%{_mingw32_libdir}/libcord.la
+%{_mingw32_libdir}/libgc.la
+%{_mingw32_libdir}/libgccpp.la
+%{_mingw32_libdir}/pkgconfig/bdw-gc.pc
+%{_mingw32_docdir}/%{name}-%{version}
+%{_mingw32_includedir}/gc.h
+%{_mingw32_includedir}/gc_cpp.h
+%{_mingw32_includedir}/gc/
+
+
+%changelog
+* Fri Oct 24 2008 Richard W.M. Jones <rjones@redhat.com> - 7.1-1
+- Initial RPM release.