all: add GOOS=ios

Introduce GOOS=ios for iOS systems. GOOS=ios matches "darwin"
build tag, like GOOS=android matches "linux" and GOOS=illumos
matches "solaris". Only ios/arm64 is supported (ios/amd64 is
not).

GOOS=ios and GOOS=darwin remain essentially the same at this
point. They will diverge at later time, to differentiate macOS
and iOS.

Uses of GOOS=="darwin" are changed to (GOOS=="darwin" || GOOS=="ios"),
except if it clearly means macOS (e.g. GOOS=="darwin" && GOARCH=="amd64"),
it remains GOOS=="darwin".

Updates #38485.

Change-Id: I4faacdc1008f42434599efb3c3ad90763a83b67c
Reviewed-on: https://go-review.googlesource.com/c/go/+/254740
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
Cherry Zhang 2020-09-16 16:59:58 -04:00
parent bc320fc1f5
commit a413908dd0
99 changed files with 215 additions and 125 deletions

View file

@ -507,8 +507,8 @@ These default to the values of <code>$GOHOSTOS</code> and
<p> <p>
Choices for <code>$GOOS</code> are Choices for <code>$GOOS</code> are
<code>android</code>, <code>darwin</code> (macOS/iOS), <code>android</code>, <code>darwin</code>, <code>dragonfly</code>,
<code>dragonfly</code>, <code>freebsd</code>, <code>illumos</code>, <code>js</code>, <code>freebsd</code>, <code>illumos</code>, <code>ios</code>, <code>js</code>,
<code>linux</code>, <code>netbsd</code>, <code>openbsd</code>, <code>linux</code>, <code>netbsd</code>, <code>openbsd</code>,
<code>plan9</code>, <code>solaris</code> and <code>windows</code>. <code>plan9</code>, <code>solaris</code> and <code>windows</code>.
</p> </p>
@ -567,6 +567,9 @@ The valid combinations of <code>$GOOS</code> and <code>$GOARCH</code> are:
<td></td><td><code>illumos</code></td> <td><code>amd64</code></td> <td></td><td><code>illumos</code></td> <td><code>amd64</code></td>
</tr> </tr>
<tr> <tr>
<td></td><td><code>ios</code></td> <td><code>arm64</code></td>
</tr>
<tr>
<td></td><td><code>js</code></td> <td><code>wasm</code></td> <td></td><td><code>js</code></td> <td><code>wasm</code></td>
</tr> </tr>
<tr> <tr>

View file

@ -24,7 +24,7 @@ func test18146(t *testing.T) {
t.Skip("skipping in short mode") t.Skip("skipping in short mode")
} }
if runtime.GOOS == "darwin" { if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
t.Skipf("skipping flaky test on %s; see golang.org/issue/18202", runtime.GOOS) t.Skipf("skipping flaky test on %s; see golang.org/issue/18202", runtime.GOOS)
} }

View file

