--- third_party/blink/renderer/platform/wtf/stack_util.cc.orig 2024-05-21 18:07:39 UTC +++ third_party/blink/renderer/platform/wtf/stack_util.cc @@ -19,6 +19,11 @@ extern "C" void* __libc_stack_end; // NOLINT #endif +#if BUILDFLAG(IS_BSD) +#include +#include +#endif + namespace WTF { size_t GetUnderestimatedStackSize() { @@ -63,6 +68,8 @@ size_t GetUnderestimatedStackSize() { // low as 512k. // return 512 * 1024; +#elif BUILDFLAG(IS_OPENBSD) + return 512 * 1024; #elif BUILDFLAG(IS_APPLE) // pthread_get_stacksize_np() returns too low a value for the main thread on // OSX 10.9, @@ -149,6 +156,13 @@ void* GetStackStart() { ::GetCurrentThreadStackLimits(&lowLimit, &highLimit); return reinterpret_cast(highLimit); #endif +#elif BUILDFLAG(IS_OPENBSD) + stack_t ss; + void *base; + int error = pthread_stackseg_np(pthread_self(), &ss); + CHECK(!error); + base = (void*)((size_t) ss.ss_sp - ss.ss_size); + return reinterpret_cast(base) + ss.ss_size; #else #error Unsupported getStackStart on this platform. #endif