diff --git a/Ports/bdwgc/package.sh b/Ports/bdwgc/package.sh index c944d17ab375a8..af84533d8ae235 100755 --- a/Ports/bdwgc/package.sh +++ b/Ports/bdwgc/package.sh @@ -1,14 +1,13 @@ #!/usr/bin/env -S bash ../.port_include.sh port='bdwgc' -version='8.2.8' -use_fresh_config_sub='true' +version='437c08c24537cde1fd54795782f94a575ce5ca87' files=( - "https://github.com/ivmai/bdwgc/releases/download/v${version}/gc-${version}.tar.gz#7649020621cb26325e1fb5c8742590d92fb48ce5c259b502faf7d9fb5dabb160" + "https://github.com/ivmai/bdwgc/archive/${version}.tar.gz#3d0794582a956ad009817f4bcd894bea4007d43d1583a7121491fadee572b48a" ) depends=( 'libatomic_ops' ) -workdir="gc-${version}" +workdir="bdwgc-${version}" useconfigure='true' configopts=( '--enable-threads=posix' 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 deleted file mode 100644 index 4e0f0b85701407..00000000000000 --- a/Ports/bdwgc/patches/0001-Teach-os_dep-and-gcconfig.h-about-serenity.patch +++ /dev/null @@ -1,180 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ali Mohammad Pur -Date: Mon, 27 Mar 2023 20:03:03 +1100 -Subject: [PATCH] Teach os_dep and gcconfig.h about serenity - ---- - 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 c1cf80fb1fb9fde95e14b0839a70d7ba421bf88f..b410f188f91960977a11695bf2a9da4639a32e94 100644 ---- a/include/private/gcconfig.h -+++ b/include/private/gcconfig.h -@@ -344,6 +344,15 @@ EXTERN_C_BEGIN - # endif - # define mach_type_known - # endif -+# if defined(__serenity__) -+# define SERENITY -+# define mach_type_known -+# if defined(_X86_) || defined (__i386__) -+# define I386 -+# elif defined(__x86_64__) -+# define X86_64 -+# endif -+#endif - # if (defined(__BEOS__) || defined(__HAIKU__)) && defined(_X86_) - # define I386 - # define HAIKU -@@ -1068,6 +1077,23 @@ EXTERN_C_BEGIN - # endif - # endif /* OPENBSD */ - -+# ifdef SERENITY -+# define OS_TYPE "SERENITY" -+ EXTERN_C_END -+# include -+ EXTERN_C_BEGIN -+# define GETPAGESIZE() (unsigned)sysconf(_SC_PAGESIZE) -+ 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" - extern int _etext[], _end[]; -@@ -2757,7 +2783,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) \ -- || defined(AIX) || defined(DARWIN) || defined(OSF1) -+ || defined(AIX) || defined(DARWIN) || defined(OSF1) || defined(SERENITY) - # define UNIX_LIKE /* Basic Unix-like system calls work. */ - #endif - -@@ -2807,7 +2833,7 @@ EXTERN_C_BEGIN - - #if defined(DARWIN) || defined(FREEBSD) || defined(HAIKU) \ - || defined(IRIX5) || defined(LINUX) || defined(NETBSD) \ -- || defined(OPENBSD) || defined(SOLARIS) \ -+ || defined(OPENBSD) || defined(SOLARIS) || defined(SERENITY) \ - || ((defined(CYGWIN32) || defined(USE_MMAP) || defined(USE_MUNMAP)) \ - && !defined(USE_WINALLOC)) - /* Try both sbrk and mmap, in that order. */ -@@ -2943,7 +2969,7 @@ EXTERN_C_BEGIN - - #if ((defined(UNIX_LIKE) && (defined(DARWIN) || defined(HAIKU) \ - || defined(HURD) || defined(OPENBSD) \ -- || defined(ARM32) \ -+ || defined(ARM32) || defined(SERENITY) \ - || defined(AVR32) || defined(MIPS) \ - || defined(NIOS2) || defined(OR1K))) \ - || (defined(LINUX) && !defined(__gnu_linux__)) \ -diff --git a/os_dep.c b/os_dep.c -index e90c7725011df1263ba7fcdadb839837a7e1b3d7..7e33a5daf11e8f3fc08c1e9dd9af17873f477729 100644 ---- a/os_dep.c -+++ b/os_dep.c -@@ -858,6 +858,22 @@ GC_INNER size_t GC_page_size = 0; - # define HAVE_GET_STACK_BASE - #endif /* HAIKU */ - -+#ifdef SERENITY -+# include -+ GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *sb) -+ { -+ uintptr_t base; -+ size_t size; -+ if (get_stack_bounds(&base, &size) < 0) { -+ WARN("get_stack_bounds failed\n", 0); -+ return GC_UNIMPLEMENTED; -+ } -+ sb->mem_base = base + size; -+ return GC_SUCCESS; -+ } -+# define HAVE_GET_STACK_BASE -+#endif /* SERENITY */ -+ - #ifdef OS2 - GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *sb) - { -@@ -889,7 +905,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 */ || defined(HPUX) \ - || defined(HURD) || defined(NETBSD) || defined(FREEBSD) -@@ -906,7 +922,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(OPENBSD) -+ || defined(NETBSD) || defined(OPENBSD) || defined(SERENITY) - struct sigaction act; - - act.sa_handler = h; -@@ -973,7 +989,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(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(HPUX) || defined(HURD) || defined(NETBSD) \ -@@ -1271,7 +1287,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) \ -- && !defined(GC_OPENBSD_THREADS) \ -+ && !defined(GC_OPENBSD_THREADS) && !defined(SERENITY) \ - && (!defined(GC_SOLARIS_THREADS) || defined(_STRICT_STDC)) - - # if (defined(HAVE_PTHREAD_ATTR_GET_NP) || defined(HAVE_PTHREAD_GETATTR_NP)) \ -@@ -1375,7 +1391,7 @@ GC_INNER size_t GC_page_size = 0; - return(result); - } - # define GET_MAIN_STACKBASE_SPECIAL --#endif /* !AMIGA, !HAIKU, !OPENBSD, !OS2, !Windows */ -+#endif /* !AMIGA, !HAIKU, !OPENBSD, !SERENITY, !OS2, !Windows */ - - #if (defined(HAVE_PTHREAD_ATTR_GET_NP) || defined(HAVE_PTHREAD_GETATTR_NP)) \ - && defined(THREADS) && !defined(HAVE_GET_STACK_BASE) -@@ -2668,7 +2684,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 */ -@@ -3160,7 +3176,7 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void) - # elif !defined(USE_WINALLOC) - # include - # include --# if !defined(CYGWIN32) && !defined(HAIKU) -+# if !defined(CYGWIN32) && !defined(HAIKU) && !defined(SERENITY) - # include - # endif - -@@ -3275,7 +3291,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(CYGWIN32) || defined(HAIKU) || defined(HURD) -+# elif defined(CYGWIN32) || defined(HAIKU) || defined(HURD) || defined(SERENITY) - # define CODE_OK TRUE - # elif defined(LINUX) - # define CODE_OK TRUE diff --git a/Ports/bdwgc/patches/0001-gctest-Set-NTHREADS-to-0.patch b/Ports/bdwgc/patches/0001-gctest-Set-NTHREADS-to-0.patch new file mode 100644 index 00000000000000..a7cb689e649a6d --- /dev/null +++ b/Ports/bdwgc/patches/0001-gctest-Set-NTHREADS-to-0.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Linus Groh +Date: Fri, 13 Dec 2024 19:22:08 +0000 +Subject: [PATCH] gctest: Set NTHREADS to 0 + +It crashes otherwise: + +``` +0x000000078c79c017: [/usr/lib/libsystem.so] syscall1 +0x7 (syscall.cpp:20 => syscall.cpp:19) +0x00000012967e283d: [/usr/lib/libc.so] pthread_mutex_lock.localalias +0x6d (serenity.h:43 => pthread_integration.cpp:158) +0x0000000143bf0344: [/home/anon/gctest] GC_thread_is_registered +0x74 (pthread_support.c:911) +0x0000000143bdb46f: [/home/anon/gctest] run_one_test +0x1f (gctest.c:1576) +0x0000000143bd8e5d: [/home/anon/gctest] main +0x1ed (gctest.c:2731) +0x0000000143bd9854: [/home/anon/gctest] _entry +0x24 (crt0.cpp:47) +``` +--- + tests/gctest.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/gctest.c b/tests/gctest.c +index 2965407e25bf6d4db75ff8711635d02c771673c3..e6cc8d7375788cacf4ab78f38ca574c719a24b58 100644 +--- a/tests/gctest.c ++++ b/tests/gctest.c +@@ -50,7 +50,7 @@ + #ifndef NTHREADS + /* This excludes the main thread, which also runs a test. */ + /* In the single-threaded case, a number of times to rerun it. */ +-# define NTHREADS 5 ++# define NTHREADS 0 + #endif + + #if defined(_WIN32_WCE) && !defined(__GNUC__) diff --git a/Ports/bdwgc/patches/0002-Error-on-unknown-arch.patch b/Ports/bdwgc/patches/0002-Error-on-unknown-arch.patch deleted file mode 100644 index 5979314595a10d..00000000000000 --- a/Ports/bdwgc/patches/0002-Error-on-unknown-arch.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ali Mohammad Pur -Date: Mon, 27 Mar 2023 20:04:41 +1100 -Subject: [PATCH] Error on unknown arch - ---- - include/private/gcconfig.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h -index b410f188f91960977a11695bf2a9da4639a32e94..2e36e697a0ab1ba89db9c18a4caa35d381f8ec90 100644 ---- a/include/private/gcconfig.h -+++ b/include/private/gcconfig.h -@@ -351,6 +351,8 @@ EXTERN_C_BEGIN - # define I386 - # elif defined(__x86_64__) - # define X86_64 -+# else -+# error "Invalid arch for serenity" - # endif - #endif - # 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 deleted file mode 100644 index 80e8b08e595c4b..00000000000000 --- a/Ports/bdwgc/patches/0003-Teach-dyn_load.c-about-serenity.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ali Mohammad Pur -Date: Mon, 27 Mar 2023 20:07:46 +1100 -Subject: [PATCH] Teach dyn_load.c about serenity - ---- - dyn_load.c | 23 ++++++++++++++++++++--- - 1 file changed, 20 insertions(+), 3 deletions(-) - -diff --git a/dyn_load.c b/dyn_load.c -index c73897e6ba0e7f70443940790d558b91f9bb75c9..bd3192ad75d68e5daa8ff4c0a989c521d3b0426d 100644 ---- a/dyn_load.c -+++ b/dyn_load.c -@@ -63,7 +63,7 @@ STATIC GC_has_static_roots_func GC_has_static_roots = 0; - && !(defined(NETBSD) && defined(__ELF__)) \ - && !(defined(OPENBSD) && (defined(__ELF__) || defined(M68K))) \ - && !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. - # 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) || defined(NACL) \ -+#if defined(SCO_ELF) || defined(DGUX) || defined(HURD) || defined(NACL) || defined(SERENITY) \ - || (defined(__ELF__) && (defined(LINUX) || defined(FREEBSD) \ - || 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 - # endif -+# ifdef SERENITY -+# include -+ struct link_map { -+ uintptr_t l_addr; -+ char* l_name; -+ uintptr_t l_ld; -+ struct link_map* l_next; -+ struct link_map* l_prev; -+ }; -+ struct r_debug { -+ int32_t r_version; -+ struct link_map* r_map; -+ void (*r_brk)(void); -+ int32_t r_state; -+ uintptr_t r_ldbase; -+ }; -+# endif - # ifdef HOST_ANDROID - /* If you don't need the "dynamic loading" feature, you may build */ - /* the collector with -D IGNORE_DYNAMIC_LOADING. */ -@@ -261,7 +278,7 @@ GC_INNER void GC_register_dynamic_libraries(void) - # endif /* !USE_PROC_FOR_LIBRARIES */ - # endif /* SOLARISDL */ - --#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(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 deleted file mode 100644 index 5fd07a4c8352d3..00000000000000 --- a/Ports/bdwgc/patches/0004-Teach-bdwgc-about-serenity-signals.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ali Mohammad Pur -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 -SIGXFSZ instead. ---- - include/gc_config_macros.h | 4 +++- - include/private/gc_priv.h | 2 +- - pthread_stop_world.c | 4 +++- - 3 files changed, 7 insertions(+), 3 deletions(-) - -diff --git a/include/gc_config_macros.h b/include/gc_config_macros.h -index ec452c68d275737d045c9ddcbf1d5806ce42427c..d1058022111998f4e8ce6d76496d902a3b24d1ec 100644 ---- a/include/gc_config_macros.h -+++ b/include/gc_config_macros.h -@@ -73,7 +73,7 @@ - - #if defined(GC_AIX_THREADS) || defined(GC_DARWIN_THREADS) \ - || defined(GC_DGUX386_THREADS) || defined(GC_FREEBSD_THREADS) \ -- || defined(GC_HPUX_THREADS) \ -+ || defined(GC_HPUX_THREADS) || defined(GC_SERENITY_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) \ -@@ -84,6 +84,8 @@ - #elif defined(GC_THREADS) - # if defined(__linux__) - # define GC_LINUX_THREADS -+# elif defined(__serenity__) -+# define GC_SERENITY_THREADS - # elif defined(__OpenBSD__) - # 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 a398e48d57f0660495c1085237cb0ca5f2465e92..903c4a06b9e99f925c7baf95d7ec6d30092228db 100644 ---- a/include/private/gc_priv.h -+++ b/include/private/gc_priv.h -@@ -3057,7 +3057,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 f903f6fe2c88e18e97b478209e1ba53a2e4a789d..c582033386129e803e031ca041565bb45ff25ea4 100644 ---- a/pthread_stop_world.c -+++ b/pthread_stop_world.c -@@ -167,7 +167,9 @@ STATIC volatile AO_t GC_world_is_stopped = FALSE; - * pointer(s) and acknowledge. - */ - #ifndef SIG_THR_RESTART --# if defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) \ -+# if defined(SERENITY) -+# define SIG_THR_RESTART SIGUSR1 -+# elif defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) \ - || defined(GC_NETBSD_THREADS) || defined(GC_USESIGRT_SIGNALS) - # if defined(_SIGRTMIN) && !defined(CPPCHECK) - # define SIG_THR_RESTART _SIGRTMIN + 5 diff --git a/Ports/bdwgc/patches/0005-Make-the-collector-build-with-threads.patch b/Ports/bdwgc/patches/0005-Make-the-collector-build-with-threads.patch deleted file mode 100644 index 7e147416f25aa9..00000000000000 --- a/Ports/bdwgc/patches/0005-Make-the-collector-build-with-threads.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ali Mohammad Pur -Date: Mon, 27 Mar 2023 20:14:33 +1100 -Subject: [PATCH] Make the collector build with threads - -In an extremely limited way for now: -- No extra threads - More threads always lead to exactly one borked thread that's stuck - in no man's land, doing who-knows-what, and definitely not - responding to signals. - However, the APIs are there and they work, so they *can* be used to - make threads. -- No fork handling - Seems borked for unknown reasons. -Co-Authored-By: EWouters <6179932+EWouters@users.noreply.github.com> ---- - CMakeLists.txt | 6 +++++- - tests/test.c | 2 +- - 2 files changed, 6 insertions(+), 2 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index faca593e426ffb4add1a4eee73ef9ac1cdc23cbe..620662222d447fad399f713a537de58d1daa1432 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -86,7 +86,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(disable_handle_fork "Prohibit installation of pthread_atfork() handlers" OFF) - option(enable_emscripten_asyncify "Use Emscripten asyncify feature" OFF) - option(install_headers "Install header and pkg-config metadata files" ON) -diff --git a/tests/test.c b/tests/test.c -index 529ca33d8cb19c9a1863609a81cc3fb9eb9847d3..50b715067be252299011f768f3d9f6d6fc05dbd6 100644 ---- a/tests/test.c -+++ b/tests/test.c -@@ -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. */ - /* In the single-threaded case, the number of times to rerun it. */ - /* Not respected by PCR test. */ - #endif diff --git a/Ports/bdwgc/patches/0006-Add-serenity-to-the-configure-list-of-pthread-unixes.patch b/Ports/bdwgc/patches/0006-Add-serenity-to-the-configure-list-of-pthread-unixes.patch deleted file mode 100644 index 8293a3da6e1a99..00000000000000 --- a/Ports/bdwgc/patches/0006-Add-serenity-to-the-configure-list-of-pthread-unixes.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Elliott -Date: Mon, 27 Mar 2023 20:18:18 +1100 -Subject: [PATCH] Add serenity to the configure list of pthread unixes - ---- - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index c8deb0840660c292258d2d043dedda4b1c37fc00..3399c06939b04eb50aaaf9e9c23e78a089055bc4 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -213,7 +213,7 @@ case "$THREADS" in - *-*-aix* | *-*-android* | *-*-cygwin* | *-*-darwin* | *-*-dragonfly* | \ - *-*-freebsd* | *-*-haiku* | *-*-hpux11* | *-*-irix* | \ - *-*-kfreebsd*-gnu | *-*-gnu* | *-*-*linux* | *-*-msys* | *-*-nacl* | \ -- *-*-netbsd* | *-*-openbsd* | *-*-osf* | *-*-solaris*) -+ *-*-netbsd* | *-*-openbsd* | *-*-osf* | *-*-solaris* | *-*-serenity* ) - AC_DEFINE(GC_THREADS) - AC_DEFINE([_REENTRANT], [1], - [Required define if using POSIX threads.]) diff --git a/Ports/bdwgc/patches/ReadMe.md b/Ports/bdwgc/patches/ReadMe.md index 5ac59f4a94e595..959de79ff76a26 100644 --- a/Ports/bdwgc/patches/ReadMe.md +++ b/Ports/bdwgc/patches/ReadMe.md @@ -1,43 +1,17 @@ # Patches for bdwgc on SerenityOS -## `0001-Teach-os_dep-and-gcconfig.h-about-serenity.patch` +## `0001-gctest-Set-NTHREADS-to-0.patch` -Teach os_dep and gcconfig.h about serenity +gctest: Set NTHREADS to 0 +It crashes otherwise: -## `0002-Error-on-unknown-arch.patch` - -Error on unknown arch - - -## `0003-Teach-dyn_load.c-about-serenity.patch` - -Teach dyn_load.c about serenity - - -## `0004-Teach-bdwgc-about-serenity-signals.patch` - -Teach bdwgc about serenity signals - -Serenity doesn't have the realtime POSIX signals, so use SIGXCPU and -SIGXFSZ instead. - -## `0005-Make-the-collector-build-with-threads.patch` - -Make the collector build with threads - -In an extremely limited way for now: -- No extra threads - More threads always lead to exactly one borked thread that's stuck - in no man's land, doing who-knows-what, and definitely not - responding to signals. - However, the APIs are there and they work, so they *can* be used to - make threads. -- No fork handling - Seems borked for unknown reasons. - -## `0006-Add-serenity-to-the-configure-list-of-pthread-unixes.patch` - -Add serenity to the configure list of pthread unixes - +``` +0x000000078c79c017: [/usr/lib/libsystem.so] syscall1 +0x7 (syscall.cpp:20 => syscall.cpp:19) +0x00000012967e283d: [/usr/lib/libc.so] pthread_mutex_lock.localalias +0x6d (serenity.h:43 => pthread_integration.cpp:158) +0x0000000143bf0344: [/home/anon/gctest] GC_thread_is_registered +0x74 (pthread_support.c:911) +0x0000000143bdb46f: [/home/anon/gctest] run_one_test +0x1f (gctest.c:1576) +0x0000000143bd8e5d: [/home/anon/gctest] main +0x1ed (gctest.c:2731) +0x0000000143bd9854: [/home/anon/gctest] _entry +0x24 (crt0.cpp:47) +```