cmd/go: remove GOAMD64 environment variable
This removes the GOAMD64 environment variable and its documentation.
The value is instead supplied by a compiled-in constant.
Note that function alignment is also dependent on the value of
the (removed) flag; it is 32 for aligned jumps, 16 if not.
When the flag-dependent logic is removed, it will be 32.
Updates #35881.
Change-Id: Ic41c0b9833d2e8a31fa3ce8067d92aa2f165bf72
Reviewed-on: https://go-review.googlesource.com/c/go/+/231600
Reviewed-by: Austin Clements <austin@google.com>
diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
index d22ee1d..9e2b4f3 100644
--- a/src/cmd/dist/build.go
+++ b/src/cmd/dist/build.go
@@ -31,7 +31,6 @@
goos string
goarm string
go386 string
- goamd64 string
gomips string
gomips64 string
goppc64 string
@@ -152,12 +151,6 @@
}
go386 = b
- b = os.Getenv("GOAMD64")
- if b == "" {
- b = "alignedjumps"
- }
- goamd64 = b
-
b = os.Getenv("GOMIPS")
if b == "" {
b = "hardfloat"
@@ -230,7 +223,6 @@
// For tools being invoked but also for os.ExpandEnv.
os.Setenv("GO386", go386)
- os.Setenv("GOAMD64", goamd64)
os.Setenv("GOARCH", goarch)
os.Setenv("GOARM", goarm)
os.Setenv("GOHOSTARCH", gohostarch)
@@ -1171,9 +1163,6 @@
if goarch == "386" {
xprintf(format, "GO386", go386)
}
- if goarch == "amd64" {
- xprintf(format, "GOAMD64", goamd64)
- }
if goarch == "mips" || goarch == "mipsle" {
xprintf(format, "GOMIPS", gomips)
}
diff --git a/src/cmd/dist/buildruntime.go b/src/cmd/dist/buildruntime.go
index f11933c..2744951 100644
--- a/src/cmd/dist/buildruntime.go
+++ b/src/cmd/dist/buildruntime.go
@@ -42,7 +42,6 @@
//
// const defaultGOROOT = <goroot>
// const defaultGO386 = <go386>
-// const defaultGOAMD64 = <goamd64>
// const defaultGOARM = <goarm>
// const defaultGOMIPS = <gomips>
// const defaultGOMIPS64 = <gomips64>
@@ -72,7 +71,6 @@
fmt.Fprintf(&buf, "import \"runtime\"\n")
fmt.Fprintln(&buf)
fmt.Fprintf(&buf, "const defaultGO386 = `%s`\n", go386)
- fmt.Fprintf(&buf, "const defaultGOAMD64 = `%s`\n", goamd64)
fmt.Fprintf(&buf, "const defaultGOARM = `%s`\n", goarm)
fmt.Fprintf(&buf, "const defaultGOMIPS = `%s`\n", gomips)
fmt.Fprintf(&buf, "const defaultGOMIPS64 = `%s`\n", gomips64)
diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go
index 5c1f725..fdeef65 100644
--- a/src/cmd/go/alldocs.go
+++ b/src/cmd/go/alldocs.go
@@ -1754,9 +1754,6 @@
// GO386
// For GOARCH=386, the floating point instruction set.
// Valid values are 387, sse2.
-// GOAMD64
-// For GOARCH=amd64, jumps can be optionally be aligned such that they do not end on
-// or cross 32 byte boundaries. Valid values are alignedjumps (default), normaljumps.
// GOMIPS
// For GOARCH=mips{,le}, whether to use floating point instructions.
// Valid values are hardfloat (default), softfloat.
diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go
index 21f55e8..7f8f8e9 100644
--- a/src/cmd/go/internal/cfg/cfg.go
+++ b/src/cmd/go/internal/cfg/cfg.go
@@ -241,7 +241,6 @@
// Used in envcmd.MkEnv and build ID computations.
GOARM = envOr("GOARM", fmt.Sprint(objabi.GOARM))
GO386 = envOr("GO386", objabi.GO386)
- GOAMD64 = envOr("GOAMD64", objabi.GOAMD64)
GOMIPS = envOr("GOMIPS", objabi.GOMIPS)
GOMIPS64 = envOr("GOMIPS64", objabi.GOMIPS64)
GOPPC64 = envOr("GOPPC64", fmt.Sprintf("%s%d", "power", objabi.GOPPC64))
@@ -267,8 +266,6 @@
return "GOARM", GOARM
case "386":
return "GO386", GO386
- case "amd64":
- return "GOAMD64", GOAMD64
case "mips", "mipsle":
return "GOMIPS", GOMIPS
case "mips64", "mips64le":
diff --git a/src/cmd/go/internal/help/helpdoc.go b/src/cmd/go/internal/help/helpdoc.go
index 9583b3f..693de8f 100644
--- a/src/cmd/go/internal/help/helpdoc.go
+++ b/src/cmd/go/internal/help/helpdoc.go
@@ -582,9 +582,6 @@
GO386
For GOARCH=386, the floating point instruction set.
Valid values are 387, sse2.
- GOAMD64
- For GOARCH=amd64, jumps can be optionally be aligned such that they do not end on
- or cross 32 byte boundaries. Valid values are alignedjumps (default), normaljumps.
GOMIPS
For GOARCH=mips{,le}, whether to use floating point instructions.
Valid values are hardfloat (default), softfloat.
diff --git a/src/cmd/internal/objabi/util.go b/src/cmd/internal/objabi/util.go
index 72dd585..2f94ec6 100644
--- a/src/cmd/internal/objabi/util.go
+++ b/src/cmd/internal/objabi/util.go
@@ -37,16 +37,13 @@
const (
ElfRelocOffset = 256
- MachoRelocOffset = 2048 // reserve enough space for ELF relocations
+ MachoRelocOffset = 2048 // reserve enough space for ELF relocations
+ Go115AMD64 = "alignedjumps" // Should be "alignedjumps" or "normaljumps"; this replaces environment variable introduced in CL 219357.
)
+// TODO(1.16): assuming no issues in 1.15 release, remove this and related constant.
func goamd64() string {
- switch v := envOr("GOAMD64", defaultGOAMD64); v {
- case "normaljumps", "alignedjumps":
- return v
- }
- log.Fatalf("Invalid GOAMD64 value. Must be normaljumps or alignedjumps.")
- panic("unreachable")
+ return Go115AMD64
}
func goarm() int {
diff --git a/src/internal/cfg/cfg.go b/src/internal/cfg/cfg.go
index e40b7b4..bdbe9df 100644
--- a/src/internal/cfg/cfg.go
+++ b/src/internal/cfg/cfg.go
@@ -33,7 +33,6 @@
GCCGO
GO111MODULE
GO386
- GOAMD64
GOARCH
GOARM
GOBIN