@ -30,7 +30,7 @@ func TestCrossPackageTests(t *testing.T) {
switch runtime.GOOS { switch runtime.GOOS {
case "android": case "android":
t.Skip("Can't exec cmd/go subprocess on Android.") t.Skip("Can't exec cmd/go subprocess on Android.")
case "darwin": case "darwin", "ios":
switch runtime.GOARCH { switch runtime.GOARCH {
case "arm64": case "arm64":
t.Skip("Can't exec cmd/go subprocess on iOS.") t.Skip("Can't exec cmd/go subprocess on iOS.")

View file

@ -62,7 +62,7 @@ import (
func testSigaltstack(t *testing.T) { func testSigaltstack(t *testing.T) {
switch { switch {
case runtime.GOOS == "solaris", runtime.GOOS == "illumos", runtime.GOOS == "darwin" && runtime.GOARCH == "arm64": case runtime.GOOS == "solaris", runtime.GOOS == "illumos", (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && runtime.GOARCH == "arm64":
t.Skipf("switching signal stack not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) t.Skipf("switching signal stack not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
} }

View file

@ -1776,7 +1776,7 @@ func test14838(t *testing.T) {
var sink C.int var sink C.int
func test17065(t *testing.T) { func test17065(t *testing.T) {
if runtime.GOOS == "darwin" { if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
t.Skip("broken on darwin; issue 17065") t.Skip("broken on darwin; issue 17065")
} }
for i := range C.ii { for i := range C.ii {

View file

@ -164,7 +164,7 @@ func Add(x int) {
} }
func testCthread(t *testing.T) { func testCthread(t *testing.T) {
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" { if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && runtime.GOARCH == "arm64" {
t.Skip("the iOS exec wrapper is unable to properly handle the panic from Add") t.Skip("the iOS exec wrapper is unable to properly handle the panic from Add")
} }
sum.i = 0 sum.i = 0

View file

@ -118,9 +118,9 @@ func testMain(m *testing.M) int {
cc = append(cc, s[start:]) cc = append(cc, s[start:])
} }
if GOOS == "darwin" { if GOOS == "darwin" || GOOS == "ios" {
// For Darwin/ARM. // For Darwin/ARM.
// TODO(crawshaw): can we do better? // TODO: do we still need this?
cc = append(cc, []string{"-framework", "CoreFoundation", "-framework", "Foundation"}...) cc = append(cc, []string{"-framework", "CoreFoundation", "-framework", "Foundation"}...)
} }
if GOOS == "aix" { if GOOS == "aix" {
@ -133,7 +133,7 @@ func testMain(m *testing.M) int {
libbase = "gccgo_" + libgodir + "_fPIC" libbase = "gccgo_" + libgodir + "_fPIC"
} else { } else {
switch GOOS { switch GOOS {
case "darwin": case "darwin", "ios":
if GOARCH == "arm64" { if GOARCH == "arm64" {
libbase += "_shared" libbase += "_shared"
} }
@ -303,7 +303,7 @@ func TestInstall(t *testing.T) {
func TestEarlySignalHandler(t *testing.T) { func TestEarlySignalHandler(t *testing.T) {
switch GOOS { switch GOOS {
case "darwin": case "darwin", "ios":
switch GOARCH { switch GOARCH {
case "arm64": case "arm64":
t.Skipf("skipping on %s/%s; see https://golang.org/issue/13701", GOOS, GOARCH) t.Skipf("skipping on %s/%s; see https://golang.org/issue/13701", GOOS, GOARCH)
@ -384,7 +384,7 @@ func TestSignalForwarding(t *testing.T) {
expectSignal(t, err, syscall.SIGSEGV) expectSignal(t, err, syscall.SIGSEGV)
// SIGPIPE is never forwarded on darwin. See golang.org/issue/33384. // SIGPIPE is never forwarded on darwin. See golang.org/issue/33384.
if runtime.GOOS != "darwin" { if runtime.GOOS != "darwin" && runtime.GOOS != "ios" {
// Test SIGPIPE forwarding // Test SIGPIPE forwarding
cmd = exec.Command(bin[0], append(bin[1:], "3")...) cmd = exec.Command(bin[0], append(bin[1:], "3")...)
@ -485,7 +485,7 @@ func TestSignalForwardingExternal(t *testing.T) {
// doesn't work on this platform. // doesn't work on this platform.
func checkSignalForwardingTest(t *testing.T) { func checkSignalForwardingTest(t *testing.T) {
switch GOOS { switch GOOS {
case "darwin": case "darwin", "ios":
switch GOARCH { switch GOARCH {
case "arm64": case "arm64":
t.Skipf("skipping on %s/%s; see https://golang.org/issue/13701", GOOS, GOARCH) t.Skipf("skipping on %s/%s; see https://golang.org/issue/13701", GOOS, GOARCH)
@ -603,7 +603,7 @@ func TestExtar(t *testing.T) {
if runtime.Compiler == "gccgo" { if runtime.Compiler == "gccgo" {
t.Skip("skipping -extar test when using gccgo") t.Skip("skipping -extar test when using gccgo")
} }
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" { if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && runtime.GOARCH == "arm64" {
t.Skip("shell scripts are not executable on iOS hosts") t.Skip("shell scripts are not executable on iOS hosts")
} }
@ -645,7 +645,7 @@ func TestExtar(t *testing.T) {
func TestPIE(t *testing.T) { func TestPIE(t *testing.T) {
switch GOOS { switch GOOS {
case "windows", "darwin", "plan9": case "windows", "darwin", "ios", "plan9":
t.Skipf("skipping PIE test on %s", GOOS) t.Skipf("skipping PIE test on %s", GOOS)
} }
@ -738,7 +738,7 @@ func TestSIGPROF(t *testing.T) {
switch GOOS { switch GOOS {
case "windows", "plan9": case "windows", "plan9":
t.Skipf("skipping SIGPROF test on %s", GOOS) t.Skipf("skipping SIGPROF test on %s", GOOS)
case "darwin": case "darwin", "ios":
t.Skipf("skipping SIGPROF test on %s; see https://golang.org/issue/19320", GOOS) t.Skipf("skipping SIGPROF test on %s; see https://golang.org/issue/19320", GOOS)
} }
@ -841,7 +841,7 @@ func TestCompileWithoutShared(t *testing.T) {
expectSignal(t, err, syscall.SIGSEGV) expectSignal(t, err, syscall.SIGSEGV)
// SIGPIPE is never forwarded on darwin. See golang.org/issue/33384. // SIGPIPE is never forwarded on darwin. See golang.org/issue/33384.
if runtime.GOOS != "darwin" { if runtime.GOOS != "darwin" && runtime.GOOS != "ios" {
binArgs := append(cmdToRun(exe), "3") binArgs := append(cmdToRun(exe), "3")
t.Log(binArgs) t.Log(binArgs)
out, err = exec.Command(binArgs[0], binArgs[1:]...).CombinedOutput() out, err = exec.Command(binArgs[0], binArgs[1:]...).CombinedOutput()

View file

@ -98,7 +98,7 @@ func testMain(m *testing.M) int {
} }
switch GOOS { switch GOOS {
case "darwin": case "darwin", "ios":
// For Darwin/ARM. // For Darwin/ARM.
// TODO(crawshaw): can we do better? // TODO(crawshaw): can we do better?
cc = append(cc, []string{"-framework", "CoreFoundation", "-framework", "Foundation"}...) cc = append(cc, []string{"-framework", "CoreFoundation", "-framework", "Foundation"}...)
@ -107,7 +107,7 @@ func testMain(m *testing.M) int {
} }
libgodir := GOOS + "_" + GOARCH libgodir := GOOS + "_" + GOARCH
switch GOOS { switch GOOS {
case "darwin": case "darwin", "ios":
if GOARCH == "arm64" { if GOARCH == "arm64" {
libgodir += "_shared" libgodir += "_shared"
} }
@ -407,7 +407,7 @@ func TestUnexportedSymbols(t *testing.T) {
adbPush(t, libname) adbPush(t, libname)
linkFlags := "-Wl,--no-as-needed" linkFlags := "-Wl,--no-as-needed"
if GOOS == "darwin" { if GOOS == "darwin" || GOOS == "ios" {
linkFlags = "" linkFlags = ""
} }
@ -636,7 +636,7 @@ func copyFile(t *testing.T, dst, src string) {
func TestGo2C2Go(t *testing.T) { func TestGo2C2Go(t *testing.T) {
switch GOOS { switch GOOS {
case "darwin": case "darwin", "ios":
// Darwin shared libraries don't support the multiple // Darwin shared libraries don't support the multiple
// copies of the runtime package implied by this test. // copies of the runtime package implied by this test.
t.Skip("linking c-shared into Go programs not supported on Darwin; issue 29061") t.Skip("linking c-shared into Go programs not supported on Darwin; issue 29061")

View file

@ -21,7 +21,7 @@ func requireTestSOSupported(t *testing.T) {
t.Helper() t.Helper()
switch runtime.GOARCH { switch runtime.GOARCH {
case "arm64": case "arm64":
if runtime.GOOS == "darwin" { if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
t.Skip("No exec facility on iOS.") t.Skip("No exec facility on iOS.")
} }
case "ppc64": case "ppc64":
@ -74,7 +74,7 @@ func TestSO(t *testing.T) {
ext := "so" ext := "so"
args := append(gogccflags, "-shared") args := append(gogccflags, "-shared")
switch runtime.GOOS { switch runtime.GOOS {
case "darwin": case "darwin", "ios":
ext = "dylib" ext = "dylib"
args = append(args, "-undefined", "suppress", "-flat_namespace") args = append(args, "-undefined", "suppress", "-flat_namespace")
case "windows": case "windows":
@ -119,7 +119,7 @@ func TestSO(t *testing.T) {
cmd.Env = append(os.Environ(), "GOPATH="+GOPATH) cmd.Env = append(os.Environ(), "GOPATH="+GOPATH)
if runtime.GOOS != "windows" { if runtime.GOOS != "windows" {
s := "LD_LIBRARY_PATH" s := "LD_LIBRARY_PATH"
if runtime.GOOS == "darwin" { if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
s = "DYLD_LIBRARY_PATH" s = "DYLD_LIBRARY_PATH"
} }
cmd.Env = append(os.Environ(), s+"=.") cmd.Env = append(os.Environ(), s+"=.")

View file

@ -21,7 +21,7 @@ func requireTestSOSupported(t *testing.T) {
t.Helper() t.Helper()
switch runtime.GOARCH { switch runtime.GOARCH {
case "arm64": case "arm64":
if runtime.GOOS == "darwin" { if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
t.Skip("No exec facility on iOS.") t.Skip("No exec facility on iOS.")
} }
case "ppc64": case "ppc64":
@ -74,7 +74,7 @@ func TestSO(t *testing.T) {
ext := "so" ext := "so"
args := append(gogccflags, "-shared") args := append(gogccflags, "-shared")
switch runtime.GOOS { switch runtime.GOOS {
case "darwin": case "darwin", "ios":
ext = "dylib" ext = "dylib"
args = append(args, "-undefined", "suppress", "-flat_namespace") args = append(args, "-undefined", "suppress", "-flat_namespace")
case "windows": case "windows":
@ -119,7 +119,7 @@ func TestSO(t *testing.T) {
cmd.Env = append(os.Environ(), "GOPATH="+GOPATH) cmd.Env = append(os.Environ(), "GOPATH="+GOPATH)
if runtime.GOOS != "windows" { if runtime.GOOS != "windows" {
s := "LD_LIBRARY_PATH" s := "LD_LIBRARY_PATH"
if runtime.GOOS == "darwin" { if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
s = "DYLD_LIBRARY_PATH" s = "DYLD_LIBRARY_PATH"
} }
cmd.Env = append(os.Environ(), s+"=.") cmd.Env = append(os.Environ(), s+"=.")

View file

@ -66,7 +66,7 @@ func statUnix(fi os.FileInfo, h *Header) error {
minor := uint32((dev & 0x00000000000000ff) >> 0) minor := uint32((dev & 0x00000000000000ff) >> 0)
minor |= uint32((dev & 0x00000ffffff00000) >> 12) minor |= uint32((dev & 0x00000ffffff00000) >> 12)
h.Devmajor, h.Devminor = int64(major), int64(minor) h.Devmajor, h.Devminor = int64(major), int64(minor)
case "darwin": case "darwin", "ios":
// Copied from golang.org/x/sys/unix/dev_darwin.go. // Copied from golang.org/x/sys/unix/dev_darwin.go.
major := uint32((dev >> 24) & 0xff) major := uint32((dev >> 24) & 0xff)
minor := uint32(dev & 0xffffff) minor := uint32(dev & 0xffffff)

View file

@ -298,7 +298,7 @@ func (p *Package) guessKinds(f *File) []*Name {
continue continue
} }
if goos == "darwin" && strings.HasSuffix(n.C, "Ref") { if (goos == "darwin" || goos == "ios") && strings.HasSuffix(n.C, "Ref") {
// For FooRef, find out if FooGetTypeID exists. // For FooRef, find out if FooGetTypeID exists.
s := n.C[:len(n.C)-3] + "GetTypeID" s := n.C[:len(n.C)-3] + "GetTypeID"
n := &Name{Go: s, C: s} n := &Name{Go: s, C: s}
@ -3075,7 +3075,7 @@ func (c *typeConv) badCFType(dt *dwarf.TypedefType) bool {
// We identify the correct set of types as those ending in Ref and for which // We identify the correct set of types as those ending in Ref and for which
// there exists a corresponding GetTypeID function. // there exists a corresponding GetTypeID function.
// See comment below for details about the bad pointers. // See comment below for details about the bad pointers.
if goos != "darwin" { if goos != "darwin" && goos != "ios" {
return false return false
} }
s := dt.Name s := dt.Name

View file

@ -11,7 +11,7 @@ import (
"cmd/internal/objabi" "cmd/internal/objabi"
) )
var darwin = objabi.GOOS == "darwin" var darwin = objabi.GOOS == "darwin" || objabi.GOOS == "ios"
func padframe(frame int64) int64 { func padframe(frame int64) int64 {
// arm64 requires that the frame size (not counting saved FP&LR) // arm64 requires that the frame size (not counting saved FP&LR)

View file

@ -248,7 +248,7 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize bool) *Config
c.FPReg = framepointerRegARM64 c.FPReg = framepointerRegARM64
c.LinkReg = linkRegARM64 c.LinkReg = linkRegARM64
c.hasGReg = true c.hasGReg = true
c.noDuffDevice = objabi.GOOS == "darwin" // darwin linker cannot handle BR26 reloc with non-zero addend c.noDuffDevice = objabi.GOOS == "darwin" || objabi.GOOS == "ios" // darwin linker cannot handle BR26 reloc with non-zero addend
case "ppc64": case "ppc64":
c.BigEndian = true c.BigEndian = true
fallthrough fallthrough

11
src/cmd/dist/build.go vendored
View file

@ -80,6 +80,7 @@ var okgoos = []string{
"darwin", "darwin",
"dragonfly", "dragonfly",
"illumos", "illumos",
"ios",
"js", "js",
"linux", "linux",
"android", "android",
@ -970,7 +971,10 @@ func matchtag(tag string) bool {
} }
return !matchtag(tag[1:]) 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. // shouldbuild reports whether we should build this file.
@ -984,7 +988,7 @@ func shouldbuild(file, pkg string) bool {
name := filepath.Base(file) name := filepath.Base(file)
excluded := func(list []string, ok string) bool { excluded := func(list []string, ok string) bool {
for _, x := range list { 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 continue
} }
i := strings.Index(name, x) i := strings.Index(name, x)
@ -1462,7 +1466,7 @@ func wrapperPathFor(goos, goarch string) string {
if gohostos != "android" { if gohostos != "android" {
return pathf("%s/misc/android/go_android_exec.go", goroot) return pathf("%s/misc/android/go_android_exec.go", goroot)
} }
case goos == "darwin" && goarch == "arm64": case (goos == "darwin" || goos == "ios") && goarch == "arm64":
if gohostos != "darwin" || gohostarch != "arm64" { if gohostos != "darwin" || gohostarch != "arm64" {
return pathf("%s/misc/ios/go_darwin_arm_exec.go", goroot) return pathf("%s/misc/ios/go_darwin_arm_exec.go", goroot)
} }
@ -1541,6 +1545,7 @@ var cgoEnabled = map[string]bool{
"android/amd64": true, "android/amd64": true,
"android/arm": true, "android/arm": true,
"android/arm64": true, "android/arm64": true,
"ios/arm64": true,
"js/wasm": false, "js/wasm": false,
"netbsd/386": true, "netbsd/386": true,
"netbsd/amd64": true, "netbsd/amd64": true,

View file

@ -464,7 +464,7 @@ func (t *tester) registerTests() {
} }
// Test the ios build tag on darwin/amd64 for the iOS simulator. // Test the ios build tag on darwin/amd64 for the iOS simulator.
if goos == "darwin" && !t.iOS() { if goos == "darwin" && goarch == "amd64" {
t.tests = append(t.tests, distTest{ t.tests = append(t.tests, distTest{
name: "amd64ios", name: "amd64ios",
heading: "ios tag on darwin/amd64", heading: "ios tag on darwin/amd64",
@ -903,7 +903,7 @@ func (t *tester) addCmd(dt *distTest, dir string, cmdline ...interface{}) *exec.
} }
func (t *tester) iOS() bool { func (t *tester) iOS() bool {
return goos == "darwin" && goarch == "arm64" return (goos == "darwin" || goos == "ios") && goarch == "arm64"
} }
func (t *tester) out(v string) { func (t *tester) out(v string) {
@ -943,7 +943,10 @@ func (t *tester) internalLink() bool {
if goos == "android" { if goos == "android" {
return false return false
} }
if t.iOS() { if goos == "ios" {
return false
}
if goos == "darwin" && goarch == "arm64" {
return false return false
} }
// Internally linking cgo is incomplete on some architectures. // Internally linking cgo is incomplete on some architectures.

View file

@ -36,8 +36,8 @@ func TestMain(m *testing.M) {
} }
func maybeSkip(t *testing.T) { func maybeSkip(t *testing.T) {
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" { if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && runtime.GOARCH == "arm64" {
t.Skip("darwin/arm64 does not have a full file tree") t.Skip("iOS does not have a full file tree")
} }
} }

View file

@ -1608,6 +1608,9 @@
// Using GOOS=illumos matches build tags and files as for GOOS=solaris // Using GOOS=illumos matches build tags and files as for GOOS=solaris
// in addition to illumos tags and files. // in addition to illumos tags and files.
// //
// Using GOOS=ios matches build tags and files as for GOOS=darwin
// in addition to ios tags and files.
//
// To keep a file from being considered for the build: // To keep a file from being considered for the build:
// //
// // +build ignore // // +build ignore

View file

@ -58,7 +58,7 @@ func init() {
switch runtime.GOOS { switch runtime.GOOS {
case "android", "js": case "android", "js":
canRun = false canRun = false
case "darwin": case "darwin", "ios":
switch runtime.GOARCH { switch runtime.GOARCH {
case "arm64": case "arm64":
canRun = false canRun = false

View file

@ -105,7 +105,7 @@ func printGoDetails(w io.Writer) {
func printOSDetails(w io.Writer) { func printOSDetails(w io.Writer) {
switch runtime.GOOS { switch runtime.GOOS {
case "darwin": case "darwin", "ios":
printCmdOut(w, "uname -v: ", "uname", "-v") printCmdOut(w, "uname -v: ", "uname", "-v")
printCmdOut(w, "", "sw_vers") printCmdOut(w, "", "sw_vers")
case "linux": case "linux":

View file

@ -838,6 +838,9 @@ in addition to android tags and files.
Using GOOS=illumos matches build tags and files as for GOOS=solaris Using GOOS=illumos matches build tags and files as for GOOS=solaris
in addition to illumos tags and files. in addition to illumos tags and files.
Using GOOS=ios matches build tags and files as for GOOS=darwin
in addition to ios tags and files.
To keep a file from being considered for the build: To keep a file from being considered for the build:
// +build ignore // +build ignore

View file

@ -141,6 +141,9 @@ func matchTag(name string, tags map[string]bool, want bool) bool {
if name == "solaris" { if name == "solaris" {
have = have || tags["illumos"] have = have || tags["illumos"]
} }
if name == "darwin" {
have = have || tags["ios"]
}
return have == want return have == want
} }
@ -158,6 +161,7 @@ func matchTag(name string, tags map[string]bool, want bool) bool {
// Exceptions: // Exceptions:
// if GOOS=android, then files with GOOS=linux are also matched. // if GOOS=android, then files with GOOS=linux are also matched.
// if GOOS=illumos, then files with GOOS=solaris are also matched. // if GOOS=illumos, then files with GOOS=solaris are also matched.
// if GOOS=ios, then files with GOOS=darwin are also matched.
// //
// If tags["*"] is true, then MatchFile will consider all possible // If tags["*"] is true, then MatchFile will consider all possible
// GOOS and GOARCH to be available and will consequently // GOOS and GOARCH to be available and will consequently
@ -208,6 +212,7 @@ var KnownOS = map[string]bool{
"freebsd": true, "freebsd": true,
"hurd": true, "hurd": true,
"illumos": true, "illumos": true,
"ios": true,
"js": true, "js": true,
"linux": true, "linux": true,
"nacl": true, // legacy; don't remove "nacl": true, // legacy; don't remove

View file

@ -1950,7 +1950,7 @@ func externalLinkingForced(p *Package) bool {
if cfg.BuildContext.GOARCH != "arm64" { if cfg.BuildContext.GOARCH != "arm64" {
return true return true
} }
case "darwin": case "darwin", "ios":
if cfg.BuildContext.GOARCH == "arm64" { if cfg.BuildContext.GOARCH == "arm64" {
return true return true
} }

View file

@ -221,7 +221,7 @@ func pkgImportPath(pkgpath string) *load.Package {
// See https://golang.org/issue/18878. // See https://golang.org/issue/18878.
func TestRespectSetgidDir(t *testing.T) { func TestRespectSetgidDir(t *testing.T) {
switch runtime.GOOS { switch runtime.GOOS {
case "darwin": case "darwin", "ios":
if runtime.GOARCH == "arm64" { if runtime.GOARCH == "arm64" {
t.Skip("can't set SetGID bit with chmod on iOS") t.Skip("can't set SetGID bit with chmod on iOS")
} }

View file

@ -2424,7 +2424,7 @@ func (b *Builder) compilerCmd(compiler []string, incdir, workdir string) []strin
// On OS X, some of the compilers behave as if -fno-common // On OS X, some of the compilers behave as if -fno-common
// is always set, and the Mach-O linker in 6l/8l assumes this. // is always set, and the Mach-O linker in 6l/8l assumes this.
// See https://golang.org/issue/3253. // See https://golang.org/issue/3253.
if cfg.Goos == "darwin" { if cfg.Goos == "darwin" || cfg.Goos == "ios" {
a = append(a, "-fno-common") a = append(a, "-fno-common")
} }

View file

@ -121,7 +121,7 @@ func buildModeInit() {
codegenArg = "-fPIC" codegenArg = "-fPIC"
} else { } else {
switch cfg.Goos { switch cfg.Goos {
case "darwin": case "darwin", "ios":
switch cfg.Goarch { switch cfg.Goarch {
case "arm64": case "arm64":
codegenArg = "-shared" codegenArg = "-shared"
@ -157,7 +157,7 @@ func buildModeInit() {
ldBuildmode = "pie" ldBuildmode = "pie"
case "windows": case "windows":
ldBuildmode = "pie" ldBuildmode = "pie"
case "darwin": case "darwin", "ios":
switch cfg.Goarch { switch cfg.Goarch {
case "arm64": case "arm64":
codegenArg = "-shared" codegenArg = "-shared"

View file

@ -243,7 +243,7 @@ func TestParseCGOArchive(t *testing.T) {
c1 := "c1" c1 := "c1"
c2 := "c2" c2 := "c2"
switch runtime.GOOS { switch runtime.GOOS {
case "darwin": case "darwin", "ios":
c1 = "_" + c1 c1 = "_" + c1
c2 = "_" + c2 c2 = "_" + c2
case "windows": case "windows":
@ -275,7 +275,7 @@ func TestParseCGOArchive(t *testing.T) {
obj := io.NewSectionReader(f, e.Offset, e.Size) obj := io.NewSectionReader(f, e.Offset, e.Size)
switch runtime.GOOS { switch runtime.GOOS {
case "darwin": case "darwin", "ios":
mf, err := macho.NewFile(obj) mf, err := macho.NewFile(obj)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)

View file

@ -378,7 +378,7 @@ func expandPseudoForm(form uint8) uint8 {
return form return form
} }
expandedForm := DW_FORM_udata expandedForm := DW_FORM_udata
if objabi.GOOS == "darwin" { if objabi.GOOS == "darwin" || objabi.GOOS == "ios" {
expandedForm = DW_FORM_data4 expandedForm = DW_FORM_data4
} }
return uint8(expandedForm) return uint8(expandedForm)

View file

@ -54,7 +54,7 @@ func (h *HeadType) Set(s string) error {
switch s { switch s {
case "aix": case "aix":
*h = Haix *h = Haix
case "darwin": case "darwin", "ios":
*h = Hdarwin *h = Hdarwin
case "dragonfly": case "dragonfly":
*h = Hdragonfly *h = Hdragonfly

View file

@ -139,7 +139,7 @@ func init() {
} }
// Note: must agree with runtime.framepointer_enabled. // Note: must agree with runtime.framepointer_enabled.
var Framepointer_enabled = GOARCH == "amd64" || GOARCH == "arm64" && (GOOS == "linux" || GOOS == "darwin") var Framepointer_enabled = GOARCH == "amd64" || GOARCH == "arm64" && (GOOS == "linux" || GOOS == "darwin" || GOOS == "ios")
func addexp(s string) { func addexp(s string) {
// Could do general integer parsing here, but the runtime copy doesn't yet. // Could do general integer parsing here, but the runtime copy doesn't yet.

View file

@ -38,7 +38,7 @@ func MustLinkExternal(goos, goarch string) bool {
if goarch != "arm64" { if goarch != "arm64" {
return true return true
} }
case "darwin": case "darwin", "ios":
if goarch == "arm64" { if goarch == "arm64" {
return true return true
} }

View file

@ -170,7 +170,7 @@ func readArmap(filename string, f *bio.Reader, arhdr ArHdr) archiveMap {
// For Mach-O and PE/386 files we strip a leading // For Mach-O and PE/386 files we strip a leading
// underscore from the symbol name. // underscore from the symbol name.
if objabi.GOOS == "darwin" || (objabi.GOOS == "windows" && objabi.GOARCH == "386") { if objabi.GOOS == "darwin" || objabi.GOOS == "ios" || (objabi.GOOS == "windows" && objabi.GOARCH == "386") {
if name[0] == '_' && len(name) > 1 { if name[0] == '_' && len(name) > 1 {
name = name[1:] name = name[1:]
} }

View file

@ -51,7 +51,7 @@ func (mode *BuildMode) Set(s string) error {
*mode = BuildModePIE *mode = BuildModePIE
case "c-archive": case "c-archive":
switch objabi.GOOS { switch objabi.GOOS {
case "aix", "darwin", "linux": case "aix", "darwin", "ios", "linux":
case "freebsd": case "freebsd":
switch objabi.GOARCH { switch objabi.GOARCH {
case "amd64": case "amd64":

View file

@ -17,7 +17,7 @@ func TestMMap(t *testing.T) {
switch runtime.GOOS { switch runtime.GOOS {
default: default:
t.Skip("unsupported OS") t.Skip("unsupported OS")
case "aix", "darwin", "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "windows": case "aix", "darwin", "ios", "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "windows":
} }
dir, err := ioutil.TempDir("", "TestMMap") dir, err := ioutil.TempDir("", "TestMMap")
if err != nil { if err != nil {

View file

@ -283,7 +283,7 @@ func testGoLib(t *testing.T, iscgo bool) {
if iscgo { if iscgo {
syms = append(syms, symType{"B", "mylib.TestCgodata", false, false}) syms = append(syms, symType{"B", "mylib.TestCgodata", false, false})
syms = append(syms, symType{"T", "mylib.TestCgofunc", false, false}) syms = append(syms, symType{"T", "mylib.TestCgofunc", false, false})
if runtime.GOOS == "darwin" || (runtime.GOOS == "windows" && runtime.GOARCH == "386") { if runtime.GOOS == "darwin" || runtime.GOOS == "ios" || (runtime.GOOS == "windows" && runtime.GOARCH == "386") {
syms = append(syms, symType{"D", "_cgodata", true, false}) syms = append(syms, symType{"D", "_cgodata", true, false})
syms = append(syms, symType{"T", "_cgofunc", true, false}) syms = append(syms, symType{"T", "_cgofunc", true, false})
} else if runtime.GOOS == "aix" { } else if runtime.GOOS == "aix" {

View file

@ -4,7 +4,7 @@
// +build ignore // +build ignore
// Generates root_darwin_ios.go. // Generates root_darwin_iosx.go.
// //
// As of iOS 13, there is no API for querying the system trusted X.509 root // As of iOS 13, there is no API for querying the system trusted X.509 root
// certificates. // certificates.
@ -37,7 +37,10 @@ import (
) )
func main() { func main() {
var output = flag.String("output", "root_darwin_ios.go", "file name to write") // Temporarily name the file _iosx.go, to avoid restricting it to GOOS=ios,
// as this is also used for darwin/arm64 (macOS).
// TODO: maybe use darwin/amd64 implementation on macOS arm64?
var output = flag.String("output", "root_darwin_iosx.go", "file name to write")
var version = flag.String("version", "", "security_certificates version") var version = flag.String("version", "", "security_certificates version")
flag.Parse() flag.Parse()
if *version == "" { if *version == "" {

View file

@ -899,7 +899,7 @@ func TestCompressedSection(t *testing.T) {
func TestNoSectionOverlaps(t *testing.T) { func TestNoSectionOverlaps(t *testing.T) {
// Ensure cmd/link outputs sections without overlaps. // Ensure cmd/link outputs sections without overlaps.
switch runtime.GOOS { switch runtime.GOOS {
case "aix", "android", "darwin", "js", "plan9", "windows": case "aix", "android", "darwin", "ios", "js", "plan9", "windows":
t.Skipf("cmd/link doesn't produce ELF binaries on %s", runtime.GOOS) t.Skipf("cmd/link doesn't produce ELF binaries on %s", runtime.GOOS)
} }
_ = net.ResolveIPAddr // force dynamic linkage _ = net.ResolveIPAddr // force dynamic linkage

View file

@ -1754,6 +1754,9 @@ func (ctxt *Context) match(name string, allTags map[string]bool) bool {
if ctxt.GOOS == "illumos" && name == "solaris" { if ctxt.GOOS == "illumos" && name == "solaris" {
return true return true
} }
if ctxt.GOOS == "ios" && name == "darwin" {
return true
}
// other tags // other tags
for _, tag := range ctxt.BuildTags { for _, tag := range ctxt.BuildTags {
@ -1781,7 +1784,10 @@ func (ctxt *Context) match(name string, allTags map[string]bool) bool {
// name_$(GOARCH)_test.* // name_$(GOARCH)_test.*
// name_$(GOOS)_$(GOARCH)_test.* // name_$(GOOS)_$(GOARCH)_test.*
// //
// An exception: if GOOS=android, then files with GOOS=linux are also matched. // Exceptions:
// if GOOS=android, then files with GOOS=linux are also matched.
// if GOOS=illumos, then files with GOOS=solaris are also matched.
// if GOOS=ios, then files with GOOS=darwin are also matched.
func (ctxt *Context) goodOSArchFile(name string, allTags map[string]bool) bool { func (ctxt *Context) goodOSArchFile(name string, allTags map[string]bool) bool {
if dot := strings.Index(name, "."); dot != -1 { if dot := strings.Index(name, "."); dot != -1 {
name = name[:dot] name = name[:dot]

View file

@ -120,7 +120,7 @@ func TestMultiplePackageImport(t *testing.T) {
} }
func TestLocalDirectory(t *testing.T) { func TestLocalDirectory(t *testing.T) {
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" { if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && runtime.GOARCH == "arm64" {
t.Skipf("skipping on %s/%s, no valid GOROOT", runtime.GOOS, runtime.GOARCH) t.Skipf("skipping on %s/%s, no valid GOROOT", runtime.GOOS, runtime.GOARCH)
} }
@ -250,7 +250,7 @@ func TestMatchFile(t *testing.T) {
} }
func TestImportCmd(t *testing.T) { func TestImportCmd(t *testing.T) {
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" { if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && runtime.GOARCH == "arm64" {
t.Skipf("skipping on %s/%s, no valid GOROOT", runtime.GOOS, runtime.GOARCH) t.Skipf("skipping on %s/%s, no valid GOROOT", runtime.GOOS, runtime.GOARCH)
} }

View file

@ -7,5 +7,5 @@ package build
// List of past, present, and future known GOOS and GOARCH values. // List of past, present, and future known GOOS and GOARCH values.
// Do not remove from this list, as these are used for go/build filename matching. // Do not remove from this list, as these are used for go/build filename matching.
const goosList = "aix android darwin dragonfly freebsd hurd illumos js linux nacl netbsd openbsd plan9 solaris windows zos " const goosList = "aix android darwin dragonfly freebsd hurd illumos ios js linux nacl netbsd openbsd plan9 solaris windows zos "
const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc riscv riscv64 s390 s390x sparc sparc64 wasm " const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc riscv riscv64 s390 s390x sparc sparc64 wasm "

View file

@ -17,7 +17,7 @@ var (
) )
func anotherOS() string { func anotherOS() string {
if thisOS != "darwin" { if thisOS != "darwin" && thisOS != "ios" {
return "darwin" return "darwin"
} }
return "linux" return "linux"

View file

@ -38,7 +38,7 @@ func TestRead(t *testing.T) {
func specialFiles() []string { func specialFiles() []string {
var ps []string var ps []string
switch runtime.GOOS { switch runtime.GOOS {
case "darwin", "dragonfly", "freebsd", "netbsd", "openbsd": case "darwin", "ios", "dragonfly", "freebsd", "netbsd", "openbsd":
ps = []string{ ps = []string{
"/dev/null", "/dev/null",
} }

View file

@ -45,7 +45,7 @@ func HasGoBuild() bool {
switch runtime.GOOS { switch runtime.GOOS {
case "android", "js": case "android", "js":
return false return false
case "darwin": case "darwin", "ios":
if runtime.GOARCH == "arm64" { if runtime.GOARCH == "arm64" {
return false return false
} }
@ -124,7 +124,7 @@ func HasExec() bool {
switch runtime.GOOS { switch runtime.GOOS {
case "js": case "js":
return false return false
case "darwin": case "darwin", "ios":
if runtime.GOARCH == "arm64" { if runtime.GOARCH == "arm64" {
return false return false
} }
@ -135,7 +135,7 @@ func HasExec() bool {
// HasSrc reports whether the entire source tree is available under GOROOT. // HasSrc reports whether the entire source tree is available under GOROOT.
func HasSrc() bool { func HasSrc() bool {
switch runtime.GOOS { switch runtime.GOOS {
case "darwin": case "darwin", "ios":
if runtime.GOARCH == "arm64" { if runtime.GOARCH == "arm64" {
return false return false
} }

View file

@ -51,7 +51,7 @@ func testableNetwork(network string) bool {
switch network { switch network {
case "unix", "unixgram": case "unix", "unixgram":
switch runtime.GOOS { switch runtime.GOOS {
case "darwin": case "darwin", "ios":
switch runtime.GOARCH { switch runtime.GOARCH {
case "arm64": case "arm64":
return false return false

View file

@ -69,7 +69,7 @@ func initConfVal() {
// Darwin pops up annoying dialog boxes if programs try to do // Darwin pops up annoying dialog boxes if programs try to do
// their own DNS requests. So always use cgo instead, which // their own DNS requests. So always use cgo instead, which
// avoids that. // avoids that.
if runtime.GOOS == "darwin" { if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
confVal.forceCgoLookupHost = true confVal.forceCgoLookupHost = true
return return
} }

View file

@ -160,7 +160,7 @@ func dialClosedPort(t *testing.T) (actual, expected time.Duration) {
// but other platforms should be instantaneous. // but other platforms should be instantaneous.
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
expected = 1500 * time.Millisecond expected = 1500 * time.Millisecond
} else if runtime.GOOS == "darwin" { } else if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
expected = 150 * time.Millisecond expected = 150 * time.Millisecond
} else { } else {
expected = 95 * time.Millisecond expected = 95 * time.Millisecond
@ -990,7 +990,7 @@ func TestDialerControl(t *testing.T) {
// except that it won't skip testing on non-mobile builders. // except that it won't skip testing on non-mobile builders.
func mustHaveExternalNetwork(t *testing.T) { func mustHaveExternalNetwork(t *testing.T) {
t.Helper() t.Helper()
mobile := runtime.GOOS == "android" || runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" mobile := runtime.GOOS == "android" || (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && runtime.GOARCH == "arm64"
if testenv.Builder() == "" || mobile { if testenv.Builder() == "" || mobile {
testenv.MustHaveExternalNetwork(t) testenv.MustHaveExternalNetwork(t)
} }

View file

@ -37,7 +37,7 @@ var trailingPort = regexp.MustCompile(`:([0-9]+)$`)
var osDefaultInheritEnv = func() []string { var osDefaultInheritEnv = func() []string {
switch runtime.GOOS { switch runtime.GOOS {
case "darwin": case "darwin", "ios":
return []string{"DYLD_LIBRARY_PATH"} return []string{"DYLD_LIBRARY_PATH"}
case "linux", "freebsd", "openbsd": case "linux", "freebsd", "openbsd":
return []string{"LD_LIBRARY_PATH"} return []string{"LD_LIBRARY_PATH"}

View file

@ -46,7 +46,7 @@ func TestPointToPointInterface(t *testing.T) {
if testing.Short() { if testing.Short() {
t.Skip("avoid external network") t.Skip("avoid external network")
} }
if runtime.GOOS == "darwin" { if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
t.Skipf("not supported on %s", runtime.GOOS) t.Skipf("not supported on %s", runtime.GOOS)
} }
if os.Getuid() != 0 { if os.Getuid() != 0 {

View file

@ -511,7 +511,7 @@ func TestDNSFlood(t *testing.T) {
defer dnsWaitGroup.Wait() defer dnsWaitGroup.Wait()
var N = 5000 var N = 5000
if runtime.GOOS == "darwin" { if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
// On Darwin this test consumes kernel threads much // On Darwin this test consumes kernel threads much
// than other platforms for some reason. // than other platforms for some reason.
// When we monitor the number of allocated Ms by // When we monitor the number of allocated Ms by
@ -628,7 +628,7 @@ func TestLookupDotsWithLocalSource(t *testing.T) {
} }
func TestLookupDotsWithRemoteSource(t *testing.T) { func TestLookupDotsWithRemoteSource(t *testing.T) {
if runtime.GOOS == "darwin" { if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
testenv.SkipFlaky(t, 27992) testenv.SkipFlaky(t, 27992)
} }
mustHaveExternalNetwork(t) mustHaveExternalNetwork(t)

View file

@ -133,7 +133,7 @@ func setupTestData() {
{"udp6", "[" + addr + "%" + ifi.Name + "]:0", false}, {"udp6", "[" + addr + "%" + ifi.Name + "]:0", false},
}...) }...)
switch runtime.GOOS { switch runtime.GOOS {
case "darwin", "dragonfly", "freebsd", "openbsd", "netbsd": case "darwin", "ios", "dragonfly", "freebsd", "openbsd", "netbsd":
ipv6LinkLocalUnicastTCPTests = append(ipv6LinkLocalUnicastTCPTests, []ipv6LinkLocalUnicastTest{ ipv6LinkLocalUnicastTCPTests = append(ipv6LinkLocalUnicastTCPTests, []ipv6LinkLocalUnicastTest{
{"tcp", "[localhost%" + ifi.Name + "]:0", true}, {"tcp", "[localhost%" + ifi.Name + "]:0", true},
{"tcp6", "[localhost%" + ifi.Name + "]:0", true}, {"tcp6", "[localhost%" + ifi.Name + "]:0", true},

View file

@ -59,7 +59,7 @@ func testableNetwork(network string) bool {
} }
case "unixpacket": case "unixpacket":
switch runtime.GOOS { switch runtime.GOOS {
case "aix", "android", "darwin", "plan9", "windows": case "aix", "android", "darwin", "ios", "plan9", "windows":
return false return false
case "netbsd": case "netbsd":
// It passes on amd64 at least. 386 fails (Issue 22927). arm is unknown. // It passes on amd64 at least. 386 fails (Issue 22927). arm is unknown.
@ -82,7 +82,7 @@ func testableNetwork(network string) bool {
} }
func iOS() bool { func iOS() bool {
return runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" return (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && runtime.GOARCH == "arm64"
} }
// testableAddress reports whether address of network is testable on // testableAddress reports whether address of network is testable on

View file

@ -17,7 +17,7 @@ func maxListenerBacklog() int {
err error err error
) )
switch runtime.GOOS { switch runtime.GOOS {
case "darwin": case "darwin", "ios":
n, err = syscall.SysctlUint32("kern.ipc.somaxconn") n, err = syscall.SysctlUint32("kern.ipc.somaxconn")
case "freebsd": case "freebsd":
n, err = syscall.SysctlUint32("kern.ipc.soacceptqueue") n, err = syscall.SysctlUint32("kern.ipc.soacceptqueue")

View file

@ -647,7 +647,7 @@ func TestTCPSelfConnect(t *testing.T) {
n = 1000 n = 1000
} }
switch runtime.GOOS { switch runtime.GOOS {
case "darwin", "dragonfly", "freebsd", "netbsd", "openbsd", "plan9", "illumos", "solaris", "windows": case "darwin", "ios", "dragonfly", "freebsd", "netbsd", "openbsd", "plan9", "illumos", "solaris", "windows":
// Non-Linux systems take a long time to figure // Non-Linux systems take a long time to figure
// out that there is nothing listening on localhost. // out that there is nothing listening on localhost.
n = 100 n = 100

View file

@ -327,7 +327,7 @@ func TestUDPZeroBytePayload(t *testing.T) {
switch runtime.GOOS { switch runtime.GOOS {
case "plan9": case "plan9":
t.Skipf("not supported on %s", runtime.GOOS) t.Skipf("not supported on %s", runtime.GOOS)
case "darwin": case "darwin", "ios":
testenv.SkipFlaky(t, 29225) testenv.SkipFlaky(t, 29225)
} }

View file

@ -154,7 +154,7 @@ func testBuffer_writeTo(t *testing.T, chunks int, useCopy bool) {
var wantSum int var wantSum int
switch runtime.GOOS { switch runtime.GOOS {
case "android", "darwin", "dragonfly", "freebsd", "illumos", "linux", "netbsd", "openbsd": case "android", "darwin", "ios", "dragonfly", "freebsd", "illumos", "linux", "netbsd", "openbsd":
var wantMinCalls int var wantMinCalls int
wantSum = want.Len() wantSum = want.Len()
v := chunks v := chunks

View file

@ -129,7 +129,7 @@ func newFile(fd uintptr, name string, kind newFileKind) *File {
// used with kqueue. // used with kqueue.
if kind == kindOpenFile { if kind == kindOpenFile {
switch runtime.GOOS { switch runtime.GOOS {
case "darwin", "dragonfly", "freebsd", "netbsd", "openbsd": case "darwin", "ios", "dragonfly", "freebsd", "netbsd", "openbsd":
var st syscall.Stat_t var st syscall.Stat_t
err := ignoringEINTR(func() error { err := ignoringEINTR(func() error {
return syscall.Fstat(fdi, &st) return syscall.Fstat(fdi, &st)
@ -150,7 +150,7 @@ func newFile(fd uintptr, name string, kind newFileKind) *File {
// on Darwin, kqueue does not work properly with fifos: // on Darwin, kqueue does not work properly with fifos:
// closing the last writer does not cause a kqueue event // closing the last writer does not cause a kqueue event
// for any readers. See issue #24164. // for any readers. See issue #24164.
if runtime.GOOS == "darwin" && typ == syscall.S_IFIFO { if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && typ == syscall.S_IFIFO {
pollable = false pollable = false
} }
} }

View file

@ -52,7 +52,7 @@ var sysdir = func() *sysDir {
"libpowermanager.so", "libpowermanager.so",
}, },
} }
case "darwin": case "darwin", "ios":
switch runtime.GOARCH { switch runtime.GOARCH {
case "arm64": case "arm64":
wd, err := syscall.Getwd() wd, err := syscall.Getwd()
@ -144,7 +144,7 @@ func localTmp() string {
switch runtime.GOOS { switch runtime.GOOS {
case "android", "windows": case "android", "windows":
return TempDir() return TempDir()
case "darwin": case "darwin", "ios":
switch runtime.GOARCH { switch runtime.GOARCH {
case "arm64": case "arm64":
return TempDir() return TempDir()
@ -481,7 +481,7 @@ func TestReaddirnamesOneAtATime(t *testing.T) {
switch runtime.GOOS { switch runtime.GOOS {
case "android": case "android":
dir = "/system/bin" dir = "/system/bin"
case "darwin": case "darwin", "ios":
switch runtime.GOARCH { switch runtime.GOARCH {
case "arm64": case "arm64":
wd, err := Getwd() wd, err := Getwd()
@ -1304,7 +1304,7 @@ func TestChdirAndGetwd(t *testing.T) {
dirs = []string{"/system/bin"} dirs = []string{"/system/bin"}
case "plan9": case "plan9":
dirs = []string{"/", "/usr"} dirs = []string{"/", "/usr"}
case "darwin": case "darwin", "ios":
switch runtime.GOARCH { switch runtime.GOARCH {
case "arm64": case "arm64":
dirs = nil dirs = nil

View file

@ -107,7 +107,7 @@ func TestMkdirAllAtSlash(t *testing.T) {
switch runtime.GOOS { switch runtime.GOOS {
case "android", "plan9", "windows": case "android", "plan9", "windows":
t.Skipf("skipping on %s", runtime.GOOS) t.Skipf("skipping on %s", runtime.GOOS)
case "darwin": case "darwin", "ios":
switch runtime.GOARCH { switch runtime.GOARCH {
case "arm64": case "arm64":
t.Skipf("skipping on darwin/arm64, mkdir returns EPERM") t.Skipf("skipping on darwin/arm64, mkdir returns EPERM")

View file

@ -158,7 +158,7 @@ func TestRemoveAllLarge(t *testing.T) {
func TestRemoveAllLongPath(t *testing.T) { func TestRemoveAllLongPath(t *testing.T) {
switch runtime.GOOS { switch runtime.GOOS {
case "aix", "darwin", "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "illumos", "solaris": case "aix", "darwin", "ios", "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "illumos", "solaris":
break break
default: default:
t.Skip("skipping for not implemented platforms") t.Skip("skipping for not implemented platforms")

View file

@ -431,7 +431,7 @@ func chtmpdir(t *testing.T) (restore func()) {
} }
func TestWalk(t *testing.T) { func TestWalk(t *testing.T) {
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" { if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && runtime.GOARCH == "arm64" {
restore := chtmpdir(t) restore := chtmpdir(t)
defer restore() defer restore()
} }
@ -1278,7 +1278,7 @@ func TestDriveLetterInEvalSymlinks(t *testing.T) {
} }
func TestBug3486(t *testing.T) { // https://golang.org/issue/3486 func TestBug3486(t *testing.T) { // https://golang.org/issue/3486
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" { if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && runtime.GOARCH == "arm64" {
t.Skipf("skipping on %s/%s", runtime.GOOS, runtime.GOARCH) t.Skipf("skipping on %s/%s", runtime.GOOS, runtime.GOARCH)
} }
root, err := filepath.EvalSymlinks(runtime.GOROOT() + "/test") root, err := filepath.EvalSymlinks(runtime.GOROOT() + "/test")

View file

@ -20,7 +20,7 @@ func TestPanicOnFault(t *testing.T) {
if runtime.GOARCH == "s390x" { if runtime.GOARCH == "s390x" {
t.Skip("s390x fault addresses are missing the low order bits") t.Skip("s390x fault addresses are missing the low order bits")
} }
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" { if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && runtime.GOARCH == "arm64" {
t.Skip("darwin/arm64 doesn't provide fault addresses") t.Skip("darwin/arm64 doesn't provide fault addresses")
} }
m, err := syscall.Mmap(-1, 0, 0x1000, syscall.PROT_READ /* Note: no PROT_WRITE */, syscall.MAP_SHARED|syscall.MAP_ANON) m, err := syscall.Mmap(-1, 0, 0x1000, syscall.PROT_READ /* Note: no PROT_WRITE */, syscall.MAP_SHARED|syscall.MAP_ANON)

View file

@ -44,6 +44,9 @@ func main() {
} }
for _, target := range gooses { for _, target := range gooses {
if target == "nacl" {
continue
}
var buf bytes.Buffer var buf bytes.Buffer
fmt.Fprintf(&buf, "// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.\n\n") fmt.Fprintf(&buf, "// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.\n\n")
if target == "linux" { if target == "linux" {
@ -52,6 +55,9 @@ func main() {
if target == "solaris" { if target == "solaris" {
fmt.Fprintf(&buf, "// +build !illumos\n") // must explicitly exclude illumos for solaris fmt.Fprintf(&buf, "// +build !illumos\n") // must explicitly exclude illumos for solaris
} }
if target == "darwin" {
fmt.Fprintf(&buf, "// +build !ios\n") // must explicitly exclude ios for darwin
}
fmt.Fprintf(&buf, "// +build %s\n\n", target) // must explicitly include target for bootstrapping purposes fmt.Fprintf(&buf, "// +build %s\n\n", target) // must explicitly include target for bootstrapping purposes
fmt.Fprintf(&buf, "package sys\n\n") fmt.Fprintf(&buf, "package sys\n\n")
fmt.Fprintf(&buf, "const GOOS = `%s`\n\n", target) fmt.Fprintf(&buf, "const GOOS = `%s`\n\n", target)
@ -69,6 +75,9 @@ func main() {
} }
for _, target := range goarches { for _, target := range goarches {
if target == "amd64p32" {
continue
}
var buf bytes.Buffer var buf bytes.Buffer
fmt.Fprintf(&buf, "// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.\n\n") fmt.Fprintf(&buf, "// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.\n\n")
fmt.Fprintf(&buf, "// +build %s\n\n", target) // must explicitly include target for bootstrapping purposes fmt.Fprintf(&buf, "// +build %s\n\n", target) // must explicitly include target for bootstrapping purposes

View file

@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0 const GoosFreebsd = 0
const GoosHurd = 0 const GoosHurd = 0
const GoosIllumos = 0 const GoosIllumos = 0
const GoosIos = 0
const GoosJs = 0 const GoosJs = 0
const GoosLinux = 0 const GoosLinux = 0
const GoosNacl = 0 const GoosNacl = 0

View file

@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0 const GoosFreebsd = 0
const GoosHurd = 0 const GoosHurd = 0
const GoosIllumos = 0 const GoosIllumos = 0
const GoosIos = 0
const GoosJs = 0 const GoosJs = 0
const GoosLinux = 0 const GoosLinux = 0
const GoosNacl = 0 const GoosNacl = 0

View file

@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT. // Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
// +build !ios
// +build darwin // +build darwin
package sys package sys
@ -13,6 +14,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0 const GoosFreebsd = 0
const GoosHurd = 0 const GoosHurd = 0
const GoosIllumos = 0 const GoosIllumos = 0
const GoosIos = 0
const GoosJs = 0 const GoosJs = 0
const GoosLinux = 0 const GoosLinux = 0
const GoosNacl = 0 const GoosNacl = 0

View file

@ -13,6 +13,7 @@ const GoosDragonfly = 1
const GoosFreebsd = 0 const GoosFreebsd = 0
const GoosHurd = 0 const GoosHurd = 0
const GoosIllumos = 0 const GoosIllumos = 0
const GoosIos = 0
const GoosJs = 0 const GoosJs = 0
const GoosLinux = 0 const GoosLinux = 0
const GoosNacl = 0 const GoosNacl = 0

View file

@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 1 const GoosFreebsd = 1
const GoosHurd = 0 const GoosHurd = 0
const GoosIllumos = 0 const GoosIllumos = 0
const GoosIos = 0
const GoosJs = 0 const GoosJs = 0
const GoosLinux = 0 const GoosLinux = 0
const GoosNacl = 0 const GoosNacl = 0

View file

@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0 const GoosFreebsd = 0
const GoosHurd = 1 const GoosHurd = 1
const GoosIllumos = 0 const GoosIllumos = 0
const GoosIos = 0
const GoosJs = 0 const GoosJs = 0
const GoosLinux = 0 const GoosLinux = 0
const GoosNacl = 0 const GoosNacl = 0

View file

@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0 const GoosFreebsd = 0
const GoosHurd = 0 const GoosHurd = 0
const GoosIllumos = 1 const GoosIllumos = 1
const GoosIos = 0
const GoosJs = 0 const GoosJs = 0
const GoosLinux = 0 const GoosLinux = 0
const GoosNacl = 0 const GoosNacl = 0

View file

@ -0,0 +1,25 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
// +build ios
package sys
const GOOS = `ios`
const GoosAix = 0
const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
const GoosIos = 1
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 0
const GoosOpenbsd = 0
const GoosPlan9 = 0
const GoosSolaris = 0
const GoosWindows = 0
const GoosZos = 0

View file

@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0 const GoosFreebsd = 0
const GoosHurd = 0 const GoosHurd = 0
const GoosIllumos = 0 const GoosIllumos = 0
const GoosIos = 0
const GoosJs = 1 const GoosJs = 1
const GoosLinux = 0 const GoosLinux = 0
const GoosNacl = 0 const GoosNacl = 0

View file

@ -14,6 +14,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0 const GoosFreebsd = 0
const GoosHurd = 0 const GoosHurd = 0
const GoosIllumos = 0 const GoosIllumos = 0
const GoosIos = 0
const GoosJs = 0 const GoosJs = 0
const GoosLinux = 1 const GoosLinux = 1
const GoosNacl = 0 const GoosNacl = 0

View file

@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0 const GoosFreebsd = 0
const GoosHurd = 0 const GoosHurd = 0
const GoosIllumos = 0 const GoosIllumos = 0
const GoosIos = 0
const GoosJs = 0 const GoosJs = 0
const GoosLinux = 0 const GoosLinux = 0
const GoosNacl = 0 const GoosNacl = 0

View file

@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0 const GoosFreebsd = 0
const GoosHurd = 0 const GoosHurd = 0
const GoosIllumos = 0 const GoosIllumos = 0
const GoosIos = 0
const GoosJs = 0 const GoosJs = 0
const GoosLinux = 0 const GoosLinux = 0
const GoosNacl = 0 const GoosNacl = 0

View file

@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0 const GoosFreebsd = 0
const GoosHurd = 0 const GoosHurd = 0
const GoosIllumos = 0 const GoosIllumos = 0
const GoosIos = 0
const GoosJs = 0 const GoosJs = 0
const GoosLinux = 0 const GoosLinux = 0
const GoosNacl = 0 const GoosNacl = 0

View file

@ -14,6 +14,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0 const GoosFreebsd = 0
const GoosHurd = 0 const GoosHurd = 0
const GoosIllumos = 0 const GoosIllumos = 0
const GoosIos = 0
const GoosJs = 0 const GoosJs = 0
const GoosLinux = 0 const GoosLinux = 0
const GoosNacl = 0 const GoosNacl = 0

View file

@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0 const GoosFreebsd = 0
const GoosHurd = 0 const GoosHurd = 0
const GoosIllumos = 0 const GoosIllumos = 0
const GoosIos = 0
const GoosJs = 0 const GoosJs = 0
const GoosLinux = 0 const GoosLinux = 0
const GoosNacl = 0 const GoosNacl = 0

View file

@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0 const GoosFreebsd = 0
const GoosHurd = 0 const GoosHurd = 0
const GoosIllumos = 0 const GoosIllumos = 0
const GoosIos = 0
const GoosJs = 0 const GoosJs = 0
const GoosLinux = 0 const GoosLinux = 0
const GoosNacl = 0 const GoosNacl = 0

View file

@ -207,7 +207,7 @@ const (
// arenaBaseOffset to offset into the top 4 GiB. // arenaBaseOffset to offset into the top 4 GiB.
// //
// WebAssembly currently has a limit of 4GB linear memory. // WebAssembly currently has a limit of 4GB linear memory.
heapAddrBits = (_64bit*(1-sys.GoarchWasm)*(1-sys.GoosDarwin*sys.GoarchArm64))*48 + (1-_64bit+sys.GoarchWasm)*(32-(sys.GoarchMips+sys.GoarchMipsle)) + 33*sys.GoosDarwin*sys.GoarchArm64 heapAddrBits = (_64bit*(1-sys.GoarchWasm)*(1-(sys.GoosDarwin+sys.GoosIos)*sys.GoarchArm64))*48 + (1-_64bit+sys.GoarchWasm)*(32-(sys.GoarchMips+sys.GoarchMipsle)) + 33*(sys.GoosDarwin+sys.GoosIos)*sys.GoarchArm64
// maxAlloc is the maximum size of an allocation. On 64-bit, // maxAlloc is the maximum size of an allocation. On 64-bit,
// it's theoretically possible to allocate 1<<heapAddrBits bytes. On // it's theoretically possible to allocate 1<<heapAddrBits bytes. On
@ -521,7 +521,7 @@ func mallocinit() {
for i := 0x7f; i >= 0; i-- { for i := 0x7f; i >= 0; i-- {
var p uintptr var p uintptr
switch { switch {
case GOARCH == "arm64" && GOOS == "darwin": case GOARCH == "arm64" && (GOOS == "darwin" || GOOS == "ios"):
p = uintptr(i)<<40 | uintptrMask&(0x0013<<28) p = uintptr(i)<<40 | uintptrMask&(0x0013<<28)
case GOARCH == "arm64": case GOARCH == "arm64":
p = uintptr(i)<<40 | uintptrMask&(0x0040<<32) p = uintptr(i)<<40 | uintptrMask&(0x0040<<32)

View file

@ -90,7 +90,7 @@ const (
// //
// This ratio is used as part of multiplicative factor to help the scavenger account // This ratio is used as part of multiplicative factor to help the scavenger account
// for the additional costs of using scavenged memory in its pacing. // for the additional costs of using scavenged memory in its pacing.
scavengeCostRatio = 0.7 * sys.GoosDarwin scavengeCostRatio = 0.7 * (sys.GoosDarwin + sys.GoosIos)
// scavengeReservationShards determines the amount of memory the scavenger // scavengeReservationShards determines the amount of memory the scavenger
// should reserve for scavenging at a time. Specifically, the amount of // should reserve for scavenging at a time. Specifically, the amount of

View file

@ -361,6 +361,9 @@ func genARM64() {
p("#ifdef GOOS_darwin") p("#ifdef GOOS_darwin")
p("MOVD R30, (RSP)") p("MOVD R30, (RSP)")
p("#endif") p("#endif")
p("#ifdef GOOS_ios")
p("MOVD R30, (RSP)")
p("#endif")
l.save() l.save()
p("CALL ·asyncPreempt2(SB)") p("CALL ·asyncPreempt2(SB)")

View file

@ -19,7 +19,7 @@ func addMaxRSS(w io.Writer) {
switch runtime.GOOS { switch runtime.GOOS {
case "linux", "android": case "linux", "android":
rssToBytes = 1024 rssToBytes = 1024
case "darwin": case "darwin", "ios":
rssToBytes = 1 rssToBytes = 1
default: default:
panic("unsupported OS") panic("unsupported OS")

View file

@ -262,7 +262,7 @@ func parseProfile(t *testing.T, valBytes []byte, f func(uintptr, []*profile.Loca
// as interpreted by matches, and returns the parsed profile. // as interpreted by matches, and returns the parsed profile.
func testCPUProfile(t *testing.T, matches matchFunc, need []string, avoid []string, f func(dur time.Duration)) *profile.Profile { func testCPUProfile(t *testing.T, matches matchFunc, need []string, avoid []string, f func(dur time.Duration)) *profile.Profile {
switch runtime.GOOS { switch runtime.GOOS {
case "darwin": case "darwin", "ios":
switch runtime.GOARCH { switch runtime.GOARCH {
case "arm64": case "arm64":
// nothing // nothing
@ -280,7 +280,7 @@ func testCPUProfile(t *testing.T, matches matchFunc, need []string, avoid []stri
broken := false broken := false
switch runtime.GOOS { switch runtime.GOOS {
case "darwin", "dragonfly", "netbsd", "illumos", "solaris": case "darwin", "ios", "dragonfly", "netbsd", "illumos", "solaris":
broken = true broken = true
case "openbsd": case "openbsd":
if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" { if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" {

View file

@ -13,6 +13,9 @@ TEXT ·asyncPreempt(SB),NOSPLIT|NOFRAME,$0-0
#ifdef GOOS_darwin #ifdef GOOS_darwin
MOVD R30, (RSP) MOVD R30, (RSP)
#endif #endif
#ifdef GOOS_ios
MOVD R30, (RSP)
#endif
MOVD R0, 8(RSP) MOVD R0, 8(RSP)
MOVD R1, 16(RSP) MOVD R1, 16(RSP)
MOVD R2, 24(RSP) MOVD R2, 24(RSP)

View file

@ -503,7 +503,7 @@ func cpuinit() {
var env string var env string
switch GOOS { switch GOOS {
case "aix", "darwin", "dragonfly", "freebsd", "netbsd", "openbsd", "illumos", "solaris", "linux": case "aix", "darwin", "ios", "dragonfly", "freebsd", "netbsd", "openbsd", "illumos", "solaris", "linux":
cpu.DebugOptions = true cpu.DebugOptions = true
// Similar to goenv_unix but extracts the environment value for // Similar to goenv_unix but extracts the environment value for
@ -1158,7 +1158,7 @@ func mstart() {
// Exit this thread. // Exit this thread.
switch GOOS { switch GOOS {
case "windows", "solaris", "illumos", "plan9", "darwin", "aix": case "windows", "solaris", "illumos", "plan9", "darwin", "ios", "aix":
// Windows, Solaris, illumos, Darwin, AIX and Plan 9 always system-allocate // Windows, Solaris, illumos, Darwin, AIX and Plan 9 always system-allocate
// the stack, but put it in _g_.stack before mstart, // the stack, but put it in _g_.stack before mstart,
// so the logic above hasn't set osStack yet. // so the logic above hasn't set osStack yet.
@ -1487,7 +1487,7 @@ func allocm(_p_ *p, fn func(), id int64) *m {
// In case of cgo or Solaris or illumos or Darwin, pthread_create will make us a stack. // In case of cgo or Solaris or illumos or Darwin, pthread_create will make us a stack.
// Windows and Plan 9 will layout sched stack on OS stack. // Windows and Plan 9 will layout sched stack on OS stack.
if iscgo || GOOS == "solaris" || GOOS == "illumos" || GOOS == "windows" || GOOS == "plan9" || GOOS == "darwin" { if iscgo || GOOS == "solaris" || GOOS == "illumos" || GOOS == "windows" || GOOS == "plan9" || GOOS == "darwin" || GOOS == "ios" {
mp.g0 = malg(-1) mp.g0 = malg(-1)
} else { } else {
mp.g0 = malg(8192 * sys.StackGuardMultiplier) mp.g0 = malg(8192 * sys.StackGuardMultiplier)
@ -4077,7 +4077,7 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) {
// Normal traceback is impossible or has failed. // Normal traceback is impossible or has failed.
// See if it falls into several common cases. // See if it falls into several common cases.
n = 0 n = 0
if (GOOS == "windows" || GOOS == "solaris" || GOOS == "illumos" || GOOS == "darwin" || GOOS == "aix") && mp.libcallg != 0 && mp.libcallpc != 0 && mp.libcallsp != 0 { if (GOOS == "windows" || GOOS == "solaris" || GOOS == "illumos" || GOOS == "darwin" || GOOS == "ios" || GOOS == "aix") && mp.libcallg != 0 && mp.libcallpc != 0 && mp.libcallsp != 0 {
// Libcall, i.e. runtime syscall on windows. // Libcall, i.e. runtime syscall on windows.
// Collect Go stack that leads to the call. // Collect Go stack that leads to the call.
n = gentraceback(mp.libcallpc, mp.libcallsp, 0, mp.libcallg.ptr(), 0, &stk[0], len(stk), nil, nil, 0) n = gentraceback(mp.libcallpc, mp.libcallsp, 0, mp.libcallg.ptr(), 0, &stk[0], len(stk), nil, nil, 0)

View file

@ -1060,4 +1060,4 @@ var (
) )
// Must agree with cmd/internal/objabi.Framepointer_enabled. // Must agree with cmd/internal/objabi.Framepointer_enabled.
const framepointer_enabled = GOARCH == "amd64" || GOARCH == "arm64" && (GOOS == "linux" || GOOS == "darwin") const framepointer_enabled = GOARCH == "amd64" || GOARCH == "arm64" && (GOOS == "linux" || GOOS == "darwin" || GOOS == "ios")

View file

@ -346,7 +346,7 @@ const preemptMSupported = true
// safe-point, it will preempt the goroutine. It always atomically // safe-point, it will preempt the goroutine. It always atomically
// increments mp.preemptGen after handling a preemption request. // increments mp.preemptGen after handling a preemption request.
func preemptM(mp *m) { func preemptM(mp *m) {
if GOOS == "darwin" && GOARCH == "arm64" && !iscgo { if (GOOS == "darwin" || GOOS == "ios") && GOARCH == "arm64" && !iscgo {
// On darwin, we use libc calls, and cgo is required on ARM64 // On darwin, we use libc calls, and cgo is required on ARM64
// so we have TLS set up to save/restore G during C calls. If cgo is // so we have TLS set up to save/restore G during C calls. If cgo is
// absent, we cannot save/restore G in TLS, and if a signal is // absent, we cannot save/restore G in TLS, and if a signal is
@ -975,7 +975,7 @@ func sigfwdgo(sig uint32, info *siginfo, ctx unsafe.Pointer) bool {
// This function and its caller sigtrampgo assumes SIGPIPE is delivered on the // This function and its caller sigtrampgo assumes SIGPIPE is delivered on the
// originating thread. This property does not hold on macOS (golang.org/issue/33384), // originating thread. This property does not hold on macOS (golang.org/issue/33384),
// so we have no choice but to ignore SIGPIPE. // so we have no choice but to ignore SIGPIPE.
if GOOS == "darwin" && sig == _SIGPIPE { if (GOOS == "darwin" || GOOS == "ios") && sig == _SIGPIPE {
return true return true
} }

View file

@ -105,7 +105,7 @@ Send:
break Send break Send
case sigReceiving: case sigReceiving:
if atomic.Cas(&sig.state, sigReceiving, sigIdle) { if atomic.Cas(&sig.state, sigReceiving, sigIdle) {
if GOOS == "darwin" { if GOOS == "darwin" || GOOS == "ios" {
sigNoteWakeup(&sig.note) sigNoteWakeup(&sig.note)
break Send break Send
} }
@ -140,7 +140,7 @@ func signal_recv() uint32 {
throw("signal_recv: inconsistent state") throw("signal_recv: inconsistent state")
case sigIdle: case sigIdle:
if atomic.Cas(&sig.state, sigIdle, sigReceiving) { if atomic.Cas(&sig.state, sigIdle, sigReceiving) {
if GOOS == "darwin" { if GOOS == "darwin" || GOOS == "ios" {
sigNoteSleep(&sig.note) sigNoteSleep(&sig.note)
break Receive break Receive
} }
@ -194,7 +194,7 @@ func signal_enable(s uint32) {
if !sig.inuse { if !sig.inuse {
// This is the first call to signal_enable. Initialize. // This is the first call to signal_enable. Initialize.
sig.inuse = true // enable reception of signals; cannot disable sig.inuse = true // enable reception of signals; cannot disable
if GOOS == "darwin" { if GOOS == "darwin" || GOOS == "ios" {
sigNoteSetup(&sig.note) sigNoteSetup(&sig.note)
} else { } else {
noteclear(&sig.note) noteclear(&sig.note)

View file

@ -66,7 +66,7 @@ const (
// to each stack below the usual guard area for OS-specific // to each stack below the usual guard area for OS-specific
// purposes like signal handling. Used on Windows, Plan 9, // purposes like signal handling. Used on Windows, Plan 9,
// and iOS because they do not use a separate stack. // and iOS because they do not use a separate stack.
_StackSystem = sys.GoosWindows*512*sys.PtrSize + sys.GoosPlan9*512 + sys.GoosDarwin*sys.GoarchArm64*1024 _StackSystem = sys.GoosWindows*512*sys.PtrSize + sys.GoosPlan9*512 + (sys.GoosDarwin+sys.GoosIos)*sys.GoarchArm64*1024
// The minimum size of stack used by Go code // The minimum size of stack used by Go code
_StackMin = 2048 _StackMin = 2048

View file

@ -15,6 +15,12 @@
#endif #endif
#ifdef GOOS_darwin #ifdef GOOS_darwin
#define TLS_darwin
#endif
#ifdef GOOS_ios
#define TLS_darwin
#endif
#ifdef TLS_darwin
#define TPIDR TPIDRRO_EL0 #define TPIDR TPIDRRO_EL0
#define TLSG_IS_VARIABLE #define TLSG_IS_VARIABLE
#define MRS_TPIDR_R0 WORD $0xd53bd060 // MRS TPIDRRO_EL0, R0 #define MRS_TPIDR_R0 WORD $0xd53bd060 // MRS TPIDRRO_EL0, R0

View file

@ -13,7 +13,7 @@ TEXT runtime·load_g(SB),NOSPLIT,$0
CBZ R0, nocgo CBZ R0, nocgo
MRS_TPIDR_R0 MRS_TPIDR_R0
#ifdef GOOS_darwin #ifdef TLS_darwin
// Darwin sometimes returns unaligned pointers // Darwin sometimes returns unaligned pointers
AND $0xfffffffffffffff8, R0 AND $0xfffffffffffffff8, R0
#endif #endif
@ -29,7 +29,7 @@ TEXT runtime·save_g(SB),NOSPLIT,$0
CBZ R0, nocgo CBZ R0, nocgo
MRS_TPIDR_R0 MRS_TPIDR_R0
#ifdef GOOS_darwin #ifdef TLS_darwin
// Darwin sometimes returns unaligned pointers // Darwin sometimes returns unaligned pointers
AND $0xfffffffffffffff8, R0 AND $0xfffffffffffffff8, R0
#endif #endif

View file

@ -296,7 +296,7 @@ func Exec(argv0 string, argv []string, envv []string) (err error) {
uintptr(unsafe.Pointer(argv0p)), uintptr(unsafe.Pointer(argv0p)),
uintptr(unsafe.Pointer(&argvp[0])), uintptr(unsafe.Pointer(&argvp[0])),
uintptr(unsafe.Pointer(&envvp[0]))) uintptr(unsafe.Pointer(&envvp[0])))
} else if runtime.GOOS == "darwin" { } else if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
// Similarly on Darwin. // Similarly on Darwin.
err1 = execveDarwin(argv0p, &argvp[0], &envvp[0]) err1 = execveDarwin(argv0p, &argvp[0], &envvp[0])
} else { } else {

View file

@ -20,7 +20,7 @@ func cmsgAlignOf(salen int) int {
case "aix": case "aix":
// There is no alignment on AIX. // There is no alignment on AIX.
salign = 1 salign = 1
case "darwin", "illumos", "solaris": case "darwin", "ios", "illumos", "solaris":
// NOTE: It seems like 64-bit Darwin, Illumos and Solaris // NOTE: It seems like 64-bit Darwin, Illumos and Solaris
// kernels still require 32-bit aligned access to network // kernels still require 32-bit aligned access to network
// subsystem. // subsystem.

View file

@ -277,7 +277,7 @@ func Accept(fd int) (nfd int, sa Sockaddr, err error) {
if err != nil { if err != nil {
return return
} }
if runtime.GOOS == "darwin" && len == 0 { if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && len == 0 {
// Accepted socket has no address. // Accepted socket has no address.
// This is likely due to a bug in xnu kernels, // This is likely due to a bug in xnu kernels,
// where instead of ECONNABORTED error socket // where instead of ECONNABORTED error socket

View file

@ -22,7 +22,7 @@ var (
) )
const ( const (
darwin64Bit = runtime.GOOS == "darwin" && sizeofPtr == 8 darwin64Bit = (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && sizeofPtr == 8
netbsd32Bit = runtime.GOOS == "netbsd" && sizeofPtr == 4 netbsd32Bit = runtime.GOOS == "netbsd" && sizeofPtr == 4
) )

View file

@ -70,7 +70,7 @@ func _() {
// Thus this test also verifies that the Flock_t structure can be // Thus this test also verifies that the Flock_t structure can be
// roundtripped with F_SETLK and F_GETLK. // roundtripped with F_SETLK and F_GETLK.
func TestFcntlFlock(t *testing.T) { func TestFcntlFlock(t *testing.T) {
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" { if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && runtime.GOARCH == "arm64" {
t.Skip("skipping; no child processes allowed on iOS") t.Skip("skipping; no child processes allowed on iOS")
} }
flock := syscall.Flock_t{ flock := syscall.Flock_t{
@ -336,7 +336,7 @@ func TestRlimit(t *testing.T) {
} }
set := rlimit set := rlimit
set.Cur = set.Max - 1 set.Cur = set.Max - 1
if runtime.GOOS == "darwin" && set.Cur > 4096 { if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && set.Cur > 4096 {
// rlim_min for RLIMIT_NOFILE should be equal to // rlim_min for RLIMIT_NOFILE should be equal to
// or lower than kern.maxfilesperproc, which on // or lower than kern.maxfilesperproc, which on
// some machines are 4096. See #40564. // some machines are 4096. See #40564.
@ -353,7 +353,7 @@ func TestRlimit(t *testing.T) {
} }
set = rlimit set = rlimit
set.Cur = set.Max - 1 set.Cur = set.Max - 1
if runtime.GOOS == "darwin" && set.Cur > 4096 { if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && set.Cur > 4096 {
set.Cur = 4096 set.Cur = 4096
} }
if set != get { if set != get {

View file

@ -21,7 +21,7 @@ func TestTicker(t *testing.T) {
delta := 20 * Millisecond delta := 20 * Millisecond
// On Darwin ARM64 the tick frequency seems limited. Issue 35692. // On Darwin ARM64 the tick frequency seems limited. Issue 35692.
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" { if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && runtime.GOARCH == "arm64" {
// The following test will run ticker count/2 times then reset // The following test will run ticker count/2 times then reset
// the ticker to double the duration for the rest of count/2. // the ticker to double the duration for the rest of count/2.
// Since tick frequency is limited on Darwin ARM64, use even // Since tick frequency is limited on Darwin ARM64, use even

View file

@ -2,9 +2,6 @@
// 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.
// +build darwin
// +build arm64
package time package time
import ( import (