Source file src/cmd/internal/objabi/stack.go
1 // Copyright 2011 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package objabi 6 7 import "internal/buildcfg" 8 9 // For the linkers. Must match Go definitions. 10 11 const ( 12 STACKSYSTEM = 0 13 StackSystem = STACKSYSTEM 14 StackBig = 4096 15 StackSmall = 128 16 ) 17 18 // Initialize StackGuard and StackLimit according to target system. 19 var StackGuard = 928*stackGuardMultiplier() + StackSystem 20 var StackLimit = StackGuard - StackSystem - StackSmall 21 22 // stackGuardMultiplier returns a multiplier to apply to the default 23 // stack guard size. Larger multipliers are used for non-optimized 24 // builds that have larger stack frames or for specific targets. 25 func stackGuardMultiplier() int { 26 // On AIX, a larger stack is needed for syscalls. 27 if buildcfg.GOOS == "aix" { 28 return 2 29 } 30 return stackGuardMultiplierDefault 31 } 32