encoding/base64: add unpadded encodings (https://golang.org/cl/1511)
log: add SetOutput functions (https://golang.org/cl/2686, https://golang.org/cl/3023)
net/http: support for setting trailers from a server Handler (https://golang.org/cl/2157)
+ net/http/cgi: fix REMOTE_ADDR, REMOTE_HOST, add REMOTE_PORT (https://golang.org/cl/4933)
net/smtp: add TLSConnectionState accessor (https://golang.org/cl/2151)
+ os/signal: add Ignore and Reset (https://golang.org/cl/3580)
runtime, syscall: use SYSCALL instruction on FreeBSD (Go 1.5 now requires FreeBSD 8-STABLE+) (https://golang.org/cl/3020)
strings: add Compare(x, y string) int, for symmetry with bytes.Compare (https://golang.org/cl/2828)
testing/quick: support generation of arrays (https://golang.org/cl/3865)
math/big: faster assembly kernels for amd64 and 386 (https://golang.org/cl/2503, https://golang.org/cl/2560)
math/big: faster "pure Go" kernels for platforms w/o assembly kernels (https://golang.org/cl/2480)
+Assembler:
+
+ARM assembly syntax has had some features removed.
+
+ - mentioning SP or PC as a hardware register
+ These are always pseudo-registers except that in some contexts
+ they're not, and it's confusing because the context should not affect
+ which register you mean. Change the references to the hardware
+ registers to be explicit: R13 for SP, R15 for PC.
+ - constant creation using assignment
+ The files say a=b when they could instead say #define a b.
+ There is no reason to have both mechanisms.
+ - R(0) to refer to R0.
+ Some macros use this to a great extent. Again, it's easy just to
+ use a #define to rename a register.
+
+Also expression evaluation now uses uint64s instead of signed integers and the
+precedence of operators is now Go-like rather than C-like.
oldgoarch string
oldgochar string
slash string
+ exe string
defaultcc string
defaultcflags string
defaultldflags string
return chomp(readfile(path))
}
+ // Show a nicer error message if this isn't a Git repo.
+ if !isGitRepo() {
+ fatal("FAILED: not a Git repo; must put a VERSION file in $GOROOT")
+ }
+
// Otherwise, use Git.
// What is the current branch?
branch := chomp(run(goroot, CheckExit, "git", "rev-parse", "--abbrev-ref", "HEAD"))
return tag
}
+ // isGitRepo reports whether the working directory is inside a Git repository.
+ func isGitRepo() bool {
+ p := ".git"
+ for {
+ fi, err := os.Stat(p)
+ if os.IsNotExist(err) {
+ p = filepath.Join("..", p)
+ continue
+ }
+ if err != nil || !fi.IsDir() {
+ return false
+ }
+ return true
+ }
+ }
+
/*
* Initial tree setup.
*/
// not be in release branches.
var unreleased = []string{
"src/cmd/link",
+ "src/cmd/objwriter",
"src/debug/goobj",
"src/old",
}
ldargs = splitfields(defaultldflags)
}
- islib := strings.HasPrefix(dir, "lib") || dir == "cmd/gc" || dir == "cmd/ld"
- ispkg := !islib && !strings.HasPrefix(dir, "cmd/")
- isgo := ispkg || dir == "cmd/go" || dir == "cmd/cgo"
+ isgo := true
+ ispkg := !strings.HasPrefix(dir, "cmd/") || strings.HasPrefix(dir, "cmd/internal/") || strings.HasPrefix(dir, "cmd/asm/internal/")
+ islib := false
- exe := ""
- if gohostos == "windows" {
- exe = ".exe"
+ // Legacy C exceptions.
+ switch dir {
+ case "lib9", "libbio", "liblink", "cmd/gc", "cmd/ld":
+ islib = true
+ isgo = false
+ case "cmd/5a", "cmd/5g", "cmd/5l",
+ "cmd/6a", "cmd/6g", "cmd/6l",
+ "cmd/8a", "cmd/8g", "cmd/8l",
+ "cmd/9a", "cmd/9g", "cmd/9l":
+ isgo = false
}
// Start final link command line.
compile = append(compile,
"-D", fmt.Sprintf("GOOS=%q", goos),
"-D", fmt.Sprintf("GOARCH=%q", goarch),
+ "-D", fmt.Sprintf("GOHOSTOS=%q", gohostos),
+ "-D", fmt.Sprintf("GOHOSTARCH=%q", gohostarch),
"-D", fmt.Sprintf("GOROOT=%q", goroot_final),
"-D", fmt.Sprintf("GOVERSION=%q", findgoversion()),
"-D", fmt.Sprintf("GOARM=%q", goarm),
}
// buildorder records the order of builds for the 'go bootstrap' command.
+// The Go packages and commands must be in dependency order,
+// maintained by hand, but the order doesn't change often.
var buildorder = []string{
+ // Legacy C programs.
"lib9",
"libbio",
"liblink",
"cmd/%sa",
"cmd/%sg",
- // The dependency order here was copied from a buildscript
- // back when there were build scripts. Will have to
- // be maintained by hand, but shouldn't change very
- // often.
+ // Go libraries and programs for bootstrap.
"runtime",
"errors",
"sync/atomic",
"reflect",
"fmt",
"encoding",
+ "encoding/binary",
"encoding/json",
"flag",
"path/filepath",
"text/template",
"go/doc",
"go/build",
+ "cmd/internal/obj",
+ "cmd/internal/obj/arm",
+ "cmd/internal/obj/i386",
+ "cmd/internal/obj/ppc64",
+ "cmd/internal/obj/x86",
+ "cmd/objwriter",
"cmd/go",
}
setup()
+ bootstrapBuildTools()
+
// For the main bootstrap, building for host os/arch.
oldgoos = goos
oldgoarch = goarch
os.Setenv("GOARCH", goarch)
os.Setenv("GOOS", goos)
+ // TODO(rsc): Enable when appropriate.
+ // This step is only needed if we believe that the Go compiler built from Go 1.4
+ // will produce different object files than the Go compiler built from itself.
+ // In the absence of bugs, that should not happen.
+ // And if there are bugs, they're more likely in the current development tree
+ // than in a standard release like Go 1.4, so don't do this rebuild by default.
+ if false {
+ xprintf("##### Building Go toolchain using itself.\n")
+ for _, pattern := range buildorder {
+ if pattern == "cmd/go" {
+ break
+ }
+ dir := pattern
+ if strings.Contains(pattern, "%s") {
+ dir = fmt.Sprintf(pattern, gohostchar)
+ }
+ install(dir)
+ if oldgochar != gohostchar && strings.Contains(pattern, "%s") {
+ install(fmt.Sprintf(pattern, oldgochar))
+ }
+ }
+ xprintf("\n")
+ }
+
+ xprintf("##### Building compilers and go_bootstrap for host, %s/%s.\n", gohostos, gohostarch)
for _, pattern := range buildorder {
dir := pattern
if strings.Contains(pattern, "%s") {
xcmd := exec.Command(cmd[0], cmd[1:]...)
xcmd.Dir = dir
+ var data []byte
var err error
- data, err := xcmd.CombinedOutput()
+
+ // If we want to show command output and this is not
+ // a background command, assume it's the only thing
+ // running, so we can just let it write directly stdout/stderr
+ // as it runs without fear of mixing the output with some
+ // other command's output. Not buffering lets the output
+ // appear as it is printed instead of once the command exits.
+ // This is most important for the invocation of 'go1.4 build -v bootstrap/...'.
+ if mode&(Background|ShowOutput) == ShowOutput {
+ xcmd.Stdout = os.Stdout
+ xcmd.Stderr = os.Stderr
+ err = xcmd.Run()
+ } else {
+ data, err = xcmd.CombinedOutput()
+ }
if err != nil && mode&CheckExit != 0 {
outputLock.Lock()
if len(data) > 0 {
os.RemoveAll(p)
}
-// xreaddir replaces dst with a list of the names of the files in dir.
+// xreaddir replaces dst with a list of the names of the files and subdirectories in dir.
// The names are relative to dir; they are not full paths.
func xreaddir(dir string) []string {
f, err := os.Open(dir)
return names
}
+// xreaddir replaces dst with a list of the names of the files in dir.
+// The names are relative to dir; they are not full paths.
+func xreaddirfiles(dir string) []string {
+ f, err := os.Open(dir)
+ if err != nil {
+ fatal("%v", err)
+ }
+ defer f.Close()
+ infos, err := f.Readdir(-1)
+ if err != nil {
+ fatal("reading %s: %v", dir, err)
+ }
+ var names []string
+ for _, fi := range infos {
+ if !fi.IsDir() {
+ names = append(names, fi.Name())
+ }
+ }
+ return names
+}
+
// xworkdir creates a new temporary directory to hold object files
// and returns the name of that directory.
func xworkdir() string {
if gohostarch == "" {
fatal("$objtype is unset")
}
+ case "windows":
+ exe = ".exe"
}
sysinit()
if gohostarch == "" {
// Default Unix system.
- out := run("", CheckExit, "uname", "-m", "-v")
+ out := run("", CheckExit, "uname", "-m")
switch {
case strings.Contains(out, "x86_64"), strings.Contains(out, "amd64"):
gohostarch = "amd64"
case strings.Contains(out, "ppc64"):
gohostarch = "ppc64"
case gohostos == "darwin":
- if strings.Contains(out, "RELEASE_ARM_") {
+ if strings.Contains(run("", CheckExit, "uname", "-v"), "RELEASE_ARM_") {
gohostarch = "arm"
}
default: