This patch to libgo changes the libgo version of the go tool to not require GOROOT. GOROOT is only required for the gc toolchain, and is not necessary for gccgo. This fixes running the gotools testsuite in a GCC build directory when using a --prefix for which you've never run `make install`. Bootstrapped and ran gotools testsuite on x86_64-pc-linux-gnu. Committed to mainline.
Ian
Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 249599) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -c49ba1ca392b3c23a4b3934e0a95a908b1dc2f1d +fc0cfdff94ca1099421900f43837ca5a70189cd6 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: libgo/go/cmd/go/main.go =================================================================== --- libgo/go/cmd/go/main.go (revision 249205) +++ libgo/go/cmd/go/main.go (working copy) @@ -155,8 +155,13 @@ func main() { } if fi, err := os.Stat(goroot); err != nil || !fi.IsDir() { - fmt.Fprintf(os.Stderr, "go: cannot find GOROOT directory: %v\n", goroot) - os.Exit(2) + // For gccgo this is fine, carry on. + // Note that this check is imperfect as we have not yet + // parsed the -compiler flag. + if runtime.Compiler != "gccgo" { + fmt.Fprintf(os.Stderr, "go: cannot find GOROOT directory: %v\n", goroot) + os.Exit(2) + } } // Set environment (GOOS, GOARCH, etc) explicitly.