build: require old Go to build new Go (and convert cmd/dist to Go)

This CL introduces the bootstrap requirement that in order to
build the current release (or development version) of Go, you
need an older Go release (1.4 or newer) already installed.
This requirement is the whole point of this CL.

To enforce the requirement, convert cmd/dist from C to Go.

With this bootstrapping out of the way, we can move on to
replacing other, larger C programs like the Go compiler,
the assemblers, and the linker.

See golang.org/s/go15bootstrap for details.

Change-Id: I53fd08ddacf3df9fae94fe2c986dba427ee4a21d
Reviewed-on: https://go-review.googlesource.com/2470
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
Russ Cox 2015-01-07 11:38:00 -05:00
parent ad6ee36cac
commit 20a10e7ddd
16 changed files with 1591 additions and 2253 deletions

56
src/cmd/dist/README vendored
View File

@ -1,45 +1,27 @@
This program, dist, is the bootstrapping tool for the Go distribution. This program, dist, is the bootstrapping tool for the Go distribution.
It takes care of building the C programs (like the Go compiler) and
the initial bootstrap copy of the go tool. It also serves as a catch-all
to replace odd jobs previously done with shell scripts.
Dist is itself written in very simple C. All interaction with C libraries, As of Go 1.5, dist and other parts of the compiler toolchain are written
even standard C libraries, is confined to a single system-specific file in Go, making bootstrapping a little more involved than in the past.
(plan9.c, unix.c, windows.c), to aid portability. Functionality needed The approach is to build the current release of Go with an earlier one.
by other files should be exposed via the portability layer. Functions
in the portability layer begin with an x prefix when they would otherwise
use the same name as or be confused for an existing function.
For example, xprintf is the portable printf.
By far the most common data types in dist are strings and arrays of The process to install Go 1.x, for x ≥ 5, is:
strings. Instead of using char* and char**, though, dist uses two named
data structures, Buf and Vec, which own all the data they point at.
The Buf operations are functions beginning with b; the Vec operations
are functions beginning with v. The basic form of any function declaring
Bufs or Vecs on the stack should be
void 1. Build cmd/dist with Go 1.4.
myfunc(void) 2. Using dist, build Go 1.x compiler toolchain with Go 1.4.
{ 3. Using dist, rebuild Go 1.x compiler toolchain with itself.
Buf b1, b2; 4. Using dist, build Go 1.x cmd/go (as go_bootstrap) with Go 1.x compiler toolchain.
Vec v1; 5. Using go_bootstrap, build the remaining Go 1.x standard library and commands.
binit(&b1); NOTE: During the transition from the old C-based toolchain to the Go-based one,
binit(&b2); step 2 also builds the parts of the toolchain written in C, and step 3 does not
vinit(&v1); recompile those.
... main code ... Because of backward compatibility, although the steps above say Go 1.4,
bprintf(&b1, "hello, world"); in practice any release ≥ Go 1.4 but < Go 1.x will work as the bootstrap base.
vadd(&v1, bstr(&b1)); // v1 takes a copy of its argument
bprintf(&b2, "another string");
vadd(&v1, bstr(&b2)); // v1 now has two strings
bfree(&b1); See golang.org/s/go15bootstrap for more details.
bfree(&b2);
vfree(&v1);
}
The binit/vinit calls prepare a buffer or vector for use, initializing the
data structures, and the bfree/vfree calls free any memory they are still
holding onto. Use of this idiom gives us lexically scoped allocations.
Compared to Go 1.4 and earlier, dist will also take over much of what used to
be done by make.bash/make.bat/make.rc and all of what used to be done by
run.bash/run.bat/run.rc, because it is nicer to implement that logic in Go
than in three different scripting languages simultaneously.

