aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/objabi/stack.go
diff options
context:
space:
mode:
authorClément Chigot <clement.chigot@atos.net>2019-01-09 14:05:17 +0100
committerIan Lance Taylor <iant@golang.org>2019-01-09 22:06:51 +0000
commit20ac64a2dd1f7993101d7e069eab3b84ab2c0bd2 (patch)
tree44cabd19b42991b488294b861f53afb0302c6b37 /src/cmd/internal/objabi/stack.go
parenta5318bf5d676b3dfc10a1843668e3593cbdc87c5 (diff)
downloadgo-20ac64a2dd1f7993101d7e069eab3b84ab2c0bd2.tar.xz
cmd/dist, cmd/link, runtime: fix stack size when cross-compiling aix/ppc64
This commit allows to cross-compiling aix/ppc64. The nosplit limit must twice as large as on others platforms because of AIX syscalls. The stack limit, especially stackGuardMultiplier, was set by cmd/dist during the bootstrap and doesn't depend on GOOS/GOARCH target. Fixes #29572 Change-Id: Id51e38885e1978d981aa9e14972eaec17294322e Reviewed-on: https://go-review.googlesource.com/c/157117 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/cmd/internal/objabi/stack.go')
-rw-r--r--src/cmd/internal/objabi/stack.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/cmd/internal/objabi/stack.go b/src/cmd/internal/objabi/stack.go
index 11433932e2..62ab0398a6 100644
--- a/src/cmd/internal/objabi/stack.go
+++ b/src/cmd/internal/objabi/stack.go
@@ -10,11 +10,24 @@ const (
STACKSYSTEM = 0
StackSystem = STACKSYSTEM
StackBig = 4096
- StackGuard = 880*stackGuardMultiplier + StackSystem
StackSmall = 128
- StackLimit = StackGuard - StackSystem - StackSmall
)
const (
StackPreempt = -1314 // 0xfff...fade
)
+
+// Initialize StackGuard and StackLimit according to target system.
+var StackGuard = 880*stackGuardMultiplier() + StackSystem
+var StackLimit = StackGuard - StackSystem - StackSmall
+
+// 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() int {
+ // On AIX, a larger stack is needed for syscalls.
+ if GOOS == "aix" {
+ return 2
+ }
+ return stackGuardMultiplierDefault
+}