bhyve-fw: drop CSM
[oi-userland.git] / components / library / webkitgtk / patches / 13-solaris-support.patch
blobf1dc02a28aa3f15c81ed76810af3b2d186d5c6e7
1 Changes for the build to work on Solaris
3 Potentially suitable to send upstream
5 diff --git a/Source/WTF/wtf/CurrentTime.cpp b/Source/WTF/wtf/CurrentTime.cpp
6 index d7fb93f..aa9c14d 100644
7 --- a/Source/WTF/wtf/CurrentTime.cpp
8 +++ b/Source/WTF/wtf/CurrentTime.cpp
9 @@ -273,7 +273,7 @@ MonotonicTime MonotonicTime::now()
10 return fromMachAbsoluteTime(mach_absolute_time());
11 #elif OS(FUCHSIA)
12 return fromRawSeconds(zx_clock_get_monotonic() / static_cast<double>(ZX_SEC(1)));
13 -#elif OS(LINUX) || OS(FREEBSD) || OS(OPENBSD) || OS(NETBSD)
14 +#elif OS(LINUX) || OS(FREEBSD) || OS(OPENBSD) || OS(SOLARIS) || OS(NETBSD)
15 struct timespec ts { };
16 clock_gettime(CLOCK_MONOTONIC, &ts);
17 return fromRawSeconds(static_cast<double>(ts.tv_sec) + ts.tv_nsec / 1.0e9);
18 diff --git a/Source/WTF/wtf/NumberOfCores.cpp b/Source/WTF/wtf/NumberOfCores.cpp
19 index 7636865..59fd2f7 100644
20 --- a/Source/WTF/wtf/NumberOfCores.cpp
21 +++ b/Source/WTF/wtf/NumberOfCores.cpp
22 @@ -30,7 +30,7 @@
24 #if OS(DARWIN)
25 #include <sys/sysctl.h>
26 -#elif OS(LINUX) || OS(AIX) || OS(OPENBSD) || OS(NETBSD) || OS(FREEBSD)
27 +#elif OS(LINUX) || OS(AIX) || OS(SOLARIS) || OS(OPENBSD) || OS(NETBSD) || OS(FREEBSD)
28 #include <unistd.h>
29 #elif OS(WINDOWS)
30 #include <windows.h>
31 @@ -65,7 +65,7 @@ int numberOfProcessorCores()
32 int sysctlResult = sysctl(name, sizeof(name) / sizeof(int), &result, &length, 0, 0);
34 s_numberOfCores = sysctlResult < 0 ? defaultIfUnavailable : result;
35 -#elif OS(LINUX) || OS(AIX) || OS(OPENBSD) || OS(NETBSD) || OS(FREEBSD)
36 +#elif OS(LINUX) || OS(AIX) || OS(SOLARIS) || OS(OPENBSD) || OS(NETBSD) || OS(FREEBSD)
37 long sysconfResult = sysconf(_SC_NPROCESSORS_ONLN);
39 s_numberOfCores = sysconfResult < 0 ? defaultIfUnavailable : static_cast<int>(sysconfResult);
40 diff --git a/Source/WTF/wtf/PageBlock.h b/Source/WTF/wtf/PageBlock.h
41 index c655a50..be6f1a4 100644
42 --- a/Source/WTF/wtf/PageBlock.h
43 +++ b/Source/WTF/wtf/PageBlock.h
44 @@ -49,7 +49,7 @@ namespace WTF {
45 // Use 64 KiB for any unknown CPUs to be conservative.
46 #if OS(DARWIN) || PLATFORM(PLAYSTATION)
47 constexpr size_t CeilingOnPageSize = 16 * KB;
48 -#elif USE(64KB_PAGE_BLOCK) || CPU(PPC) || CPU(PPC64) || CPU(PPC64LE) || CPU(UNKNOWN)
49 +#elif USE(64KB_PAGE_BLOCK) || CPU(PPC) || CPU(PPC64) || CPU(PPC64LE) || CPU(SPARC) || CPU(UNKNOWN)
50 constexpr size_t CeilingOnPageSize = 64 * KB;
51 #elif OS(WINDOWS) || CPU(MIPS) || CPU(MIPS64) || CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64)
52 constexpr size_t CeilingOnPageSize = 4 * KB;
54 diff --git a/Source/WTF/wtf/PlatformHave.h b/Source/WTF/wtf/PlatformHave.h
55 index 41afbb4..9e5d453 100644
56 --- a/Source/WTF/wtf/PlatformHave.h
57 +++ b/Source/WTF/wtf/PlatformHave.h
58 @@ -229,16 +229,16 @@
59 #define HAVE_HOSTED_CORE_ANIMATION 1
60 #endif
62 -#if OS(DARWIN) || OS(FUCHSIA) || ((OS(FREEBSD) || OS(NETBSD) || OS(OPENBSD) || OS(LINUX)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS) || CPU(RISCV64)))
63 +#if OS(DARWIN) || OS(FUCHSIA) || OS(SOLARIS) || ((OS(FREEBSD) || OS(NETBSD) || OS(OPENBSD) || OS(LINUX)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS) || CPU(RISCV64)))
64 #define HAVE_MACHINE_CONTEXT 1
65 #endif
67 -#if OS(DARWIN) || (OS(LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__) && !CPU(MIPS))
68 +#if OS(DARWIN) || OS(SOLARIS) || (OS(LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__) && !CPU(MIPS))
69 #define HAVE_BACKTRACE 1
70 #define HAVE_BACKTRACE_SYMBOLS 1
71 #endif
73 -#if OS(DARWIN) || OS(LINUX)
74 +#if OS(DARWIN) || OS(LINUX) || OS(SOLARIS)
75 #define HAVE_DLADDR 1
76 #endif
78 @@ -376,7 +376,7 @@
79 #define HAVE_URL_FORMATTING 1
80 #endif
82 -#if !OS(WINDOWS)
83 +#if !OS(WINDOWS) && !OS(SOLARIS)
84 #define HAVE_STACK_BOUNDS_FOR_NEW_THREAD 1
85 #endif
87 diff --git a/Source/WTF/wtf/PlatformOS.h b/Source/WTF/wtf/PlatformOS.h
88 index be27911..a5216ba 100644
89 --- a/Source/WTF/wtf/PlatformOS.h
90 +++ b/Source/WTF/wtf/PlatformOS.h
91 @@ -114,6 +114,11 @@
92 #define WTF_OS_OPENBSD 1
93 #endif
95 +/* OS(SOLARIS) - Solaris */
96 +#if defined(sun) || defined(__sun)
97 +#define WTF_OS_SOLARIS 1
98 +#endif
100 /* OS(WINDOWS) - Any version of Windows */
101 #if defined(WIN32) || defined(_WIN32)
102 #define WTF_OS_WINDOWS 1
103 @@ -129,6 +134,7 @@
104 || OS(LINUX) \
105 || OS(NETBSD) \
106 || OS(OPENBSD) \
107 + || OS(SOLARIS) \
108 || defined(unix) \
109 || defined(__unix) \
110 || defined(__unix__)
111 diff --git a/Source/WTF/wtf/StackBounds.cpp b/Source/WTF/wtf/StackBounds.cpp
112 index e6f7095..8fb3955 100644
113 --- a/Source/WTF/wtf/StackBounds.cpp
114 +++ b/Source/WTF/wtf/StackBounds.cpp
115 @@ -29,6 +29,10 @@
117 #include <windows.h>
119 +#elif OS(SOLARIS)
121 +#include <thread.h>
123 #elif OS(UNIX)
125 #include <pthread.h>
126 @@ -65,6 +69,17 @@ StackBounds StackBounds::currentThreadStackBoundsInternal()
127 return newThreadStackBounds(pthread_self());
130 +#elif OS(SOLARIS)
132 +StackBounds StackBounds::currentThreadStackBoundsInternal()
134 + stack_t s;
135 + thr_stksegment(&s);
136 + void* origin = s.ss_sp;
137 + void* bound = static_cast<char*>(origin) - s.ss_size;
138 + return StackBounds { origin, bound };
141 #elif OS(UNIX)
143 #if OS(OPENBSD)
144 diff --git a/Source/WebCore/inspector/InspectorFrontendHost.cpp b/Source/WebCore/inspector/InspectorFrontendHost.cpp
145 index 6577423..b882b9e 100644
146 --- a/Source/WebCore/inspector/InspectorFrontendHost.cpp
147 +++ b/Source/WebCore/inspector/InspectorFrontendHost.cpp
148 @@ -386,6 +386,8 @@ String InspectorFrontendHost::platform() const
149 return "freebsd"_s;
150 #elif OS(OPENBSD)
151 return "openbsd"_s;
152 +#elif OS(SOLARIS)
153 + return "solaris"_s;
154 #else
155 return "unknown"_s;
156 #endif
157 --- webkitgtk-2.42.5/Source/JavaScriptCore/runtime/MachineContext.h.~1~ 2023-09-19 04:27:45.475782200 -0400
158 +++ webkitgtk-2.42.5/Source/JavaScriptCore/runtime/MachineContext.h 2024-02-18 01:24:47.690986457 -0500
159 @@ -33,6 +33,7 @@
160 #include <wtf/PlatformRegisters.h>
161 #include <wtf/PointerPreparations.h>
162 #include <wtf/StdLibExtras.h>
163 +#include <sys/regset.h>
165 namespace JSC {
166 namespace MachineContext {
167 @@ -193,7 +194,7 @@
168 #error Unknown Architecture
169 #endif
171 -#elif OS(FUCHSIA) || OS(LINUX)
172 +#elif OS(FUCHSIA) || OS(LINUX) || OS(SOLARIS)
174 #if CPU(X86)
175 return reinterpret_cast<void*&>((uintptr_t&) machineContext.gregs[REG_ESP]);
176 @@ -338,7 +339,7 @@
177 #error Unknown Architecture
178 #endif
180 -#elif OS(FUCHSIA) || OS(LINUX)
181 +#elif OS(FUCHSIA) || OS(LINUX) || OS(SOLARIS)
183 // The following sequence depends on glibc's sys/ucontext.h.
184 #if CPU(X86)
185 @@ -496,7 +497,7 @@
186 #error Unknown Architecture
187 #endif
189 -#elif OS(FUCHSIA) || OS(LINUX)
190 +#elif OS(FUCHSIA) || OS(LINUX) || OS(SOLARIS)
192 // The following sequence depends on glibc's sys/ucontext.h.
193 #if CPU(X86)
194 @@ -652,7 +653,7 @@
195 #error Unknown Architecture
196 #endif
198 -#elif OS(FUCHSIA) || OS(LINUX)
199 +#elif OS(FUCHSIA) || OS(LINUX) || OS(SOLARIS)
201 // The following sequence depends on glibc's sys/ucontext.h.
202 #if CPU(X86)
203 @@ -787,7 +788,7 @@
204 #error Unknown Architecture
205 #endif
207 -#elif OS(FUCHSIA) || OS(LINUX)
208 +#elif OS(FUCHSIA) || OS(LINUX) || OS(SOLARIS)
210 // The following sequence depends on glibc's sys/ucontext.h.
211 #if CPU(X86)