diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
index dca5464e5605d8a68df141fe35500f753b439332..39f016e3157b182b21e8ad93fd5f8de2cf0b4565 100644
--- a/src/cmd/dist/build.go
+++ b/src/cmd/dist/build.go
@@ -1359,7 +1359,7 @@ func cmdbootstrap() {
 	}
 
 	// To recap, so far we have built the new toolchain
-	// (cmd/asm, cmd/compile, cmd/link)
+	// (cmd/asm, cmd/cgo, cmd/compile, cmd/link)
 	// using Go 1.4's toolchain and go command.
 	// Then we built the new go command (as go_bootstrap)
 	// using the new toolchain and our own build logic (above).
diff --git a/src/cmd/dist/buildtool.go b/src/cmd/dist/buildtool.go
index 8d1c914f304d634dff930feebff48f42e20331a5..320c62f8505aa8bfaa68bb1d7bf81ac5c3d89207 100644
--- a/src/cmd/dist/buildtool.go
+++ b/src/cmd/dist/buildtool.go
@@ -33,6 +33,7 @@ import (
 var bootstrapDirs = []string{
 	"cmd/asm",
 	"cmd/asm/internal/...",
+	"cmd/cgo",
 	"cmd/compile",
 	"cmd/compile/internal/...",
 	"cmd/internal/archive",
@@ -101,7 +102,6 @@ func bootstrapBuildTools() {
 
 	mkbuildcfg(pathf("%s/src/internal/buildcfg/zbootstrap.go", goroot))
 	mkobjabi(pathf("%s/src/cmd/internal/objabi/zbootstrap.go", goroot))
-	mkzdefaultcc("", pathf("%s/src/cmd/cgo/zdefaultcc.go", goroot))
 
 	// Use $GOROOT/pkg/bootstrap as the bootstrap workspace root.
 	// We use a subdirectory of $GOROOT/pkg because that's the
@@ -134,6 +134,12 @@ func bootstrapBuildTools() {
 				}
 
 				xmkdirall(dst)
+				if path == "cmd/cgo" {
+					// Write to src because we need the file both for bootstrap
+					// and for later in the main build.
+					mkzdefaultcc("", pathf("%s/zdefaultcc.go", src))
+					mkzdefaultcc("", pathf("%s/zdefaultcc.go", dst))
+				}
 				return nil
 			}