1
0
mirror of https://github.com/golang/go synced 2024-11-19 09:34:52 -07:00

cmd/go: for gccgo run the located binary rather than using PATH

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>
This commit is contained in:
Ian Lance Taylor 2015-01-09 13:33:58 -08:00
parent 4f97afcdf2
commit 4084b280f5

View 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 {