From 4900b34ae1580c6da3d4a08a490e80e2efc9ec95 Mon Sep 17 00:00:00 2001 From: Cameron Youell Date: Mon, 27 Mar 2023 20:35:57 +1100 Subject: [PATCH] Ports/bdwgc: Update bdwgc to version 8.2.2 --- Ports/AvailablePorts.md | 2 +- Ports/bdwgc/package.sh | 16 +-- ...os_dep-and-gcconfig.h-about-serenity.patch | 114 +++++++----------- .../patches/0002-Error-on-unknown-arch.patch | 8 +- ...0003-Teach-dyn_load.c-about-serenity.patch | 36 +++--- ...4-Teach-bdwgc-about-serenity-signals.patch | 26 ++-- .../0005-Explicitly-link-with-pthread.patch | 70 ----------- ...ke-the-collector-build-with-threads.patch} | 30 ++--- ...the-conigure-list-of-pthread-unixes.patch} | 6 +- Ports/bdwgc/patches/ReadMe.md | 12 +- 10 files changed, 105 insertions(+), 215 deletions(-) delete mode 100644 Ports/bdwgc/patches/0005-Explicitly-link-with-pthread.patch rename Ports/bdwgc/patches/{0006-Make-the-collector-build-with-threads.patch => 0005-Make-the-collector-build-with-threads.patch} (53%) rename Ports/bdwgc/patches/{0007-Add-serenity-to-the-conigure-list-of-pthread-unixes.patch => 0006-Add-serenity-to-the-conigure-list-of-pthread-unixes.patch} (88%) diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index cdbd4cd88f..fecac94134 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -17,7 +17,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n | [`bash`](bash/) | GNU Bash | 5.2.15 | https://www.gnu.org/software/bash/ | | [`bass`](bass/) | Beneath a Steel Sky | cd-1.2 | https://www.scummvm.org/games | | [`bc`](bc/) | bc | 6.5.0 | https://github.com/gavinhoward/bc | -| [`bdwgc`](bdwgc/) | Boehm-Demers-Weiser Garbage Collector (libgc) | 8.0.6 | https://github.com/ivmai/bdwgc | +| [`bdwgc`](bdwgc/) | Boehm-Demers-Weiser Garbage Collector (libgc) | 8.2.2 | https://github.com/ivmai/bdwgc | | [`binutils`](binutils/) | GNU Binutils | 2.40 | https://www.gnu.org/software/binutils/ | | [`bison`](bison/) | GNU Bison | 1.25 | https://www.gnu.org/software/bison/ | | [`bochs`](bochs/) | Bochs x86 PC emulator | 2.7 | https://sourceforge.net/projects/bochs/ | diff --git a/Ports/bdwgc/package.sh b/Ports/bdwgc/package.sh index 558d6f0dbc..a8bffb18f8 100755 --- a/Ports/bdwgc/package.sh +++ b/Ports/bdwgc/package.sh @@ -1,14 +1,14 @@ #!/usr/bin/env -S bash ../.port_include.sh -port=bdwgc -version=8.0.6 -use_fresh_config_sub=true -files="https://github.com/ivmai/bdwgc/releases/download/v$version/gc-$version.tar.gz bdwgc.tar.gz 3b4914abc9fa76593596773e4da671d7ed4d5390e3d46fbf2e5f155e121bea11" -depends=(libatomic_ops) -workdir=gc-$version -auth_type=sha256 +port='bdwgc' +version='8.2.2' +use_fresh_config_sub='true' +files="https://github.com/ivmai/bdwgc/releases/download/v$version/gc-$version.tar.gz bdwgc.tar.gz f30107bcb062e0920a790ffffa56d9512348546859364c23a14be264b38836a0" +depends=("libatomic_ops") +workdir="gc-$version" +auth_type='sha256' -useconfigure=true +useconfigure='true' configopts=("--enable-threads=posix") pre_configure() { run ./autogen.sh diff --git a/Ports/bdwgc/patches/0001-Teach-os_dep-and-gcconfig.h-about-serenity.patch b/Ports/bdwgc/patches/0001-Teach-os_dep-and-gcconfig.h-about-serenity.patch index 7dc9acb389..8ffdaddeda 100644 --- a/Ports/bdwgc/patches/0001-Teach-os_dep-and-gcconfig.h-about-serenity.patch +++ b/Ports/bdwgc/patches/0001-Teach-os_dep-and-gcconfig.h-about-serenity.patch @@ -1,20 +1,20 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur -Date: Thu, 24 Feb 2022 01:00:57 +0330 +Date: Mon, 27 Mar 2023 20:03:03 +1100 Subject: [PATCH] Teach os_dep and gcconfig.h about serenity --- - include/private/gcconfig.h | 48 +++++++++++++++++++++++++++++++++++--- - os_dep.c | 34 ++++++++++++++++++++------- - 2 files changed, 70 insertions(+), 12 deletions(-) + include/private/gcconfig.h | 32 +++++++++++++++++++++++++++++--- + os_dep.c | 32 ++++++++++++++++++++++++-------- + 2 files changed, 53 insertions(+), 11 deletions(-) diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h -index 1979c58..e9d1d42 100644 +index 2de01af..8e9fb29 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h -@@ -351,6 +351,15 @@ EXTERN_C_BEGIN - # define HAIKU - # define mach_type_known +@@ -337,6 +337,15 @@ EXTERN_C_BEGIN + # endif + # define mach_type_known # endif +# if defined(__serenity__) +# define SERENITY @@ -25,13 +25,13 @@ index 1979c58..e9d1d42 100644 +# define X86_64 +# endif +#endif - # if defined(__HAIKU__) && (defined(__amd64__) || defined(__x86_64__)) - # define X86_64 + # if (defined(__BEOS__) || defined(__HAIKU__)) && defined(_X86_) + # define I386 # define HAIKU -@@ -1377,6 +1386,22 @@ EXTERN_C_BEGIN - # define DYNAMIC_LOADING - # define MPROTECT_VDB +@@ -1058,6 +1067,23 @@ EXTERN_C_BEGIN # endif + # endif /* OPENBSD */ + +# ifdef SERENITY +# define OS_TYPE "SERENITY" + EXTERN_C_END @@ -48,34 +48,11 @@ index 1979c58..e9d1d42 100644 +# define USE_MMAP 1 +# endif +# endif - # ifdef SOLARIS - # define OS_TYPE "SOLARIS" - extern int _etext[], _end[]; -@@ -2727,6 +2752,23 @@ EXTERN_C_BEGIN - # define DYNAMIC_LOADING - # define MPROTECT_VDB - # endif -+# ifdef SERENITY -+# define OS_TYPE "SERENITY" -+ EXTERN_C_END -+# include -+ EXTERN_C_BEGIN -+# define GETPAGESIZE() (unsigned)sysconf(_SC_PAGESIZE) -+# define HEURISTIC2 -+ extern int etext[], _end[]; -+# define DATASTART ((ptr_t)((((word)(etext)) + 0xfff) & ~0xfff)) -+# define DATAEND ((ptr_t)(_end)) -+# define DYNAMIC_LOADING -+# define MPROTECT_VDB -+# define USE_MMAP_ANON -+# ifndef USE_MMAP -+# define USE_MMAP 1 -+# endif -+# endif - # ifdef SOLARIS - # define OS_TYPE "SOLARIS" - # define ELF_CLASS ELFCLASS64 -@@ -3068,7 +3110,7 @@ EXTERN_C_BEGIN ++ + # ifdef SOLARIS + # define OS_TYPE "SOLARIS" + extern int _etext[], _end[]; +@@ -2703,7 +2729,7 @@ EXTERN_C_BEGIN #if defined(SVR4) || defined(LINUX) || defined(IRIX5) || defined(HPUX) \ || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \ || defined(DGUX) || defined(BSD) || defined(HAIKU) || defined(HURD) \ @@ -84,7 +61,7 @@ index 1979c58..e9d1d42 100644 # define UNIX_LIKE /* Basic Unix-like system calls work. */ #endif -@@ -3118,7 +3160,7 @@ EXTERN_C_BEGIN +@@ -2753,7 +2779,7 @@ EXTERN_C_BEGIN #if defined(DARWIN) || defined(FREEBSD) || defined(HAIKU) \ || defined(IRIX5) || defined(LINUX) || defined(NETBSD) \ @@ -93,7 +70,7 @@ index 1979c58..e9d1d42 100644 || ((defined(CYGWIN32) || defined(USE_MMAP) || defined(USE_MUNMAP)) \ && !defined(USE_WINALLOC)) /* Try both sbrk and mmap, in that order. */ -@@ -3223,7 +3265,7 @@ EXTERN_C_BEGIN +@@ -2880,7 +2906,7 @@ EXTERN_C_BEGIN #if ((defined(UNIX_LIKE) && (defined(DARWIN) || defined(HAIKU) \ || defined(HURD) || defined(OPENBSD) \ @@ -103,10 +80,10 @@ index 1979c58..e9d1d42 100644 || defined(NIOS2) || defined(OR1K))) \ || (defined(LINUX) && !defined(__gnu_linux__)) \ diff --git a/os_dep.c b/os_dep.c -index b183423..a6d62b9 100644 +index eaf5bb0..afd73f7 100644 --- a/os_dep.c +++ b/os_dep.c -@@ -845,6 +845,22 @@ GC_INNER size_t GC_page_size = 0; +@@ -854,6 +854,22 @@ GC_INNER size_t GC_page_size = 0; # define HAVE_GET_STACK_BASE #endif /* HAIKU */ @@ -129,34 +106,34 @@ index b183423..a6d62b9 100644 #ifdef OS2 GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *sb) { -@@ -873,7 +889,7 @@ GC_INNER size_t GC_page_size = 0; +@@ -882,7 +898,7 @@ GC_INNER size_t GC_page_size = 0; # if defined(SUNOS5SIGS) || defined(IRIX5) || defined(OSF1) \ || defined(HAIKU) || defined(HURD) || defined(FREEBSD) \ - || defined(NETBSD) + || defined(NETBSD) || defined(SERENITY) static struct sigaction old_segv_act; - # if defined(_sigargs) /* !Irix6.x */ \ + # if defined(_sigargs) /* !Irix6.x */ || defined(HPUX) \ || defined(HURD) || defined(NETBSD) || defined(FREEBSD) -@@ -890,7 +906,7 @@ GC_INNER size_t GC_page_size = 0; +@@ -899,7 +915,7 @@ GC_INNER size_t GC_page_size = 0; { # if defined(SUNOS5SIGS) || defined(IRIX5) || defined(OSF1) \ || defined(HAIKU) || defined(HURD) || defined(FREEBSD) \ -- || defined(NETBSD) -+ || defined(NETBSD) || defined(SERENITY) +- || defined(NETBSD) || defined(OPENBSD) ++ || defined(NETBSD) || defined(OPENBSD) || defined(SERENITY) struct sigaction act; act.sa_handler = h; -@@ -955,7 +971,7 @@ GC_INNER size_t GC_page_size = 0; +@@ -965,7 +981,7 @@ GC_INNER size_t GC_page_size = 0; { # if defined(SUNOS5SIGS) || defined(IRIX5) || defined(OSF1) \ || defined(HAIKU) || defined(HURD) || defined(FREEBSD) \ -- || defined(NETBSD) -+ || defined(NETBSD) || defined(SERENITY) +- || defined(NETBSD) || defined(OPENBSD) ++ || defined(NETBSD) || defined(OPENBSD) || defined(SERENITY) (void) sigaction(SIGSEGV, &old_segv_act, 0); # if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \ - || defined(HURD) || defined(NETBSD) -@@ -1227,7 +1243,7 @@ GC_INNER size_t GC_page_size = 0; + || defined(HPUX) || defined(HURD) || defined(NETBSD) \ +@@ -1253,7 +1269,7 @@ GC_INNER size_t GC_page_size = 0; # define GET_MAIN_STACKBASE_SPECIAL #elif !defined(AMIGA) && !defined(HAIKU) && !defined(OS2) \ && !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32) \ @@ -165,7 +142,7 @@ index b183423..a6d62b9 100644 && (!defined(GC_SOLARIS_THREADS) || defined(_STRICT_STDC)) # if (defined(HAVE_PTHREAD_ATTR_GET_NP) || defined(HAVE_PTHREAD_GETATTR_NP)) \ -@@ -1328,7 +1344,7 @@ GC_INNER size_t GC_page_size = 0; +@@ -1356,7 +1372,7 @@ GC_INNER size_t GC_page_size = 0; return(result); } # define GET_MAIN_STACKBASE_SPECIAL @@ -174,25 +151,16 @@ index b183423..a6d62b9 100644 #if (defined(HAVE_PTHREAD_ATTR_GET_NP) || defined(HAVE_PTHREAD_GETATTR_NP)) \ && defined(THREADS) && !defined(HAVE_GET_STACK_BASE) -@@ -2584,7 +2600,7 @@ GC_INNER void GC_unmap(ptr_t start, size_t bytes) - /* accidentally grabbing the same address space. */ - { - # if defined(AIX) || defined(CYGWIN32) || defined(HAIKU) \ -- || defined(HPUX) -+ || defined(HPUX) || defined(SERENITY) +@@ -2647,7 +2663,7 @@ static void block_unmap_inner(ptr_t start_addr, size_t len) + ps3_free_mem(start_addr, len); + # elif defined(AIX) || defined(CYGWIN32) || defined(HAIKU) \ + || (defined(LINUX) && !defined(PREFER_MMAP_PROT_NONE)) \ +- || defined(HPUX) ++ || defined(HPUX) || defined(SERENITY) /* On AIX, mmap(PROT_NONE) fails with ENOMEM unless the */ /* environment variable XPG_SUS_ENV is set to ON. */ /* On Cygwin, calling mmap() with the new protection flags on */ -@@ -2715,7 +2731,7 @@ GC_INNER void GC_unmap_gap(ptr_t start1, size_t bytes1, ptr_t start2, - if (len != 0) { - /* Immediately remap as above. */ - # if defined(AIX) || defined(CYGWIN32) || defined(HAIKU) \ -- || defined(HPUX) -+ || defined(HPUX) || defined(SERENITY) - if (mprotect(start_addr, len, PROT_NONE)) - ABORT("mprotect(PROT_NONE) failed"); - # else -@@ -3035,7 +3051,7 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void) +@@ -3140,7 +3156,7 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void) # elif !defined(USE_WINALLOC) # include # include @@ -201,7 +169,7 @@ index b183423..a6d62b9 100644 # include # endif -@@ -3160,7 +3176,7 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void) +@@ -3255,7 +3271,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) diff --git a/Ports/bdwgc/patches/0002-Error-on-unknown-arch.patch b/Ports/bdwgc/patches/0002-Error-on-unknown-arch.patch index 3947101b33..f5809d5ff4 100644 --- a/Ports/bdwgc/patches/0002-Error-on-unknown-arch.patch +++ b/Ports/bdwgc/patches/0002-Error-on-unknown-arch.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur -Date: Thu, 24 Feb 2022 01:50:40 +0330 +Date: Mon, 27 Mar 2023 20:04:41 +1100 Subject: [PATCH] Error on unknown arch --- @@ -8,10 +8,10 @@ Subject: [PATCH] Error on unknown arch 1 file changed, 2 insertions(+) diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h -index e9d1d42..8e48b66 100644 +index 2126a12..7b8b86f 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h -@@ -358,6 +358,8 @@ EXTERN_C_BEGIN +@@ -344,6 +344,8 @@ EXTERN_C_BEGIN # define I386 # elif defined(__x86_64__) # define X86_64 @@ -19,4 +19,4 @@ index e9d1d42..8e48b66 100644 +# error "Invalid arch for serenity" # endif #endif - # if defined(__HAIKU__) && (defined(__amd64__) || defined(__x86_64__)) + # if (defined(__BEOS__) || defined(__HAIKU__)) && defined(_X86_) diff --git a/Ports/bdwgc/patches/0003-Teach-dyn_load.c-about-serenity.patch b/Ports/bdwgc/patches/0003-Teach-dyn_load.c-about-serenity.patch index e6cd209fba..4c75870941 100644 --- a/Ports/bdwgc/patches/0003-Teach-dyn_load.c-about-serenity.patch +++ b/Ports/bdwgc/patches/0003-Teach-dyn_load.c-about-serenity.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur -Date: Thu, 24 Feb 2022 01:54:50 +0330 +Date: Mon, 27 Mar 2023 20:07:46 +1100 Subject: [PATCH] Teach dyn_load.c about serenity --- @@ -8,27 +8,27 @@ Subject: [PATCH] Teach dyn_load.c about serenity 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/dyn_load.c b/dyn_load.c -index d857246..734643d 100644 +index 46c53af..9026932 100644 --- a/dyn_load.c +++ b/dyn_load.c -@@ -60,7 +60,7 @@ STATIC GC_has_static_roots_func GC_has_static_roots = 0; - && !(defined(FREEBSD) && defined(__ELF__)) \ - && !((defined(LINUX) || defined(NACL)) && defined(__ELF__)) \ +@@ -63,7 +63,7 @@ STATIC GC_has_static_roots_func GC_has_static_roots = 0; && !(defined(NETBSD) && defined(__ELF__)) \ -- && !defined(HAIKU) && !defined(HURD) \ -+ && !defined(HAIKU) && !defined(HURD) && !defined(SERENITY) \ && !(defined(OPENBSD) && (defined(__ELF__) || defined(M68K))) \ - && !defined(CPPCHECK) + && !defined(HAIKU) && !defined(HURD) && !defined(NACL) \ +- && !defined(CPPCHECK) ++ && !defined(CPPCHECK) && !defined(SERENITY) # error We only know how to find data segments of dynamic libraries for above. -@@ -88,7 +88,7 @@ STATIC GC_has_static_roots_func GC_has_static_roots = 0; + # error Additional SVR4 variants might not be too hard to add. + #endif +@@ -89,7 +89,7 @@ STATIC GC_has_static_roots_func GC_has_static_roots = 0; # endif #endif /* OPENBSD */ --#if defined(SCO_ELF) || defined(DGUX) || defined(HURD) \ -+#if defined(SCO_ELF) || defined(DGUX) || defined(HURD) || defined(SERENITY) \ +-#if defined(SCO_ELF) || defined(DGUX) || defined(HURD) || defined(NACL) \ ++#if defined(SCO_ELF) || defined(DGUX) || defined(HURD) || defined(NACL) || defined(SERENITY) \ || (defined(__ELF__) && (defined(LINUX) || defined(FREEBSD) \ - || defined(NACL) || defined(NETBSD) \ - || defined(OPENBSD))) + || defined(NETBSD) || defined(OPENBSD))) + # include @@ -98,6 +98,23 @@ STATIC GC_has_static_roots_func GC_has_static_roots = 0; /* Exclude Android because linker.h below includes its own version. */ # include @@ -53,12 +53,12 @@ index d857246..734643d 100644 # ifdef HOST_ANDROID /* If you don't need the "dynamic loading" feature, you may build */ /* the collector with -D IGNORE_DYNAMIC_LOADING. */ -@@ -259,7 +276,7 @@ GC_INNER void GC_register_dynamic_libraries(void) +@@ -261,7 +278,7 @@ GC_INNER void GC_register_dynamic_libraries(void) # endif /* !USE_PROC ... */ # endif /* SOLARISDL */ --#if defined(SCO_ELF) || defined(DGUX) || defined(HURD) \ -+#if defined(SCO_ELF) || defined(DGUX) || defined(HURD) || defined(SERENITY) \ +-#if defined(SCO_ELF) || defined(DGUX) || defined(HURD) || defined(NACL) \ ++#if defined(SCO_ELF) || defined(DGUX) || defined(HURD) || defined(NACL) || defined(SERENITY) \ || (defined(__ELF__) && (defined(LINUX) || defined(FREEBSD) \ - || defined(NACL) || defined(NETBSD) \ - || defined(OPENBSD))) + || defined(NETBSD) || defined(OPENBSD))) + diff --git a/Ports/bdwgc/patches/0004-Teach-bdwgc-about-serenity-signals.patch b/Ports/bdwgc/patches/0004-Teach-bdwgc-about-serenity-signals.patch index 7d9e848852..6fcdf3ced9 100644 --- a/Ports/bdwgc/patches/0004-Teach-bdwgc-about-serenity-signals.patch +++ b/Ports/bdwgc/patches/0004-Teach-bdwgc-about-serenity-signals.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur -Date: Thu, 24 Feb 2022 03:30:02 +0330 +Date: Mon, 27 Mar 2023 20:10:51 +1100 Subject: [PATCH] Teach bdwgc about serenity signals Serenity doesn't have the realtime POSIX signals, so use SIGXCPU and @@ -12,10 +12,10 @@ SIGXFSZ instead. 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/gc_config_macros.h b/include/gc_config_macros.h -index 14c65ee..c19b050 100644 +index 3bbc5fe..da783ce 100644 --- a/include/gc_config_macros.h +++ b/include/gc_config_macros.h -@@ -72,7 +72,7 @@ +@@ -73,7 +73,7 @@ #if defined(GC_AIX_THREADS) || defined(GC_DARWIN_THREADS) \ || defined(GC_DGUX386_THREADS) || defined(GC_FREEBSD_THREADS) \ @@ -24,7 +24,7 @@ index 14c65ee..c19b050 100644 || defined(GC_IRIX_THREADS) || defined(GC_LINUX_THREADS) \ || defined(GC_NETBSD_THREADS) || defined(GC_OPENBSD_THREADS) \ || defined(GC_OSF1_THREADS) || defined(GC_SOLARIS_THREADS) \ -@@ -83,6 +83,8 @@ +@@ -84,6 +84,8 @@ #elif defined(GC_THREADS) # if defined(__linux__) # define GC_LINUX_THREADS @@ -34,23 +34,23 @@ index 14c65ee..c19b050 100644 # define GC_OPENBSD_THREADS # elif defined(_PA_RISC1_1) || defined(_PA_RISC2_0) || defined(hppa) \ diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h -index 629418f..1278091 100644 +index b26543e..23e911e 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h -@@ -2641,7 +2641,7 @@ GC_INNER void *GC_store_debug_info_inner(void *p, word sz, const char *str, - /* Linuxthreads itself uses SIGUSR1 and SIGUSR2. */ - # define SIG_SUSPEND SIGPWR - # endif --# elif defined(GC_OPENBSD_THREADS) -+# elif defined(GC_OPENBSD_THREADS) || defined(GC_SERENITY_THREADS) +@@ -2985,7 +2985,7 @@ GC_INNER void *GC_store_debug_info_inner(void *p, word sz, const char *str, + && !defined(GC_USESIGRT_SIGNALS) + # define SIG_SUSPEND SIGUSR1 + /* SIGTSTP and SIGCONT could be used alternatively on FreeBSD. */ +-# elif defined(GC_OPENBSD_THREADS) && !defined(GC_USESIGRT_SIGNALS) ++# elif (defined(GC_OPENBSD_THREADS) && !defined(GC_USESIGRT_SIGNALS)) || defined(GC_SERENITY_THREADS) # ifndef GC_OPENBSD_UTHREADS # define SIG_SUSPEND SIGXFSZ # endif diff --git a/pthread_stop_world.c b/pthread_stop_world.c -index 4b2c429..25eb2a5 100644 +index b865d30..f0cf1a6 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c -@@ -146,7 +146,9 @@ STATIC volatile AO_t GC_world_is_stopped = FALSE; +@@ -165,7 +165,9 @@ STATIC volatile AO_t GC_world_is_stopped = FALSE; * pointer(s) and acknowledge. */ #ifndef SIG_THR_RESTART diff --git a/Ports/bdwgc/patches/0005-Explicitly-link-with-pthread.patch b/Ports/bdwgc/patches/0005-Explicitly-link-with-pthread.patch deleted file mode 100644 index 1e4196171e..0000000000 --- a/Ports/bdwgc/patches/0005-Explicitly-link-with-pthread.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ali Mohammad Pur -Date: Thu, 24 Feb 2022 03:47:50 +0330 -Subject: [PATCH] Explicitly link with pthread - -The cmakelists was using the wrong variable to link against pthread. ---- - CMakeLists.txt | 5 +++-- - tests/CMakeLists.txt | 12 ++++++------ - 2 files changed, 9 insertions(+), 8 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index c8ebd9b..e9c52f1 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -52,7 +52,8 @@ IF(enable_threads) - FIND_PACKAGE(Threads REQUIRED) - MESSAGE("Thread Model: ${CMAKE_THREAD_LIBS_INIT}" ) - INCLUDE_DIRECTORIES(${Threads_INCLUDE_DIR}) -- SET(LIBS ${LIBS} ${Threads_LIBRARIES}) -+ SET(LIBS ${LIBS} ${Threads_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) -+ MESSAGE("Libs: ${LIBS}" ) - ENDIF(enable_threads) - - OPTION(enable_handle_fork "Attempt to ensure a usable collector after fork()" ON) -@@ -235,7 +236,7 @@ ENDIF(enable_checksums) - ADD_LIBRARY( gc-lib STATIC ${SRC}) - SET_TARGET_PROPERTIES(gc-lib PROPERTIES - COMPILE_DEFINITIONS GC_NOT_DLL) --#TODO TARGET_LINK_LIBRARIES(... ... ${LIBS}) -+TARGET_LINK_LIBRARIES(gc-lib ${LIBS}) - - ADD_LIBRARY( gcmt-dll SHARED ${SRC}) - -diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt -index 3c84220..5e15727 100644 ---- a/tests/CMakeLists.txt -+++ b/tests/CMakeLists.txt -@@ -23,25 +23,25 @@ SET_SOURCE_FILES_PROPERTIES( - PROPERTIES LANGUAGE CXX) - - ADD_EXECUTABLE(gctest WIN32 test.c) --TARGET_LINK_LIBRARIES(gctest gc-lib) -+TARGET_LINK_LIBRARIES(gctest gc-lib ${LIBS}) - ADD_TEST(NAME gctest COMMAND gctest) - - ADD_EXECUTABLE(hugetest huge_test.c) --TARGET_LINK_LIBRARIES(hugetest gc-lib) -+TARGET_LINK_LIBRARIES(hugetest gc-lib ${LIBS}) - ADD_TEST(NAME hugetest COMMAND hugetest) - - ADD_EXECUTABLE(leaktest leak_test.c) --TARGET_LINK_LIBRARIES(leaktest gc-lib) -+TARGET_LINK_LIBRARIES(leaktest gc-lib ${LIBS}) - ADD_TEST(NAME leaktest COMMAND leaktest) - - ADD_EXECUTABLE(middletest middle.c) --TARGET_LINK_LIBRARIES(middletest gc-lib) -+TARGET_LINK_LIBRARIES(middletest gc-lib ${LIBS}) - ADD_TEST(NAME middletest COMMAND middletest) - - ADD_EXECUTABLE(realloc_test realloc_test.c) --TARGET_LINK_LIBRARIES(realloc_test gc-lib) -+TARGET_LINK_LIBRARIES(realloc_test gc-lib ${LIBS}) - ADD_TEST(NAME realloc_test COMMAND realloc_test) - - ADD_EXECUTABLE(smashtest smash_test.c) --TARGET_LINK_LIBRARIES(smashtest gc-lib) -+TARGET_LINK_LIBRARIES(smashtest gc-lib ${LIBS}) - ADD_TEST(NAME smashtest COMMAND smashtest) diff --git a/Ports/bdwgc/patches/0006-Make-the-collector-build-with-threads.patch b/Ports/bdwgc/patches/0005-Make-the-collector-build-with-threads.patch similarity index 53% rename from Ports/bdwgc/patches/0006-Make-the-collector-build-with-threads.patch rename to Ports/bdwgc/patches/0005-Make-the-collector-build-with-threads.patch index a9a489cdc7..03dc9aa3ba 100644 --- a/Ports/bdwgc/patches/0006-Make-the-collector-build-with-threads.patch +++ b/Ports/bdwgc/patches/0005-Make-the-collector-build-with-threads.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur -Date: Fri, 25 Feb 2022 04:53:53 +0330 +Date: Mon, 27 Mar 2023 20:14:33 +1100 Subject: [PATCH] Make the collector build with threads In an extremely limited way for now: @@ -18,32 +18,32 @@ In an extremely limited way for now: 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index e9c52f1..7c9daad 100644 +index 50dba74..6fcb550 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -56,7 +56,11 @@ IF(enable_threads) - MESSAGE("Libs: ${LIBS}" ) - ENDIF(enable_threads) - --OPTION(enable_handle_fork "Attempt to ensure a usable collector after fork()" ON) +@@ -77,7 +77,11 @@ option(enable_register_main_static_data "Perform the initial guess of data root + option(enable_checksums "Report erroneously cleared dirty bits" OFF) + option(enable_werror "Pass -Werror to the C compiler (treat warnings as errors)" OFF) + option(enable_single_obj_compilation "Compile all libgc source files into single .o" OFF) +-option(enable_handle_fork "Attempt to ensure a usable collector after fork()" ON) +IF(DEBUG_THREADS) + ADD_DEFINITIONS("-DDEBUG_THREADS") +ENDIF() + +OPTION(enable_handle_fork "Attempt to ensure a usable collector after fork()" OFF) - - OPTION(enable_thread_local_alloc "Turn on thread-local allocation optimization" ON) - + option(disable_handle_fork "Prohibit installation of pthread_atfork() handlers" OFF) + option(install_headers "Install header and pkg-config metadata files" ON) + option(without_libatomic_ops "Use atomic_ops.h in libatomic_ops/src" OFF) diff --git a/tests/test.c b/tests/test.c -index 8e2e3a6..f38fb22 100644 +index b41a300..0ad4ea5 100644 --- a/tests/test.c +++ b/tests/test.c -@@ -40,7 +40,7 @@ +@@ -43,7 +43,7 @@ #include "gc.h" #ifndef NTHREADS /* Number of additional threads to fork. */ --# define NTHREADS 5 /* excludes main thread, which also runs a test. */ -+# define NTHREADS 0 /* excludes main thread, which also runs a test. */ +-# define NTHREADS 5 /* Excludes main thread, which also runs a test. */ ++# define NTHREADS 0 /* Excludes main thread, which also runs a test. */ + /* In the single-threaded case, the number of times to rerun it. */ /* Not respected by PCR test. */ #endif - diff --git a/Ports/bdwgc/patches/0007-Add-serenity-to-the-conigure-list-of-pthread-unixes.patch b/Ports/bdwgc/patches/0006-Add-serenity-to-the-conigure-list-of-pthread-unixes.patch similarity index 88% rename from Ports/bdwgc/patches/0007-Add-serenity-to-the-conigure-list-of-pthread-unixes.patch rename to Ports/bdwgc/patches/0006-Add-serenity-to-the-conigure-list-of-pthread-unixes.patch index aa57d5032d..e5e3ae3f87 100644 --- a/Ports/bdwgc/patches/0007-Add-serenity-to-the-conigure-list-of-pthread-unixes.patch +++ b/Ports/bdwgc/patches/0006-Add-serenity-to-the-conigure-list-of-pthread-unixes.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Elliott -Date: Mon, 16 May 2022 23:55:41 -0600 +Date: Mon, 27 Mar 2023 20:18:18 +1100 Subject: [PATCH] Add serenity to the conigure list of pthread unixes --- @@ -8,10 +8,10 @@ Subject: [PATCH] Add serenity to the conigure list of pthread unixes 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 3b38e6f..5b6daa4 100644 +index 7113d07..e51906c 100644 --- a/configure.ac +++ b/configure.ac -@@ -201,7 +201,7 @@ case "$THREADS" in +@@ -208,7 +208,7 @@ case "$THREADS" in *-*-aix* | *-*-android* | *-*-cygwin* | *-*-darwin* | *-*-dragonfly* | \ *-*-freebsd* | *-*-haiku* | *-*-hpux11* | *-*-irix* | \ *-*-kfreebsd*-gnu | *-*-gnu* | *-*-*linux* | *-*-msys* | *-*-nacl* | \ diff --git a/Ports/bdwgc/patches/ReadMe.md b/Ports/bdwgc/patches/ReadMe.md index 1075666b11..4422f06512 100644 --- a/Ports/bdwgc/patches/ReadMe.md +++ b/Ports/bdwgc/patches/ReadMe.md @@ -22,13 +22,7 @@ Teach bdwgc about serenity signals Serenity doesn't have the realtime POSIX signals, so use SIGXCPU and SIGXFSZ instead. -## `0005-Explicitly-link-with-pthread.patch` - -Explicitly link with pthread - -The cmakelists was using the wrong variable to link against pthread. - -## `0006-Make-the-collector-build-with-threads.patch` +## `0005-Make-the-collector-build-with-threads.patch` Make the collector build with threads @@ -42,8 +36,6 @@ In an extremely limited way for now: - No fork handling Seems borked for unknown reasons. -## `0007-Add-serenity-to-the-conigure-list-of-pthread-unixes.patch` +## `0006-Add-serenity-to-the-conigure-list-of-pthread-unixes.patch` Add serenity to the conigure list of pthread unixes - -