Skip to content

Commit

Permalink
Ports/bdwgc: Update bdwgc to version 8.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
cammo1123 authored and linusg committed Mar 27, 2023
1 parent fb3a1e2 commit 4900b34
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 215 deletions.
2 changes: 1 addition & 1 deletion Ports/AvailablePorts.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/ |
Expand Down
16 changes: 8 additions & 8 deletions Ports/bdwgc/package.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <[email protected]>
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
Expand All @@ -25,43 +25,19 @@ 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
# endif
+# ifdef SERENITY
+# define OS_TYPE "SERENITY"
+ EXTERN_C_END
+# include <unistd.h>
+ 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[];
@@ -2727,6 +2752,23 @@ 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
+# include <unistd.h>
+ 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))
Expand All @@ -72,10 +48,11 @@ index 1979c58..e9d1d42 100644
+# 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) \
Expand All @@ -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) \
Expand All @@ -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) \
Expand All @@ -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 */

Expand All @@ -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) \
Expand All @@ -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
Expand All @@ -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 <sys/mman.h>
# include <signal.h>
Expand All @@ -201,7 +169,7 @@ index b183423..a6d62b9 100644
# include <sys/syscall.h>
# 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)
Expand Down
8 changes: 4 additions & 4 deletions Ports/bdwgc/patches/0002-Error-on-unknown-arch.patch
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <[email protected]>
Date: Thu, 24 Feb 2022 01:50:40 +0330
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 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
+# else
+# error "Invalid arch for serenity"
# endif
#endif
# if defined(__HAIKU__) && (defined(__amd64__) || defined(__x86_64__))
# if (defined(__BEOS__) || defined(__HAIKU__)) && defined(_X86_)
36 changes: 18 additions & 18 deletions Ports/bdwgc/patches/0003-Teach-dyn_load.c-about-serenity.patch
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <[email protected]>
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

---
dyn_load.c | 23 ++++++++++++++++++++---
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 <stddef.h>
@@ -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 <elf.h>
Expand All @@ -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)))

Loading

1 comment on commit 4900b34

@ivmai
Copy link

@ivmai ivmai commented on 4900b34 Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have upstreamed support of Serenity OS, so rebasing of the patches is no longer needed I hope - ivmai/bdwgc#685 (if you have time, please test the upstream master).

Please sign in to comment.