Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream Serenity OS support #685

Closed
ivmai opened this issue Dec 12, 2024 · 3 comments
Closed

Upstream Serenity OS support #685

ivmai opened this issue Dec 12, 2024 · 3 comments

Comments

@ivmai
Copy link
Owner

ivmai commented Dec 12, 2024

Existing patches location (for v8.2.8): https://github.com/SerenityOS/serenity/tree/master/Ports/bdwgc/patches
(Initially downstream support was added in SerenityOS/serenity#12748)

ivmai pushed a commit that referenced this issue Dec 13, 2024
(cherry-pick of 8a007e7 from SerenityOS/serenity)

Issue #685 (bdwgc).

* configure.ac [$THREADS==posix && $host==*-*-serenity*] (GC_THREADS,
_REENTRANT): Define C macro.
* configure.ac [$THREADS==posix && $host==*-*-serenity*]
(use_parallel_mark, use_thread_local_alloc, default_threadlibs): Set
variable.
ivmai pushed a commit that referenced this issue Dec 13, 2024
(cherry-pick of ce9f355, 4900b34 from SerenityOS/serenity)

Issue #685 (bdwgc).

Teach os_dep.c and gcconfig.h about serenity on x86 and x86_64.
Teach dyn_load.c about serenity.
Teach bdwgc about serenity signals.  (Serenity does not have the
realtime POSIX signals, so use SIGXCPU and SIGXFSZ instead.)

* dyn_load.c [DYNAMIC_LOADING && !ANY_MSWIN && !CPPCHECK && SERENITY]:
Do not generate preprocessor error.
* dyn_load.c [DYNAMIC_LOADING && !ANY_MSWIN && SERENITY]: Include
`stddef.h`, `link.h`.
* dyn_load.c [DYNAMIC_LOADING && !ANY_MSWIN && SERENITY] (link_map,
r_debug): Define struct.
* dyn_load.c [DYNAMIC_LOADING && !ANY_MSWIN && SERENITY]
(GC_FirstDLOpenedLinkMap, GC_register_dynamic_libraries): Define.
* include/private/gc_priv.h [SIGNAL_BASED_STOP_WORLD && !SIG_SUSPEND
&& !THREAD_SANITIZER && SERENITY] (SIG_SUSPEND): Define to `SIGXFSZ`
instead of `SIGRTMIN+6`.
* include/private/gcconfig.h [__serenity__] (SERENITY): Define macro.
* include/private/gcconfig.h [(__i386__ || i386 || __X86__)
&& SERENITY] (I386, mach_type_known): Likewise.
* include/private/gcconfig.h [(__x86_64 || __x86_64__ || __amd64__
|| __X86_64__) && SERENITY] (X86_64, mach_type_known): Likewise.
* include/private/gcconfig.h [SERENITY] (OS_TYPE, DATASTART, DATAEND,
DYNAMIC_LOADING, MPROTECT_VDB, USE_MMAP_ANON, USE_SEGV_SIGACT,
USE_BUS_SIGACT, UNIX_LIKE, MMAP_SUPPORTED): Likewise.
* include/private/gcconfig.h [SERENITY && !NO_GETCONTEXT]
(NO_GETCONTEXT): Likewise.
* include/private/gcconfig.h [SERENITY] (etext, _end): Declare global
variable.
* include/private/gcconfig.h [!HAVE_UNISTD_H && SERENITY]: Include
`unistd.h`.
* include/private/gcconfig.h [SERENITY] (GETPAGESIZE): Define to
`sysconf(_SC_PAGESIZE)`.
* os_dep.c [SERENITY]: Include `serenity.h`.
* os_dep.c [SERENITY] (GC_get_stack_base): Implement.
* os_dep.c [USE_MUNMAP && !USE_WINALLOC && SERENITY]
(block_unmap_inner): Use `mprotect()` and `madvise()` instead of
`mmap(PROT_NONE)`.
* os_dep.c [MPROTECT_VDB && SERENITY]: Include `sys/syscall.h`.
* os_dep.c [MPROTECT_VDB && SERENITY] (CODE_OK): Define to true.

Co-authored-by: Cameron Youell <[email protected]>
ivmai added a commit that referenced this issue Dec 13, 2024
Issue #685 (bdwgc).
ivmai added a commit that referenced this issue Dec 13, 2024
Issue #685 (bdwgc).

* include/private/gcconfig.h [__aarch64__ && !ANY_BSD && !COSMO
&& !DARWIN && !LINUX && !KOS && !NN_BUILD_TARGET_PLATFORM_NX && !QNX
&& !_WIN32] (AARCH64, NOSYS, mach_type_known): Do not define if
`SERENITY` is defined.
* include/private/gcconfig.h [__aarch64__ && SERENITY] (AARCH64,
mach_type_known): Define macro.
@ivmai ivmai closed this as completed Dec 13, 2024
linusg added a commit to linusg/serenity that referenced this issue Dec 13, 2024
With the exception of a tweak in gctest all patches were upstreamed.
See: ivmai/bdwgc#685
@linusg
Copy link
Contributor

linusg commented Dec 13, 2024

I updated the port here: https://github.com/linusg/serenity/tree/ports-bdwgc-update

However I can't tell if everything works correctly because gctest doesn't seem to work with the current patches either. Probably needs to be tested with a real application instead.

@ivmai
Copy link
Owner Author

ivmai commented Dec 14, 2024

However I can't tell if everything works correctly because gctest doesn't seem to work with the current patches either.

I have opened #688 (I don't have time to address it, maybe someone else will investigate the failure.)

ivmai added a commit that referenced this issue Dec 20, 2024
(fix of commit b48ee2b)

Issue #685 (bdwgc).

* dyn_load.c [DYNAMIC_LOADING && !ANY_MSWIN && ((HOST_ANDROID
&& !GC_DONT_DEFINE_LINK_MAP && !(__ANDROID_API__>=21)) || SERENITY)]
(link_map, r_debug): Do not define struct if `USE_PROC_FOR_LIBRARIES`.
* dyn_load.c [DYNAMIC_LOADING && !ANY_MSWIN && SERENITY
&& !USE_PROC_FOR_LIBRARIES && !(NETBSD && RTLD_DI_LINKMAP) && CPPCHECK]
(GC_FirstDLOpenedLinkMap): Call `GC_noop1(rd->r_version)`.
* dyn_load.c [DYNAMIC_LOADING && !ANY_MSWIN && SERENITY && CPPCHECK
&& !USE_PROC_FOR_LIBRARIES] (GC_register_dynamic_libraries): Call
`GC_noop1_ptr(lm->l_name)`, `GC_noop1_ptr(lm->l_prev)` and
`GC_noop1(lm->l_ld)`.
ivmai pushed a commit that referenced this issue Dec 27, 2024
(cherry-pick of 8a007e7 from SerenityOS/serenity)

Issue #685 (bdwgc).

* configure.ac [$THREADS==posix && $host==*-*-serenity*] (GC_THREADS,
_REENTRANT): Define C macro.
* configure.ac [$THREADS==posix && $host==*-*-serenity*]
(use_parallel_mark, use_thread_local_alloc, default_threadlibs): Set
variable.
ivmai pushed a commit that referenced this issue Dec 27, 2024
(a cherry-pick of commits b48ee2b, 86d2983, 21dc24a from 'master')

Issue #685 (bdwgc).

Teach os_dep.c and gcconfig.h about serenity on x86 and x86_64.
Teach dyn_load.c about serenity.
Teach bdwgc about serenity signals.  (Serenity does not have the
realtime POSIX signals, so use SIGXCPU and SIGXFSZ instead.)

* dyn_load.c [DYNAMIC_LOADING && !(MSWIN32 || MSWINCE || CYGWIN32)
&& !CPPCHECK && SERENITY]: Do not generate preprocessor error.
* dyn_load.c [DYNAMIC_LOADING && !(MSWIN32 || MSWINCE || CYGWIN32)
&& SERENITY]: Include `stddef.h`, `link.h`.
* dyn_load.c [DYNAMIC_LOADING && !(MSWIN32 || MSWINCE || CYGWIN32)
&& SERENITY] (link_map, r_debug): Define struct.
* dyn_load.c [DYNAMIC_LOADING && !(MSWIN32 || MSWINCE || CYGWIN32)
&& SERENITY] (GC_FirstDLOpenedLinkMap, GC_register_dynamic_libraries):
Define.
* include/private/gc_priv.h [GC_PTHREADS && !GC_WIN32_THREADS && !NACL
&& !GC_DARWIN_THREADS && !SIG_SUSPEND && !THREAD_SANITIZER
&& SERENITY] (SIG_SUSPEND): Define to `SIGXFSZ`
instead of `SIGRTMIN+6`.
* include/private/gcconfig.h [__serenity__] (SERENITY): Define macro.
* include/private/gcconfig.h [__i386__ && SERENITY] (I386,
mach_type_known): Likewise.
* include/private/gcconfig.h [__x86_64__ && SERENITY] (X86_64,
mach_type_known): Likewise.
* include/private/gcconfig.h [SERENITY] (OS_TYPE, DATASTART, DATAEND,
DYNAMIC_LOADING, USE_MMAP_ANON, UNIX_LIKE, MMAP_SUPPORTED): Likewise.
* include/private/gcconfig.h [SERENITY && !NO_GETCONTEXT]
(NO_GETCONTEXT): Likewise.
* include/private/gcconfig.h [SERENITY] (etext, _end): Declare global
variable.
* include/private/gcconfig.h [SERENITY && !GETPAGESIZE]: Include
`unistd.h`.
* include/private/gcconfig.h [SERENITY && !GETPAGESIZE] (GETPAGESIZE):
Define to `sysconf(_SC_PAGESIZE)`.
* os_dep.c [SERENITY]: Include `serenity.h`.
* os_dep.c [SERENITY] (GC_get_stack_base): Implement.
* os_dep.c [NEED_FIND_LIMIT && SERENITY] (old_segv_act, old_bus_act):
Define static variable.
* os_dep.c [NEED_FIND_LIMIT && SERENITY]
(GC_set_and_save_fault_handler, GC_reset_fault_handler): Use
`sigaction()` instead of `signal()`.

Co-authored-by: Cameron Youell <[email protected]>
Co-authored-by: Linus Groh <[email protected]>
ivmai added a commit that referenced this issue Dec 27, 2024
Issue #685 (bdwgc).
@ivmai
Copy link
Owner Author

ivmai commented Dec 27, 2024

@linusg, please test https://github.com/ivmai/bdwgc/tree/release-8_2 branch, Serenity OS support has been backported. The upcoming stable release (v8.2.10) will be based on this branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants