go/src/cmd/internal/objabi/stack.go
Damien Neil 4da905bcf0 cmd/internal/objabi, internal/runtime: increase nosplit limit on OpenBSD
OpenBSD is bumping up against the nosplit limit, and openbsd/ppc64
is over it. Increase StackGuardMultiplier on OpenBSD, matching AIX.

Change-Id: I61e17c99ce77e1fd3f368159dc4615aeae99e913
Reviewed-on: https://go-review.googlesource.com/c/go/+/632996
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-12-06 00:35:41 +00:00

33 lines
946 B
Go

// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package objabi
import (
"internal/abi"
"internal/buildcfg"
)
func StackNosplit(race bool) int {
// This arithmetic must match that in runtime/stack.go:stackNosplit.
return abi.StackNosplitBase * stackGuardMultiplier(race)
}
// stackGuardMultiplier returns a multiplier to apply to the default
// stack guard size. Larger multipliers are used for non-optimized
// builds that have larger stack frames or for specific targets.
func stackGuardMultiplier(race bool) int {
// This arithmetic must match that in internal/runtime/sys/consts.go:StackGuardMultiplier.
n := 1
// On AIX and OpenBSD, a larger stack is needed for syscalls.
if buildcfg.GOOS == "aix" || buildcfg.GOOS == "openbsd" {
n += 1
}
// The race build also needs more stack.
if race {
n += 1
}
return n
}