mirror of
https://github.com/golang/go
synced 2024-11-22 19:54:39 -07:00
[dev.cc] cmd/dist: write cmd/internal/obj/zbootstrap.go
cmd/internal/obj needs information about the default values of GOROOT, GOARM, GOEXPERIMENT, Version, and so on. It cannot ask package runtime, because during bootstrap package runtime comes from Go 1.4. So it must have its own copy. Change-Id: I73d3e75a3d47210b3184a51a810ebb44826b81e5 Reviewed-on: https://go-review.googlesource.com/3140 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
parent
be818361b9
commit
a8e5e803e6
1
.gitignore
vendored
1
.gitignore
vendored
@ -35,6 +35,7 @@ src/cmd/gc/mkbuiltin1
|
|||||||
src/cmd/gc/opnames.h
|
src/cmd/gc/opnames.h
|
||||||
src/cmd/gc/y.output
|
src/cmd/gc/y.output
|
||||||
src/cmd/go/zdefaultcc.go
|
src/cmd/go/zdefaultcc.go
|
||||||
|
src/cmd/internal/obj/zbootstrap.go
|
||||||
src/go/doc/headscan
|
src/go/doc/headscan
|
||||||
src/runtime/mkversion
|
src/runtime/mkversion
|
||||||
src/runtime/zaexperiment.h
|
src/runtime/zaexperiment.h
|
||||||
|
28
src/cmd/dist/buildruntime.go
vendored
28
src/cmd/dist/buildruntime.go
vendored
@ -45,3 +45,31 @@ func mkzexperiment(dir, file string) {
|
|||||||
|
|
||||||
writefile(out, file, 0)
|
writefile(out, file, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// mkzbootstrap writes cmd/internal/obj/zbootstrap.go:
|
||||||
|
//
|
||||||
|
// package obj
|
||||||
|
//
|
||||||
|
// const defaultGOROOT = <goroot>
|
||||||
|
// const defaultGOARM = <goarm>
|
||||||
|
// const defaultGOOS = <goos>
|
||||||
|
// const defaultGOARCH = <goarch>
|
||||||
|
// const version = <version>
|
||||||
|
// const goexperiment = <goexperiment>
|
||||||
|
//
|
||||||
|
func mkzbootstrap(file string) {
|
||||||
|
out := fmt.Sprintf(
|
||||||
|
"// auto generated by go tool dist\n"+
|
||||||
|
"\n"+
|
||||||
|
"package obj\n"+
|
||||||
|
"\n"+
|
||||||
|
"const defaultGOROOT = `%s`\n"+
|
||||||
|
"const defaultGOARM = `%s`\n"+
|
||||||
|
"const defaultGOOS = `%s`\n"+
|
||||||
|
"const defaultGOARCH = `%s`\n"+
|
||||||
|
"const version = `%s`\n"+
|
||||||
|
"const goexperiment = `%s`\n",
|
||||||
|
goroot_final, goarm, gohostos, gohostarch, goversion, os.Getenv("GOEXPERIMENT"))
|
||||||
|
|
||||||
|
writefile(out, file, 0)
|
||||||
|
}
|
||||||
|
2
src/cmd/dist/buildtool.go
vendored
2
src/cmd/dist/buildtool.go
vendored
@ -38,6 +38,8 @@ func bootstrapBuildTools() {
|
|||||||
}
|
}
|
||||||
xprintf("##### Building Go toolchain using %s.\n", goroot_bootstrap)
|
xprintf("##### Building Go toolchain using %s.\n", goroot_bootstrap)
|
||||||
|
|
||||||
|
mkzbootstrap(pathf("%s/src/cmd/internal/obj/zbootstrap.go", goroot))
|
||||||
|
|
||||||
// Use $GOROOT/pkg/bootstrap as the bootstrap workspace root.
|
// Use $GOROOT/pkg/bootstrap as the bootstrap workspace root.
|
||||||
// We use a subdirectory of $GOROOT/pkg because that's the
|
// We use a subdirectory of $GOROOT/pkg because that's the
|
||||||
// space within $GOROOT where we store all generated objects.
|
// space within $GOROOT where we store all generated objects.
|
||||||
|
Loading…
Reference in New Issue
Block a user