summaryrefslogtreecommitdiff
path: root/libgo/go/cmd
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2018-05-04 01:34:30 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2018-05-04 01:34:30 +0000
commit652293284321e34fa1d87ad70c28a854b5b47580 (patch)
treea9a9eeee039e6d87b7e8e3de6831a7a0fef92747 /libgo/go/cmd
parente7902c2c8f7a7b84fb2637319af2d7cf9cf42096 (diff)
cmd/go: update to match recent changes to gc
In https://golang.org/cl/111097 the gc version of cmd/go was updated to include some gofrontend-specific changes. The gofrontend code already has different versions of those changes; this CL makes the gofrontend match the upstream code. Reviewed-on: https://go-review.googlesource.com/111099 From-SVN: r259918
Diffstat (limited to 'libgo/go/cmd')
-rw-r--r--libgo/go/cmd/go/alldocs.go6
-rw-r--r--libgo/go/cmd/go/internal/cfg/cfg.go11
-rw-r--r--libgo/go/cmd/go/internal/help/helpdoc.go6
-rw-r--r--libgo/go/cmd/go/internal/load/pkg.go3
4 files changed, 14 insertions, 12 deletions
diff --git a/libgo/go/cmd/go/alldocs.go b/libgo/go/cmd/go/alldocs.go
index 5e1ac5aaf57..aadf97c064f 100644
--- a/libgo/go/cmd/go/alldocs.go
+++ b/libgo/go/cmd/go/alldocs.go
@@ -1266,6 +1266,9 @@
//
// Special-purpose environment variables:
//
+// GCCGOTOOLDIR
+// If set, where to find gccgo tools, such as cgo.
+// The default is based on how gccgo was configured.
// GOROOT_FINAL
// The root of the installed Go tree, when it is
// installed in a location other than where it is built.
@@ -1279,9 +1282,6 @@
// Defined by Git. A colon-separated list of schemes that are allowed to be used
// with git fetch/clone. If set, any scheme not explicitly mentioned will be
// considered insecure by 'go get'.
-// GCCGOTOOLDIR
-// If set, where to find gccgo tools, such as cgo.
-// The default is based on how gccgo was configured.
//
//
// Import path syntax
diff --git a/libgo/go/cmd/go/internal/cfg/cfg.go b/libgo/go/cmd/go/internal/cfg/cfg.go
index bfdd67e842d..f0a2277d1b2 100644
--- a/libgo/go/cmd/go/internal/cfg/cfg.go
+++ b/libgo/go/cmd/go/internal/cfg/cfg.go
@@ -92,11 +92,12 @@ var (
// Update build context to use our computed GOROOT.
func init() {
BuildContext.GOROOT = GOROOT
- // Note that we must use runtime.GOOS and runtime.GOARCH here,
- // as the tool directory does not move based on environment variables.
- // This matches the initialization of ToolDir in go/build,
- // except for using GOROOT rather than runtime.GOROOT().
if runtime.Compiler != "gccgo" {
+ // Note that we must use runtime.GOOS and runtime.GOARCH here,
+ // as the tool directory does not move based on environment
+ // variables. This matches the initialization of ToolDir in
+ // go/build, except for using GOROOT rather than
+ // runtime.GOROOT.
build.ToolDir = filepath.Join(GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
}
}
@@ -107,6 +108,8 @@ func findGOROOT() string {
}
def := filepath.Clean(runtime.GOROOT())
if runtime.Compiler == "gccgo" {
+ // gccgo has no real GOROOT, and it certainly doesn't
+ // depend on the executable's location.
return def
}
exe, err := os.Executable()
diff --git a/libgo/go/cmd/go/internal/help/helpdoc.go b/libgo/go/cmd/go/internal/help/helpdoc.go
index 9a9fc4e9448..6aa449a8e29 100644
--- a/libgo/go/cmd/go/internal/help/helpdoc.go
+++ b/libgo/go/cmd/go/internal/help/helpdoc.go
@@ -526,6 +526,9 @@ Architecture-specific environment variables:
Special-purpose environment variables:
+ GCCGOTOOLDIR
+ If set, where to find gccgo tools, such as cgo.
+ The default is based on how gccgo was configured.
GOROOT_FINAL
The root of the installed Go tree, when it is
installed in a location other than where it is built.
@@ -539,9 +542,6 @@ Special-purpose environment variables:
Defined by Git. A colon-separated list of schemes that are allowed to be used
with git fetch/clone. If set, any scheme not explicitly mentioned will be
considered insecure by 'go get'.
- GCCGOTOOLDIR
- If set, where to find gccgo tools, such as cgo.
- The default is based on how gccgo was configured.
`,
}
diff --git a/libgo/go/cmd/go/internal/load/pkg.go b/libgo/go/cmd/go/internal/load/pkg.go
index 52ff6b8fcd2..d3026072e09 100644
--- a/libgo/go/cmd/go/internal/load/pkg.go
+++ b/libgo/go/cmd/go/internal/load/pkg.go
@@ -13,7 +13,6 @@ import (
"os"
pathpkg "path"
"path/filepath"
- "runtime"
"sort"
"strings"
"unicode"
@@ -976,7 +975,7 @@ func (p *Package) load(stk *ImportStack, bp *build.Package, err error) {
// This is for 'go tool'.
// Override all the usual logic and force it into the tool directory.
if cfg.BuildToolchainName == "gccgo" {
- p.Target = filepath.Join(runtime.GCCGOTOOLDIR, elem)
+ p.Target = filepath.Join(base.ToolDir, elem)
} else {
p.Target = filepath.Join(cfg.GOROOTpkg, "tool", full)
}