summaryrefslogtreecommitdiff
path: root/Ports/bdwgc/patches/0003-Teach-dyn_load.c-about-serenity.patch
blob: 15f9675fb1805792d9ed5de34ad9ab87b453799a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
From a7fd9227e9111502a6134666d6636a8695c36f4e Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Thu, 24 Feb 2022 01:54:50 +0330
Subject: [PATCH 3/6] 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
--- 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__)) \
     && !(defined(NETBSD) && defined(__ELF__)) \
-    && !defined(HAIKU) && !defined(HURD) \
+    && !defined(HAIKU) && !defined(HURD) && !defined(SERENITY) \
     && !(defined(OPENBSD) && (defined(__ELF__) || defined(M68K))) \
     && !defined(CPPCHECK)
 # 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;
 # endif
 #endif /* OPENBSD */
 
-#if defined(SCO_ELF) || defined(DGUX) || defined(HURD) \
+#if defined(SCO_ELF) || defined(DGUX) || defined(HURD) || defined(SERENITY) \
     || (defined(__ELF__) && (defined(LINUX) || defined(FREEBSD) \
                              || defined(NACL) || defined(NETBSD) \
                              || defined(OPENBSD)))
@@ -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.                    */
@@ -259,7 +276,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) \
     || (defined(__ELF__) && (defined(LINUX) || defined(FREEBSD) \
                              || defined(NACL) || defined(NETBSD) \
                              || defined(OPENBSD)))
-- 
2.35.1