]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: diagnose un-bootstrapped runtime
authorRuss Cox <rsc@golang.org>
Fri, 18 Jan 2013 21:24:00 +0000 (16:24 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 18 Jan 2013 21:24:00 +0000 (16:24 -0500)
Fixes #4665.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7132057

src/cmd/go/build.go

index 776aa5e0df3f0467082ead760a2229f8984544d0..4591225ef492477c78a0b9b55d2500f88d6fdf27 100644 (file)
@@ -649,6 +649,16 @@ func (b *builder) do(root *action) {
        wg.Wait()
 }
 
+// hasString reports whether s appears in the list of strings.
+func hasString(strings []string, s string) bool {
+       for _, t := range strings {
+               if s == t {
+                       return true
+               }
+       }
+       return false
+}
+
 // build is the action for building a single package or command.
 func (b *builder) build(a *action) (err error) {
        defer func() {
@@ -669,6 +679,11 @@ func (b *builder) build(a *action) (err error) {
                fmt.Fprintf(os.Stderr, "%s\n", a.p.ImportPath)
        }
 
+       if a.p.Standard && a.p.ImportPath == "runtime" && buildContext.Compiler == "gc" &&
+               !hasString(a.p.HFiles, "zasm_"+buildContext.GOOS+"_"+buildContext.GOARCH+".h") {
+               return fmt.Errorf("%s/%s must be bootstrapped using make.bash", buildContext.GOOS, buildContext.GOARCH)
+       }
+
        // Make build directory.
        obj := a.objdir
        if err := b.mkdir(obj); err != nil {