From: Ian Lance Taylor Date: Fri, 9 Jan 2015 21:18:04 +0000 (+0000) Subject: cmd/go: Adjust finding gccgo to match current upstream sources. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b44fb4c37a4697dfd50c37282c9d2ec2bd3aa95a;p=gcc.git cmd/go: Adjust finding gccgo to match current upstream sources. From-SVN: r219406 --- diff --git a/libgo/go/cmd/go/build.go b/libgo/go/cmd/go/build.go index 8de76276118..36216cea404 100644 --- a/libgo/go/cmd/go/build.go +++ b/libgo/go/cmd/go/build.go @@ -1783,15 +1783,22 @@ func (gcToolchain) cc(b *builder, p *Package, objdir, ofile, cfile string) error // The Gccgo toolchain. type gccgoToolchain struct{} -func (gccgoToolchain) compiler() string { - if v := os.Getenv("GOC"); v != "" { - return v +var gccgoName, gccgoBin string + +func init() { + gccgoName = os.Getenv("GCCGO") + if gccgoName == "" { + gccgoName = defaultGCCGO } - return defaultGOC + gccgoBin, _ = exec.LookPath(gccgoName) +} + +func (gccgoToolchain) compiler() string { + return gccgoBin } -func (tools gccgoToolchain) linker() string { - return tools.compiler() +func (gccgoToolchain) linker() string { + return gccgoBin } func (tools gccgoToolchain) gc(b *builder, p *Package, archive, obj string, importArgs []string, gofiles []string) (ofile string, output []byte, err error) {