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":
++ 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", goversion),
+ "-D", fmt.Sprintf("GOVERSION=%q", findgoversion()),
"-D", fmt.Sprintf("GOARM=%q", goarm),
"-D", fmt.Sprintf("GO386=%q", go386),
"-D", fmt.Sprintf("GO_EXTLINK_ENABLED=%q", goextlinkenabled),
writefile(out, file, 0)
}
- goroot_final, goarm, gohostos, gohostarch, goversion, os.Getenv("GOEXPERIMENT"))
+
+// 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, findgoversion(), os.Getenv("GOEXPERIMENT"))
+
+ writefile(out, file, 0)
+}