Source file
src/cmd/dist/buildruntime.go
1
2
3
4
5 package main
6
7 import (
8 "bytes"
9 "fmt"
10 "os"
11 "strings"
12 )
13
14
17
18
19
20
21
22
23
24 func mkzversion(dir, file string) {
25 var buf bytes.Buffer
26 fmt.Fprintf(&buf, "// Code generated by go tool dist; DO NOT EDIT.\n")
27 fmt.Fprintln(&buf)
28 fmt.Fprintf(&buf, "package sys\n")
29 fmt.Fprintln(&buf)
30 fmt.Fprintf(&buf, "const StackGuardMultiplierDefault = %d\n", stackGuardMultiplierDefault())
31
32 writefile(buf.String(), file, writeSkipSame)
33 }
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 func mkbuildcfg(file string) {
55 var buf bytes.Buffer
56 fmt.Fprintf(&buf, "// Code generated by go tool dist; DO NOT EDIT.\n")
57 fmt.Fprintln(&buf)
58 fmt.Fprintf(&buf, "package buildcfg\n")
59 fmt.Fprintln(&buf)
60 fmt.Fprintf(&buf, "import \"runtime\"\n")
61 fmt.Fprintln(&buf)
62 fmt.Fprintf(&buf, "const defaultGO386 = `%s`\n", go386)
63 fmt.Fprintf(&buf, "const defaultGOAMD64 = `%s`\n", goamd64)
64 fmt.Fprintf(&buf, "const defaultGOARM = `%s`\n", goarm)
65 fmt.Fprintf(&buf, "const defaultGOMIPS = `%s`\n", gomips)
66 fmt.Fprintf(&buf, "const defaultGOMIPS64 = `%s`\n", gomips64)
67 fmt.Fprintf(&buf, "const defaultGOPPC64 = `%s`\n", goppc64)
68 fmt.Fprintf(&buf, "const defaultGOEXPERIMENT = `%s`\n", goexperiment)
69 fmt.Fprintf(&buf, "const defaultGO_EXTLINK_ENABLED = `%s`\n", goextlinkenabled)
70 fmt.Fprintf(&buf, "const defaultGO_LDSO = `%s`\n", defaultldso)
71 fmt.Fprintf(&buf, "const version = `%s`\n", findgoversion())
72 fmt.Fprintf(&buf, "const defaultGOOS = runtime.GOOS\n")
73 fmt.Fprintf(&buf, "const defaultGOARCH = runtime.GOARCH\n")
74
75 writefile(buf.String(), file, writeSkipSame)
76 }
77
78
79
80
81
82
83
84 func mkobjabi(file string) {
85 var buf bytes.Buffer
86 fmt.Fprintf(&buf, "// Code generated by go tool dist; DO NOT EDIT.\n")
87 fmt.Fprintln(&buf)
88 fmt.Fprintf(&buf, "package objabi\n")
89 fmt.Fprintln(&buf)
90 fmt.Fprintf(&buf, "const stackGuardMultiplierDefault = %d\n", stackGuardMultiplierDefault())
91
92 writefile(buf.String(), file, writeSkipSame)
93 }
94
95
96
97
98 func stackGuardMultiplierDefault() int {
99 for _, s := range strings.Split(os.Getenv("GO_GCFLAGS"), " ") {
100 if s == "-N" {
101 return 2
102 }
103 }
104 return 1
105 }
106
View as plain text