- Update to 7.2d. Tested on i386, amd64, sparc64, macppc, hppa and alpha.

okay and testing by sthen, landry, thanks!
This commit is contained in:
kurt 2013-06-01 21:05:28 +00:00
parent 3b72b4afb0
commit f8128c5102
22 changed files with 348 additions and 896 deletions

View File

@ -1,18 +1,19 @@
# $OpenBSD: Makefile,v 1.49 2013/03/21 08:45:14 ajacoutot Exp $ # $OpenBSD: Makefile,v 1.50 2013/06/01 21:05:28 kurt Exp $
COMMENT-main= garbage collection and memory leak detection for C and C++ COMMENT-main= garbage collection and memory leak detection for C and C++
COMMENT-atomic= access to hardware provided atomic memory operations COMMENT-atomic= access to hardware provided atomic memory operations
VERSION= 7.0 VERSION= 7.2d
DISTNAME= gc-${VERSION} DISTNAME= gc-${VERSION}
PKGNAME-atomic= libatomic_ops-1.2 PKGNAME-atomic= libatomic_ops-${VERSION}
PKGNAME-main= boehm-gc-${VERSION} PKGNAME-main= boehm-gc-${VERSION}
REVISION= 7
WRKDIST= ${WRKDIR}/gc-7.2
MULTI_PACKAGES= -main -atomic MULTI_PACKAGES= -main -atomic
SHARED_LIBS += gc 3.0 # .1.2 SHARED_LIBS += gc 4.0 # .1.3
SHARED_LIBS += cord 2.3 # .1.3 SHARED_LIBS += gccpp 0.0 # .1.3
SHARED_LIBS += cord 2.3 # .1.3
CATEGORIES= devel CATEGORIES= devel
@ -20,14 +21,12 @@ MASTER_SITES= ${HOMEPAGE}gc_source/
HOMEPAGE= http://www.hpl.hp.com/personal/Hans_Boehm/gc/ HOMEPAGE= http://www.hpl.hp.com/personal/Hans_Boehm/gc/
MAINTAINER= Todd T. Fries <todd@openbsd.org>
# currently works only on most ELF archs # currently works only on most ELF archs
NOT_FOR_ARCHS= m68k m88k vax mips64 mips64el NOT_FOR_ARCHS= m68k m88k vax mips64 mips64el
PERMIT_PACKAGE_CDROM= Yes PERMIT_PACKAGE_CDROM= Yes
WANTLIB += pthread WANTLIB-main += pthread
MAKE_ENV= CP="cp" \ MAKE_ENV= CP="cp" \
INSTALL_DATA="${INSTALL_DATA}" \ INSTALL_DATA="${INSTALL_DATA}" \
@ -35,10 +34,11 @@ MAKE_ENV= CP="cp" \
USE_GROFF = Yes USE_GROFF = Yes
AUTOCONF_VERSION= 2.61 AUTOCONF_VERSION= 2.68
CONFIGURE_STYLE= autoconf no-autoheader CONFIGURE_STYLE= autoconf no-autoheader
CONFIGURE_ARGS= ${CONFIGURE_SHARED} \ CONFIGURE_ARGS= ${CONFIGURE_SHARED} \
--enable-cplusplus \
--enable-threads=pthreads --enable-threads=pthreads
pre-configure: pre-configure:

View File

@ -1,5 +1,2 @@
MD5 (gc-7.0.tar.gz) = NkXM9fMuuyfZmyew0p6cOA== SHA256 (gc-7.2d.tar.gz) = 2f4K6GUNQ3RqSL+zlMqwGjGfOAnO4Z+OvRaqmFtRHF4=
RMD160 (gc-7.0.tar.gz) = SRLiWQ3YISvr7rHjJQZ2LKMdAIg= SIZE (gc-7.2d.tar.gz) = 1263064
SHA1 (gc-7.0.tar.gz) = ZX2EtwKlcvilENLChXim26rT/tI=
SHA256 (gc-7.0.tar.gz) = 0grG6Tm4J3BDS3bk99wYpAmdUH609CpdOtdGJQwBHls=
SIZE (gc-7.0.tar.gz) = 1072682

View File

@ -1,25 +0,0 @@
$OpenBSD: patch-configure_ac,v 1.2 2012/02/22 12:31:42 kurt Exp $
--- configure.ac.orig Sat Jun 30 11:40:15 2007
+++ configure.ac Sun Feb 19 12:57:00 2012
@@ -113,6 +113,11 @@ case "$THREADS" in
*-*-hpux10*)
AC_MSG_WARN("Only HP-UX 11 POSIX threads are supported.")
;;
+ *-*-openbsd*)
+ AC_DEFINE(GC_OPENBSD_THREADS)
+ THREADDLLIBS=-pthread
+ INCLUDES="$INCLUDES -pthread"
+ ;;
*-*-freebsd*)
AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
AC_DEFINE(GC_FREEBSD_THREADS)
@@ -394,6 +399,9 @@ case "$host" in
;;
sparc-*-netbsd*)
machdep="mach_dep.lo sparc_netbsd_mach_dep.lo"
+ ;;
+ sparc*-*-openbsd*)
+ machdep="mach_dep.lo sparc_mach_dep.lo"
;;
sparc-sun-solaris2.3)
machdep="mach_dep.lo sparc_mach_dep.lo"

View File

@ -1,58 +0,0 @@
$OpenBSD: patch-doc_gc_man,v 1.5 2008/04/01 17:41:13 kurt Exp $
--- doc/gc.man.orig Mon Oct 10 18:33:34 2005
+++ doc/gc.man Wed Feb 6 19:33:58 2008
@@ -1,4 +1,4 @@
-.TH GC_MALLOC 1L "2 October 2003"
+.TH GC_MALLOC 3 "2 October 2003"
.SH NAME
GC_malloc, GC_malloc_atomic, GC_free, GC_realloc, GC_enable_incremental, GC_register_finalizer, GC_malloc_ignore_off_page, GC_malloc_atomic_ignore_off_page, GC_set_warn_proc \- Garbage collecting malloc replacement
.SH SYNOPSIS
@@ -81,6 +81,48 @@ GC_enable_incremental.
This may temporarily write protect pages in the heap. See the README file for more information on how this interacts with system calls that write to the heap.
.LP
Other facilities not discussed here include limited facilities to support incremental collection on machines without appropriate VM support, provisions for providing more explicit object layout information to the garbage collector, more direct support for ``weak'' pointers, support for ``abortable'' garbage collections during idle time, etc.
+.LP
+.SH "PORT INFORMATION"
+.LP
+In this (OpenBSD package) installation,
+.I gc.h
+and
+.I gc_cpp.h
+will be found in
+.I /usr/local/include ,
+and the libraries in
+.I /usr/local/lib.
+.LP
+These libraries have been compiled as drop-in replacements
+for malloc and free (which is to say, all malloc
+calls will allocate garbage-collectable data).
+There is no need to include "gc.h" in your C files unless you want
+access to the debugging (and other) functions defined there,
+or unless you want to explicitly use
+.I GC_malloc_uncollectable
+for some allocations.
+Just link against them whenever you want either garbage
+collection or leak detection.
+.LP
+The C++ header file, "gc_cpp.h",
+.I is
+necessary for C++ programs, to obtain the appropriate
+definitions of the
+.I new
+and
+.I delete
+operators.
+The comments in both of these header files presently
+provide far better documentation
+for the package than this man page;
+look there for more information.
+.LP
+Both libraries are compiled without (explicit) support
+for the experimental
+.I gc
+extension of
+.I g++.
+This may or may not make a difference.
.LP
.SH "SEE ALSO"
The README and gc.h files in the distribution. More detailed definitions of the functions exported by the collector are given there. (The above list is not complete.)

