fix boehm-gc with rthreads for gcc 4.6. based on kurt@'s work.

ok espie@
This commit is contained in:
pascal 2012-02-28 20:00:16 +00:00
parent 9f4f36912e
commit bdd5b86d65
8 changed files with 48 additions and 362 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.16 2012/02/16 21:30:15 pascal Exp $
# $OpenBSD: Makefile,v 1.17 2012/02/28 20:00:16 pascal Exp $
ONLY_FOR_ARCHS = amd64 i386 powerpc sparc sparc64
BROKEN-sparc64 = gengtype looping infinitely
@ -23,7 +23,7 @@ REVISION-main = 0
REVISION-c++ = 0
REVISION-estdc =0
REVISION-f95 = 0
REVISION-java = 0
REVISION-java = 1
REVISION-objc = 0
REVISION-ada = 0
REVISION-go = 0

View File

@ -1,55 +0,0 @@
$OpenBSD: patch-boehm-gc_Makefile_in,v 1.3 2011/12/08 17:40:55 pascal Exp $
--- boehm-gc/Makefile.in.orig Wed Oct 26 11:30:24 2011
+++ boehm-gc/Makefile.in Thu Dec 8 09:56:11 2011
@@ -64,13 +64,14 @@ CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
am__DEPENDENCIES_1 =
@POWERPC_DARWIN_TRUE@am__objects_1 = powerpc_darwin_mach_dep.lo
+@OPENBSD_THREADS_TRUE@am__objects_1 = openbsd_stop_world.lo
am_libgcjgc_la_OBJECTS = allchblk.lo alloc.lo blacklst.lo checksums.lo \
dbg_mlc.lo dyn_load.lo finalize.lo gc_dlopen.lo gcj_mlc.lo \
headers.lo malloc.lo mallocx.lo mark.lo mark_rts.lo misc.lo \
new_hblk.lo obj_map.lo os_dep.lo pcr_interface.lo ptr_chck.lo \
real_malloc.lo reclaim.lo specific.lo stubborn.lo typd_mlc.lo \
backgraph.lo win32_threads.lo pthread_support.lo \
- pthread_stop_world.lo darwin_stop_world.lo $(am__objects_1)
+ darwin_stop_world.lo $(am__objects_1)
libgcjgc_la_OBJECTS = $(am_libgcjgc_la_OBJECTS)
am__objects_2 = allchblk.lo alloc.lo blacklst.lo checksums.lo \
dbg_mlc.lo dyn_load.lo finalize.lo gc_dlopen.lo gcj_mlc.lo \
@@ -78,7 +79,7 @@ am__objects_2 = allchblk.lo alloc.lo blacklst.lo check
new_hblk.lo obj_map.lo os_dep.lo pcr_interface.lo ptr_chck.lo \
real_malloc.lo reclaim.lo specific.lo stubborn.lo typd_mlc.lo \
backgraph.lo win32_threads.lo pthread_support.lo \
- pthread_stop_world.lo darwin_stop_world.lo $(am__objects_1)
+ darwin_stop_world.lo $(am__objects_1)
am_libgcjgc_convenience_la_OBJECTS = $(am__objects_2)
libgcjgc_convenience_la_OBJECTS = \
$(am_libgcjgc_convenience_la_OBJECTS)
@@ -209,6 +210,8 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+OPENBSD_THREADS_FALSE = @OPENBSD_THREADS_FALSE@
+OPENBSD_THREADS_TRUE = @OPENBSD_THREADS_TRUE@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
@@ -287,15 +290,15 @@ AUTOMAKE_OPTIONS = cygnus subdir-objects
ACLOCAL_AMFLAGS = -I .. -I ../config
SUBDIRS = include
noinst_LTLIBRARIES = libgcjgc.la libgcjgc_convenience.la
-@POWERPC_DARWIN_FALSE@asm_libgcjgc_sources =
@POWERPC_DARWIN_TRUE@asm_libgcjgc_sources = powerpc_darwin_mach_dep.s
+@OPENBSD_THREADS_TRUE@asm_libgcjgc_sources = openbsd_stop_world.c.s
libgcjgc_la_SOURCES = allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c \
dyn_load.c finalize.c gc_dlopen.c gcj_mlc.c headers.c \
malloc.c mallocx.c mark.c mark_rts.c misc.c new_hblk.c \
obj_map.c os_dep.c pcr_interface.c ptr_chck.c real_malloc.c reclaim.c \
specific.c stubborn.c typd_mlc.c \
backgraph.c win32_threads.c \
-pthread_support.c pthread_stop_world.c darwin_stop_world.c \
+pthread_support.c darwin_stop_world.c \
$(asm_libgcjgc_sources)
libgcjgc_convenience_la_SOURCES = $(libgcjgc_la_SOURCES)

