aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/dist
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/dist')
-rw-r--r--src/cmd/dist/build.go60
-rw-r--r--src/cmd/dist/buildtool.go2
-rw-r--r--src/cmd/dist/cpuid_386.s16
-rw-r--r--src/cmd/dist/cpuid_amd64.s16
-rw-r--r--src/cmd/dist/cpuid_default.s10
-rw-r--r--src/cmd/dist/main.go9
-rw-r--r--src/cmd/dist/test.go70
-rw-r--r--src/cmd/dist/util_gc.go12
-rw-r--r--src/cmd/dist/util_gccgo.go13
9 files changed, 103 insertions, 105 deletions
diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
index 397b3bb88f..c8c3212d16 100644
--- a/src/cmd/dist/build.go
+++ b/src/cmd/dist/build.go
@@ -80,6 +80,7 @@ var okgoos = []string{
"darwin",
"dragonfly",
"illumos",
+ "ios",
"js",
"linux",
"android",
@@ -143,11 +144,7 @@ func xinit() {
b = os.Getenv("GO386")
if b == "" {
- if cansse2() {
- b = "sse2"
- } else {
- b = "387"
- }
+ b = "sse2"
}
go386 = b
@@ -835,6 +832,21 @@ func runInstall(pkg string, ch chan struct{}) {
asmArgs = append(asmArgs, "-D", "GOMIPS64_"+gomips64)
}
goasmh := pathf("%s/go_asm.h", workdir)
+ if IsRuntimePackagePath(pkg) {
+ asmArgs = append(asmArgs, "-compiling-runtime")
+ if os.Getenv("GOEXPERIMENT") == "regabi" {
+ // In order to make it easier to port runtime assembly
+ // to the register ABI, we introduce a macro
+ // indicating the experiment is enabled.
+ //
+ // Note: a similar change also appears in
+ // cmd/go/internal/work/gc.go.
+ //
+ // TODO(austin): Remove this once we commit to the
+ // register ABI (#40724).
+ asmArgs = append(asmArgs, "-D=GOEXPERIMENT_REGABI=1")
+ }
+ }
// Collect symabis from assembly code.
var symabis string
@@ -970,7 +982,10 @@ func matchtag(tag string) bool {
}
return !matchtag(tag[1:])
}
- return tag == "gc" || tag == goos || tag == goarch || tag == "cmd_go_bootstrap" || tag == "go1.1" || (goos == "android" && tag == "linux") || (goos == "illumos" && tag == "solaris")
+ return tag == "gc" || tag == goos || tag == goarch || tag == "cmd_go_bootstrap" || tag == "go1.1" ||
+ (goos == "android" && tag == "linux") ||
+ (goos == "illumos" && tag == "solaris") ||
+ (goos == "ios" && tag == "darwin")
}
// shouldbuild reports whether we should build this file.
@@ -984,7 +999,7 @@ func shouldbuild(file, pkg string) bool {
name := filepath.Base(file)
excluded := func(list []string, ok string) bool {
for _, x := range list {
- if x == ok || (ok == "android" && x == "linux") || (ok == "illumos" && x == "solaris") {
+ if x == ok || (ok == "android" && x == "linux") || (ok == "illumos" && x == "solaris") || (ok == "ios" && x == "darwin") {
continue
}
i := strings.Index(name, x)
@@ -1462,9 +1477,9 @@ func wrapperPathFor(goos, goarch string) string {
if gohostos != "android" {
return pathf("%s/misc/android/go_android_exec.go", goroot)
}
- case goos == "darwin" && goarch == "arm64":
- if gohostos != "darwin" || gohostarch != "arm64" {
- return pathf("%s/misc/ios/go_darwin_arm_exec.go", goroot)
+ case goos == "ios":
+ if gohostos != "ios" {
+ return pathf("%s/misc/ios/go_ios_exec.go", goroot)
}
}
return ""
@@ -1534,13 +1549,15 @@ var cgoEnabled = map[string]bool{
"linux/mipsle": true,
"linux/mips64": true,
"linux/mips64le": true,
- "linux/riscv64": false, // Issue 36641
+ "linux/riscv64": true,
"linux/s390x": true,
"linux/sparc64": true,
"android/386": true,
"android/amd64": true,
"android/arm": true,
"android/arm64": true,
+ "ios/arm64": true,
+ "ios/amd64": true,
"js/wasm": false,
"netbsd/386": true,
"netbsd/amd64": true,
@@ -1550,6 +1567,7 @@ var cgoEnabled = map[string]bool{
"openbsd/amd64": true,
"openbsd/arm": true,
"openbsd/arm64": true,
+ "openbsd/mips64": false,
"plan9/386": false,
"plan9/amd64": false,
"plan9/arm": false,
@@ -1732,3 +1750,23 @@ func cmdlist() {
fatalf("write failed: %v", err)
}
}
+
+// IsRuntimePackagePath examines 'pkgpath' and returns TRUE if it
+// belongs to the collection of "runtime-related" packages, including
+// "runtime" itself, "reflect", "syscall", and the
+// "runtime/internal/*" packages. See also the function of the same
+// name in cmd/internal/objabi/path.go.
+func IsRuntimePackagePath(pkgpath string) bool {
+ rval := false
+ switch pkgpath {
+ case "runtime":
+ rval = true
+ case "reflect":
+ rval = true
+ case "syscall":
+ rval = true
+ default:
+ rval = strings.HasPrefix(pkgpath, "runtime/internal")
+ }
+ return rval
+}
diff --git a/src/cmd/dist/buildtool.go b/src/cmd/dist/buildtool.go
index 79eab24d29..e7bedfb84e 100644
--- a/src/cmd/dist/buildtool.go
+++ b/src/cmd/dist/buildtool.go
@@ -53,6 +53,7 @@ var bootstrapDirs = []string{
"cmd/compile/internal/x86",
"cmd/compile/internal/wasm",
"cmd/internal/bio",
+ "cmd/internal/codesign",
"cmd/internal/gcprog",
"cmd/internal/dwarf",
"cmd/internal/edit",
@@ -67,6 +68,7 @@ var bootstrapDirs = []string{
"cmd/internal/obj/s390x",
"cmd/internal/obj/x86",
"cmd/internal/obj/wasm",
+ "cmd/internal/pkgpath",
"cmd/internal/src",
"cmd/internal/sys",
"cmd/link",
diff --git a/src/cmd/dist/cpuid_386.s b/src/cmd/dist/cpuid_386.s
deleted file mode 100644
index 65fbb2dcb7..0000000000
--- a/src/cmd/dist/cpuid_386.s
+++ /dev/null
@@ -1,16 +0,0 @@
-// 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 !gccgo
-
-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
-
diff --git a/src/cmd/dist/cpuid_amd64.s b/src/cmd/dist/cpuid_amd64.s
deleted file mode 100644
index ea0b9d4dc9..0000000000
--- a/src/cmd/dist/cpuid_amd64.s
+++ /dev/null
@@ -1,16 +0,0 @@
-// 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 !gccgo
-
-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
-
diff --git a/src/cmd/dist/cpuid_default.s b/src/cmd/dist/cpuid_default.s
deleted file mode 100644
index 6412a507a9..0000000000
--- a/src/cmd/dist/cpuid_default.s
+++ /dev/null
@@ -1,10 +0,0 @@
-// 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,!gccgo
-
-#include "textflag.h"
-
-TEXT ·cpuid(SB),NOSPLIT,$0-0
- RET
diff --git a/src/cmd/dist/main.go b/src/cmd/dist/main.go
index b8a8c5f2e6..37de1acc31 100644
--- a/src/cmd/dist/main.go
+++ b/src/cmd/dist/main.go
@@ -108,6 +108,9 @@ func main() {
gohostarch = "arm64"
case strings.Contains(out, "arm"):
gohostarch = "arm"
+ if gohostos == "netbsd" && strings.Contains(run("", CheckExit, "uname", "-p"), "aarch64") {
+ gohostarch = "arm64"
+ }
case strings.Contains(out, "ppc64le"):
gohostarch = "ppc64le"
case strings.Contains(out, "ppc64"):
@@ -126,10 +129,14 @@ func main() {
gohostarch = "riscv64"
case strings.Contains(out, "s390x"):
gohostarch = "s390x"
- case gohostos == "darwin":
+ case gohostos == "darwin", gohostos == "ios":
if strings.Contains(run("", CheckExit, "uname", "-v"), "RELEASE_ARM64_") {
gohostarch = "arm64"
}
+ case gohostos == "openbsd":
+ if strings.Contains(run("", CheckExit, "uname", "-p"), "mips64") {
+ gohostarch = "mips64"
+ }
default:
fatalf("unknown architecture: %s", out)
}
diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go
index 5ea5c81656..955ce2a063 100644
--- a/src/cmd/dist/test.go
+++ b/src/cmd/dist/test.go
@@ -217,6 +217,9 @@ func (t *tester) run() {
fmt.Println("\nFAILED")
xexit(1)
} else if incomplete[goos+"/"+goarch] {
+ // The test succeeded, but consider it as failed so we don't
+ // forget to remove the port from the incomplete map once the
+ // port is complete.
fmt.Println("\nFAILED (incomplete port)")
xexit(1)
} else if t.partial {
@@ -463,13 +466,14 @@ func (t *tester) registerTests() {
})
}
- // Test the ios build tag on darwin/amd64 for the iOS simulator.
- if goos == "darwin" && !t.iOS() {
+ // Test ios/amd64 for the iOS simulator.
+ if goos == "darwin" && goarch == "amd64" && t.cgoEnabled {
t.tests = append(t.tests, distTest{
name: "amd64ios",
- heading: "ios tag on darwin/amd64",
+ heading: "GOOS=ios on darwin/amd64",
fn: func(dt *distTest) error {
- t.addCmd(dt, "src", t.goTest(), t.timeout(300), "-tags=ios", "-run=SystemRoots", "crypto/x509")
+ cmd := t.addCmd(dt, "src", t.goTest(), t.timeout(300), "-run=SystemRoots", "crypto/x509")
+ cmd.Env = append(os.Environ(), "GOOS=ios", "CGO_ENABLED=1")
return nil
},
})
@@ -903,7 +907,7 @@ func (t *tester) addCmd(dt *distTest, dir string, cmdline ...interface{}) *exec.
}
func (t *tester) iOS() bool {
- return goos == "darwin" && goarch == "arm64"
+ return goos == "ios"
}
func (t *tester) out(v string) {
@@ -921,7 +925,7 @@ func (t *tester) extLink() bool {
"darwin-amd64", "darwin-arm64",
"dragonfly-amd64",
"freebsd-386", "freebsd-amd64", "freebsd-arm",
- "linux-386", "linux-amd64", "linux-arm", "linux-arm64", "linux-ppc64le", "linux-mips64", "linux-mips64le", "linux-mips", "linux-mipsle", "linux-s390x",
+ "linux-386", "linux-amd64", "linux-arm", "linux-arm64", "linux-ppc64le", "linux-mips64", "linux-mips64le", "linux-mips", "linux-mipsle", "linux-riscv64", "linux-s390x",
"netbsd-386", "netbsd-amd64",
"openbsd-386", "openbsd-amd64",
"windows-386", "windows-amd64":
@@ -943,13 +947,13 @@ func (t *tester) internalLink() bool {
if goos == "android" {
return false
}
- if t.iOS() {
+ if goos == "ios" {
return false
}
// Internally linking cgo is incomplete on some architectures.
// https://golang.org/issue/10373
// https://golang.org/issue/14449
- if goarch == "mips64" || goarch == "mips64le" || goarch == "mips" || goarch == "mipsle" {
+ if goarch == "mips64" || goarch == "mips64le" || goarch == "mips" || goarch == "mipsle" || goarch == "riscv64" {
return false
}
if goos == "aix" {
@@ -961,10 +965,10 @@ func (t *tester) internalLink() bool {
func (t *tester) internalLinkPIE() bool {
switch goos + "-" + goarch {
- case "linux-amd64", "linux-arm64",
- "android-arm64":
- return true
- case "windows-amd64", "windows-386", "windows-arm":
+ case "darwin-amd64", "darwin-arm64",
+ "linux-amd64", "linux-arm64",
+ "android-arm64",
+ "windows-amd64", "windows-386", "windows-arm":
return true
}
return false
@@ -979,7 +983,7 @@ func (t *tester) supportedBuildmode(mode string) bool {
}
switch pair {
case "aix-ppc64",
- "darwin-amd64", "darwin-arm64",
+ "darwin-amd64", "darwin-arm64", "ios-arm64",
"linux-amd64", "linux-386", "linux-ppc64le", "linux-s390x",
"freebsd-amd64",
"windows-amd64", "windows-386":
@@ -989,7 +993,7 @@ func (t *tester) supportedBuildmode(mode string) bool {
case "c-shared":
switch pair {
case "linux-386", "linux-amd64", "linux-arm", "linux-arm64", "linux-ppc64le", "linux-s390x",
- "darwin-amd64",
+ "darwin-amd64", "darwin-arm64",
"freebsd-amd64",
"android-arm", "android-arm64", "android-386",
"windows-amd64", "windows-386":
@@ -1008,7 +1012,7 @@ func (t *tester) supportedBuildmode(mode string) bool {
switch pair {
case "linux-386", "linux-amd64", "linux-arm", "linux-s390x", "linux-ppc64le":
return true
- case "darwin-amd64":
+ case "darwin-amd64", "darwin-arm64":
return true
case "freebsd-amd64":
return true
@@ -1017,10 +1021,10 @@ func (t *tester) supportedBuildmode(mode string) bool {
case "pie":
switch pair {
case "aix/ppc64",
- "linux-386", "linux-amd64", "linux-arm", "linux-arm64", "linux-ppc64le", "linux-s390x",
+ "linux-386", "linux-amd64", "linux-arm", "linux-arm64", "linux-ppc64le", "linux-riscv64", "linux-s390x",
"android-amd64", "android-arm", "android-arm64", "android-386":
return true
- case "darwin-amd64":
+ case "darwin-amd64", "darwin-arm64":
return true
case "windows-amd64", "windows-386", "windows-arm":
return true
@@ -1078,15 +1082,19 @@ func (t *tester) cgoTest(dt *distTest) error {
cmd := t.addCmd(dt, "misc/cgo/test", t.goTest())
cmd.Env = append(os.Environ(), "GOFLAGS=-ldflags=-linkmode=auto")
- if t.internalLink() {
+ // Skip internal linking cases on arm64 to support GCC-9.4 and above,
+ // only for linux, conservatively.
+ // See issue #39466.
+ skipInternalLink := goarch == "arm64" && goos == "linux"
+
+ if t.internalLink() && !skipInternalLink {
cmd := t.addCmd(dt, "misc/cgo/test", t.goTest(), "-tags=internal")
cmd.Env = append(os.Environ(), "GOFLAGS=-ldflags=-linkmode=internal")
}
pair := gohostos + "-" + goarch
switch pair {
- case "darwin-amd64",
- "openbsd-386", "openbsd-amd64",
+ case "darwin-amd64", "darwin-arm64",
"windows-386", "windows-amd64":
// test linkmode=external, but __thread not supported, so skip testtls.
if !t.extLink() {
@@ -1097,12 +1105,20 @@ func (t *tester) cgoTest(dt *distTest) error {
cmd = t.addCmd(dt, "misc/cgo/test", t.goTest(), "-ldflags", "-linkmode=external -s")
+ if t.supportedBuildmode("pie") {
+ t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie")
+ if t.internalLink() && t.internalLinkPIE() {
+ t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie", "-ldflags=-linkmode=internal", "-tags=internal,internal_pie")
+ }
+ }
+
case "aix-ppc64",
"android-arm", "android-arm64",
"dragonfly-amd64",
"freebsd-386", "freebsd-amd64", "freebsd-arm",
- "linux-386", "linux-amd64", "linux-arm", "linux-ppc64le", "linux-s390x",
- "netbsd-386", "netbsd-amd64", "linux-arm64":
+ "linux-386", "linux-amd64", "linux-arm", "linux-arm64", "linux-ppc64le", "linux-riscv64", "linux-s390x",
+ "netbsd-386", "netbsd-amd64",
+ "openbsd-386", "openbsd-amd64", "openbsd-arm", "openbsd-arm64", "openbsd-mips64":
cmd := t.addCmd(dt, "misc/cgo/test", t.goTest())
cmd.Env = append(os.Environ(), "GOFLAGS=-ldflags=-linkmode=external")
@@ -1147,8 +1163,8 @@ func (t *tester) cgoTest(dt *distTest) error {
if t.supportedBuildmode("pie") {
t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie")
- if t.internalLink() && t.internalLinkPIE() {
- t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie", "-ldflags=-linkmode=internal")
+ if t.internalLink() && t.internalLinkPIE() && !skipInternalLink {
+ t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie", "-ldflags=-linkmode=internal", "-tags=internal,internal_pie")
}
t.addCmd(dt, "misc/cgo/testtls", t.goTest(), "-buildmode=pie")
t.addCmd(dt, "misc/cgo/nocgo", t.goTest(), "-buildmode=pie")
@@ -1428,7 +1444,6 @@ func (t *tester) testDirTest(dt *distTest, shard, shards int) error {
// cgoPackages is the standard packages that use cgo.
var cgoPackages = []string{
- "crypto/x509",
"net",
"os/user",
}
@@ -1494,6 +1509,7 @@ func (t *tester) makeGOROOTUnwritable() (undo func()) {
}
gocacheSubdir, _ := filepath.Rel(dir, gocache)
+ // Note: Can't use WalkDir here, because this has to compile with Go 1.4.
filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
if suffix := strings.TrimPrefix(path, dir+string(filepath.Separator)); suffix != "" {
if suffix == gocacheSubdir {
@@ -1603,7 +1619,9 @@ func raceDetectorSupported(goos, goarch string) bool {
switch goos {
case "linux":
return goarch == "amd64" || goarch == "ppc64le" || goarch == "arm64"
- case "darwin", "freebsd", "netbsd", "windows":
+ case "darwin":
+ return goarch == "amd64" || goarch == "arm64"
+ case "freebsd", "netbsd", "windows":
return goarch == "amd64"
default:
return false
diff --git a/src/cmd/dist/util_gc.go b/src/cmd/dist/util_gc.go
index 698beef704..17a0e6fbb5 100644
--- a/src/cmd/dist/util_gc.go
+++ b/src/cmd/dist/util_gc.go
@@ -6,18 +6,6 @@
package main
-func cpuid(info *[4]uint32, ax uint32)
-
-func cansse2() bool {
- if gohostarch != "386" && gohostarch != "amd64" {
- return false
- }
-
- var info [4]uint32
- cpuid(&info, 1)
- return info[3]&(1<<26) != 0 // SSE2
-}
-
// useVFPv1 tries to execute one VFPv1 instruction on ARM.
// It will crash the current process if VFPv1 is missing.
func useVFPv1()
diff --git a/src/cmd/dist/util_gccgo.go b/src/cmd/dist/util_gccgo.go
index f9f01dc048..dc897236fb 100644
--- a/src/cmd/dist/util_gccgo.go
+++ b/src/cmd/dist/util_gccgo.go
@@ -6,19 +6,6 @@
package main
-/*
-int supports_sse2() {
-#if defined(__i386__) || defined(__x86_64__)
- return __builtin_cpu_supports("sse2");
-#else
- return 0;
-#endif
-}
-*/
-import "C"
-
-func cansse2() bool { return C.supports_sse2() != 0 }
-
func useVFPv1() {}
func useVFPv3() {}