View File

@ -1,48 +1,25 @@
$OpenBSD: patch-dyn_load_c,v 1.6 2008/04/01 17:41:13 kurt Exp $ $OpenBSD: patch-dyn_load_c,v 1.7 2013/06/01 21:05:28 kurt Exp $
--- dyn_load.c.orig Thu Jun 28 17:36:03 2007 --- dyn_load.c.orig Thu Aug 9 16:25:13 2012
+++ dyn_load.c Thu Mar 20 18:09:28 2008 +++ dyn_load.c Tue Mar 19 19:39:39 2013
@@ -63,6 +63,7 @@ static int (*GC_has_static_roots)(const char *, void * @@ -83,12 +83,20 @@ STATIC GC_has_static_roots_func GC_has_static_roots =
!defined(HPUX) && !(defined(LINUX) && defined(__ELF__)) && \ # define ELFSIZE ARCH_ELFSIZE
!defined(AIX) && !defined(SCO_ELF) && !defined(DGUX) && \
!(defined(FREEBSD) && defined(__ELF__)) && \
+ !(defined(OPENBSD) && (defined(__ELF__) || defined(M68K))) && \
!(defined(NETBSD) && defined(__ELF__)) && !defined(HURD) && \
!defined(DARWIN) && !defined(CYGWIN32)
--> We only know how to find data segments of dynamic libraries for the
@@ -84,9 +85,9 @@ static int (*GC_has_static_roots)(const char *, void *
#if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \
(defined(FREEBSD) && defined(__ELF__)) || defined(DGUX) || \
+ (defined(OPENBSD) && defined(__ELF__)) || \
(defined(NETBSD) && defined(__ELF__)) || defined(HURD)
# include <stddef.h>
-# include <elf.h>
# include <link.h>
#endif #endif
@@ -99,7 +100,7 @@ static int (*GC_has_static_roots)(const char *, void * +#if defined(OPENBSD)
# else +# include <sys/param.h>
# define ElfW(type) Elf64_##type +# include <dlfcn.h>
# endif +# if OpenBSD >= 200519
-# elif defined(NETBSD) +# define HAVE_DL_ITERATE_PHDR
+# elif defined(NETBSD) || defined(OPENBSD) +# endif
# if ELFSIZE == 32 +#endif
# define ElfW(type) Elf32_##type +
# else #if defined(SCO_ELF) || defined(DGUX) || defined(HURD) \
@@ -216,6 +217,7 @@ void GC_register_dynamic_libraries() || (defined(__ELF__) && (defined(LINUX) || defined(FREEBSD) \
|| defined(NETBSD) || defined(OPENBSD)))
#if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \ # include <stddef.h>
(defined(FREEBSD) && defined(__ELF__)) || defined(DGUX) || \ # if !defined(OPENBSD) && !defined(PLATFORM_ANDROID)
+ (defined(OPENBSD) && defined(__ELF__)) || \ - /* FIXME: Why we exclude it for OpenBSD? */
(defined(NETBSD) && defined(__ELF__)) || defined(HURD) + /* OpenBSD doesn't have elf.h. link.h below is sufficent */
/* Exclude Android because linker.h below includes its own version. */
# include <elf.h>
@@ -414,7 +416,7 @@ GC_bool GC_register_main_static_data() # endif
/* This doesn't necessarily work in all cases, e.g. with preloaded
* dynamic libraries. */
-#if defined(NETBSD)
+#if defined(NETBSD) || defined(OPENBSD)
# include <sys/exec_elf.h>
/* for compatibility with 1.4.x */
# ifndef DT_DEBUG

View File

@ -1,23 +0,0 @@
$OpenBSD: patch-include_gc_config_macros_h,v 1.1 2007/07/14 22:16:17 kili Exp $
--- include/gc_config_macros.h.orig Mon Jul 2 14:21:33 2007
+++ include/gc_config_macros.h Thu Jul 12 09:56:42 2007
@@ -65,7 +65,7 @@
defined(GC_DGUX386_THREADS) || defined(GC_DARWIN_THREADS) || \
defined(GC_AIX_THREADS) || defined(GC_NETBSD_THREADS) || \
(defined(GC_WIN32_THREADS) && defined(__CYGWIN32__)) || \
- defined(GC_GNU_THREADS)
+ defined(GC_GNU_THREADS) || defined(GC_OPENBSD_THREADS)
# define GC_PTHREADS
# endif
@@ -100,6 +100,10 @@
# endif
# if defined(__APPLE__) && defined(__MACH__)
# define GC_DARWIN_THREADS
+# define GC_PTHREADS
+# endif
+# if !defined(GC_PTHREADS) && defined(__OpenBSD__)
+# define GC_OPENBSD_THREADS
# define GC_PTHREADS
# endif
# if !defined(GC_PTHREADS) && (defined(__FreeBSD__) || defined(__DragonFly__))

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-include_private_gc_priv_h,v 1.1 2013/06/01 21:05:28 kurt Exp $
--- include/private/gc_priv.h.orig Thu Aug 9 16:25:13 2012
+++ include/private/gc_priv.h Tue Mar 19 19:39:39 2013
@@ -2209,7 +2209,11 @@ GC_INNER ptr_t GC_store_debug_info(ptr_t p, word sz, c
/* Linuxthreads itself uses SIGUSR1 and SIGUSR2. */
# define SIG_SUSPEND SIGPWR
# endif
-# elif !defined(GC_OPENBSD_THREADS) && !defined(GC_DARWIN_THREADS)
+# elif defined(GC_OPENBSD_THREADS)
+# if OpenBSD >= 201211
+# define SIG_SUSPEND SIGXFSZ
+# endif
+# elif !defined(GC_DARWIN_THREADS)
# if defined(_SIGRTMIN)
# define SIG_SUSPEND _SIGRTMIN + 6
# else

View File

@ -1,334 +1,140 @@
--- include/private/gcconfig.h.orig Thu Jun 28 20:00:09 2007 $OpenBSD: patch-include_private_gcconfig_h,v 1.18 2013/06/01 21:05:28 kurt Exp $
+++ include/private/gcconfig.h Fri Mar 16 17:43:45 2012 --- include/private/gcconfig.h.orig Thu Aug 9 16:25:13 2012
@@ -64,7 +64,7 @@ +++ include/private/gcconfig.h Tue Mar 19 19:39:39 2013
/* Determine the machine type: */ @@ -842,10 +842,11 @@
# if defined(__arm__) || defined(__thumb__) # ifdef OPENBSD
# define ARM32 # define OS_TYPE "OPENBSD"
-# if !defined(LINUX) && !defined(NETBSD) # define ALIGNMENT 4
+# if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD) -# ifdef GC_OPENBSD_THREADS
# define NOSYS -# define UTHREAD_SP_OFFSET 268
# define mach_type_known -# else
# endif -# include <sys/param.h>
@@ -75,14 +75,18 @@ +# include <sys/param.h>
# if defined(hp9000s300) +# if defined(GC_OPENBSD_THREADS) && OpenBSD < 201211
# error M68K based HP machines no longer supported. +# define UTHREAD_SP_OFFSET 268
# endif
-# if defined(OPENBSD) && defined(m68k)
-# define M68K
-# define mach_type_known
-# endif
# if defined(OPENBSD) && defined(__sparc__)
# define SPARC
# define mach_type_known
# endif
+# if defined(OPENBSD) && defined(__arm__)
+# define ARM32
+# define mach_type_known
+# endif
+# if defined(OPENBSD) && defined(__sh__)
+# define SH
+# define mach_type_known
+# endif
# if defined(NETBSD) && (defined(m68k) || defined(__m68k__))
# define M68K
# define mach_type_known
@@ -99,7 +103,7 @@
# define SH
# define mach_type_known
# endif
-# if defined(vax)
+# if defined(vax) || defined(__vax__)
# define VAX
# ifdef ultrix
# define ULTRIX
@@ -117,7 +121,7 @@
# if defined(nec_ews) || defined(_nec_ews)
# define EWS4800
# endif
-# if !defined(LINUX) && !defined(EWS4800) && !defined(NETBSD)
+# if !defined(LINUX) && !defined(EWS4800) && !defined(NETBSD) && !defined(OPENBSD)
# if defined(ultrix) || defined(__ultrix)
# define ULTRIX
# else
@@ -198,7 +202,7 @@
# if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \
|| defined(hppa) || defined(__hppa__)
# define HP_PA
-# if !defined(LINUX) && !defined(HPUX)
+# if !defined(LINUX) && !defined(HPUX) && !defined(OPENBSD)
# define HPUX
# endif
# define mach_type_known
@@ -219,6 +223,10 @@
# define I386
# define mach_type_known
# endif
+# if defined(OPENBSD) && defined(__amd64__)
+# define X86_64
+# define mach_type_known
+# endif
# if defined(LINUX) && defined(__x86_64__)
# define X86_64
# define mach_type_known
@@ -290,6 +298,11 @@
# define MACOS
# define mach_type_known
# endif
+# if defined(__OpenBSD__) && (defined(__powerpc__))
+# define POWERPC
+# define OPENBSD
+# define mach_type_known
+# endif
# if defined(macosx) || (defined(__APPLE__) && defined(__MACH__))
# define DARWIN
# if defined(__ppc__) || defined(__ppc64__)
@@ -645,17 +658,6 @@
# ifdef M68K
# define MACH_TYPE "M68K"
# define ALIGNMENT 2
-# ifdef OPENBSD
-# define OS_TYPE "OPENBSD"
-# define HEURISTIC2
-# ifdef __ELF__
-# define DATASTART GC_data_start
-# define DYNAMIC_LOADING
-# else
- extern char etext[];
-# define DATASTART ((ptr_t)(etext))
-# endif
-# endif
# ifdef NETBSD
# define OS_TYPE "NETBSD"
# define HEURISTIC2
@@ -788,6 +790,22 @@
should be looked into some more */
# define NO_PTHREAD_TRYLOCK
# endif
+# ifdef OPENBSD
+# define OS_TYPE "OPENBSD"
+# define ALIGNMENT 4
+# define SIG_SUSPEND SIGXFSZ
+# define SIG_THR_RESTART SIGXCPU
+# ifndef GC_OPENBSD_THREADS
+# include <sys/param.h>
+# include <uvm/uvm_extern.h>
+# define STACKBOTTOM USRSTACK
+# endif +# endif
+ extern int __data_start[]; +# ifndef GC_OPENBSD_THREADS
+# define DATASTART ((ptr_t)(__data_start)) # include <uvm/uvm_extern.h>
+ extern char _end[]; # define STACKBOTTOM USRSTACK
+# define DATAEND ((ptr_t)(&_end)) # endif
+# define DYNAMIC_LOADING @@ -1044,10 +1045,11 @@
+# endif
# ifdef FREEBSD
# define ALIGNMENT 4
# define OS_TYPE "FREEBSD"
@@ -955,9 +973,18 @@
# endif # endif
# ifdef OPENBSD # ifdef OPENBSD
# define OS_TYPE "OPENBSD" # define OS_TYPE "OPENBSD"
-# define STACKBOTTOM ((ptr_t) 0xf8000000) -# ifdef GC_OPENBSD_THREADS
- extern int etext[]; -# define UTHREAD_SP_OFFSET 232
-# define DATASTART ((ptr_t)(etext)) -# else
+# define SIG_SUSPEND SIGXFSZ -# include <sys/param.h>
+# define SIG_THR_RESTART SIGXCPU +# include <sys/param.h>
+# ifndef GC_OPENBSD_THREADS +# if defined(GC_OPENBSD_THREADS) && OpenBSD < 201211
+# include <sys/param.h> +# define UTHREAD_SP_OFFSET 232
+# include <uvm/uvm_extern.h>
+# define STACKBOTTOM USRSTACK
+# endif +# endif
+ extern int __data_start[]; +# ifndef GC_OPENBSD_THREADS
+# define DATASTART ((ptr_t)(__data_start)) # include <uvm/uvm_extern.h>
+ extern char _end[]; # define STACKBOTTOM USRSTACK
+# define DATAEND ((ptr_t)(&_end))
+# define DYNAMIC_LOADING
# endif
# ifdef NETBSD
# define OS_TYPE "NETBSD"
@@ -1203,6 +1230,18 @@
# endif
# ifdef OPENBSD
# define OS_TYPE "OPENBSD"
+# define SIG_SUSPEND SIGXFSZ
+# define SIG_THR_RESTART SIGXCPU
+# ifndef GC_OPENBSD_THREADS
+# include <sys/param.h>
+# include <uvm/uvm_extern.h>
+# define STACKBOTTOM USRSTACK
+# endif
+ extern int __data_start[];
+# define DATASTART ((ptr_t)(__data_start))
+ extern char _end[];
+# define DATAEND ((ptr_t)(&_end))
+# define DYNAMIC_LOADING
# endif
# ifdef FREEBSD
# define OS_TYPE "FREEBSD"
@@ -1238,7 +1277,7 @@
# ifdef BSDI
# define OS_TYPE "BSDI"
# endif
-# if defined(OPENBSD) || defined(NETBSD) \
+# if defined(NETBSD) \
|| defined(THREE86BSD) || defined(BSDI)
# define HEURISTIC2
extern char etext[];
@@ -1403,6 +1442,22 @@
# define STACKBOTTOM ((ptr_t) 0x7ffff000)
# endif /* _ELF_ */
# endif
+# ifdef OPENBSD
+# define OS_TYPE "OPENBSD"
+# define ALIGNMENT 4
+# define SIG_SUSPEND SIGXFSZ
+# define SIG_THR_RESTART SIGXCPU
+# ifndef GC_OPENBSD_THREADS
+# include <sys/param.h>
+# include <uvm/uvm_extern.h>
+# define STACKBOTTOM USRSTACK
+# endif
+ extern int _fdata[];
+# define DATASTART ((ptr_t)(_fdata))
+ extern char _end[];
+# define DATAEND ((ptr_t)(&_end))
+# define DYNAMIC_LOADING
+# endif
# if defined(NONSTOP)
# define CPP_WORDSZ 32
# define OS_TYPE "NONSTOP"
@@ -1423,7 +1478,7 @@
# define CPP_WORDSZ 32
# define ALIGNMENT 4
# endif
-# if !defined(GC_HPUX_THREADS) && !defined(GC_LINUX_THREADS)
+# if !defined(GC_HPUX_THREADS) && !defined(GC_LINUX_THREADS) && !defined(OPENBSD)
# ifndef LINUX /* For now. */
# define MPROTECT_VDB
# endif # endif
@@ -1472,6 +1527,21 @@ @@ -1321,10 +1323,11 @@
extern int _end[];
# define DATAEND (&_end)
# endif /* LINUX */
+# ifdef OPENBSD
+# define OS_TYPE "OPENBSD"
+# define SIG_SUSPEND SIGXFSZ
+# define SIG_THR_RESTART SIGXCPU
+# ifndef GC_OPENBSD_THREADS
+# include <sys/param.h>
+# include <uvm/uvm_extern.h>
+# define STACKBOTTOM USRSTACK
+# endif
+ extern int __data_start[];
+# define DATASTART ((ptr_t)(__data_start))
+ extern char _end[];
+# define DATAEND ((ptr_t)(&_end))
+# define DYNAMIC_LOADING
+# endif
# endif /* HP_PA */
# ifdef ALPHA
@@ -1489,15 +1559,19 @@
# endif # endif
# ifdef OPENBSD # ifdef OPENBSD
# define OS_TYPE "OPENBSD" # define OS_TYPE "OPENBSD"
-# define HEURISTIC2 -# ifdef GC_OPENBSD_THREADS
-# ifdef __ELF__ /* since OpenBSD/Alpha 2.9 */
-# define DATASTART GC_data_start
-# define ELFCLASS32 32
-# define ELFCLASS64 64
-# define ELF_CLASS ELFCLASS64
-# else /* ECOFF, until OpenBSD/Alpha 2.7 */
-# define DATASTART ((ptr_t) 0x140000000)
-# endif
+# define ELF_CLASS ELFCLASS64
+# define SIG_SUSPEND SIGXFSZ
+# define SIG_THR_RESTART SIGXCPU
+# ifndef GC_OPENBSD_THREADS
+# include <sys/param.h> +# include <sys/param.h>
+# include <uvm/uvm_extern.h> +# if defined(GC_OPENBSD_THREADS) && OpenBSD < 201211
+# define STACKBOTTOM USRSTACK # define UTHREAD_SP_OFFSET 176
-# else
-# include <sys/param.h>
+# endif
+# ifndef GC_OPENBSD_THREADS
# include <uvm/uvm_extern.h>
# define STACKBOTTOM USRSTACK
# endif
@@ -1556,10 +1559,11 @@
# ifdef OPENBSD
# define OS_TYPE "OPENBSD"
# define ALIGNMENT 4
-# ifdef GC_OPENBSD_THREADS
+# include <sys/param.h>
+# if defined(GC_OPENBSD_THREADS) && OpenBSD < 201211
# define UTHREAD_SP_OFFSET 808
-# else
-# include <sys/param.h>
+# endif +# endif
+ extern int __data_start[];
+# define DATASTART ((ptr_t)(__data_start))
+ extern char _end[];
+# define DATAEND ((ptr_t)(&_end))
+# define DYNAMIC_LOADING
# endif
# ifdef FREEBSD
# define OS_TYPE "FREEBSD"
@@ -1665,6 +1739,7 @@
# ifdef CX_UX
# define OS_TYPE "CX_UX"
# define DATASTART ((((word)etext + 0x3fffff) & ~0x3fffff) + 0x10000)
+# define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
# endif
# ifdef DGUX
# define OS_TYPE "DGUX"
@@ -1764,6 +1839,22 @@
# define OS_TYPE "MSWINCE"
# define DATAEND /* not needed */
# endif
+# ifdef OPENBSD
+# define ALIGNMENT 4
+# define OS_TYPE "OPENBSD"
+# define SIG_SUSPEND SIGXFSZ
+# define SIG_THR_RESTART SIGXCPU
+# ifndef GC_OPENBSD_THREADS +# ifndef GC_OPENBSD_THREADS
# include <uvm/uvm_extern.h>
# define STACKBOTTOM USRSTACK
# endif
@@ -1634,10 +1638,11 @@
# endif /* LINUX */
# ifdef OPENBSD
# define OS_TYPE "OPENBSD"
-# ifdef GC_OPENBSD_THREADS
+# include <sys/param.h>
+# if defined(GC_OPENBSD_THREADS) && OpenBSD < 201211
# define UTHREAD_SP_OFFSET 520
-# else
-# include <sys/param.h>
+# endif
+# ifndef GC_OPENBSD_THREADS
# include <uvm/uvm_extern.h>
# define STACKBOTTOM USRSTACK
# endif
@@ -1666,10 +1671,11 @@
# ifdef OPENBSD
# define OS_TYPE "OPENBSD"
# define ELF_CLASS ELFCLASS64
-# ifdef GC_OPENBSD_THREADS
+# include <sys/param.h> +# include <sys/param.h>
+# include <uvm/uvm_extern.h> +# if defined(GC_OPENBSD_THREADS) && OpenBSD < 201211
+# define STACKBOTTOM USRSTACK # define UTHREAD_SP_OFFSET 816
+# endif -# else
+ extern int __data_start[]; -# include <sys/param.h>
+# define DATASTART ((ptr_t)(__data_start)) +# endif
+ extern char _end[]; +# ifndef GC_OPENBSD_THREADS
+# define DATAEND ((ptr_t)(&_end)) # include <uvm/uvm_extern.h>
+# define DYNAMIC_LOADING # define STACKBOTTOM USRSTACK
+# endif # endif
# ifdef NOSYS @@ -1973,10 +1979,11 @@
/* __data_start is usually defined in the target linker script. */ # ifdef OPENBSD
extern int __data_start[]; # define ALIGNMENT 4
@@ -1807,6 +1898,21 @@ # define OS_TYPE "OPENBSD"
# define DATASTART GC_data_start -# ifdef GC_OPENBSD_THREADS
# define DYNAMIC_LOADING +# include <sys/param.h>
+# if defined(GC_OPENBSD_THREADS) && OpenBSD < 201211
# define UTHREAD_SP_OFFSET 176
-# else
-# include <sys/param.h>
+# endif
+# ifndef GC_OPENBSD_THREADS
# include <uvm/uvm_extern.h>
# define STACKBOTTOM USRSTACK
# endif
@@ -2032,10 +2039,11 @@
# endif # endif
+# ifdef OPENBSD # ifdef OPENBSD
+# define OS_TYPE "OPENBSD" # define OS_TYPE "OPENBSD"
+# define SIG_SUSPEND SIGXFSZ -# ifdef GC_OPENBSD_THREADS
+# define SIG_THR_RESTART SIGXCPU +# include <sys/param.h>
+# ifndef GC_OPENBSD_THREADS +# if defined(GC_OPENBSD_THREADS) && OpenBSD < 201211
# define UTHREAD_SP_OFFSET 332
-# else
-# include <sys/param.h>
+# endif
+# ifndef GC_OPENBSD_THREADS
# include <uvm/uvm_extern.h>
# define STACKBOTTOM USRSTACK
# endif
@@ -2099,10 +2107,11 @@
# ifdef OPENBSD
# define OS_TYPE "OPENBSD"
# define ELF_CLASS ELFCLASS64
-# ifdef GC_OPENBSD_THREADS
+# include <sys/param.h> +# include <sys/param.h>
+# include <uvm/uvm_extern.h> +# if defined(GC_OPENBSD_THREADS) && OpenBSD < 201211
+# define STACKBOTTOM USRSTACK # define UTHREAD_SP_OFFSET 400
+# endif -# else
+ extern int __data_start[]; -# include <sys/param.h>
+# define DATASTART ((ptr_t)(__data_start)) +# endif
+ extern char _end[]; +# ifndef GC_OPENBSD_THREADS
+# define DATAEND ((ptr_t)(&_end)) # include <uvm/uvm_extern.h>
+# define DYNAMIC_LOADING # define STACKBOTTOM USRSTACK
+# endif # endif
# endif
# ifdef SH4
@@ -1838,6 +1944,22 @@
# define CPP_WORDSZ 64
# ifndef HBLKSIZE
# define HBLKSIZE 4096
+# endif
+# ifdef OPENBSD
+# define OS_TYPE "OPENBSD"
+# define ELF_CLASS ELFCLASS64
+# define SIG_SUSPEND SIGXFSZ
+# define SIG_THR_RESTART SIGXCPU
+# ifndef GC_OPENBSD_THREADS
+# include <sys/param.h>
+# include <uvm/uvm_extern.h>
+# define STACKBOTTOM USRSTACK
+# endif
+ extern int __data_start[];
+# define DATASTART ((ptr_t)(__data_start))
+ extern char _end[];
+# define DATAEND ((ptr_t)(&_end))
+# define DYNAMIC_LOADING
# endif
# define CACHE_LINE_SIZE 64
# ifdef LINUX

View File

@ -0,0 +1,27 @@
$OpenBSD: patch-include_private_pthread_stop_world_h,v 1.1 2013/06/01 21:05:28 kurt Exp $
--- include/private/pthread_stop_world.h.orig Thu Aug 9 16:25:13 2012
+++ include/private/pthread_stop_world.h Tue Mar 19 19:39:39 2013
@@ -18,8 +18,22 @@
#ifndef GC_PTHREAD_STOP_WORLD_H
#define GC_PTHREAD_STOP_WORLD_H
+#if defined(GC_OPENBSD_THREADS)
+
+# include <sys/param.h>
+
+/*
+ * Beginning with the 5.2 release, OpenBSD has kernel supported threads.
+ * Only the userland thread model needs a non-standard approach.
+ */
+# if defined(OpenBSD) && OpenBSD < 201211
+# define GC_OPENBSD_UTHREADS 1
+# endif
+
+#endif /* GC_OPENBSD_THREADS */
+
struct thread_stop_info {
-# ifndef GC_OPENBSD_THREADS
+# ifndef GC_OPENBSD_UTHREADS
word last_stop_count; /* GC_last_stop_count value when thread */
/* last successfully handled a suspend */
/* signal. */

View File

@ -1,13 +0,0 @@
$OpenBSD: patch-libatomic_ops-1_2_src_atomic_ops_h,v 1.1 2008/04/01 17:41:13 kurt Exp $
--- libatomic_ops-1.2/src/atomic_ops.h.orig Thu Jun 14 01:10:58 2007
+++ libatomic_ops-1.2/src/atomic_ops.h Fri Mar 21 14:01:24 2008
@@ -228,6 +228,9 @@
# if defined(__cris__) || defined(CRIS)
# include "atomic_ops/sysdeps/gcc/cris.h"
# endif
+# if defined(__mips__)
+# include "atomic_ops/sysdeps/gcc/mips.h"
+# endif
#endif /* __GNUC__ && !AO_USE_PTHREAD_DEFS */
#if defined(__INTEL_COMPILER) && !defined(AO_USE_PTHREAD_DEFS)

View File

@ -1,11 +0,0 @@
$OpenBSD: patch-libatomic_ops-1_2_src_atomic_ops_sysdeps_Makefile_am,v 1.1 2008/04/01 17:41:13 kurt Exp $
--- libatomic_ops-1.2/src/atomic_ops/sysdeps/Makefile.am.orig Tue Jun 5 18:06:20 2007
+++ libatomic_ops-1.2/src/atomic_ops/sysdeps/Makefile.am Fri Mar 21 14:01:30 2008
@@ -29,6 +29,7 @@ nobase_sysdep_HEADERS= generic_pthread.h \
gcc/powerpc.h gcc/sparc.h \
gcc/hppa.h gcc/m68k.h gcc/s390.h \
gcc/ia64.h gcc/x86_64.h gcc/cris.h \
+ gcc/mips.h \
\
icc/ia64.h \
\

View File

@ -1,93 +0,0 @@
$OpenBSD: patch-libatomic_ops-1_2_src_atomic_ops_sysdeps_gcc_mips_h,v 1.1 2008/04/01 17:41:13 kurt Exp $
--- libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc/mips.h.orig Fri Mar 21 14:01:24 2008
+++ libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc/mips.h Fri Mar 21 14:01:24 2008
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2005 Thiemo Seufer <ths@networkno.de>
+ * Copyright (c) 2007 Zhang Le <r0bertz@gentoo.org>
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+#include "../all_aligned_atomic_load_store.h"
+#include "../test_and_set_t_is_ao_t.h"
+
+/* Data dependence does not imply read ordering. */
+#define AO_NO_DD_ORDERING
+
+AO_INLINE void
+AO_nop_full()
+{
+ __asm__ __volatile__(
+ " .set push \n"
+ " .set mips3 \n"
+ " .set noreorder \n"
+ " .set nomacro \n"
+ " sync \n"
+ " .set pop "
+ : : : "memory");
+}
+
+#define AO_HAVE_nop_full
+
+AO_INLINE int
+AO_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val)
+{
+ register int was_equal = 0;
+ register int temp;
+
+ __asm__ __volatile__(
+ " .set push \n"
+ " .set mips3 \n"
+ " .set noreorder \n"
+ " .set nomacro \n"
+ "1: ll %0, %1 \n"
+ " bne %0, %4, 2f \n"
+ " move %0, %3 \n"
+ " sc %0, %1 \n"
+ " .set pop \n"
+ " beqz %0, 1b \n"
+ " li %2, 1 \n"
+ "2: "
+ : "=&r" (temp), "+R" (*addr), "+r" (was_equal)
+ : "r" (new_val), "r" (old)
+ : "memory");
+ return was_equal;
+}
+
+#define AO_HAVE_compare_and_swap
+
+AO_INLINE AO_t
+AO_fetch_and_add_full (volatile AO_t *p, AO_t incr)
+{
+ AO_t result, temp;
+ __asm__ __volatile__(
+ " .set push \n"
+ " .set mips3 \n"
+ " .set noreorder \n"
+ " .set nomacro \n"
+ "1: ll %1, %2 \n"
+ " addu %0, %1, %3 \n"
+ " sc %0, %2 \n"
+ " beqz %0, 1b \n"
+ " addu %0, %1, %3 \n"
+ " sync \n"
+ " .set pop \n"
+ : "=&r" (result), "=&r" (temp), "=m" (*p)
+ : "r" (incr), "m" (*p)
+ : "memory");
+ return result;
+}
+
+#define AO_HAVE_fetch_and_add_full
+
+/*
+ * FIXME: fetch_and_add_full implemented, any others?
+ */

View File

@ -1,21 +0,0 @@
$OpenBSD: patch-mach_dep_c,v 1.4 2007/07/14 22:16:17 kili Exp $
--- mach_dep.c.orig Wed Jul 11 12:46:22 2007
+++ mach_dep.c Wed Jul 11 12:58:50 2007
@@ -159,7 +159,7 @@ void GC_push_regs()
# undef HAVE_PUSH_REGS
#endif
-#if !defined(HAVE_PUSH_REGS) && defined(UNIX_LIKE)
+#if !defined(HAVE_PUSH_REGS) && defined(UNIX_LIKE) && !defined(OPENBSD)
# include <ucontext.h>
#endif
@@ -174,7 +174,7 @@ void GC_with_callee_saves_pushed(void (*fn)(ptr_t, voi
# if defined(HAVE_PUSH_REGS)
GC_push_regs();
-# elif defined(UNIX_LIKE) && !defined(DARWIN) && !defined(ARM32)
+# elif defined(UNIX_LIKE) && !defined(DARWIN) && !defined(ARM32) && !defined(OPENBSD)
/* Older versions of Darwin seem to lack getcontext(). */
/* ARM Linux often doesn't support a real getcontext(). */
ucontext_t ctxt;

View File

@ -1,11 +0,0 @@
--- misc.c.orig Thu Jun 28 14:14:55 2007
+++ misc.c Fri Feb 8 09:43:48 2008
@@ -629,7 +629,7 @@ void GC_init_inner()
# if defined(SEARCH_FOR_DATA_START)
GC_init_linux_data_start();
# endif
-# if (defined(NETBSD) || defined(OPENBSD)) && defined(__ELF__)
+# if defined(NETBSD) && defined(__ELF__)
GC_init_netbsd_elf();
# endif
# if !defined(THREADS) || defined(GC_PTHREADS) || defined(GC_WIN32_THREADS) \

View File

@ -1,185 +0,0 @@
--- os_dep.c.orig Fri Jun 29 15:17:44 2007
+++ os_dep.c Sun Feb 19 13:28:15 2012
@@ -486,7 +486,7 @@ static void *tiny_sbrk(ptrdiff_t increment)
#define sbrk tiny_sbrk
# endif /* ECOS */
-#if (defined(NETBSD) || defined(OPENBSD)) && defined(__ELF__)
+#if defined(NETBSD) && defined(__ELF__)
ptr_t GC_data_start;
void GC_init_netbsd_elf(void)
@@ -499,6 +499,86 @@ static void *tiny_sbrk(ptrdiff_t increment)
}
#endif
+#if defined(OPENBSD)
+ static struct sigaction old_segv_act;
+ sigjmp_buf GC_jmp_buf_openbsd;
+
+ /*ARGSUSED*/
+ void GC_fault_handler_openbsd(int sig)
+ {
+ siglongjmp(GC_jmp_buf_openbsd, 1);
+ }
+
+ /* Return the first nonaddressible location > p or bound */
+ /* Requires allocation lock. */
+ ptr_t GC_find_limit_openbsd(ptr_t p, ptr_t bound)
+ {
+ static volatile ptr_t result;
+ /* Safer if static, since otherwise it may not be */
+ /* preserved across the longjmp. Can safely be */
+ /* static since it's only called with the */
+ /* allocation lock held. */
+ struct sigaction act;
+ size_t pgsz = (size_t)sysconf(_SC_PAGESIZE);
+
+ GC_ASSERT(I_HOLD_LOCK());
+
+ act.sa_handler = GC_fault_handler_openbsd;
+ sigemptyset(&act.sa_mask);
+ act.sa_flags = SA_NODEFER | SA_RESTART;
+ sigaction(SIGSEGV, &act, &old_segv_act);
+
+ if (sigsetjmp(GC_jmp_buf_openbsd, 1) == 0) {
+ result = (ptr_t)(((word)(p)) & ~(pgsz-1));
+ for (;;) {
+ result += pgsz;
+ if (result >= bound) {
+ result = bound;
+ break;
+ }
+ GC_noop1((word)(*result));
+ }
+ }
+
+ sigaction(SIGSEGV, &old_segv_act, 0);
+
+ return(result);
+ }
+
+ /* Return first addressable location > p or bound */
+ /* Requires allocation lock. */
+ ptr_t GC_skip_hole_openbsd(ptr_t p, ptr_t bound)
+ {
+ static volatile ptr_t result;
+ struct sigaction act;
+ size_t pgsz = (size_t)sysconf(_SC_PAGESIZE);
+ static volatile int firstpass;
+
+ GC_ASSERT(I_HOLD_LOCK());
+
+ act.sa_handler = GC_fault_handler_openbsd;
+ sigemptyset(&act.sa_mask);
+ act.sa_flags = SA_NODEFER | SA_RESTART;
+ sigaction(SIGSEGV, &act, &old_segv_act);
+
+ firstpass = 1;
+ result = (ptr_t)(((word)(p)) & ~(pgsz-1));
+ if (sigsetjmp(GC_jmp_buf_openbsd, 1) != 0 || firstpass) {
+ firstpass = 0;
+ result += pgsz;
+ if (result >= bound) {
+ result = bound;
+ } else
+ GC_noop1((word)(*result));
+ }
+
+ sigaction(SIGSEGV, &old_segv_act, 0);
+
+ return(result);
+ }
+#endif
+
+
# ifdef OS2
# include <stddef.h>
@@ -1097,7 +1177,7 @@ ptr_t GC_get_main_stack_base(void)
#if !defined(BEOS) && !defined(AMIGA) && !defined(MSWIN32) \
&& !defined(MSWINCE) && !defined(OS2) && !defined(NOSYS) && !defined(ECOS) \
- && !defined(CYGWIN32)
+ && !defined(CYGWIN32) && !defined(GC_OPENBSD_THREADS)
ptr_t GC_get_main_stack_base(void)
{
@@ -1206,6 +1286,35 @@ int GC_get_stack_base(struct GC_stack_base *b)
#endif /* GC_LINUX_THREADS */
+#if defined(GC_OPENBSD_THREADS)
+
+/* Find the stack using pthread_stackseg_np() */
+
+# include <sys/signal.h>
+# include <pthread.h>
+# include <pthread_np.h>
+
+#define HAVE_GET_STACK_BASE
+
+int GC_get_stack_base(struct GC_stack_base *sb)
+{
+ stack_t stack;
+ pthread_stackseg_np(pthread_self(), &stack);
+ sb->mem_base = stack.ss_sp;
+ return GC_SUCCESS;
+}
+
+/* This is always called from the main thread. */
+ptr_t GC_get_main_stack_base(void)
+{
+ struct GC_stack_base sb;
+
+ GC_get_stack_base(&sb);
+ return (ptr_t)sb.mem_base;
+}
+
+#endif /* GC_OPENBSD_THREADS */
+
#ifndef HAVE_GET_STACK_BASE
/* Retrieve stack base. */
/* Using the GC_find_limit version is risky. */
@@ -1660,8 +1769,33 @@ ptr_t GC_FreeBSDGetDataStart(size_t max_page_size, ptr
#else /* !OS2 && !Windows && !AMIGA */
+#if defined(OPENBSD)
+
+/*
+ * Depending on arch alignment there can be multiple holes
+ * between DATASTART & DATAEND. Scan from DATASTART - DATAEND
+ * and register each region.
+ */
void GC_register_data_segments(void)
{
+ ptr_t region_start, region_end;
+
+ region_start = DATASTART;
+
+ for(;;) {
+ region_end = GC_find_limit_openbsd(region_start, DATAEND);
+ GC_add_roots_inner(region_start, region_end, FALSE);
+ if (region_end < DATAEND)
+ region_start = GC_skip_hole_openbsd(region_end, DATAEND);
+ else
+ break;
+ }
+}
+
+# else /* !OS2 && !Windows && !AMIGA && !OPENBSD */
+
+void GC_register_data_segments(void)
+{
# if !defined(PCR) && !defined(MACOS)
# if defined(REDIRECT_MALLOC) && defined(GC_SOLARIS_THREADS)
/* As of Solaris 2.3, the Solaris threads implementation */
@@ -1717,6 +1851,7 @@ void GC_register_data_segments(void)
/* change. */
}
+# endif /* ! OPENBSD */
# endif /* ! AMIGA */
# endif /* ! MSWIN32 && ! MSWINCE*/
# endif /* ! OS2 */

View File

@ -0,0 +1,120 @@
$OpenBSD: patch-pthread_stop_world_c,v 1.3 2013/06/01 21:05:28 kurt Exp $
--- pthread_stop_world.c.orig Thu Aug 9 16:25:13 2012
+++ pthread_stop_world.c Tue Mar 19 19:41:04 2013
@@ -35,7 +35,7 @@ GC_INNER __thread GC_thread GC_nacl_gc_thread_self = N
int GC_nacl_thread_parked[MAX_NACL_GC_THREADS];
int GC_nacl_thread_used[MAX_NACL_GC_THREADS];
-#elif !defined(GC_OPENBSD_THREADS)
+#elif !defined(GC_OPENBSD_UTHREADS)
#include <signal.h>
#include <semaphore.h>
@@ -298,7 +298,7 @@ STATIC void GC_restart_handler(int sig)
# endif
}
-#endif /* !GC_OPENBSD_THREADS && !NACL */
+#endif /* !GC_OPENBSD_UTHREADS && !NACL */
#ifdef IA64
# define IF_IA64(x) x
@@ -422,7 +422,7 @@ STATIC int GC_suspend_all(void)
# ifndef NACL
GC_thread p;
-# ifndef GC_OPENBSD_THREADS
+# ifndef GC_OPENBSD_UTHREADS
int result;
# endif
pthread_t self = pthread_self();
@@ -436,7 +436,7 @@ STATIC int GC_suspend_all(void)
if (!THREAD_EQUAL(p -> id, self)) {
if (p -> flags & FINISHED) continue;
if (p -> thread_blocked) /* Will wait */ continue;
-# ifndef GC_OPENBSD_THREADS
+# ifndef GC_OPENBSD_UTHREADS
if (p -> stop_info.last_stop_count == GC_stop_count) continue;
n_live_threads++;
# endif
@@ -445,7 +445,7 @@ STATIC int GC_suspend_all(void)
(unsigned)(p -> id));
# endif
-# ifdef GC_OPENBSD_THREADS
+# ifdef GC_OPENBSD_UTHREADS
{
stack_t stack;
if (pthread_suspend_np(p -> id) != 0)
@@ -523,7 +523,7 @@ STATIC int GC_suspend_all(void)
GC_INNER void GC_stop_world(void)
{
-# if !defined(GC_OPENBSD_THREADS) && !defined(NACL)
+# if !defined(GC_OPENBSD_UTHREADS) && !defined(NACL)
int i;
int n_live_threads;
int code;
@@ -545,7 +545,7 @@ GC_INNER void GC_stop_world(void)
}
# endif /* PARALLEL_MARK */
-# if defined(GC_OPENBSD_THREADS) || defined(NACL)
+# if defined(GC_OPENBSD_UTHREADS) || defined(NACL)
(void)GC_suspend_all();
# else
AO_store(&GC_stop_count, GC_stop_count+1);
@@ -735,7 +735,7 @@ GC_INNER void GC_start_world(void)
pthread_t self = pthread_self();
register int i;
register GC_thread p;
-# ifndef GC_OPENBSD_THREADS
+# ifndef GC_OPENBSD_UTHREADS
register int n_live_threads = 0;
register int result;
# endif
@@ -747,7 +747,7 @@ GC_INNER void GC_start_world(void)
GC_log_printf("World starting\n");
# endif
-# ifndef GC_OPENBSD_THREADS
+# ifndef GC_OPENBSD_UTHREADS
AO_store(&GC_world_is_stopped, FALSE);
# endif
for (i = 0; i < THREAD_TABLE_SZ; i++) {
@@ -755,7 +755,7 @@ GC_INNER void GC_start_world(void)
if (!THREAD_EQUAL(p -> id, self)) {
if (p -> flags & FINISHED) continue;
if (p -> thread_blocked) continue;
-# ifndef GC_OPENBSD_THREADS
+# ifndef GC_OPENBSD_UTHREADS
n_live_threads++;
# endif
# ifdef DEBUG_THREADS
@@ -763,7 +763,7 @@ GC_INNER void GC_start_world(void)
(unsigned)(p -> id));
# endif
-# ifdef GC_OPENBSD_THREADS
+# ifdef GC_OPENBSD_UTHREADS
if (pthread_resume_np(p -> id) != 0)
ABORT("pthread_resume_np failed");
# else
@@ -810,7 +810,7 @@ GC_INNER void GC_start_world(void)
GC_INNER void GC_stop_init(void)
{
-# if !defined(GC_OPENBSD_THREADS) && !defined(NACL)
+# if !defined(GC_OPENBSD_UTHREADS) && !defined(NACL)
struct sigaction act;
if (sem_init(&GC_suspend_ack_sem, GC_SEM_INIT_PSHARED, 0) != 0)
@@ -873,7 +873,7 @@ GC_INNER void GC_stop_init(void)
if (GC_print_stats && GC_retry_signals) {
GC_log_printf("Will retry suspend signal if necessary\n");
}
-# endif /* !GC_OPENBSD_THREADS && !NACL */
+# endif /* !GC_OPENBSD_UTHREADS && !NACL */
}
#endif

View File

@ -1,43 +0,0 @@
$OpenBSD: patch-pthread_support_c,v 1.3 2012/04/30 15:33:16 kurt Exp $
--- pthread_support.c.orig Tue May 15 01:24:46 2007
+++ pthread_support.c Tue Mar 6 10:24:21 2012
@@ -763,7 +763,7 @@ void GC_thr_init(void)
GC_nprocs = pthread_num_processors_np();
# endif
# if defined(GC_OSF1_THREADS) || defined(GC_AIX_THREADS) \
- || defined(GC_SOLARIS_THREADS)
+ || defined(GC_SOLARIS_THREADS) || defined(GC_OPENBSD_THREADS)
GC_nprocs = sysconf(_SC_NPROCESSORS_ONLN);
if (GC_nprocs <= 0) GC_nprocs = 1;
# endif
@@ -848,7 +848,7 @@ void GC_init_parallel(void)
}
-#if !defined(GC_DARWIN_THREADS)
+#if !defined(GC_DARWIN_THREADS) && !defined(GC_OPENBSD_THREADS)
int WRAP_FUNC(pthread_sigmask)(int how, const sigset_t *set, sigset_t *oset)
{
sigset_t fudged_set;
@@ -1103,6 +1103,12 @@ void * GC_start_routine(void * arg)
GC_enable();
# endif
return GC_inner_start_routine(&sb, arg);
+# elif defined(GC_OPENBSD_THREADS)
+ /* On OpenBSD GC_get_stack_base() doesn't cause any allocations */
+ struct GC_stack_base sb;
+ if (GC_get_stack_base(&sb) != GC_SUCCESS)
+ ABORT("Failed to get thread stack base.");
+ return GC_inner_start_routine(&sb, arg);
# else
return GC_call_with_stack_base(GC_inner_start_routine, arg);
# endif
@@ -1297,7 +1303,7 @@ void GC_generic_lock(pthread_mutex_t * lock)
/* as STL alloc.h. This isn't really the right way to do this. */
/* but until the POSIX scheduling mess gets straightened out ... */
-volatile AO_TS_t GC_allocate_lock = 0;
+volatile AO_TS_t GC_allocate_lock = AO_TS_INITIALIZER;
void GC_lock(void)

View File

@ -1,13 +0,0 @@
$OpenBSD: patch-tests_test_c,v 1.1 2007/07/14 22:16:17 kili Exp $
--- tests/test.c.orig Mon Jun 18 18:18:01 2007
+++ tests/test.c Thu Jul 12 11:19:28 2007
@@ -1579,7 +1579,8 @@ int main()
pthread_attr_init(&attr);
# if defined(GC_IRIX_THREADS) || defined(GC_FREEBSD_THREADS) \
- || defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS)
+ || defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS) \
+ || defined(GC_OPENBSD_THREADS)
pthread_attr_setstacksize(&attr, 1000000);
# endif
n_tests = 0;

View File

@ -1,13 +0,0 @@
$OpenBSD: patch-threadlibs_c,v 1.1 2007/07/14 22:16:17 kili Exp $
--- threadlibs.c.orig Thu Jul 12 08:56:01 2007
+++ threadlibs.c Thu Jul 12 08:58:02 2007
@@ -18,6 +18,9 @@ int main()
# endif
printf("-lpthread\n");
# endif
+# if defined(GC_OPENBSD_THREADS)
+ printf("-pthread\n");
+# endif
# if defined(GC_FREEBSD_THREADS)
# ifdef GC_USE_DLOPEN_WRAP
printf("-ldl ");

View File

@ -1,3 +0,0 @@
@comment $OpenBSD: PFRAG.shared-main,v 1.1 2008/07/01 09:43:19 landry Exp $
@lib lib/libcord.so.${LIBcord_VERSION}
@lib lib/libgc.so.${LIBgc_VERSION}

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST-atomic,v 1.1 2008/07/01 09:43:19 landry Exp $ @comment $OpenBSD: PLIST-atomic,v 1.2 2013/06/01 21:05:28 kurt Exp $
include/atomic_ops/ include/atomic_ops/
include/atomic_ops.h include/atomic_ops.h
include/atomic_ops/generalize-small.h include/atomic_ops/generalize-small.h
@ -11,6 +11,8 @@ include/atomic_ops/sysdeps/all_acquire_release_volatile.h
include/atomic_ops/sysdeps/all_aligned_atomic_load_store.h include/atomic_ops/sysdeps/all_aligned_atomic_load_store.h
include/atomic_ops/sysdeps/all_atomic_load_store.h include/atomic_ops/sysdeps/all_atomic_load_store.h
include/atomic_ops/sysdeps/ao_t_is_int.h include/atomic_ops/sysdeps/ao_t_is_int.h
include/atomic_ops/sysdeps/armcc/
include/atomic_ops/sysdeps/armcc/arm_v6.h
include/atomic_ops/sysdeps/atomic_load_store.h include/atomic_ops/sysdeps/atomic_load_store.h
include/atomic_ops/sysdeps/char_acquire_release_volatile.h include/atomic_ops/sysdeps/char_acquire_release_volatile.h
include/atomic_ops/sysdeps/char_atomic_load_store.h include/atomic_ops/sysdeps/char_atomic_load_store.h
@ -18,12 +20,16 @@ include/atomic_ops/sysdeps/emul_cas.h
include/atomic_ops/sysdeps/gcc/ include/atomic_ops/sysdeps/gcc/
include/atomic_ops/sysdeps/gcc/alpha.h include/atomic_ops/sysdeps/gcc/alpha.h
include/atomic_ops/sysdeps/gcc/arm.h include/atomic_ops/sysdeps/gcc/arm.h
include/atomic_ops/sysdeps/gcc/avr32.h
include/atomic_ops/sysdeps/gcc/cris.h include/atomic_ops/sysdeps/gcc/cris.h
include/atomic_ops/sysdeps/gcc/hexagon.h
include/atomic_ops/sysdeps/gcc/hppa.h include/atomic_ops/sysdeps/gcc/hppa.h
include/atomic_ops/sysdeps/gcc/ia64.h include/atomic_ops/sysdeps/gcc/ia64.h
include/atomic_ops/sysdeps/gcc/m68k.h include/atomic_ops/sysdeps/gcc/m68k.h
include/atomic_ops/sysdeps/gcc/mips.h
include/atomic_ops/sysdeps/gcc/powerpc.h include/atomic_ops/sysdeps/gcc/powerpc.h
include/atomic_ops/sysdeps/gcc/s390.h include/atomic_ops/sysdeps/gcc/s390.h
include/atomic_ops/sysdeps/gcc/sh.h
include/atomic_ops/sysdeps/gcc/sparc.h include/atomic_ops/sysdeps/gcc/sparc.h
include/atomic_ops/sysdeps/gcc/x86.h include/atomic_ops/sysdeps/gcc/x86.h
include/atomic_ops/sysdeps/gcc/x86_64.h include/atomic_ops/sysdeps/gcc/x86_64.h
@ -39,6 +45,8 @@ include/atomic_ops/sysdeps/int_acquire_release_volatile.h
include/atomic_ops/sysdeps/int_aligned_atomic_load_store.h include/atomic_ops/sysdeps/int_aligned_atomic_load_store.h
include/atomic_ops/sysdeps/int_atomic_load_store.h include/atomic_ops/sysdeps/int_atomic_load_store.h
include/atomic_ops/sysdeps/msftc/ include/atomic_ops/sysdeps/msftc/
include/atomic_ops/sysdeps/msftc/arm.h
include/atomic_ops/sysdeps/msftc/common32_defs.h
include/atomic_ops/sysdeps/msftc/x86.h include/atomic_ops/sysdeps/msftc/x86.h
include/atomic_ops/sysdeps/msftc/x86_64.h include/atomic_ops/sysdeps/msftc/x86_64.h
include/atomic_ops/sysdeps/ordered.h include/atomic_ops/sysdeps/ordered.h
@ -50,12 +58,16 @@ include/atomic_ops/sysdeps/short_atomic_load_store.h
include/atomic_ops/sysdeps/standard_ao_double_t.h include/atomic_ops/sysdeps/standard_ao_double_t.h
include/atomic_ops/sysdeps/sunc/ include/atomic_ops/sysdeps/sunc/
include/atomic_ops/sysdeps/sunc/sparc.h include/atomic_ops/sysdeps/sunc/sparc.h
include/atomic_ops/sysdeps/sunc/x86.h
include/atomic_ops/sysdeps/sunc/x86_64.h
include/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h include/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h
include/atomic_ops/sysdeps/test_and_set_t_is_char.h include/atomic_ops/sysdeps/test_and_set_t_is_char.h
include/atomic_ops_malloc.h include/atomic_ops_malloc.h
include/atomic_ops_stack.h include/atomic_ops_stack.h
lib/libatomic_ops.a lib/libatomic_ops.a
lib/libatomic_ops_gpl.a lib/libatomic_ops_gpl.a
lib/pkgconfig/
lib/pkgconfig/atomic_ops.pc
share/libatomic_ops/ share/libatomic_ops/
share/libatomic_ops/COPYING share/libatomic_ops/COPYING
share/libatomic_ops/LICENSING.txt share/libatomic_ops/LICENSING.txt

View File

@ -1,7 +1,8 @@
@comment $OpenBSD: PLIST-main,v 1.1 2008/07/01 09:43:19 landry Exp $ @comment $OpenBSD: PLIST-main,v 1.2 2013/06/01 21:05:28 kurt Exp $
@pkgpath devel/boehm-gc @pkgpath devel/boehm-gc
%%SHARED%%
include/gc/ include/gc/
include/gc.h
include/gc/cord.h
include/gc/gc.h include/gc/gc.h
include/gc/gc_allocator.h include/gc/gc_allocator.h
include/gc/gc_amiga_redirects.h include/gc/gc_amiga_redirects.h
@ -14,13 +15,20 @@ include/gc/gc_mark.h
include/gc/gc_pthread_redirects.h include/gc/gc_pthread_redirects.h
include/gc/gc_tiny_fl.h include/gc/gc_tiny_fl.h
include/gc/gc_typed.h include/gc/gc_typed.h
include/gc/gc_version.h
include/gc/leak_detector.h include/gc/leak_detector.h
include/gc/new_gc_alloc.h include/gc/new_gc_alloc.h
include/gc/weakpointer.h include/gc/weakpointer.h
include/gc_cpp.h
lib/libcord.a lib/libcord.a
lib/libcord.la lib/libcord.la
@lib lib/libcord.so.${LIBcord_VERSION}
lib/libgc.a lib/libgc.a
lib/libgc.la lib/libgc.la
@lib lib/libgc.so.${LIBgc_VERSION}
lib/libgccpp.a
lib/libgccpp.la
@lib lib/libgccpp.so.${LIBgccpp_VERSION}
lib/pkgconfig/ lib/pkgconfig/
lib/pkgconfig/bdw-gc.pc lib/pkgconfig/bdw-gc.pc
@man man/man3/GC_enable_incremental.3 @man man/man3/GC_enable_incremental.3
@ -43,6 +51,7 @@ share/gc/README.amiga
share/gc/README.arm.cross share/gc/README.arm.cross
share/gc/README.autoconf share/gc/README.autoconf
share/gc/README.changes share/gc/README.changes
share/gc/README.cmake
share/gc/README.contributors share/gc/README.contributors
share/gc/README.cords share/gc/README.cords
share/gc/README.darwin share/gc/README.darwin