View File

@ -1,16 +1,7 @@
$OpenBSD: patch-boehm-gc_configure,v 1.4 2012/01/26 13:17:22 pascal Exp $
$OpenBSD: patch-boehm-gc_configure,v 1.5 2012/02/28 20:00:16 pascal Exp $
--- boehm-gc/configure.orig Wed Oct 26 11:30:24 2011
+++ boehm-gc/configure Wed Jan 25 18:20:55 2012
@@ -615,6 +615,8 @@ CPLUSPLUS_TRUE
target_all
EXTRA_TEST_LIBS
extra_ldflags_libgc
+OPENBSD_THREADS_TRUE
+OPENBSD_THREADS_FALSE
POWERPC_DARWIN_FALSE
POWERPC_DARWIN_TRUE
THREADLIBS
@@ -10756,7 +10758,7 @@ netbsd*)
+++ boehm-gc/configure Mon Feb 20 21:59:55 2012
@@ -10756,7 +10756,7 @@ netbsd*)
need_version=no
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
@ -19,7 +10,7 @@ $OpenBSD: patch-boehm-gc_configure,v 1.4 2012/01/26 13:17:22 pascal Exp $
dynamic_linker='NetBSD (a.out) ld.so'
else
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -14480,7 +14482,7 @@ openbsd*)
@@ -14480,7 +14480,7 @@ openbsd*)
*) need_version=no ;;
esac
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
@ -28,7 +19,7 @@ $OpenBSD: patch-boehm-gc_configure,v 1.4 2012/01/26 13:17:22 pascal Exp $
shlibpath_var=LD_LIBRARY_PATH
if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
case $host_os in
@@ -14855,6 +14857,12 @@ $as_echo "#define _REENTRANT 1" >>confdefs.h
@@ -14855,6 +14855,11 @@ $as_echo "#define _REENTRANT 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"Only HP-UX 11 POSIX threads are supported.\"" >&5
$as_echo "$as_me: WARNING: \"Only HP-UX 11 POSIX threads are supported.\"" >&2;}
;;
@ -36,26 +27,19 @@ $OpenBSD: patch-boehm-gc_configure,v 1.4 2012/01/26 13:17:22 pascal Exp $
+ $as_echo "#define GC_OPENBSD_THREADS 1" >>confdefs.h
+ THREADLIBS=-pthread
+ INCLUDES="$INCLUDES -pthread"
+ openbsd_threads=true
+ ;;
*-*-kfreebsd*-gnu)
$as_echo "#define GC_FREEBSD_THREADS 1" >>confdefs.h
@@ -14995,6 +15003,13 @@ else
@@ -14995,7 +15000,6 @@ else
POWERPC_DARWIN_FALSE=
fi
+if test x$openbsd_threads = xtrue; then
+ OPENBSD_THREADS_TRUE=
+ OPENBSD_THREADS_FALSE='#'
+else
+ OPENBSD_THREADS_TRUE='#'
+ OPENBSD_THREADS_FALSE=
+fi
-
# Darwin needs a few extra special tests to deal with variation in the
# system headers.
@@ -15294,6 +15309,9 @@ $as_echo "#define DATASTART_IS_ETEXT 1" >>confdefs.h
case "$host" in
@@ -15294,6 +15298,9 @@ $as_echo "#define DATASTART_IS_ETEXT 1" >>confdefs.h
;;
sparc-*-netbsd*)
machdep="sparc_netbsd_mach_dep.lo"

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-boehm-gc_include_private_gcconfig_h,v 1.2 2011/11/22 21:46:39 pascal Exp $
$OpenBSD: patch-boehm-gc_include_private_gcconfig_h,v 1.3 2012/02/28 20:00:16 pascal Exp $
--- boehm-gc/include/private/gcconfig.h.orig Sun Mar 21 20:34:19 2010
+++ boehm-gc/include/private/gcconfig.h Tue Nov 22 14:11:11 2011
+++ boehm-gc/include/private/gcconfig.h Mon Feb 20 22:09:03 2012
@@ -62,7 +62,7 @@
/* Determine the machine type: */
# if defined(__arm__) || defined(__thumb__)
@ -109,9 +109,9 @@ $OpenBSD: patch-boehm-gc_include_private_gcconfig_h,v 1.2 2011/11/22 21:46:39 pa
+# ifdef OPENBSD
+# define OS_TYPE "OPENBSD"
+# define ALIGNMENT 4
+# ifdef GC_OPENBSD_THREADS
+# define UTHREAD_SP_OFFSET 268
+# else
+# define SIG_SUSPEND SIGUSR1
+# define SIG_THR_RESTART SIGUSR2
+# ifndef GC_OPENBSD_THREADS
+# include <sys/param.h>
+# include <uvm/uvm_extern.h>
+# define STACKBOTTOM USRSTACK
@ -134,9 +134,9 @@ $OpenBSD: patch-boehm-gc_include_private_gcconfig_h,v 1.2 2011/11/22 21:46:39 pa
-# define STACKBOTTOM ((ptr_t) 0xf8000000)
- extern int etext[];
-# define DATASTART ((ptr_t)(etext))
+# ifdef GC_OPENBSD_THREADS
+# define UTHREAD_SP_OFFSET 232
+# else
+# define SIG_SUSPEND SIGUSR1
+# define SIG_THR_RESTART SIGUSR2
+# ifndef GC_OPENBSD_THREADS
+# include <sys/param.h>
+# include <uvm/uvm_extern.h>
+# define STACKBOTTOM USRSTACK
@ -155,9 +155,9 @@ $OpenBSD: patch-boehm-gc_include_private_gcconfig_h,v 1.2 2011/11/22 21:46:39 pa
# endif
# ifdef OPENBSD
# define OS_TYPE "OPENBSD"
+# ifdef GC_OPENBSD_THREADS
+# define UTHREAD_SP_OFFSET 192
+# else
+# define SIG_SUSPEND SIGUSR1
+# define SIG_THR_RESTART SIGUSR2
+# ifndef GC_OPENBSD_THREADS
+# include <sys/param.h>
+# include <uvm/uvm_extern.h>
+# define STACKBOTTOM USRSTACK
@ -179,9 +179,9 @@ $OpenBSD: patch-boehm-gc_include_private_gcconfig_h,v 1.2 2011/11/22 21:46:39 pa
+# ifdef OPENBSD
+# define OS_TYPE "OPENBSD"
+# define ALIGNMENT 4
+# ifdef GC_OPENBSD_THREADS
+# define UTHREAD_SP_OFFSET 808
+# else
+# define SIG_SUSPEND SIGUSR1
+# define SIG_THR_RESTART SIGUSR2
+# ifndef GC_OPENBSD_THREADS
+# include <sys/param.h>
+# include <uvm/uvm_extern.h>
+# define STACKBOTTOM USRSTACK
@ -212,9 +212,9 @@ $OpenBSD: patch-boehm-gc_include_private_gcconfig_h,v 1.2 2011/11/22 21:46:39 pa
# endif /* LINUX */
+# ifdef OPENBSD
+# define OS_TYPE "OPENBSD"
+# ifdef GC_OPENBSD_THREADS
+# define UTHREAD_SP_OFFSET 520
+# else
+# define SIG_SUSPEND SIGUSR1
+# define SIG_THR_RESTART SIGUSR2
+# ifndef GC_OPENBSD_THREADS
+# include <sys/param.h>
+# include <uvm/uvm_extern.h>
+# define STACKBOTTOM USRSTACK
@ -244,9 +244,9 @@ $OpenBSD: patch-boehm-gc_include_private_gcconfig_h,v 1.2 2011/11/22 21:46:39 pa
-# define DATASTART ((ptr_t) 0x140000000)
-# endif
+# define ELF_CLASS ELFCLASS64
+# ifdef GC_OPENBSD_THREADS
+# define UTHREAD_SP_OFFSET 816
+# else
+# define SIG_SUSPEND SIGUSR1
+# define SIG_THR_RESTART SIGUSR2
+# ifndef GC_OPENBSD_THREADS
+# include <sys/param.h>
+# include <uvm/uvm_extern.h>
+# define STACKBOTTOM USRSTACK
@ -276,9 +276,9 @@ $OpenBSD: patch-boehm-gc_include_private_gcconfig_h,v 1.2 2011/11/22 21:46:39 pa
+# ifdef OPENBSD
+# define ALIGNMENT 4
+# define OS_TYPE "OPENBSD"
+# ifdef GC_OPENBSD_THREADS
+# define UTHREAD_SP_OFFSET 176
+# else
+# define SIG_SUSPEND SIGUSR1
+# define SIG_THR_RESTART SIGUSR2
+# ifndef GC_OPENBSD_THREADS
+# include <sys/param.h>
+# include <uvm/uvm_extern.h>
+# define STACKBOTTOM USRSTACK
@ -300,9 +300,9 @@ $OpenBSD: patch-boehm-gc_include_private_gcconfig_h,v 1.2 2011/11/22 21:46:39 pa
# endif
+# ifdef OPENBSD
+# define OS_TYPE "OPENBSD"
+# ifdef GC_OPENBSD_THREADS
+# define UTHREAD_SP_OFFSET 332
+# else
+# define SIG_SUSPEND SIGUSR1
+# define SIG_THR_RESTART SIGUSR2
+# ifndef GC_OPENBSD_THREADS
+# include <sys/param.h>
+# include <uvm/uvm_extern.h>
+# define STACKBOTTOM USRSTACK
@ -326,9 +326,9 @@ $OpenBSD: patch-boehm-gc_include_private_gcconfig_h,v 1.2 2011/11/22 21:46:39 pa
+# ifdef OPENBSD
+# define OS_TYPE "OPENBSD"
+# define ELF_CLASS ELFCLASS64
+# ifdef GC_OPENBSD_THREADS
+# define UTHREAD_SP_OFFSET 400
+# else
+# define SIG_SUSPEND SIGUSR1
+# define SIG_THR_RESTART SIGUSR2
+# ifndef GC_OPENBSD_THREADS
+# include <sys/param.h>
+# include <uvm/uvm_extern.h>
+# define STACKBOTTOM USRSTACK

