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());
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
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)
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
59 #define HAVE_HOSTED_CORE_ANIMATION 1
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
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
73 -#if OS(DARWIN) || OS(LINUX)
74 +#if OS(DARWIN) || OS(LINUX) || OS(SOLARIS)
79 #define HAVE_URL_FORMATTING 1
83 +#if !OS(WINDOWS) && !OS(SOLARIS)
84 #define HAVE_STACK_BOUNDS_FOR_NEW_THREAD 1
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
92 #define WTF_OS_OPENBSD 1
95 +/* OS(SOLARIS) - Solaris */
96 +#if defined(sun) || defined(__sun)
97 +#define WTF_OS_SOLARIS 1
100 /* OS(WINDOWS) - Any version of Windows */
101 #if defined(WIN32) || defined(_WIN32)
102 #define WTF_OS_WINDOWS 1
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
126 @@ -65,6 +69,17 @@ StackBounds StackBounds::currentThreadStackBoundsInternal()
127 return newThreadStackBounds(pthread_self());
132 +StackBounds StackBounds::currentThreadStackBoundsInternal()
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 };
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
153 + return "solaris"_s;
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
160 #include <wtf/PlatformRegisters.h>
161 #include <wtf/PointerPreparations.h>
162 #include <wtf/StdLibExtras.h>
163 +#include <sys/regset.h>
166 namespace MachineContext {
168 #error Unknown Architecture
171 -#elif OS(FUCHSIA) || OS(LINUX)
172 +#elif OS(FUCHSIA) || OS(LINUX) || OS(SOLARIS)
175 return reinterpret_cast<void*&>((uintptr_t&) machineContext.gregs[REG_ESP]);
177 #error Unknown Architecture
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.
186 #error Unknown Architecture
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.
195 #error Unknown Architecture
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.
204 #error Unknown Architecture
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.