From d7172084d09b845a5decdbe97ee39f02cfe1cd03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Oudompheng?= Date: Tue, 31 Jan 2012 19:41:38 +0100 Subject: [PATCH] cmd/go: fix handling of gccgo standard library. The previous logic was mainly non-working. It only needs to ensure that the go tool doesn't try to build the standard library with gccgo. R=golang-dev, rsc CC=golang-dev, remy https://golang.org/cl/5580051 --- src/cmd/go/build.go | 6 ++++++ src/cmd/go/pkg.go | 8 -------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go index 1e27b3da0d6cb..b0e05b2c167cc 100644 --- a/src/cmd/go/build.go +++ b/src/cmd/go/build.go @@ -349,6 +349,12 @@ func (b *builder) action(mode buildMode, depMode buildMode, p *Package) *action // Fake packages - nothing to build. return a } + // gccgo standard library is "fake" too. + if _, ok := buildToolchain.(gccgoToolchain); ok { + // the target name is needed for cgo. + a.target = p.target + return a + } } if !p.Stale && !buildA && p.target != "" { diff --git a/src/cmd/go/pkg.go b/src/cmd/go/pkg.go index 2a32e2aea4fec..ad7d7c95ab198 100644 --- a/src/cmd/go/pkg.go +++ b/src/cmd/go/pkg.go @@ -295,14 +295,6 @@ func scanPackage(ctxt *build.Context, t *build.Tree, arg, importPath, dir string dir = filepath.Join(filepath.Dir(dir), "gccgo", filepath.Base(dir)) } p.target = buildToolchain.pkgpath(dir, p) - - // NB. Currently we have gccgo install the standard libraries - // in the "usual" location, where the Go toolchain puts them. - if p.Standard { - if _, ok := buildToolchain.(gccgoToolchain); ok { - p.target = goToolchain{}.pkgpath(dir, p) - } - } } var built time.Time