<p>
Choices for <code>$GOOS</code> are
-<code>android</code>, <code>darwin</code> (macOS/iOS),
-<code>dragonfly</code>, <code>freebsd</code>, <code>illumos</code>, <code>js</code>,
+<code>android</code>, <code>darwin</code>, <code>dragonfly</code>,
+<code>freebsd</code>, <code>illumos</code>, <code>ios</code>, <code>js</code>,
<code>linux</code>, <code>netbsd</code>, <code>openbsd</code>,
<code>plan9</code>, <code>solaris</code> and <code>windows</code>.
</p>
<td></td><td><code>illumos</code></td> <td><code>amd64</code></td>
</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>
</tr>
<tr>
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)
}
switch runtime.GOOS {
case "android":
t.Skip("Can't exec cmd/go subprocess on Android.")
- case "darwin":
+ case "darwin", "ios":
switch runtime.GOARCH {
case "arm64":
t.Skip("Can't exec cmd/go subprocess on iOS.")
func testSigaltstack(t *testing.T) {
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)
}
var sink C.int
func test17065(t *testing.T) {
- if runtime.GOOS == "darwin" {
+ if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
t.Skip("broken on darwin; issue 17065")
}
for i := range C.ii {
}
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")
}
sum.i = 0
cc = append(cc, s[start:])
}
- if GOOS == "darwin" {
+ if GOOS == "darwin" || GOOS == "ios" {
// For Darwin/ARM.
- // TODO(crawshaw): can we do better?
+ // TODO: do we still need this?
cc = append(cc, []string{"-framework", "CoreFoundation", "-framework", "Foundation"}...)
}
if GOOS == "aix" {
libbase = "gccgo_" + libgodir + "_fPIC"
} else {
switch GOOS {
- case "darwin":
+ case "darwin", "ios":
if GOARCH == "arm64" {
libbase += "_shared"
}
func TestEarlySignalHandler(t *testing.T) {
switch GOOS {
- case "darwin":
+ case "darwin", "ios":
switch GOARCH {
case "arm64":
t.Skipf("skipping on %s/%s; see https://golang.org/issue/13701", GOOS, GOARCH)
expectSignal(t, err, syscall.SIGSEGV)
// 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
cmd = exec.Command(bin[0], append(bin[1:], "3")...)
// doesn't work on this platform.
func checkSignalForwardingTest(t *testing.T) {
switch GOOS {
- case "darwin":
+ case "darwin", "ios":
switch GOARCH {
case "arm64":
t.Skipf("skipping on %s/%s; see https://golang.org/issue/13701", GOOS, GOARCH)
if runtime.Compiler == "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")
}
func TestPIE(t *testing.T) {
switch GOOS {
- case "windows", "darwin", "plan9":
+ case "windows", "darwin", "ios", "plan9":
t.Skipf("skipping PIE test on %s", GOOS)
}
switch GOOS {
case "windows", "plan9":
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)
}
expectSignal(t, err, syscall.SIGSEGV)
// 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")
t.Log(binArgs)
out, err = exec.Command(binArgs[0], binArgs[1:]...).CombinedOutput()
}
switch GOOS {
- case "darwin":
+ case "darwin", "ios":
// For Darwin/ARM.
// TODO(crawshaw): can we do better?
cc = append(cc, []string{"-framework", "CoreFoundation", "-framework", "Foundation"}...)
}
libgodir := GOOS + "_" + GOARCH
switch GOOS {
- case "darwin":
+ case "darwin", "ios":
if GOARCH == "arm64" {
libgodir += "_shared"
}
adbPush(t, libname)
linkFlags := "-Wl,--no-as-needed"
- if GOOS == "darwin" {
+ if GOOS == "darwin" || GOOS == "ios" {
linkFlags = ""
}
func TestGo2C2Go(t *testing.T) {
switch GOOS {
- case "darwin":
+ case "darwin", "ios":
// Darwin shared libraries don't support the multiple
// copies of the runtime package implied by this test.
t.Skip("linking c-shared into Go programs not supported on Darwin; issue 29061")
t.Helper()
switch runtime.GOARCH {
case "arm64":
- if runtime.GOOS == "darwin" {
+ if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
t.Skip("No exec facility on iOS.")
}
case "ppc64":
ext := "so"
args := append(gogccflags, "-shared")
switch runtime.GOOS {
- case "darwin":
+ case "darwin", "ios":
ext = "dylib"
args = append(args, "-undefined", "suppress", "-flat_namespace")
case "windows":
cmd.Env = append(os.Environ(), "GOPATH="+GOPATH)
if runtime.GOOS != "windows" {
s := "LD_LIBRARY_PATH"
- if runtime.GOOS == "darwin" {
+ if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
s = "DYLD_LIBRARY_PATH"
}
cmd.Env = append(os.Environ(), s+"=.")
t.Helper()
switch runtime.GOARCH {
case "arm64":
- if runtime.GOOS == "darwin" {
+ if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
t.Skip("No exec facility on iOS.")
}
case "ppc64":
ext := "so"
args := append(gogccflags, "-shared")
switch runtime.GOOS {
- case "darwin":
+ case "darwin", "ios":
ext = "dylib"
args = append(args, "-undefined", "suppress", "-flat_namespace")
case "windows":
cmd.Env = append(os.Environ(), "GOPATH="+GOPATH)
if runtime.GOOS != "windows" {
s := "LD_LIBRARY_PATH"
- if runtime.GOOS == "darwin" {
+ if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
s = "DYLD_LIBRARY_PATH"
}
cmd.Env = append(os.Environ(), s+"=.")
minor := uint32((dev & 0x00000000000000ff) >> 0)
minor |= uint32((dev & 0x00000ffffff00000) >> 12)
h.Devmajor, h.Devminor = int64(major), int64(minor)
- case "darwin":
+ case "darwin", "ios":
// Copied from golang.org/x/sys/unix/dev_darwin.go.
major := uint32((dev >> 24) & 0xff)
minor := uint32(dev & 0xffffff)
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.
s := n.C[:len(n.C)-3] + "GetTypeID"
n := &Name{Go: s, C: s}
// We identify the correct set of types as those ending in Ref and for which
// there exists a corresponding GetTypeID function.
// See comment below for details about the bad pointers.
- if goos != "darwin" {
+ if goos != "darwin" && goos != "ios" {
return false
}
s := dt.Name
"cmd/internal/objabi"
)
-var darwin = objabi.GOOS == "darwin"
+var darwin = objabi.GOOS == "darwin" || objabi.GOOS == "ios"
func padframe(frame int64) int64 {
// arm64 requires that the frame size (not counting saved FP&LR)
c.FPReg = framepointerRegARM64
c.LinkReg = linkRegARM64
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":
c.BigEndian = true
fallthrough
"darwin",
"dragonfly",
"illumos",
+ "ios",
"js",
"linux",
"android",
}
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.
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)
if gohostos != "android" {
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" {
return pathf("%s/misc/ios/go_darwin_arm_exec.go", goroot)
}
"android/amd64": true,
"android/arm": true,
"android/arm64": true,
+ "ios/arm64": true,
"js/wasm": false,
"netbsd/386": true,
"netbsd/amd64": true,
}
// 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{
name: "amd64ios",
heading: "ios tag on darwin/amd64",
}
func (t *tester) iOS() bool {
- return goos == "darwin" && goarch == "arm64"
+ return (goos == "darwin" || goos == "ios") && goarch == "arm64"
}
func (t *tester) out(v string) {
if goos == "android" {
return false
}
- if t.iOS() {
+ if goos == "ios" {
+ return false
+ }
+ if goos == "darwin" && goarch == "arm64" {
return false
}
// Internally linking cgo is incomplete on some architectures.
}
func maybeSkip(t *testing.T) {
- if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
- t.Skip("darwin/arm64 does not have a full file tree")
+ if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && runtime.GOARCH == "arm64" {
+ t.Skip("iOS does not have a full file tree")
}
}
// Using GOOS=illumos matches build tags and files as for GOOS=solaris
// 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:
//
// // +build ignore
switch runtime.GOOS {
case "android", "js":
canRun = false
- case "darwin":
+ case "darwin", "ios":
switch runtime.GOARCH {
case "arm64":
canRun = false
func printOSDetails(w io.Writer) {
switch runtime.GOOS {
- case "darwin":
+ case "darwin", "ios":
printCmdOut(w, "uname -v: ", "uname", "-v")
printCmdOut(w, "", "sw_vers")
case "linux":
Using GOOS=illumos matches build tags and files as for GOOS=solaris
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:
// +build ignore
if name == "solaris" {
have = have || tags["illumos"]
}
+ if name == "darwin" {
+ have = have || tags["ios"]
+ }
return have == want
}
// 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.
//
// If tags["*"] is true, then MatchFile will consider all possible
// GOOS and GOARCH to be available and will consequently
"freebsd": true,
"hurd": true,
"illumos": true,
+ "ios": true,
"js": true,
"linux": true,
"nacl": true, // legacy; don't remove
if cfg.BuildContext.GOARCH != "arm64" {
return true
}
- case "darwin":
+ case "darwin", "ios":
if cfg.BuildContext.GOARCH == "arm64" {
return true
}
// See https://golang.org/issue/18878.
func TestRespectSetgidDir(t *testing.T) {
switch runtime.GOOS {
- case "darwin":
+ case "darwin", "ios":
if runtime.GOARCH == "arm64" {
t.Skip("can't set SetGID bit with chmod on iOS")
}
// 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.
// See https://golang.org/issue/3253.
- if cfg.Goos == "darwin" {
+ if cfg.Goos == "darwin" || cfg.Goos == "ios" {
a = append(a, "-fno-common")
}
codegenArg = "-fPIC"
} else {
switch cfg.Goos {
- case "darwin":
+ case "darwin", "ios":
switch cfg.Goarch {
case "arm64":
codegenArg = "-shared"
ldBuildmode = "pie"
case "windows":
ldBuildmode = "pie"
- case "darwin":
+ case "darwin", "ios":
switch cfg.Goarch {
case "arm64":
codegenArg = "-shared"
c1 := "c1"
c2 := "c2"
switch runtime.GOOS {
- case "darwin":
+ case "darwin", "ios":
c1 = "_" + c1
c2 = "_" + c2
case "windows":
obj := io.NewSectionReader(f, e.Offset, e.Size)
switch runtime.GOOS {
- case "darwin":
+ case "darwin", "ios":
mf, err := macho.NewFile(obj)
if err != nil {
t.Fatal(err)
return form
}
expandedForm := DW_FORM_udata
- if objabi.GOOS == "darwin" {
+ if objabi.GOOS == "darwin" || objabi.GOOS == "ios" {
expandedForm = DW_FORM_data4
}
return uint8(expandedForm)
switch s {
case "aix":
*h = Haix
- case "darwin":
+ case "darwin", "ios":
*h = Hdarwin
case "dragonfly":
*h = Hdragonfly
}
// 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) {
// Could do general integer parsing here, but the runtime copy doesn't yet.
if goarch != "arm64" {
return true
}
- case "darwin":
+ case "darwin", "ios":
if goarch == "arm64" {
return true
}
// For Mach-O and PE/386 files we strip a leading
// 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 {
name = name[1:]
}
*mode = BuildModePIE
case "c-archive":
switch objabi.GOOS {
- case "aix", "darwin", "linux":
+ case "aix", "darwin", "ios", "linux":
case "freebsd":
switch objabi.GOARCH {
case "amd64":
switch runtime.GOOS {
default:
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")
if err != nil {
if iscgo {
syms = append(syms, symType{"B", "mylib.TestCgodata", 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{"T", "_cgofunc", true, false})
} else if runtime.GOOS == "aix" {
// +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
// certificates.
)
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")
flag.Parse()
if *version == "" {
func TestNoSectionOverlaps(t *testing.T) {
// Ensure cmd/link outputs sections without overlaps.
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)
}
_ = net.ResolveIPAddr // force dynamic linkage
if ctxt.GOOS == "illumos" && name == "solaris" {
return true
}
+ if ctxt.GOOS == "ios" && name == "darwin" {
+ return true
+ }
// other tags
for _, tag := range ctxt.BuildTags {
// name_$(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 {
if dot := strings.Index(name, "."); dot != -1 {
name = name[:dot]
}
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)
}
}
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)
}
// 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.
-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 "
)
func anotherOS() string {
- if thisOS != "darwin" {
+ if thisOS != "darwin" && thisOS != "ios" {
return "darwin"
}
return "linux"
func specialFiles() []string {
var ps []string
switch runtime.GOOS {
- case "darwin", "dragonfly", "freebsd", "netbsd", "openbsd":
+ case "darwin", "ios", "dragonfly", "freebsd", "netbsd", "openbsd":
ps = []string{
"/dev/null",
}
switch runtime.GOOS {
case "android", "js":
return false
- case "darwin":
+ case "darwin", "ios":
if runtime.GOARCH == "arm64" {
return false
}
switch runtime.GOOS {
case "js":
return false
- case "darwin":
+ case "darwin", "ios":
if runtime.GOARCH == "arm64" {
return false
}
// HasSrc reports whether the entire source tree is available under GOROOT.
func HasSrc() bool {
switch runtime.GOOS {
- case "darwin":
+ case "darwin", "ios":
if runtime.GOARCH == "arm64" {
return false
}
switch network {
case "unix", "unixgram":
switch runtime.GOOS {
- case "darwin":
+ case "darwin", "ios":
switch runtime.GOARCH {
case "arm64":
return false
// Darwin pops up annoying dialog boxes if programs try to do
// their own DNS requests. So always use cgo instead, which
// avoids that.
- if runtime.GOOS == "darwin" {
+ if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
confVal.forceCgoLookupHost = true
return
}
// but other platforms should be instantaneous.
if runtime.GOOS == "windows" {
expected = 1500 * time.Millisecond
- } else if runtime.GOOS == "darwin" {
+ } else if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
expected = 150 * time.Millisecond
} else {
expected = 95 * time.Millisecond
// except that it won't skip testing on non-mobile builders.
func mustHaveExternalNetwork(t *testing.T) {
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 {
testenv.MustHaveExternalNetwork(t)
}
var osDefaultInheritEnv = func() []string {
switch runtime.GOOS {
- case "darwin":
+ case "darwin", "ios":
return []string{"DYLD_LIBRARY_PATH"}
case "linux", "freebsd", "openbsd":
return []string{"LD_LIBRARY_PATH"}
if testing.Short() {
t.Skip("avoid external network")
}
- if runtime.GOOS == "darwin" {
+ if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
t.Skipf("not supported on %s", runtime.GOOS)
}
if os.Getuid() != 0 {
defer dnsWaitGroup.Wait()
var N = 5000
- if runtime.GOOS == "darwin" {
+ if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
// On Darwin this test consumes kernel threads much
// than other platforms for some reason.
// When we monitor the number of allocated Ms by
}
func TestLookupDotsWithRemoteSource(t *testing.T) {
- if runtime.GOOS == "darwin" {
+ if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
testenv.SkipFlaky(t, 27992)
}
mustHaveExternalNetwork(t)
{"udp6", "[" + addr + "%" + ifi.Name + "]:0", false},
}...)
switch runtime.GOOS {
- case "darwin", "dragonfly", "freebsd", "openbsd", "netbsd":
+ case "darwin", "ios", "dragonfly", "freebsd", "openbsd", "netbsd":
ipv6LinkLocalUnicastTCPTests = append(ipv6LinkLocalUnicastTCPTests, []ipv6LinkLocalUnicastTest{
{"tcp", "[localhost%" + ifi.Name + "]:0", true},
{"tcp6", "[localhost%" + ifi.Name + "]:0", true},
}
case "unixpacket":
switch runtime.GOOS {
- case "aix", "android", "darwin", "plan9", "windows":
+ case "aix", "android", "darwin", "ios", "plan9", "windows":
return false
case "netbsd":
// It passes on amd64 at least. 386 fails (Issue 22927). arm is unknown.
}
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
err error
)
switch runtime.GOOS {
- case "darwin":
+ case "darwin", "ios":
n, err = syscall.SysctlUint32("kern.ipc.somaxconn")
case "freebsd":
n, err = syscall.SysctlUint32("kern.ipc.soacceptqueue")
n = 1000
}
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
// out that there is nothing listening on localhost.
n = 100
switch runtime.GOOS {
case "plan9":
t.Skipf("not supported on %s", runtime.GOOS)
- case "darwin":
+ case "darwin", "ios":
testenv.SkipFlaky(t, 29225)
}
var wantSum int
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
wantSum = want.Len()
v := chunks
// used with kqueue.
if kind == kindOpenFile {
switch runtime.GOOS {
- case "darwin", "dragonfly", "freebsd", "netbsd", "openbsd":
+ case "darwin", "ios", "dragonfly", "freebsd", "netbsd", "openbsd":
var st syscall.Stat_t
err := ignoringEINTR(func() error {
return syscall.Fstat(fdi, &st)
// on Darwin, kqueue does not work properly with fifos:
// closing the last writer does not cause a kqueue event
// 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
}
}
"libpowermanager.so",
},
}
- case "darwin":
+ case "darwin", "ios":
switch runtime.GOARCH {
case "arm64":
wd, err := syscall.Getwd()
switch runtime.GOOS {
case "android", "windows":
return TempDir()
- case "darwin":
+ case "darwin", "ios":
switch runtime.GOARCH {
case "arm64":
return TempDir()
switch runtime.GOOS {
case "android":
dir = "/system/bin"
- case "darwin":
+ case "darwin", "ios":
switch runtime.GOARCH {
case "arm64":
wd, err := Getwd()
dirs = []string{"/system/bin"}
case "plan9":
dirs = []string{"/", "/usr"}
- case "darwin":
+ case "darwin", "ios":
switch runtime.GOARCH {
case "arm64":
dirs = nil
switch runtime.GOOS {
case "android", "plan9", "windows":
t.Skipf("skipping on %s", runtime.GOOS)
- case "darwin":
+ case "darwin", "ios":
switch runtime.GOARCH {
case "arm64":
t.Skipf("skipping on darwin/arm64, mkdir returns EPERM")
func TestRemoveAllLongPath(t *testing.T) {
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
default:
t.Skip("skipping for not implemented platforms")
}
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)
defer restore()
}
}
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)
}
root, err := filepath.EvalSymlinks(runtime.GOROOT() + "/test")
if runtime.GOARCH == "s390x" {
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")
}
m, err := syscall.Mmap(-1, 0, 0x1000, syscall.PROT_READ /* Note: no PROT_WRITE */, syscall.MAP_SHARED|syscall.MAP_ANON)
}
for _, target := range gooses {
+ if target == "nacl" {
+ continue
+ }
var buf bytes.Buffer
fmt.Fprintf(&buf, "// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.\n\n")
if target == "linux" {
if target == "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, "package sys\n\n")
fmt.Fprintf(&buf, "const GOOS = `%s`\n\n", target)
}
for _, target := range goarches {
+ if target == "amd64p32" {
+ continue
+ }
var buf bytes.Buffer
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
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+// +build !ios
// +build darwin
package sys
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosFreebsd = 1
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosFreebsd = 0
const GoosHurd = 1
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 1
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
--- /dev/null
+// 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
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 1
const GoosLinux = 0
const GoosNacl = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 1
const GoosNacl = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
// arenaBaseOffset to offset into the top 4 GiB.
//
// 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,
// it's theoretically possible to allocate 1<<heapAddrBits bytes. On
for i := 0x7f; i >= 0; i-- {
var p uintptr
switch {
- case GOARCH == "arm64" && GOOS == "darwin":
+ case GOARCH == "arm64" && (GOOS == "darwin" || GOOS == "ios"):
p = uintptr(i)<<40 | uintptrMask&(0x0013<<28)
case GOARCH == "arm64":
p = uintptr(i)<<40 | uintptrMask&(0x0040<<32)
//
// 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.
- scavengeCostRatio = 0.7 * sys.GoosDarwin
+ scavengeCostRatio = 0.7 * (sys.GoosDarwin + sys.GoosIos)
// scavengeReservationShards determines the amount of memory the scavenger
// should reserve for scavenging at a time. Specifically, the amount of
p("#ifdef GOOS_darwin")
p("MOVD R30, (RSP)")
p("#endif")
+ p("#ifdef GOOS_ios")
+ p("MOVD R30, (RSP)")
+ p("#endif")
l.save()
p("CALL ·asyncPreempt2(SB)")
switch runtime.GOOS {
case "linux", "android":
rssToBytes = 1024
- case "darwin":
+ case "darwin", "ios":
rssToBytes = 1
default:
panic("unsupported OS")
// 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 {
switch runtime.GOOS {
- case "darwin":
+ case "darwin", "ios":
switch runtime.GOARCH {
case "arm64":
// nothing
broken := false
switch runtime.GOOS {
- case "darwin", "dragonfly", "netbsd", "illumos", "solaris":
+ case "darwin", "ios", "dragonfly", "netbsd", "illumos", "solaris":
broken = true
case "openbsd":
if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" {
#ifdef GOOS_darwin
MOVD R30, (RSP)
#endif
+ #ifdef GOOS_ios
+ MOVD R30, (RSP)
+ #endif
MOVD R0, 8(RSP)
MOVD R1, 16(RSP)
MOVD R2, 24(RSP)
var env string
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
// Similar to goenv_unix but extracts the environment value for
// Exit this thread.
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
// the stack, but put it in _g_.stack before mstart,
// so the logic above hasn't set osStack yet.
// 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.
- 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)
} else {
mp.g0 = malg(8192 * sys.StackGuardMultiplier)
// Normal traceback is impossible or has failed.
// See if it falls into several common cases.
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.
// 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)
)
// 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")
// safe-point, it will preempt the goroutine. It always atomically
// increments mp.preemptGen after handling a preemption request.
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
// 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
// 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),
// so we have no choice but to ignore SIGPIPE.
- if GOOS == "darwin" && sig == _SIGPIPE {
+ if (GOOS == "darwin" || GOOS == "ios") && sig == _SIGPIPE {
return true
}
break Send
case sigReceiving:
if atomic.Cas(&sig.state, sigReceiving, sigIdle) {
- if GOOS == "darwin" {
+ if GOOS == "darwin" || GOOS == "ios" {
sigNoteWakeup(&sig.note)
break Send
}
throw("signal_recv: inconsistent state")
case sigIdle:
if atomic.Cas(&sig.state, sigIdle, sigReceiving) {
- if GOOS == "darwin" {
+ if GOOS == "darwin" || GOOS == "ios" {
sigNoteSleep(&sig.note)
break Receive
}
if !sig.inuse {
// This is the first call to signal_enable. Initialize.
sig.inuse = true // enable reception of signals; cannot disable
- if GOOS == "darwin" {
+ if GOOS == "darwin" || GOOS == "ios" {
sigNoteSetup(&sig.note)
} else {
noteclear(&sig.note)
// to each stack below the usual guard area for OS-specific
// purposes like signal handling. Used on Windows, Plan 9,
// 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
_StackMin = 2048
#endif
#ifdef GOOS_darwin
+#define TLS_darwin
+#endif
+#ifdef GOOS_ios
+#define TLS_darwin
+#endif
+#ifdef TLS_darwin
#define TPIDR TPIDRRO_EL0
#define TLSG_IS_VARIABLE
#define MRS_TPIDR_R0 WORD $0xd53bd060 // MRS TPIDRRO_EL0, R0
CBZ R0, nocgo
MRS_TPIDR_R0
-#ifdef GOOS_darwin
+#ifdef TLS_darwin
// Darwin sometimes returns unaligned pointers
AND $0xfffffffffffffff8, R0
#endif
CBZ R0, nocgo
MRS_TPIDR_R0
-#ifdef GOOS_darwin
+#ifdef TLS_darwin
// Darwin sometimes returns unaligned pointers
AND $0xfffffffffffffff8, R0
#endif
uintptr(unsafe.Pointer(argv0p)),
uintptr(unsafe.Pointer(&argvp[0])),
uintptr(unsafe.Pointer(&envvp[0])))
- } else if runtime.GOOS == "darwin" {
+ } else if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
// Similarly on Darwin.
err1 = execveDarwin(argv0p, &argvp[0], &envvp[0])
} else {
case "aix":
// There is no alignment on AIX.
salign = 1
- case "darwin", "illumos", "solaris":
+ case "darwin", "ios", "illumos", "solaris":
// NOTE: It seems like 64-bit Darwin, Illumos and Solaris
// kernels still require 32-bit aligned access to network
// subsystem.
if err != nil {
return
}
- if runtime.GOOS == "darwin" && len == 0 {
+ if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && len == 0 {
// Accepted socket has no address.
// This is likely due to a bug in xnu kernels,
// where instead of ECONNABORTED error socket
)
const (
- darwin64Bit = runtime.GOOS == "darwin" && sizeofPtr == 8
+ darwin64Bit = (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && sizeofPtr == 8
netbsd32Bit = runtime.GOOS == "netbsd" && sizeofPtr == 4
)
// Thus this test also verifies that the Flock_t structure can be
// roundtripped with F_SETLK and F_GETLK.
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")
}
flock := syscall.Flock_t{
}
set := rlimit
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
// or lower than kern.maxfilesperproc, which on
// some machines are 4096. See #40564.
}
set = rlimit
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
}
if set != get {
delta := 20 * Millisecond
// 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 ticker to double the duration for the rest of count/2.
// Since tick frequency is limited on Darwin ARM64, use even
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build darwin
-// +build arm64
-
package time
import (