]> gcc.gnu.org Git - gcc.git/commitdiff
cmd: Use correct install tool dir with gccgo
authorIan Lance Taylor <ian@gcc.gnu.org>
Fri, 20 Nov 2015 21:30:16 +0000 (21:30 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Fri, 20 Nov 2015 21:30:16 +0000 (21:30 +0000)
    When using the go command built from gccgo to build and
    install a go tool, use the value from runtime GCCGOTOOLDIR as
    the install directory.

    This also fixes the output from 'go tool' when used with the
    gccgo-built go command, to only include the go tools and not
    other binaries found in the same directory.

    Reviewed-on: https://go-review.googlesource.com/16516

From-SVN: r230677

gcc/go/gofrontend/MERGE
libgo/go/cmd/go/pkg.go
libgo/go/cmd/go/tool.go

index d43f4311ed21571122faed03837b5e68d5ee5d01..418f37a1542804730ee0164ae639231b1d24a871 100644 (file)
@@ -1,4 +1,4 @@
-dfa74d975884f363c74d6a66a37b1703093fdba6
+d52835c9376985f92f35c32af5f1808239981536
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index ff5236e90abd0b0cd08817c55419baded43cb095..3270a8b52364b9e4113ae76ec7251261be976cb1 100644 (file)
@@ -785,7 +785,11 @@ func (p *Package) load(stk *importStack, bp *build.Package, err error) *Package
                if goTools[p.ImportPath] == toTool {
                        // This is for 'go tool'.
                        // Override all the usual logic and force it into the tool directory.
-                       p.target = filepath.Join(gorootPkg, "tool", full)
+                       if buildContext.Compiler == "gccgo" {
+                               p.target = filepath.Join(runtime.GCCGOTOOLDIR, elem)
+                       } else {
+                               p.target = filepath.Join(gorootPkg, "tool", full)
+                       }
                }
                if p.target != "" && buildContext.GOOS == "windows" {
                        p.target += ".exe"
index 937ca1f306cf025eb5124c6cfc86950d8c132e83..4b9493937aa1a34bbf18a37f923219a5a9885015 100644 (file)
@@ -39,6 +39,12 @@ var (
        toolN bool
 )
 
+// List of go tools found in the gccgo tool directory.
+// Other binaries could be in the same directory so don't
+// show those with the 'go tool' command.
+
+var gccgoTools = []string{"cgo", "fix", "cover", "godoc", "vet"}
+
 func init() {
        cmdTool.Flag.BoolVar(&toolN, "n", false, "")
 }
@@ -146,6 +152,21 @@ func listTools() {
                if toolIsWindows && strings.HasSuffix(name, toolWindowsExtension) {
                        name = name[:len(name)-len(toolWindowsExtension)]
                }
-               fmt.Println(name)
+
+               // The tool directory used by gccgo will have other binaries
+               // in additions to go tools.  Only display go tools for this list.
+
+               if buildContext.Compiler == "gccgo" {
+                       for _, tool := range gccgoTools {
+                               if tool == name {
+                                       fmt.Println(name)
+                               }
+                       }
+               } else {
+
+                       // Not gccgo, list all the tools found in this dir
+
+                       fmt.Println(name)
+               }
        }
 }
This page took 0.127236 seconds and 5 git commands to generate.