cmd/dist: force stackGuardMultiplierDefault to 1

Nothing seems to break, not even the noopt builder.

For #51256 (the conversation there is headed toward additional changes).

Change-Id: Icb7ca451159a74f351c25d2cefb32c773b9bb017
Reviewed-on: https://go-review.googlesource.com/c/go/+/416859
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Russ Cox 2022-07-11 16:49:19 -04:00
parent 8f6884393d
commit b12366bbb5
3 changed files with 4 additions and 23 deletions

View File

@ -7,8 +7,6 @@ package main
import (
"bytes"
"fmt"
"os"
"strings"
)
/*
@ -19,15 +17,12 @@ import (
//
// package sys
//
// const StackGuardMultiplier = <multiplier value>
// (Nothing right now!)
func mkzversion(dir, file string) {
var buf bytes.Buffer
fmt.Fprintf(&buf, "// Code generated by go tool dist; DO NOT EDIT.\n")
fmt.Fprintln(&buf)
fmt.Fprintf(&buf, "package sys\n")
fmt.Fprintln(&buf)
fmt.Fprintf(&buf, "const StackGuardMultiplierDefault = %d\n", stackGuardMultiplierDefault())
writefile(buf.String(), file, writeSkipSame)
}
@ -78,26 +73,12 @@ func mkbuildcfg(file string) {
//
// package objabi
//
// const stackGuardMultiplierDefault = <multiplier value>
// (Nothing right now!)
func mkobjabi(file string) {
var buf bytes.Buffer
fmt.Fprintf(&buf, "// Code generated by go tool dist; DO NOT EDIT.\n")
fmt.Fprintln(&buf)
fmt.Fprintf(&buf, "package objabi\n")
fmt.Fprintln(&buf)
fmt.Fprintf(&buf, "const stackGuardMultiplierDefault = %d\n", stackGuardMultiplierDefault())
writefile(buf.String(), file, writeSkipSame)
}
// stackGuardMultiplierDefault returns a multiplier to apply to the default
// stack guard size. Larger multipliers are used for non-optimized
// builds that have larger stack frames.
func stackGuardMultiplierDefault() int {
for _, s := range strings.Split(os.Getenv("GO_GCFLAGS"), " ") {
if s == "-N" {
return 2
}
}
return 1
}

View File

@ -27,5 +27,5 @@ func stackGuardMultiplier() int {
if buildcfg.GOOS == "aix" {
return 2
}
return stackGuardMultiplierDefault
return 1
}

View File

@ -10,7 +10,7 @@ import (
)
// AIX requires a larger stack for syscalls.
const StackGuardMultiplier = StackGuardMultiplierDefault*(1-goos.IsAix) + 2*goos.IsAix
const StackGuardMultiplier = 1*(1-goos.IsAix) + 2*goos.IsAix
// DefaultPhysPageSize is the default physical page size.
const DefaultPhysPageSize = goarch.DefaultPhysPageSize