public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* libgo patch committed: use correct tool dir with gccgo
@ 2015-11-20 21:31 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2015-11-20 21:31 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 266 bytes --]

This patch from Lynn Boger fixes the go tool shipped with gccgo to use
the correct tool directory.  It also fixes the 'go tool' output to
only list known tools.  Bootstrapped and ran Go testsuite on
x86_64-pc-linux-gnu.  Committed to mainline and GCC 5 branch.

Ian

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 2206 bytes --]

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 230657)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -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: libgo/go/cmd/go/pkg.go
===================================================================
--- libgo/go/cmd/go/pkg.go	(revision 230463)
+++ libgo/go/cmd/go/pkg.go	(working copy)
@@ -785,7 +785,11 @@ func (p *Package) load(stk *importStack,
 		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: libgo/go/cmd/go/tool.go
===================================================================
--- libgo/go/cmd/go/tool.go	(revision 230463)
+++ libgo/go/cmd/go/tool.go	(working copy)
@@ -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)
+		}
 	}
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-11-20 21:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-20 21:31 libgo patch committed: use correct tool dir with gccgo Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).