]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: for gccgo run the located binary rather than using PATH
authorIan Lance Taylor <iant@golang.org>
Fri, 9 Jan 2015 21:33:58 +0000 (13:33 -0800)
committerIan Lance Taylor <iant@golang.org>
Fri, 6 Mar 2015 17:46:22 +0000 (17:46 +0000)
Change-Id: I308588db2942e7110a2be22257843931941d92f1
Reviewed-on: https://go-review.googlesource.com/2622
Reviewed-by: Peter Collingbourne <pcc@google.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
src/cmd/go/build.go

index 751c67fcd941a5192ff5ebb1bf4e6e70fa10fe9b..5b32c015f4fd32f4e358c3d79ec3efed2296bca1 100644 (file)
@@ -1910,7 +1910,7 @@ func (gccgoToolchain) linker() string {
        return gccgoBin
 }
 
-func (gccgoToolchain) gc(b *builder, p *Package, archive, obj string, asmhdr bool, importArgs []string, gofiles []string) (ofile string, output []byte, err error) {
+func (tools gccgoToolchain) gc(b *builder, p *Package, archive, obj string, asmhdr bool, importArgs []string, gofiles []string) (ofile string, output []byte, err error) {
        out := "_go_.o"
        ofile = obj + out
        gcargs := []string{"-g"}
@@ -1921,7 +1921,7 @@ func (gccgoToolchain) gc(b *builder, p *Package, archive, obj string, asmhdr boo
        if p.localPrefix != "" {
                gcargs = append(gcargs, "-fgo-relative-import-path="+p.localPrefix)
        }
-       args := stringList(gccgoName, importArgs, "-c", gcargs, "-o", ofile, buildGccgoflags)
+       args := stringList(tools.compiler(), importArgs, "-c", gcargs, "-o", ofile, buildGccgoflags)
        for _, f := range gofiles {
                args = append(args, mkAbs(p.Dir, f))
        }
@@ -1930,14 +1930,14 @@ func (gccgoToolchain) gc(b *builder, p *Package, archive, obj string, asmhdr boo
        return ofile, output, err
 }
 
-func (gccgoToolchain) asm(b *builder, p *Package, obj, ofile, sfile string) error {
+func (tools gccgoToolchain) asm(b *builder, p *Package, obj, ofile, sfile string) error {
        sfile = mkAbs(p.Dir, sfile)
        defs := []string{"-D", "GOOS_" + goos, "-D", "GOARCH_" + goarch}
        if pkgpath := gccgoCleanPkgpath(p); pkgpath != "" {
                defs = append(defs, `-D`, `GOPKGPATH="`+pkgpath+`"`)
        }
        defs = append(defs, b.gccArchArgs()...)
-       return b.run(p.Dir, p.ImportPath, nil, gccgoName, "-I", obj, "-o", ofile, defs, sfile)
+       return b.run(p.Dir, p.ImportPath, nil, tools.compiler(), "-I", obj, "-o", ofile, defs, sfile)
 }
 
 func (gccgoToolchain) pkgpath(basedir string, p *Package) string {
@@ -2016,7 +2016,7 @@ func (tools gccgoToolchain) ld(b *builder, p *Package, out string, allactions []
        if objc {
                ldflags = append(ldflags, "-lobjc")
        }
-       return b.run(".", p.ImportPath, nil, gccgoName, "-o", out, ofiles, "-Wl,-(", ldflags, "-Wl,-)", buildGccgoflags)
+       return b.run(".", p.ImportPath, nil, tools.linker(), "-o", out, ofiles, "-Wl,-(", ldflags, "-Wl,-)", buildGccgoflags)
 }
 
 func (gccgoToolchain) cc(b *builder, p *Package, objdir, ofile, cfile string) error {