Commit 4084b280 authored by Ian Lance Taylor's avatar Ian Lance Taylor

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

Change-Id: I308588db2942e7110a2be22257843931941d92f1
Reviewed-on: https://go-review.googlesource.com/2622Reviewed-by: 's avatarPeter Collingbourne <pcc@google.com>
Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
parent 4f97afcd
...@@ -1910,7 +1910,7 @@ func (gccgoToolchain) linker() string { ...@@ -1910,7 +1910,7 @@ func (gccgoToolchain) linker() string {
return gccgoBin 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" out := "_go_.o"
ofile = obj + out ofile = obj + out
gcargs := []string{"-g"} gcargs := []string{"-g"}
...@@ -1921,7 +1921,7 @@ func (gccgoToolchain) gc(b *builder, p *Package, archive, obj string, asmhdr boo ...@@ -1921,7 +1921,7 @@ func (gccgoToolchain) gc(b *builder, p *Package, archive, obj string, asmhdr boo
if p.localPrefix != "" { if p.localPrefix != "" {
gcargs = append(gcargs, "-fgo-relative-import-path="+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 { for _, f := range gofiles {
args = append(args, mkAbs(p.Dir, f)) args = append(args, mkAbs(p.Dir, f))
} }
...@@ -1930,14 +1930,14 @@ func (gccgoToolchain) gc(b *builder, p *Package, archive, obj string, asmhdr boo ...@@ -1930,14 +1930,14 @@ func (gccgoToolchain) gc(b *builder, p *Package, archive, obj string, asmhdr boo
return ofile, output, err 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) sfile = mkAbs(p.Dir, sfile)
defs := []string{"-D", "GOOS_" + goos, "-D", "GOARCH_" + goarch} defs := []string{"-D", "GOOS_" + goos, "-D", "GOARCH_" + goarch}
if pkgpath := gccgoCleanPkgpath(p); pkgpath != "" { if pkgpath := gccgoCleanPkgpath(p); pkgpath != "" {
defs = append(defs, `-D`, `GOPKGPATH="`+pkgpath+`"`) defs = append(defs, `-D`, `GOPKGPATH="`+pkgpath+`"`)
} }
defs = append(defs, b.gccArchArgs()...) 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 { func (gccgoToolchain) pkgpath(basedir string, p *Package) string {
...@@ -2016,7 +2016,7 @@ func (tools gccgoToolchain) ld(b *builder, p *Package, out string, allactions [] ...@@ -2016,7 +2016,7 @@ func (tools gccgoToolchain) ld(b *builder, p *Package, out string, allactions []
if objc { if objc {
ldflags = append(ldflags, "-lobjc") 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 { func (gccgoToolchain) cc(b *builder, p *Package, objdir, ofile, cfile string) error {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment