--- third_party/blink/renderer/platform/wtf/stack_util.cc.orig 2026-03-24 16:59:08 UTC +++ third_party/blink/renderer/platform/wtf/stack_util.cc @@ -22,6 +22,11 @@ extern "C" void* __libc_stack_end; // NOLINT #include #endif +#if BUILDFLAG(IS_BSD) +#include +#include +#endif + namespace blink { size_t GetUnderestimatedStackSize() { @@ -66,6 +71,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, @@ -157,6 +164,13 @@ void* GetStackStartImpl() { ::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