ladybird/Ports/bdwgc/patches/0003-Teach-dyn_load.c-about-serenity.patch
2023-10-12 23:30:22 +02:00

64 lines
2.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
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 bee040c39925679ae159a644ec9b72d1fa794d25..db57ded046676d96f24ff948f0a8df2db4b4c847 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 <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>
# endif
+# ifdef SERENITY
+# include <link.h>
+ 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)))