View File

@ -1,16 +0,0 @@
$OpenBSD: patch-boehm-gc_include_private_openbsd_stop_world_h,v 1.1.1.1 2011/11/14 13:00:57 pascal Exp $
--- boehm-gc/include/private/openbsd_stop_world.h.orig Thu Mar 5 17:44:00 2009
+++ boehm-gc/include/private/openbsd_stop_world.h Thu Mar 5 17:44:00 2009
@@ -0,0 +1,12 @@
+#ifndef GC_OPENBSD_STOP_WORLD_H
+#define GC_OPENBSD_STOP_WORLD_H
+
+#if !defined(GC_OPENBSD_THREADS)
+#error openbsd_stop_world.h included without GC_OPENBSD_THREADS defined
+#endif
+
+struct thread_stop_info {
+ ptr_t stack_ptr; /* Valid only when stopped. */
+};
+
+#endif

View File

@ -1,197 +0,0 @@
$OpenBSD: patch-boehm-gc_openbsd_stop_world_c,v 1.2 2011/11/22 21:46:39 pascal Exp $
--- boehm-gc/openbsd_stop_world.c.orig Sun Nov 20 19:18:24 2011
+++ boehm-gc/openbsd_stop_world.c Mon Nov 21 01:15:08 2011
@@ -0,0 +1,193 @@
+#include "private/pthread_support.h"
+
+/* derived from pthread_stop_world.c */
+
+# if defined(GC_OPENBSD_THREADS)
+
+/* We hold allocation lock. Should do exactly the right thing if the */
+/* world is stopped. Should not fail if it isn't. */
+void GC_push_all_stacks()
+{
+ GC_bool found_me = FALSE;
+ size_t nthreads = 0;
+ int i;
+ GC_thread p;
+ ptr_t lo, hi;
+ pthread_t me = pthread_self();
+
+ if (!GC_thr_initialized) GC_thr_init();
+# if DEBUG_THREADS
+ GC_printf1("Pushing stacks from thread 0x%x\n", (unsigned) me);
+# endif
+ for (i = 0; i < THREAD_TABLE_SZ; i++) {
+ for (p = GC_threads[i]; p != 0; p = p -> next) {
+ if (p -> flags & FINISHED) continue;
+ ++nthreads;
+ if (pthread_equal(p -> id, me)) {
+# ifdef SPARC
+ lo = (ptr_t)GC_save_regs_in_stack();
+# else
+ lo = GC_approx_sp();
+# endif
+ found_me = TRUE;
+ } else {
+ lo = p -> stop_info.stack_ptr;
+ }
+ if ((p -> flags & MAIN_THREAD) == 0) {
+ hi = p -> stack_end;
+ } else {
+ /* The original stack. */
+ hi = GC_stackbottom;
+ }
+# if DEBUG_THREADS
+ GC_printf3("Stack for thread 0x%x = [%p,%p)\n",
+ (unsigned)(p -> id), lo, hi);
+# endif
+ if (0 == lo) ABORT("GC_push_all_stacks: sp not set!\n");
+# ifdef STACK_GROWS_UP
+ /* We got them backwards! */
+ GC_push_all_stack(hi, lo);
+# else
+ GC_push_all_stack(lo, hi);
+# endif
+ }
+ }
+ if (GC_print_stats) {
+ GC_printf1("Pushed %d thread stacks\n", nthreads);
+ }
+ if (!found_me && !GC_in_thread_creation)
+ ABORT("Collecting from unknown thread.");
+}
+
+/* We hold the allocation lock. Suspend all threads that might */
+/* still be running. */
+void GC_suspend_all()
+{
+ int i;
+ GC_thread p;
+ int result;
+ pthread_t my_thread = pthread_self();
+
+ for (i = 0; i < THREAD_TABLE_SZ; i++) {
+ for (p = GC_threads[i]; p != 0; p = p -> next) {
+ if (!pthread_equal(p -> id, my_thread)) {
+ if (p -> flags & FINISHED) continue;
+ if (p -> thread_blocked) /* Will wait */ continue;
+# if DEBUG_THREADS
+ GC_printf1("Suspending thread 0x%x\n",
+ (unsigned)(p -> id));
+# endif
+
+ if (pthread_suspend_np(p -> id) != 0)
+ ABORT("pthread_suspend_np failed");
+
+ /*
+ * This will only work for userland pthreads. It will
+ * fail badly on rthreads. Perhaps we should consider
+ * a pthread_sp_np() function that returns the stack
+ * pointer for a suspended thread and implement in
+ * both pthreads and rthreads.
+ */
+ p -> stop_info.stack_ptr = *(ptr_t*)((char *)p -> id + UTHREAD_SP_OFFSET);
+ }
+ }
+ }
+}
+
+void GC_stop_world()
+{
+ int i;
+
+ GC_ASSERT(I_HOLD_LOCK());
+# if DEBUG_THREADS
+ GC_printf1("Stopping the world from 0x%x\n", (unsigned)pthread_self());
+# endif
+
+ /* Make sure all free list construction has stopped before we start. */
+ /* No new construction can start, since free list construction is */
+ /* required to acquire and release the GC lock before it starts, */
+ /* and we have the lock. */
+# ifdef PARALLEL_MARK
+ GC_acquire_mark_lock();
+ GC_ASSERT(GC_fl_builder_count == 0);
+ /* We should have previously waited for it to become zero. */
+# endif /* PARALLEL_MARK */
+
+ GC_suspend_all();
+
+# ifdef PARALLEL_MARK
+ GC_release_mark_lock();
+# endif
+ #if DEBUG_THREADS
+ GC_printf1("World stopped from 0x%x\n", (unsigned)pthread_self());
+ #endif
+}
+
+/* Caller holds allocation lock, and has held it continuously since */
+/* the world stopped. */
+void GC_start_world()
+{
+ pthread_t my_thread = pthread_self();
+ register int i;
+ register GC_thread p;
+ register int result;
+
+# if DEBUG_THREADS
+ GC_printf0("World starting\n");
+# endif
+
+ for (i = 0; i < THREAD_TABLE_SZ; i++) {
+ for (p = GC_threads[i]; p != 0; p = p -> next) {
+ if (!pthread_equal(p -> id, my_thread)) {
+ if (p -> flags & FINISHED) continue;
+ if (p -> thread_blocked) continue;
+ #if DEBUG_THREADS
+ GC_printf1("Resuming thread 0x%x\n",
+ (unsigned)(p -> id));
+ #endif
+
+ if (pthread_resume_np(p -> id) != 0)
+ ABORT("pthread_kill failed");
+ }
+ }
+ }
+# if DEBUG_THREADS
+ GC_printf0("World started\n");
+# endif
+}
+
+void GC_stop_init() {
+}
+
+void GC_suspend_thread(pthread_t thread) {
+ if (thread == pthread_self()) {
+ ABORT("attempting to suspend self");
+ } else {
+ GC_thread t = GC_lookup_thread(thread);
+ if (t == NULL)
+ ABORT("attempting to suspend unknown thread");
+
+ if (pthread_suspend_np(t -> id) != 0)
+ ABORT("pthread_suspend_np failed");
+ }
+}
+
+void GC_resume_thread(pthread_t thread) {
+ GC_thread t = GC_lookup_thread(thread);
+ if (t == NULL)
+ ABORT("attempting to resume unknown thread");
+
+ if (pthread_resume_np(t -> id) != 0)
+ ABORT("pthread_resume_np failed");
+}
+
+int GC_is_thread_suspended(pthread_t thread) {
+ GC_thread t = GC_lookup_thread(thread);
+ if (t == NULL)
+ ABORT("querying suspension state of unknown thread");
+
+ return (t -> flags & SUSPENDED);
+}
+
+
+#endif

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-boehm-gc_os_dep_c,v 1.2 2011/12/08 17:40:55 pascal Exp $
--- boehm-gc/os_dep.c.orig Sun Mar 21 20:34:19 2010
+++ boehm-gc/os_dep.c Thu Dec 8 16:41:50 2011
@@ -385,14 +385,111 @@ static void *tiny_sbrk(ptrdiff_t increment)
$OpenBSD: patch-boehm-gc_os_dep_c,v 1.3 2012/02/28 20:00:16 pascal Exp $
--- boehm-gc/os_dep.c.orig Tue Feb 21 00:39:27 2012
+++ boehm-gc/os_dep.c Tue Feb 21 00:40:19 2012
@@ -385,14 +385,94 @@ static void *tiny_sbrk(ptrdiff_t increment)
void GC_init_netbsd_elf()
{
@ -19,18 +19,6 @@ $OpenBSD: patch-boehm-gc_os_dep_c,v 1.2 2011/12/08 17:40:55 pascal Exp $
+ static struct sigaction old_segv_act;
+ sigjmp_buf GC_jmp_buf_openbsd;
+
+# if defined(GC_OPENBSD_THREADS)
+# include <sys/syscall.h>
+ sigset_t __syscall(quad_t, ...);
+# endif
+
+ /*
+ * Dont use GC_find_limit() because siglongjmp out of the
+ * signal handler by-passes our userland pthreads lib, leaving
+ * SIGSEGV and SIGPROF masked. Instead use this custom one
+ * that works-around the issues.
+ */
+
+ /*ARGSUSED*/
+ void GC_fault_handler_openbsd(int sig)
+ {
@ -68,11 +56,6 @@ $OpenBSD: patch-boehm-gc_os_dep_c,v 1.2 2011/12/08 17:40:55 pascal Exp $
+ }
+ }
+
+# if defined(GC_OPENBSD_THREADS)
+ /* due to the siglongjump we need to manually unmask SIGPROF */
+ __syscall(SYS_sigprocmask, SIG_UNBLOCK, sigmask(SIGPROF));
+# endif
+
+ sigaction(SIGSEGV, &old_segv_act, 0);
+
+ return(result);
@ -115,7 +98,7 @@ $OpenBSD: patch-boehm-gc_os_dep_c,v 1.2 2011/12/08 17:40:55 pascal Exp $
# ifdef OS2
# include <stddef.h>
@@ -1009,7 +1106,8 @@ ptr_t GC_get_stack_base()
@@ -1009,7 +1089,8 @@ ptr_t GC_get_stack_base()
#endif /* FREEBSD_STACKBOTTOM */
#if !defined(BEOS) && !defined(AMIGA) && !defined(MSWIN32) \
@ -125,7 +108,7 @@ $OpenBSD: patch-boehm-gc_os_dep_c,v 1.2 2011/12/08 17:40:55 pascal Exp $
ptr_t GC_get_stack_base()
{
@@ -1069,6 +1167,25 @@ ptr_t GC_get_stack_base()
@@ -1069,6 +1150,25 @@ ptr_t GC_get_stack_base()
# endif /* ! AMIGA, !OS 2, ! MS Windows, !BEOS, !NOSYS, !ECOS */
@ -151,7 +134,7 @@ $OpenBSD: patch-boehm-gc_os_dep_c,v 1.2 2011/12/08 17:40:55 pascal Exp $
/*
* Register static data segment(s) as roots.
* If more data segments are added later then they need to be registered
@@ -1440,6 +1557,32 @@ int * etext_addr;
@@ -1440,6 +1540,32 @@ int * etext_addr;
#else /* !OS2 && !Windows && !AMIGA */
@ -184,7 +167,7 @@ $OpenBSD: patch-boehm-gc_os_dep_c,v 1.2 2011/12/08 17:40:55 pascal Exp $
void GC_register_data_segments()
{
# if !defined(PCR) && !defined(SRC_M3) && !defined(MACOS)
@@ -1497,6 +1640,7 @@ void GC_register_data_segments()
@@ -1497,6 +1623,7 @@ void GC_register_data_segments()
/* change. */
}

View File

@ -1,13 +0,0 @@
$OpenBSD: patch-boehm-gc_pthread_stop_world_c,v 1.1.1.1 2011/11/14 13:00:57 pascal Exp $
--- boehm-gc/pthread_stop_world.c.orig Sat Nov 12 10:40:58 2011
+++ boehm-gc/pthread_stop_world.c Sat Nov 12 10:41:52 2011
@@ -1,7 +1,8 @@
#include "private/pthread_support.h"
#if defined(GC_PTHREADS) && !defined(GC_SOLARIS_THREADS) \
- && !defined(GC_WIN32_THREADS) && !defined(GC_DARWIN_THREADS)
+ && !defined(GC_WIN32_THREADS) && !defined(GC_DARWIN_THREADS) \
+ && !defined(GC_OPENBSD_THREADS)
#include <signal.h>
#include <semaphore.h>