mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd: move GOEXPERIMENT knob from make.bash to cmd/go
This CL changes GOEXPERIMENT to act like other GO[CONFIG] environment variables. Namely, that it can be set at make.bash time to provide a default value used by the toolchain, but then can be manually set when running either cmd/go or the individual tools (compiler, assembler, linker). For example, it's now possible to test rsc.io/tmp/fieldtrack by simply running: GOEXPERIMENT=fieldtrack go test -gcflags=-l rsc.io/tmp/fieldtrack \ -ldflags=-k=rsc.io/tmp/fieldtrack.tracked without needing to re-run make.bash. (-gcflags=-l is needed because the compiler's inlining abilities have improved, so calling a function with a for loop is no longer sufficient to suppress inlining.) Fixes #42681. Change-Id: I2cf8995d5d0d05f6785a2ee1d3b54b2cfb3331ca Reviewed-on: https://go-review.googlesource.com/c/go/+/300991 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
parent
b3896fc331
commit
7fc638d6f1
12 changed files with 51 additions and 48 deletions
|
|
@ -45,6 +45,16 @@ func NewInput(name string) *Input {
|
|||
// predefine installs the macros set by the -D flag on the command line.
|
||||
func predefine(defines flags.MultiFlag) map[string]*Macro {
|
||||
macros := make(map[string]*Macro)
|
||||
|
||||
if *flags.CompilingRuntime && objabi.Regabi_enabled != 0 {
|
||||
const name = "GOEXPERIMENT_REGABI"
|
||||
macros[name] = &Macro{
|
||||
name: name,
|
||||
args: nil,
|
||||
tokens: Tokenize("1"),
|
||||
}
|
||||
}
|
||||
|
||||
for _, name := range defines {
|
||||
value := "1"
|
||||
i := strings.IndexRune(name, '=')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue