diff options
| author | Keith Randall <khr@golang.org> | 2022-11-16 12:56:40 -0800 |
|---|---|---|
| committer | Keith Randall <khr@google.com> | 2022-11-18 16:26:25 +0000 |
| commit | 893964b9727a3dfcadab75c0f6b3c6b683b9bae0 (patch) | |
| tree | 612af6c8419229681102fa682c18000e84f5701d /src/runtime | |
| parent | e18d07ddc5c9005738c3063130f0f5ccf127849e (diff) | |
| download | go-893964b9727a3dfcadab75c0f6b3c6b683b9bae0.tar.xz | |
runtime,cmd/link: increase stack guard space when building with -race
More stuff to do = more stack needed. Bump up the guard space when
building with the race detector.
Fixes #54291
Change-Id: I701bc8800507921bed568047d35b8f49c26e7df7
Reviewed-on: https://go-review.googlesource.com/c/go/+/451217
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/internal/sys/consts.go | 4 | ||||
| -rw-r--r-- | src/runtime/internal/sys/consts_norace.go | 9 | ||||
| -rw-r--r-- | src/runtime/internal/sys/consts_race.go | 9 | ||||
| -rw-r--r-- | src/runtime/stack.go | 2 |
4 files changed, 23 insertions, 1 deletions
diff --git a/src/runtime/internal/sys/consts.go b/src/runtime/internal/sys/consts.go index c603716580..98c0f09ef1 100644 --- a/src/runtime/internal/sys/consts.go +++ b/src/runtime/internal/sys/consts.go @@ -10,7 +10,9 @@ import ( ) // AIX requires a larger stack for syscalls. -const StackGuardMultiplier = 1*(1-goos.IsAix) + 2*goos.IsAix +// The race build also needs more stack. See issue 54291. +// This arithmetic must match that in cmd/internal/objabi/stack.go:stackGuardMultiplier. +const StackGuardMultiplier = 1 + goos.IsAix + isRace // DefaultPhysPageSize is the default physical page size. const DefaultPhysPageSize = goarch.DefaultPhysPageSize diff --git a/src/runtime/internal/sys/consts_norace.go b/src/runtime/internal/sys/consts_norace.go new file mode 100644 index 0000000000..a9613b8843 --- /dev/null +++ b/src/runtime/internal/sys/consts_norace.go @@ -0,0 +1,9 @@ +// Copyright 2022 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. + +//go:build !race + +package sys + +const isRace = 0 diff --git a/src/runtime/internal/sys/consts_race.go b/src/runtime/internal/sys/consts_race.go new file mode 100644 index 0000000000..f824fb39d3 --- /dev/null +++ b/src/runtime/internal/sys/consts_race.go @@ -0,0 +1,9 @@ +// Copyright 2022 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. + +//go:build race + +package sys + +const isRace = 1 diff --git a/src/runtime/stack.go b/src/runtime/stack.go index 546f997881..d5e587a209 100644 --- a/src/runtime/stack.go +++ b/src/runtime/stack.go @@ -98,6 +98,7 @@ const ( // The guard leaves enough room for one _StackSmall frame plus // a _StackLimit chain of NOSPLIT calls plus _StackSystem // bytes for the OS. + // This arithmetic must match that in cmd/internal/objabi/stack.go:StackLimit. _StackGuard = 928*sys.StackGuardMultiplier + _StackSystem // After a stack split check the SP is allowed to be this @@ -107,6 +108,7 @@ const ( // The maximum number of bytes that a chain of NOSPLIT // functions can use. + // This arithmetic must match that in cmd/internal/objabi/stack.go:StackLimit. _StackLimit = _StackGuard - _StackSystem - _StackSmall ) |
