mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-04 22:18:55 +02:00
boehm_gc: add recipe for version 7.6.4. (#2215)
* Rename license file (BOEHM -> Boehm) * Remove --enable-thread-local-alloc * Sort PROVIDES[_devel], BUILD_PREREQUIRES. * Drop the libtool files after make install * Add debug-info package * Remove CFLAGS+=-fPIC for make check * Remove --enable-threads, --disable-debug configure options * Use autoreconf instead of libtoolize+autoconf * Add fallback SOURCE_URI (referring to hboehm.info) * Workaround sem_wait and pthread_join fails
This commit is contained in:
393
dev-libs/boehm_gc/patches/boehm_gc-7.6.4.patchset
Normal file
393
dev-libs/boehm_gc/patches/boehm_gc-7.6.4.patchset
Normal file
@@ -0,0 +1,393 @@
|
||||
From 82f5e61273486a041abc72991fe0cdf8441efbdc Mon Sep 17 00:00:00 2001
|
||||
From: "Joseph C, Hill" <calvin@hakobaito.co.uk>
|
||||
Date: Fri, 16 Feb 2018 11:08:51 +0300
|
||||
Subject: [PATCH 1/2] Haiku patches for x86_64
|
||||
|
||||
---
|
||||
configure.ac | 5 +++++
|
||||
dyn_load.c | 18 +++++++++++++++++-
|
||||
include/gc_config_macros.h | 7 +++++--
|
||||
include/private/gcconfig.h | 37 +++++++++++++++++++++++++++++-------
|
||||
include/private/thread_local_alloc.h | 3 ++-
|
||||
os_dep.c | 36 ++++++++++++++++++++++++++---------
|
||||
pthread_support.c | 4 ++--
|
||||
7 files changed, 88 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index da9cded0..67d9a6f3 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -140,6 +140,7 @@ AH_TEMPLATE([GC_AIX_THREADS], [Define to support IBM AIX threads.])
|
||||
AH_TEMPLATE([GC_DARWIN_THREADS], [Define to support Darwin pthreads.])
|
||||
AH_TEMPLATE([GC_FREEBSD_THREADS], [Define to support FreeBSD pthreads.])
|
||||
AH_TEMPLATE([GC_GNU_THREADS], [Define to support GNU pthreads.])
|
||||
+AH_TEMPLATE([GC_HAIKU_THREADS], [Define to support Haiku pthreads.])
|
||||
AH_TEMPLATE([GC_HPUX_THREADS], [Define to support HP/UX 11 pthreads.])
|
||||
AH_TEMPLATE([GC_IRIX_THREADS], [Define to support Irix pthreads.])
|
||||
AH_TEMPLATE([GC_LINUX_THREADS], [Define to support pthreads on Linux.])
|
||||
@@ -201,6 +202,10 @@ case "$THREADS" in
|
||||
AC_DEFINE(GC_AIX_THREADS)
|
||||
AC_DEFINE(_REENTRANT)
|
||||
;;
|
||||
+ *-*-haiku*)
|
||||
+ AC_DEFINE(GC_HAIKU_THREADS)
|
||||
+ AC_DEFINE(_REENTRANT)
|
||||
+ ;;
|
||||
*-*-hpux11*)
|
||||
AC_MSG_WARN("Only HP/UX 11 POSIX threads are supported.")
|
||||
AC_DEFINE(GC_HPUX_THREADS)
|
||||
diff --git a/dyn_load.c b/dyn_load.c
|
||||
index 0f36f777..b83dcb71 100644
|
||||
--- a/dyn_load.c
|
||||
+++ b/dyn_load.c
|
||||
@@ -58,7 +58,8 @@ STATIC GC_has_static_roots_func GC_has_static_roots = 0;
|
||||
&& !(defined(ALPHA) && defined(OSF1)) \
|
||||
&& !(defined(FREEBSD) && defined(__ELF__)) \
|
||||
&& !((defined(LINUX) || defined(NACL)) && defined(__ELF__)) \
|
||||
- && !(defined(NETBSD) && defined(__ELF__)) && !defined(HURD) \
|
||||
+ && !(defined(NETBSD) && defined(__ELF__)) \
|
||||
+ && !defined(HAIKU) && !defined(HURD) \
|
||||
&& !(defined(OPENBSD) && (defined(__ELF__) || defined(M68K))) \
|
||||
&& !defined(CPPCHECK)
|
||||
# error We only know how to find data segments of dynamic libraries for above.
|
||||
@@ -1490,6 +1491,21 @@ GC_INNER GC_bool GC_register_main_static_data(void)
|
||||
|
||||
#endif /* DARWIN */
|
||||
|
||||
+#if defined(HAIKU)
|
||||
+# include <kernel/image.h>
|
||||
+
|
||||
+ GC_INNER void GC_register_dynamic_libraries(void)
|
||||
+ {
|
||||
+ image_info info;
|
||||
+ int32 cookie = 0;
|
||||
+
|
||||
+ while (get_next_image_info(0, &cookie, &info) == B_OK) {
|
||||
+ ptr_t data = (ptr_t)info.data;
|
||||
+ GC_add_roots_inner(data, data + info.data_size, TRUE);
|
||||
+ }
|
||||
+ }
|
||||
+#endif /* HAIKU */
|
||||
+
|
||||
#elif defined(PCR)
|
||||
|
||||
# include "il/PCR_IL.h"
|
||||
diff --git a/include/gc_config_macros.h b/include/gc_config_macros.h
|
||||
index e8748f5d..2c76f4a9 100644
|
||||
--- a/include/gc_config_macros.h
|
||||
+++ b/include/gc_config_macros.h
|
||||
@@ -64,7 +64,8 @@
|
||||
|
||||
#if defined(GC_AIX_THREADS) || defined(GC_DARWIN_THREADS) \
|
||||
|| defined(GC_DGUX386_THREADS) || defined(GC_FREEBSD_THREADS) \
|
||||
- || defined(GC_GNU_THREADS) || defined(GC_HPUX_THREADS) \
|
||||
+ || defined(GC_GNU_THREADS) \
|
||||
+ || defined(GC_HAIKU_THREADS) || defined(GC_HPUX_THREADS) \
|
||||
|| defined(GC_IRIX_THREADS) || defined(GC_LINUX_THREADS) \
|
||||
|| defined(GC_NETBSD_THREADS) || defined(GC_OPENBSD_THREADS) \
|
||||
|| defined(GC_OSF1_THREADS) || defined(GC_SOLARIS_THREADS) \
|
||||
@@ -94,6 +95,8 @@
|
||||
# define GC_SOLARIS_THREADS
|
||||
# elif defined(__APPLE__) && defined(__MACH__)
|
||||
# define GC_DARWIN_THREADS
|
||||
+# elif defined(__HAIKU__)
|
||||
+# define GC_HAIKU_THREADS
|
||||
# elif defined(__OpenBSD__)
|
||||
# define GC_OPENBSD_THREADS
|
||||
# elif !defined(GC_LINUX_THREADS) && !defined(GC_HPUX_THREADS) \
|
||||
@@ -321,7 +324,7 @@
|
||||
/* This may also be desirable if it is possible but expensive to */
|
||||
/* retrieve the call chain. */
|
||||
#if (defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__) \
|
||||
- || defined(__FreeBSD__) || defined(__DragonFly__) \
|
||||
+ || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__HAIKU__) \
|
||||
|| defined(PLATFORM_ANDROID) || defined(__ANDROID__)) \
|
||||
&& !defined(GC_CAN_SAVE_CALL_STACKS)
|
||||
# define GC_ADD_CALLER
|
||||
diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
|
||||
index ffbdc142..7b05f4ee 100644
|
||||
--- a/include/private/gcconfig.h
|
||||
+++ b/include/private/gcconfig.h
|
||||
@@ -288,9 +288,14 @@
|
||||
# endif
|
||||
# define mach_type_known
|
||||
# endif
|
||||
-# if defined(__BEOS__) && defined(_X86_)
|
||||
+# if (defined(__BEOS__) || defined(__HAIKU__)) && defined(_X86_)
|
||||
# define I386
|
||||
-# define BEOS
|
||||
+# define HAIKU
|
||||
+# define mach_type_known
|
||||
+# endif
|
||||
+# if defined(__HAIKU__) && (defined(__amd64__) || defined(__x86_64__))
|
||||
+# define X86_64
|
||||
+# define HAIKU
|
||||
# define mach_type_known
|
||||
# endif
|
||||
# if defined(OPENBSD) && defined(__amd64__)
|
||||
@@ -1268,12 +1273,14 @@
|
||||
# define DATASTART ((ptr_t)((((word)(etext)) + 0xfff) & ~0xfff))
|
||||
# define STACKBOTTOM ((ptr_t)0x3ffff000)
|
||||
# endif
|
||||
-# ifdef BEOS
|
||||
-# define OS_TYPE "BEOS"
|
||||
+# ifdef HAIKU
|
||||
+# define OS_TYPE "HAIKU"
|
||||
# include <OS.h>
|
||||
# define GETPAGESIZE() (unsigned)B_PAGE_SIZE
|
||||
extern int etext[];
|
||||
# define DATASTART ((ptr_t)((((word)(etext)) + 0xfff) & ~0xfff))
|
||||
+# define DYNAMIC_LOADING
|
||||
+# define MPROTECT_VDB
|
||||
# endif
|
||||
# ifdef SOLARIS
|
||||
# define OS_TYPE "SOLARIS"
|
||||
@@ -2532,6 +2539,18 @@
|
||||
# define SEARCH_FOR_DATA_START
|
||||
# endif
|
||||
# endif
|
||||
+# ifdef HAIKU
|
||||
+# define OS_TYPE "HAIKU"
|
||||
+# include <OS.h>
|
||||
+# define GETPAGESIZE() (unsigned)B_PAGE_SIZE
|
||||
+# define SEARCH_FOR_DATA_START
|
||||
+# define HEURISTIC2
|
||||
+# ifndef USE_MMAP
|
||||
+# define USE_MMAP
|
||||
+# endif
|
||||
+# define DYNAMIC_LOADING
|
||||
+# define MPROTECT_VDB
|
||||
+# endif
|
||||
# ifdef SOLARIS
|
||||
# define OS_TYPE "SOLARIS"
|
||||
# define ELF_CLASS ELFCLASS64
|
||||
@@ -2796,7 +2815,7 @@
|
||||
|
||||
#if defined(SVR4) || defined(LINUX) || defined(IRIX5) || defined(HPUX) \
|
||||
|| defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
|
||||
- || defined(DGUX) || defined(BSD) || defined(HURD) \
|
||||
+ || defined(DGUX) || defined(BSD) || defined(HAIKU) || defined(HURD) \
|
||||
|| defined(AIX) || defined(DARWIN) || defined(OSF1)
|
||||
# define UNIX_LIKE /* Basic Unix-like system calls work. */
|
||||
#endif
|
||||
@@ -2906,9 +2925,10 @@
|
||||
# define DEFAULT_VDB
|
||||
#endif
|
||||
|
||||
-#if ((defined(UNIX_LIKE) && (defined(DARWIN) || defined(HURD) \
|
||||
+#if ((defined(UNIX_LIKE) && (defined(DARWIN) || defined(HAIKU) \
|
||||
+ || defined(HURD) \
|
||||
|| defined(OPENBSD) || defined(ARM32) \
|
||||
- || defined(MIPS) || defined(AVR32) \
|
||||
+ || defined(AVR32) || defined(MIPS) \
|
||||
|| defined(OR1K) || defined(NIOS2))) \
|
||||
|| (defined(LINUX) && !defined(__gnu_linux__)) \
|
||||
|| (defined(RTEMS) && defined(I386)) || defined(PLATFORM_ANDROID)) \
|
||||
@@ -3330,6 +3350,9 @@
|
||||
# elif defined(SN_TARGET_PS3)
|
||||
void *ps3_get_mem(size_t bytes);
|
||||
# define GET_MEM(bytes) (struct hblk*)ps3_get_mem(bytes)
|
||||
+# elif defined(HAIKU)
|
||||
+ ptr_t GC_haiku_get_mem(size_t bytes);
|
||||
+# define GET_MEM(bytes) (struct hblk*)GC_haiku_get_mem(bytes)
|
||||
# else
|
||||
ptr_t GC_unix_get_mem(size_t bytes);
|
||||
# define GET_MEM(bytes) (struct hblk *)GC_unix_get_mem(bytes)
|
||||
diff --git a/include/private/thread_local_alloc.h b/include/private/thread_local_alloc.h
|
||||
index 7e7627c7..36e8c6d7 100644
|
||||
--- a/include/private/thread_local_alloc.h
|
||||
+++ b/include/private/thread_local_alloc.h
|
||||
@@ -59,7 +59,8 @@
|
||||
# elif defined(GC_DGUX386_THREADS) || defined(GC_OSF1_THREADS) \
|
||||
|| defined(GC_AIX_THREADS) || defined(GC_DARWIN_THREADS) \
|
||||
|| defined(GC_FREEBSD_THREADS) || defined(GC_NETBSD_THREADS) \
|
||||
- || defined(GC_LINUX_THREADS) || defined(GC_RTEMS_PTHREADS)
|
||||
+ || defined(GC_LINUX_THREADS) || defined(GC_HAIKU_THREADS) \
|
||||
+ || defined(GC_RTEMS_PTHREADS)
|
||||
# define USE_PTHREAD_SPECIFIC
|
||||
# elif defined(GC_HPUX_THREADS)
|
||||
# ifdef __GNUC__
|
||||
diff --git a/os_dep.c b/os_dep.c
|
||||
index d3429d04..28c2773c 100644
|
||||
--- a/os_dep.c
|
||||
+++ b/os_dep.c
|
||||
@@ -829,7 +829,7 @@ GC_INNER size_t GC_page_size = 0;
|
||||
}
|
||||
#endif /* !MSWIN32 */
|
||||
|
||||
-#ifdef BEOS
|
||||
+#ifdef HAIKU
|
||||
# include <kernel/OS.h>
|
||||
|
||||
GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *sb)
|
||||
@@ -840,7 +840,7 @@ GC_INNER size_t GC_page_size = 0;
|
||||
return GC_SUCCESS;
|
||||
}
|
||||
# define HAVE_GET_STACK_BASE
|
||||
-#endif /* BEOS */
|
||||
+#endif /* HAIKU */
|
||||
|
||||
#ifdef OS2
|
||||
GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *sb)
|
||||
@@ -869,7 +869,8 @@ GC_INNER size_t GC_page_size = 0;
|
||||
typedef void (*GC_fault_handler_t)(int);
|
||||
|
||||
# if defined(SUNOS5SIGS) || defined(IRIX5) || defined(OSF1) \
|
||||
- || defined(HURD) || defined(FREEBSD) || defined(NETBSD)
|
||||
+ || defined(HAIKU) || defined(HURD) || defined(FREEBSD) \
|
||||
+ || defined(NETBSD)
|
||||
static struct sigaction old_segv_act;
|
||||
# if defined(_sigargs) /* !Irix6.x */ \
|
||||
|| defined(HURD) || defined(NETBSD) || defined(FREEBSD)
|
||||
@@ -885,7 +886,8 @@ GC_INNER size_t GC_page_size = 0;
|
||||
GC_INNER void GC_set_and_save_fault_handler(GC_fault_handler_t h)
|
||||
{
|
||||
# if defined(SUNOS5SIGS) || defined(IRIX5) || defined(OSF1) \
|
||||
- || defined(HURD) || defined(FREEBSD) || defined(NETBSD)
|
||||
+ || defined(HAIKU) || defined(HURD) || defined(FREEBSD) \
|
||||
+ || defined(NETBSD)
|
||||
struct sigaction act;
|
||||
|
||||
act.sa_handler = h;
|
||||
@@ -949,7 +951,8 @@ GC_INNER size_t GC_page_size = 0;
|
||||
GC_INNER void GC_reset_fault_handler(void)
|
||||
{
|
||||
# if defined(SUNOS5SIGS) || defined(IRIX5) || defined(OSF1) \
|
||||
- || defined(HURD) || defined(FREEBSD) || defined(NETBSD)
|
||||
+ || defined(HAIKU) || defined(HURD) || defined(FREEBSD) \
|
||||
+ || defined(NETBSD)
|
||||
(void) sigaction(SIGSEGV, &old_segv_act, 0);
|
||||
# if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \
|
||||
|| defined(HURD) || defined(NETBSD)
|
||||
@@ -1190,7 +1193,7 @@ GC_INNER size_t GC_page_size = 0;
|
||||
return (ptr_t)GC_get_main_symbian_stack_base();
|
||||
}
|
||||
# define GET_MAIN_STACKBASE_SPECIAL
|
||||
-#elif !defined(BEOS) && !defined(AMIGA) && !defined(OS2) \
|
||||
+#elif !defined(AMIGA) && !defined(HAIKU) && !defined(OS2) \
|
||||
&& !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32) \
|
||||
&& !defined(GC_OPENBSD_THREADS) \
|
||||
&& (!defined(GC_SOLARIS_THREADS) || defined(_STRICT_STDC))
|
||||
@@ -1291,7 +1294,7 @@ GC_INNER size_t GC_page_size = 0;
|
||||
return(result);
|
||||
}
|
||||
# define GET_MAIN_STACKBASE_SPECIAL
|
||||
-#endif /* !AMIGA, !BEOS, !OPENBSD, !OS2, !Windows */
|
||||
+#endif /* !AMIGA, !HAIKU, !OPENBSD, !OS2, !Windows */
|
||||
|
||||
#if (defined(HAVE_PTHREAD_ATTR_GET_NP) || defined(HAVE_PTHREAD_GETATTR_NP)) \
|
||||
&& defined(THREADS) && !defined(HAVE_GET_STACK_BASE)
|
||||
@@ -2425,6 +2428,19 @@ void * os2_alloc(size_t bytes)
|
||||
# undef GC_AMIGA_AM
|
||||
#endif
|
||||
|
||||
+#if defined(HAIKU)
|
||||
+# include <stdlib.h>
|
||||
+ ptr_t GC_haiku_get_mem(size_t bytes)
|
||||
+ {
|
||||
+ void* mem;
|
||||
+
|
||||
+ GC_ASSERT(GC_page_size != 0);
|
||||
+ if (posix_memalign(&mem, GC_page_size, bytes) == 0)
|
||||
+ return mem;
|
||||
+ return NULL;
|
||||
+ }
|
||||
+#endif /* HAIKU */
|
||||
+
|
||||
#ifdef USE_MUNMAP
|
||||
|
||||
/* For now, this only works on Win32/WinCE and some Unix-like */
|
||||
@@ -3021,7 +3037,9 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void)
|
||||
# elif !defined(USE_WINALLOC)
|
||||
# include <sys/mman.h>
|
||||
# include <signal.h>
|
||||
-# include <sys/syscall.h>
|
||||
+# if !defined(HAIKU)
|
||||
+# include <sys/syscall.h>
|
||||
+# endif
|
||||
|
||||
# define PROTECT(addr, len) \
|
||||
if (mprotect((caddr_t)(addr), (size_t)(len), \
|
||||
@@ -3181,7 +3199,7 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void)
|
||||
# define CODE_OK (si -> si_code == 2 /* experimentally determined */)
|
||||
# elif defined(IRIX5)
|
||||
# define CODE_OK (si -> si_code == EACCES)
|
||||
-# elif defined(HURD)
|
||||
+# elif defined(HAIKU) || defined(HURD)
|
||||
# define CODE_OK TRUE
|
||||
# elif defined(LINUX)
|
||||
# define CODE_OK TRUE
|
||||
diff --git a/pthread_support.c b/pthread_support.c
|
||||
index 335e6ebb..48e8b418 100644
|
||||
--- a/pthread_support.c
|
||||
+++ b/pthread_support.c
|
||||
@@ -873,8 +873,8 @@ STATIC void GC_remove_all_threads_but_me(void)
|
||||
# define GC_get_nprocs() pthread_num_processors_np()
|
||||
|
||||
#elif defined(GC_OSF1_THREADS) || defined(GC_AIX_THREADS) \
|
||||
- || defined(GC_SOLARIS_THREADS) || defined(GC_GNU_THREADS) \
|
||||
- || defined(PLATFORM_ANDROID) || defined(NACL)
|
||||
+ || defined(GC_HAIKU_THREADS) || defined(GC_SOLARIS_THREADS) \
|
||||
+ || defined(GC_GNU_THREADS) || defined(PLATFORM_ANDROID) || defined(NACL)
|
||||
GC_INLINE int GC_get_nprocs(void)
|
||||
{
|
||||
int nprocs = (int)sysconf(_SC_NPROCESSORS_ONLN);
|
||||
--
|
||||
2.16.1
|
||||
|
||||
From 0057c5d11ee910704aa4fa76ab2c028fe06c8699 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Maidanski <ivmai@mail.ru>
|
||||
Date: Tue, 6 Mar 2018 23:55:33 +0300
|
||||
Subject: [PATCH 2/2] Haiku workarounds for EACCES returned by sem_wait and for
|
||||
ESRCH returned by pthread_join
|
||||
|
||||
---
|
||||
pthread_support.c | 4 ++++
|
||||
tests/subthread_create.c | 9 +++++++++
|
||||
2 files changed, 13 insertions(+)
|
||||
|
||||
diff --git a/pthread_support.c b/pthread_support.c
|
||||
index 48e8b418..7fda8fa1 100644
|
||||
--- a/pthread_support.c
|
||||
+++ b/pthread_support.c
|
||||
@@ -1870,6 +1870,10 @@ GC_API int WRAP_FUNC(pthread_create)(pthread_t *new_thread,
|
||||
DISABLE_CANCEL(cancel_state);
|
||||
/* pthread_create is not a cancellation point. */
|
||||
while (0 != sem_wait(&(si -> registered))) {
|
||||
+# if defined(GC_HAIKU_THREADS)
|
||||
+ /* To workaround some bug in Haiku semaphores. */
|
||||
+ if (EACCES == errno) continue;
|
||||
+# endif
|
||||
if (EINTR != errno) ABORT("sem_wait failed");
|
||||
}
|
||||
RESTORE_CANCEL(cancel_state);
|
||||
diff --git a/tests/subthread_create.c b/tests/subthread_create.c
|
||||
index e30eae53..b60912ad 100644
|
||||
--- a/tests/subthread_create.c
|
||||
+++ b/tests/subthread_create.c
|
||||
@@ -24,6 +24,10 @@
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
+#if defined(__HAIKU__)
|
||||
+# include <errno.h>
|
||||
+#endif
|
||||
+
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -125,6 +129,11 @@ int main(void)
|
||||
err = pthread_join(th[i], &res);
|
||||
if (err) {
|
||||
fprintf(stderr, "Failed to join thread: %s\n", strerror(err));
|
||||
+# if defined(__HAIKU__)
|
||||
+ /* The error is just ignored (and the test is ended) to */
|
||||
+ /* workaround some bug in Haiku pthread_join. */
|
||||
+ if (ESRCH == err) break;
|
||||
+# endif
|
||||
exit(1);
|
||||
}
|
||||
# else
|
||||
--
|
||||
2.16.1
|
||||
|
||||
Reference in New Issue
Block a user