1994
src/cmd/dist/build.go vendored

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,14 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "a.h" package main
import (
"bytes"
"fmt"
"strconv"
"strings"
)
/* /*
* Helpers for building cmd/gc. * Helpers for building cmd/gc.
@ -12,207 +19,152 @@
// It finds the OXXX enum, pulls out all the constants // It finds the OXXX enum, pulls out all the constants
// from OXXX to OEND, and writes a table mapping // from OXXX to OEND, and writes a table mapping
// op to string. // op to string.
void func gcopnames(dir, file string) {
gcopnames(char *dir, char *file) var out bytes.Buffer
{ fmt.Fprintf(&out, "// auto generated by go tool dist\n")
char *p, *q; fmt.Fprintf(&out, "static char *opnames[] = {\n")
int i, j, end;
Buf in, b, out;
Vec lines, fields;
binit(&in); in := readfile(pathf("%s/go.h", dir))
binit(&b); lines := splitlines(in)
binit(&out); i := 0
vinit(&lines); for i < len(lines) && !strings.Contains(lines[i], "OXXX") {
vinit(&fields); i++
}
bwritestr(&out, bprintf(&b, "// auto generated by go tool dist\n")); for _, line := range lines[i:] {
bwritestr(&out, bprintf(&b, "static char *opnames[] = {\n")); if i := strings.Index(line, "//"); i >= 0 {
line = line[:i]
readfile(&in, bprintf(&b, "%s/go.h", dir)); }
splitlines(&lines, bstr(&in)); for _, field := range splitfields(line) {
i = 0; field = strings.TrimPrefix(field, "O")
while(i<lines.len && !contains(lines.p[i], "OXXX")) field = strings.TrimSuffix(field, ",")
i++; fmt.Fprintf(&out, "\t[O%s] = \"%s\",\n", field, field)
end = 0; }
for(; i<lines.len && !end; i++) { if strings.Contains(line, "OEND") {
p = xstrstr(lines.p[i], "//"); break
if(p != nil)
*p = '\0';
end = contains(lines.p[i], "OEND");
splitfields(&fields, lines.p[i]);
for(j=0; j<fields.len; j++) {
q = fields.p[j];
if(*q == 'O')
q++;
p = q+xstrlen(q)-1;
if(*p == ',')
*p = '\0';
bwritestr(&out, bprintf(&b, " [O%s] = \"%s\",\n", q, q));
} }
} }
fmt.Fprintf(&out, "};\n")
bwritestr(&out, bprintf(&b, "};\n")); writefile(out.String(), file, 0)
writefile(&out, file, 0);
bfree(&in);
bfree(&b);
bfree(&out);
vfree(&lines);
vfree(&fields);
}
static int
xatoi(char *s, char **end)
{
int val = 0;
for(; *s && *s >= '0' && *s <= '9'; ++s)
val = val * 10 + (*s - '0');
*end = s;
return val;
} }
// mkanames reads [5689].out.h and writes anames[5689].c // mkanames reads [5689].out.h and writes anames[5689].c
// The format is much the same as the Go opcodes above. // The format is much the same as the Go opcodes above.
// It also writes out cnames array for C_* constants and the dnames // It also writes out cnames array for C_* constants and the dnames
// array for D_* constants. // array for D_* constants.
void func mkanames(dir, file string) {
mkanames(char *dir, char *file) ch := file[len(file)-3]
{ targ := pathf("%s/../cmd/%cl/%c.out.h", dir, ch, ch)
int i, j, ch, n, unknown; in := readfile(targ)
Buf in, b, out, out2; lines := splitlines(in)
Vec lines;
char *p, *p2;
Vec dnames[128];
binit(&b);
binit(&in);
binit(&out);
binit(&out2);
vinit(&lines);
for(i=0; i<nelem(dnames); i++)
vinit(&dnames[i]);
ch = file[xstrlen(file)-3];
bprintf(&b, "%s/../cmd/%cl/%c.out.h", dir, ch, ch);
readfile(&in, bstr(&b));
splitlines(&lines, bstr(&in));
// Include link.h so that the extern declaration there is // Include link.h so that the extern declaration there is
// checked against the non-extern declaration we are generating. // checked against the non-extern declaration we are generating.
bwritestr(&out, bprintf(&b, "// auto generated by go tool dist\n")); var out bytes.Buffer
bwritestr(&out, bprintf(&b, "#include <u.h>\n")); fmt.Fprintf(&out, "// auto generated by go tool dist\n")
bwritestr(&out, bprintf(&b, "#include <libc.h>\n")); fmt.Fprintf(&out, "#include <u.h>\n")
bwritestr(&out, bprintf(&b, "#include <bio.h>\n")); fmt.Fprintf(&out, "#include <libc.h>\n")
bwritestr(&out, bprintf(&b, "#include <link.h>\n")); fmt.Fprintf(&out, "#include <bio.h>\n")
bwritestr(&out, bprintf(&b, "#include \"../cmd/%cl/%c.out.h\"\n", ch, ch)); fmt.Fprintf(&out, "#include <link.h>\n")
bwritestr(&out, bprintf(&b, "\n")); fmt.Fprintf(&out, "#include \"../cmd/%cl/%c.out.h\"\n", ch, ch)
fmt.Fprintf(&out, "\n")
bwritestr(&out, bprintf(&b, "char* anames%c[] = {\n", ch)); fmt.Fprintf(&out, "char* anames%c[] = {\n", ch)
for(i=0; i<lines.len; i++) { for _, line := range lines {
if(hasprefix(lines.p[i], "\tA")) { if strings.HasPrefix(line, "\tA") {
p = xstrstr(lines.p[i], ","); if i := strings.Index(line, ","); i >= 0 {
if(p) line = line[:i]
*p = '\0'; }
p = xstrstr(lines.p[i], "\n"); if i := strings.Index(line, "\n"); i >= 0 {
if(p) line = line[:i]
*p = '\0'; }
p = lines.p[i] + 2; line = line[2:]
bwritestr(&out, bprintf(&b, "\t\"%s\",\n", p)); fmt.Fprintf(&out, "\t\"%s\",\n", line)
} }
} }
bwritestr(&out, "};\n"); fmt.Fprintf(&out, "};\n")
j=0; j := 0
bprintf(&out2, "char* cnames%c[] = {\n", ch); var out2 bytes.Buffer
for(i=0; i<lines.len; i++) { fmt.Fprintf(&out2, "char* cnames%c[] = {\n", ch)
if(hasprefix(lines.p[i], "\tC_")) { for _, line := range lines {
p = xstrstr(lines.p[i], ","); if strings.HasPrefix(line, "\tC_") {
if(p) if i := strings.Index(line, ","); i >= 0 {
*p = '\0'; line = line[:i]
p = xstrstr(lines.p[i], "\n"); }
if(p) if i := strings.Index(line, "\n"); i >= 0 {
*p = '\0'; line = line[:i]
p = lines.p[i] + 3; }
bwritestr(&out2, bprintf(&b, "\t\"%s\",\n", p)); line = line[3:]
j++; fmt.Fprintf(&out2, "\t\"%s\",\n", line)
j++
} }
} }
bwritestr(&out2, "};\n"); fmt.Fprintf(&out2, "};\n")
if(j>0) if j > 0 {
bwriteb(&out, &out2); out.Write(out2.Bytes())
}
j=unknown=0; var dnames [128][]string
n=-1; j = 0
for(i=0; i<lines.len; i++) { unknown := false
if(hasprefix(lines.p[i], "\tD_")) { n := -1
p = xstrstr(lines.p[i], ","); for _, line := range lines {
if(p) if strings.HasPrefix(line, "\tD_") {
*p = '\0'; if i := strings.Index(line, ","); i >= 0 {
p = xstrstr(lines.p[i], "\n"); line = line[:i]
if(p) }
*p = '\0';
// Parse explicit value, if any // Parse explicit value, if any
p = xstrstr(lines.p[i], "="); if i := strings.Index(line, "="); i >= 0 {
if(p) { value := strings.TrimSpace(line[i+1:])
// Skip space after '=' line = strings.TrimSpace(line[:i])
p2 = p + 1; var err error
while(*p2 == ' ' || *p2 == '\t') n, err = strconv.Atoi(value)
p2++; if err != nil {
n = xatoi(p2, &p2);
// We can't do anything about // We can't do anything about
// non-numeric values or anything that // non-numeric values or anything that
// follows // follows.
while(*p2 == ' ' || *p2 == '\t') unknown = true
p2++; continue
if(*p2 != 0) {
unknown = 1;
continue;
} }
// Truncate space before '=' unknown = false
while(*(p-1) == ' ' || *(p-1) == '\t')
p--;
*p = '\0';
unknown = 0;
} else { } else {
n++; n++
} }
if(unknown || n >= nelem(dnames)) if unknown || n < 0 || n >= len(dnames) {
continue; continue
p = lines.p[i] + 3;
if(xstrcmp(p, "LAST") == 0)
continue;
vadd(&dnames[n], p);
j++;
}
}
if(j>0){
bwritestr(&out, bprintf(&b, "char* dnames%c[D_LAST] = {\n", ch));
for(i=0; i<nelem(dnames); i++) {
if(dnames[i].len == 0)
continue;
bwritestr(&out, bprintf(&b, "\t[D_%s] = \"", dnames[i].p[0]));
for(j=0; j<dnames[i].len; j++) {
if(j != 0)
bwritestr(&out, "/");
bwritestr(&out, dnames[i].p[j]);
}
bwritestr(&out, "\",\n");
}
bwritestr(&out, "};\n");
} }
writefile(&out, file, 0); line = strings.TrimSpace(line)
line = line[len("D_"):]
bfree(&b); if strings.Contains(line, "LAST") {
bfree(&in); continue
bfree(&out); }
bfree(&out2); dnames[n] = append(dnames[n], line)
vfree(&lines); j++
for(i=0; i<nelem(dnames); i++) }
vfree(&dnames[i]); }
if j > 0 {
fmt.Fprintf(&out, "char* dnames%c[D_LAST] = {\n", ch)
for _, d := range dnames {
if len(d) == 0 {
continue
}
fmt.Fprintf(&out, "\t[D_%s] = \"", d[0])
for k, name := range d {
if k > 0 {
fmt.Fprintf(&out, "/")
}
fmt.Fprintf(&out, "%s", name)
}
fmt.Fprintf(&out, "\",\n")
}
fmt.Fprintf(&out, "};\n")
}
writefile(out.String(), file, 0)
} }

View File

@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "a.h" package main
import "fmt"
/* /*
* Helpers for building cmd/go and cmd/cgo. * Helpers for building cmd/go and cmd/cgo.
@ -15,35 +17,23 @@
// const defaultCXX = <defaultcxx> // const defaultCXX = <defaultcxx>
// //
// It is invoked to write cmd/go/zdefaultcc.go // It is invoked to write cmd/go/zdefaultcc.go
// but we also write cmd/cgo/zdefaultcc.go. // but we also write cmd/cgo/zdefaultcc.go
void func mkzdefaultcc(dir, file string) {
mkzdefaultcc(char *dir, char *file) var out string
{
Buf b, out;
USED(dir); out = fmt.Sprintf(
"// auto generated by go tool dist\n"+
binit(&out); "\n"+
bprintf(&out, "package main\n"+
"// auto generated by go tool dist\n" "\n"+
"\n" "const defaultCC = `%s`\n"+
"package main\n"
"\n"
"const defaultCC = `%s`\n"
"const defaultCXX = `%s`\n", "const defaultCXX = `%s`\n",
defaultcctarget, defaultcxxtarget); defaultcctarget, defaultcxxtarget)
writefile(&out, file, 0); writefile(out, file, 0)
// Convert file name to replace. // Convert file name to replace: turn go into cgo.
binit(&b); i := len(file) - len("go/zdefaultcc.go")
bwritestr(&b, file); file = file[:i] + "c" + file[i:]
if(slash[0] == '/') writefile(out, file, 0)
bsubst(&b, "/go/zdefaultcc.go", "/cgo/zdefaultcc.go");
else
bsubst(&b, "\\go\\zdefaultcc.go", "\\cgo\\zdefaultcc.go");
writefile(&out, bstr(&b), 0);
bfree(&b);
bfree(&out);
} }

View File

@ -2,7 +2,12 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "a.h" package main
import (
"fmt"
"os"
)
/* /*
* Helpers for building runtime. * Helpers for building runtime.
@ -14,55 +19,28 @@
// const defaultGoroot = <goroot> // const defaultGoroot = <goroot>
// const theVersion = <version> // const theVersion = <version>
// //
void func mkzversion(dir, file string) {
mkzversion(char *dir, char *file) out := fmt.Sprintf(
{ "// auto generated by go tool dist\n"+
Buf b, out; "\n"+
"package runtime\n"+
"\n"+
"const defaultGoroot = `%s`\n"+
"const theVersion = `%s`\n"+
"var buildVersion = theVersion\n", goroot_final, goversion)
USED(dir); writefile(out, file, 0)
binit(&b);
binit(&out);
bwritestr(&out, bprintf(&b,
"// auto generated by go tool dist\n"
"\n"
"package runtime\n"
"\n"
"const defaultGoroot = `%s`\n"
"const theVersion = `%s`\n"
"var buildVersion = theVersion\n", goroot_final, goversion));
writefile(&out, file, 0);
bfree(&b);
bfree(&out);
} }
// mkzexperiment writes zaexperiment.h (sic): // mkzexperiment writes zaexperiment.h (sic):
// //
// #define GOEXPERIMENT "experiment string" // #define GOEXPERIMENT "experiment string"
// //
void func mkzexperiment(dir, file string) {
mkzexperiment(char *dir, char *file) out := fmt.Sprintf(
{ "// auto generated by go tool dist\n"+
Buf b, out, exp; "\n"+
"#define GOEXPERIMENT \"%s\"\n", os.Getenv("GOEXPERIMENT"))
USED(dir); writefile(out, file, 0)
binit(&b);
binit(&out);
binit(&exp);
xgetenv(&exp, "GOEXPERIMENT");
bwritestr(&out, bprintf(&b,
"// auto generated by go tool dist\n"
"\n"
"#define GOEXPERIMENT \"%s\"\n", bstr(&exp)));
writefile(&out, file, 0);
bfree(&b);
bfree(&out);
bfree(&exp);
} }

14
src/cmd/dist/cpuid_386.s vendored Normal file
View File

@ -0,0 +1,14 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
TEXT ·cpuid(SB),$0-8
MOVL ax+4(FP), AX
CPUID
MOVL info+0(FP), DI
MOVL AX, 0(DI)
MOVL BX, 4(DI)
MOVL CX, 8(DI)
MOVL DX, 12(DI)
RET

14
src/cmd/dist/cpuid_amd64.s vendored Normal file
View File

@ -0,0 +1,14 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
TEXT ·cpuid(SB),$0-12
MOVL ax+8(FP), AX
CPUID
MOVQ info+0(FP), DI
MOVL AX, 0(DI)
MOVL BX, 4(DI)
MOVL CX, 8(DI)
MOVL DX, 12(DI)
RET

10
src/cmd/dist/cpuid_default.s vendored Normal file
View File

@ -0,0 +1,10 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !386,!amd64
#include "textflag.h"
TEXT ·cpuid(SB),NOSPLIT,$0-0
RET

89
src/cmd/dist/main.go vendored
View File

@ -2,41 +2,84 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "a.h" package main
int vflag; import (
int sflag; "flag"
char *argv0; "fmt"
"os"
"strconv"
)
// cmdtab records the available commands. // cmdtab records the available commands.
static struct { var cmdtab = []struct {
char *name; name string
void (*f)(int, char**); f func()
} cmdtab[] = { }{
{"banner", cmdbanner}, {"banner", cmdbanner},
{"bootstrap", cmdbootstrap}, {"bootstrap", cmdbootstrap},
{"clean", cmdclean}, {"clean", cmdclean},
{"env", cmdenv}, {"env", cmdenv},
{"install", cmdinstall}, {"install", cmdinstall},
{"version", cmdversion}, {"version", cmdversion},
}; }
// The OS-specific main calls into the portable code here. // The OS-specific main calls into the portable code here.
void func xmain() {
xmain(int argc, char **argv) if len(os.Args) < 2 {
{ usage()
int i; }
cmd := os.Args[1]
if(argc <= 1) os.Args = os.Args[1:] // for flag parsing during cmd
usage(); for _, ct := range cmdtab {
if ct.name == cmd {
for(i=0; i<nelem(cmdtab); i++) { flag.Usage = func() {
if(streq(cmdtab[i].name, argv[1])) { fmt.Fprintf(os.Stderr, "usage: go tool dist %s [options]\n", cmd)
cmdtab[i].f(argc-1, argv+1); flag.PrintDefaults()
return; os.Exit(2)
}
ct.f()
return
} }
} }
xprintf("unknown command %s\n", argv[1]); xprintf("unknown command %s\n", cmd)
usage(); usage()
}
func xflagparse(maxargs int) {
flag.Var((*count)(&vflag), "v", "verbosity")
flag.Parse()
if maxargs >= 0 && flag.NArg() > maxargs {
flag.Usage()
}
}
// count is a flag.Value that is like a flag.Bool and a flag.Int.
// If used as -name, it increments the count, but -name=x sets the count.
// Used for verbose flag -v.
type count int
func (c *count) String() string {
return fmt.Sprint(int(*c))
}
func (c *count) Set(s string) error {
switch s {
case "true":
*c++
case "false":
*c = 0
default:
n, err := strconv.Atoi(s)
if err != nil {
return fmt.Errorf("invalid count %q", s)
}
*c = count(n)
}
return nil
}
func (c *count) IsBoolFlag() bool {
return true
} }

10
src/cmd/dist/sys_default.go vendored Normal file
View File

@ -0,0 +1,10 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !windows,!plan9
package main
func sysinit() {
}

49
src/cmd/dist/sys_windows.go vendored Normal file
View File

@ -0,0 +1,49 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"syscall"
"unsafe"
)
var (
modkernel32 = syscall.NewLazyDLL("kernel32.dll")
procGetSystemInfo = syscall.NewProc("GetSystemInfo")
)
// see http://msdn.microsoft.com/en-us/library/windows/desktop/ms724958(v=vs.85).aspx
type systeminfo struct {
wProcessorArchitecture uint16
wReserved uint16
dwPageSize uint32
lpMinimumApplicationAddress uintptr
lpMaximumApplicationAddress uintptr
dwActiveProcessorMask uintptr
dwNumberOfProcessors uint32
dwProcessorType uint32
dwAllocationGranularity uint32
wProcessorLevel uint16
wProcessorRevision uint16
}
const (
PROCESSOR_ARCHITECTURE_AMD64 = 9
PROCESSOR_ARCHITECTURE_INTEL = 0
)
var sysinfo systeminfo
func sysinit() {
syscall.Syscall(procGetSystemInfo.Addr(), 1, uintptr(unsafe.Pointer(&sysinfo)), 0, 0)
switch sysinfo.wProcessorArchitecture {
case PROCESSOR_ARCHITECTURE_AMD64:
gohostarch = "amd64"
case PROCESSOR_ARCHITECTURE_INTEL:
gohostarch = "386"
default:
fatal("unknown processor architecture")
}
}

1072
src/cmd/dist/util.go vendored

File diff suppressed because it is too large Load Diff

15
src/cmd/dist/vfp_arm.s vendored Normal file
View File

@ -0,0 +1,15 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "textflag.h"
// try to run "vmov.f64 d0, d0" instruction
TEXT useVFPv1(SB),NOSPLIT,$0
VMOV.F64 D0, D0
RET
// try to run VFPv3-only "vmov.f64 d0, #112" instruction
TEXT useVFPv3(SB),NOSPLIT,$0
VMOV.F64 $112, D0
RET

14
src/cmd/dist/vfp_default.s vendored Normal file
View File

@ -0,0 +1,14 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !arm
#include "textflag.h"
TEXT ·useVFPv1(SB),NOSPLIT,$0
RET
TEXT ·useVFPv3(SB),NOSPLIT,$0
RET

View File

@ -3,6 +3,8 @@
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
# See golang.org/s/go15bootstrap for an overview of the build process.
# Environment variables that control make.bash: # Environment variables that control make.bash:
# #
# GOROOT_FINAL: The expected final Go root, baked into binaries. # GOROOT_FINAL: The expected final Go root, baked into binaries.
@ -110,26 +112,16 @@ rm -f ./runtime/runtime_defs.go
# Finally! Run the build. # Finally! Run the build.
echo '##### Building C bootstrap tool.' echo '##### Building Go bootstrap tool.'
echo cmd/dist echo cmd/dist
export GOROOT="$(cd .. && pwd)" export GOROOT="$(cd .. && pwd)"
GOROOT_FINAL="${GOROOT_FINAL:-$GOROOT}" GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:-$HOME/go1.4}
DEFGOROOT='-DGOROOT_FINAL="'"$GOROOT_FINAL"'"' if [ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/go." >&2
mflag="" echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2
case "$GOHOSTARCH" in
386) mflag=-m32;;
amd64) mflag=-m64;;
esac
if [ "$(uname)" == "Darwin" ]; then
# golang.org/issue/5261
mflag="$mflag -mmacosx-version-min=10.6"
fi fi
# if gcc does not exist and $CC is not set, try clang if available. rm -f cmd/dist/dist
if [ -z "$CC" -a -z "$(type -t gcc)" -a -n "$(type -t clang)" ]; then GOROOT="$GOROOT_BOOTSTRAP" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
export CC=clang CXX=clang++
fi
${CC:-gcc} $mflag -O2 -Wall -Werror -o cmd/dist/dist -Icmd/dist "$DEFGOROOT" cmd/dist/*.c
# -e doesn't propagate out of eval, so check success by hand. # -e doesn't propagate out of eval, so check success by hand.
eval $(./cmd/dist/dist env -p || echo FAIL=true) eval $(./cmd/dist/dist env -p || echo FAIL=true)

View File

@ -1,41 +0,0 @@
#!/usr/bin/env bash
# Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
set -e
case "`uname`" in
Darwin)
;;
*)
exit 0
esac
# Check that the go command exists
if ! go help >/dev/null 2>&1; then
echo "The go command is not in your PATH." >&2
exit 2
fi
eval $(go env)
if ! [ -x $GOTOOLDIR/prof ]; then
echo "You don't need to run sudo.bash." >&2
exit 2
fi
if [[ ! -d /usr/local/bin ]]; then
echo 1>&2 'sudo.bash: problem with /usr/local/bin; cannot install tools.'
exit 2
fi
cd $(dirname $0)
for i in prof
do
# Remove old binaries if present
sudo rm -f /usr/local/bin/6$i
# Install new binaries
sudo cp $GOTOOLDIR/$i /usr/local/bin/go$i
sudo chgrp procmod /usr/local/bin/go$i
sudo chmod g+s /usr/local/bin/go$i
done