]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: remove GOAMD64 environment variable
authorDavid Chase <drchase@google.com>
Fri, 1 May 2020 21:30:33 +0000 (17:30 -0400)
committerDavid Chase <drchase@google.com>
Wed, 20 May 2020 19:21:43 +0000 (19:21 +0000)
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>
src/cmd/dist/build.go
src/cmd/dist/buildruntime.go
src/cmd/go/alldocs.go
src/cmd/go/internal/cfg/cfg.go
src/cmd/go/internal/help/helpdoc.go
src/cmd/internal/objabi/util.go
src/internal/cfg/cfg.go

index d22ee1d361d7e1561f5c3726b6c062665616c968..9e2b4f33b866b9b10a6326cd342a3a50822695b2 100644 (file)
@@ -31,7 +31,6 @@ var (
        goos             string
        goarm            string
        go386            string
-       goamd64          string
        gomips           string
        gomips64         string
        goppc64          string
@@ -152,12 +151,6 @@ func xinit() {
        }
        go386 = b
 
-       b = os.Getenv("GOAMD64")
-       if b == "" {
-               b = "alignedjumps"
-       }
-       goamd64 = b
-
        b = os.Getenv("GOMIPS")
        if b == "" {
                b = "hardfloat"
@@ -230,7 +223,6 @@ func xinit() {
 
        // 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 @@ func cmdenv() {
        if goarch == "386" {
                xprintf(format, "GO386", go386)
        }
-       if goarch == "amd64" {
-               xprintf(format, "GOAMD64", goamd64)
-       }
        if goarch == "mips" || goarch == "mipsle" {
                xprintf(format, "GOMIPS", gomips)
        }
index f11933c9258c0f2b68c28eab50174f8a733d82b3..27449515976b36449ecd7a92c3341d3a98fbb832 100644 (file)
@@ -42,7 +42,6 @@ func mkzversion(dir, file string) {
 //
 //     const defaultGOROOT = <goroot>
 //     const defaultGO386 = <go386>
-//     const defaultGOAMD64 = <goamd64>
 //     const defaultGOARM = <goarm>
 //     const defaultGOMIPS = <gomips>
 //     const defaultGOMIPS64 = <gomips64>
@@ -72,7 +71,6 @@ func mkzbootstrap(file string) {
        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)
index 5c1f7254bf7b8da173988d28710aa4c4bcf0a740..fdeef651c7675d8cae7b13fc2f9fdd411da3ba95 100644 (file)
 //     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.
index 21f55e852f6b6c1e43be3660f4e10b33ba9cd198..7f8f8e92be31f12771e6b493da05aff60894fa50 100644 (file)
@@ -241,7 +241,6 @@ var (
        // 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 @@ func GetArchEnv() (key, val string) {
                return "GOARM", GOARM
        case "386":
                return "GO386", GO386
-       case "amd64":
-               return "GOAMD64", GOAMD64
        case "mips", "mipsle":
                return "GOMIPS", GOMIPS
        case "mips64", "mips64le":
index 9583b3f3271db9443eed7c100f878a40bb7f61c6..693de8ff49de5e954863bd0d13123fc12f077bb2 100644 (file)
@@ -582,9 +582,6 @@ Architecture-specific environment variables:
        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.
index 72dd5856f8c528eb8ea8544ff2eeaf03ecaceadb..2f94ec6a67d99f9df35a8d51fd1e923240389496 100644 (file)
@@ -37,16 +37,13 @@ var (
 
 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 {
index e40b7b4d1aa3197d60842f6ab38991547c2c328b..bdbe9df3e75d13a9e4376f5471143bc6a20d6522 100644 (file)
@@ -33,7 +33,6 @@ const KnownEnv = `
        GCCGO
        GO111MODULE
        GO386
-       GOAMD64
        GOARCH
        GOARM
        GOBIN