aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2020-09-16 16:59:58 -0400
committerCherry Zhang <cherryyz@google.com>2020-09-23 18:12:59 +0000
commita413908dd064de6e3ea5b8d95d707a532bd3f4c8 (patch)
treeca1bb03a29fff2bb902aa015fe04fcd36988394d /src/runtime
parentbc320fc1f5bc5d6019e3d8d62aa32eac3417bb7f (diff)
downloadgo-a413908dd064de6e3ea5b8d95d707a532bd3f4c8.tar.xz
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>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/debug/panic_test.go2
-rw-r--r--src/runtime/internal/sys/gengoos.go9
-rw-r--r--src/runtime/internal/sys/zgoos_aix.go1
-rw-r--r--src/runtime/internal/sys/zgoos_android.go1
-rw-r--r--src/runtime/internal/sys/zgoos_darwin.go2
-rw-r--r--src/runtime/internal/sys/zgoos_dragonfly.go1
-rw-r--r--src/runtime/internal/sys/zgoos_freebsd.go1
-rw-r--r--src/runtime/internal/sys/zgoos_hurd.go1
-rw-r--r--src/runtime/internal/sys/zgoos_illumos.go1
-rw-r--r--src/runtime/internal/sys/zgoos_ios.go25
-rw-r--r--src/runtime/internal/sys/zgoos_js.go1
-rw-r--r--src/runtime/internal/sys/zgoos_linux.go1
-rw-r--r--src/runtime/internal/sys/zgoos_netbsd.go1
-rw-r--r--src/runtime/internal/sys/zgoos_openbsd.go1
-rw-r--r--src/runtime/internal/sys/zgoos_plan9.go1
-rw-r--r--src/runtime/internal/sys/zgoos_solaris.go1
-rw-r--r--src/runtime/internal/sys/zgoos_windows.go1
-rw-r--r--src/runtime/internal/sys/zgoos_zos.go1
-rw-r--r--src/runtime/malloc.go4
-rw-r--r--src/runtime/mgcscavenge.go2
-rw-r--r--src/runtime/mkpreempt.go3
-rw-r--r--src/runtime/pprof/pprof_rusage.go2
-rw-r--r--src/runtime/pprof/pprof_test.go4
-rw-r--r--src/runtime/preempt_arm64.s3
-rw-r--r--src/runtime/proc.go8
-rw-r--r--src/runtime/runtime2.go2
-rw-r--r--src/runtime/signal_unix.go4
-rw-r--r--src/runtime/sigqueue.go6
-rw-r--r--src/runtime/stack.go2
-rw-r--r--src/runtime/tls_arm64.h6
-rw-r--r--src/runtime/tls_arm64.s4
31 files changed, 82 insertions, 20 deletions
diff --git a/src/runtime/debug/panic_test.go b/src/runtime/debug/panic_test.go
index 4b7830e100..93be216985 100644
--- a/src/runtime/debug/panic_test.go
+++ b/src/runtime/debug/panic_test.go
@@ -20,7 +20,7 @@ func TestPanicOnFault(t *testing.T) {
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)
diff --git a/src/runtime/internal/sys/gengoos.go b/src/runtime/internal/sys/gengoos.go
index 952b13649d..2a4bf0c3b4 100644
--- a/src/runtime/internal/sys/gengoos.go
+++ b/src/runtime/internal/sys/gengoos.go
@@ -44,6 +44,9 @@ func main() {
}
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" {
@@ -52,6 +55,9 @@ func main() {
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)
@@ -69,6 +75,9 @@ func main() {
}
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
diff --git a/src/runtime/internal/sys/zgoos_aix.go b/src/runtime/internal/sys/zgoos_aix.go
index d97485c43c..0631d02aa5 100644
--- a/src/runtime/internal/sys/zgoos_aix.go
+++ b/src/runtime/internal/sys/zgoos_aix.go
@@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
diff --git a/src/runtime/internal/sys/zgoos_android.go b/src/runtime/internal/sys/zgoos_android.go
index eec970b064..d356a40bec 100644
--- a/src/runtime/internal/sys/zgoos_android.go
+++ b/src/runtime/internal/sys/zgoos_android.go
@@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
diff --git a/src/runtime/internal/sys/zgoos_darwin.go b/src/runtime/internal/sys/zgoos_darwin.go
index c40819ee55..6aa2db7e3a 100644
--- a/src/runtime/internal/sys/zgoos_darwin.go
+++ b/src/runtime/internal/sys/zgoos_darwin.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+// +build !ios
// +build darwin
package sys
@@ -13,6 +14,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
diff --git a/src/runtime/internal/sys/zgoos_dragonfly.go b/src/runtime/internal/sys/zgoos_dragonfly.go
index 3dc4edcc31..88ee1174f1 100644
--- a/src/runtime/internal/sys/zgoos_dragonfly.go
+++ b/src/runtime/internal/sys/zgoos_dragonfly.go
@@ -13,6 +13,7 @@ const GoosDragonfly = 1
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
diff --git a/src/runtime/internal/sys/zgoos_freebsd.go b/src/runtime/internal/sys/zgoos_freebsd.go
index 6c98b342f9..8de2ec0559 100644
--- a/src/runtime/internal/sys/zgoos_freebsd.go
+++ b/src/runtime/internal/sys/zgoos_freebsd.go
@@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 1
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
diff --git a/src/runtime/internal/sys/zgoos_hurd.go b/src/runtime/internal/sys/zgoos_hurd.go
index d6dcc7bad4..183ccb02a1 100644
--- a/src/runtime/internal/sys/zgoos_hurd.go
+++ b/src/runtime/internal/sys/zgoos_hurd.go
@@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHurd = 1
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
diff --git a/src/runtime/internal/sys/zgoos_illumos.go b/src/runtime/internal/sys/zgoos_illumos.go
index 17f4ecc34e..d04134e1df 100644
--- a/src/runtime/internal/sys/zgoos_illumos.go
+++ b/src/runtime/internal/sys/zgoos_illumos.go
@@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 1
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
diff --git a/src/runtime/internal/sys/zgoos_ios.go b/src/runtime/internal/sys/zgoos_ios.go
new file mode 100644
index 0000000000..cf6e9d61f0
--- /dev/null
+++ b/src/runtime/internal/sys/zgoos_ios.go
@@ -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
diff --git a/src/runtime/internal/sys/zgoos_js.go b/src/runtime/internal/sys/zgoos_js.go
index 74c9943d9b..1d9279ab38 100644
--- a/src/runtime/internal/sys/zgoos_js.go
+++ b/src/runtime/internal/sys/zgoos_js.go
@@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 1
const GoosLinux = 0
const GoosNacl = 0
diff --git a/src/runtime/internal/sys/zgoos_linux.go b/src/runtime/internal/sys/zgoos_linux.go
index 1d5fcb0685..0f718d704f 100644
--- a/src/runtime/internal/sys/zgoos_linux.go
+++ b/src/runtime/internal/sys/zgoos_linux.go
@@ -14,6 +14,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 1
const GoosNacl = 0
diff --git a/src/runtime/internal/sys/zgoos_netbsd.go b/src/runtime/internal/sys/zgoos_netbsd.go
index 194fa6e432..2ae149ff13 100644
--- a/src/runtime/internal/sys/zgoos_netbsd.go
+++ b/src/runtime/internal/sys/zgoos_netbsd.go
@@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
diff --git a/src/runtime/internal/sys/zgoos_openbsd.go b/src/runtime/internal/sys/zgoos_openbsd.go
index 2108691679..7d4d61e4ca 100644
--- a/src/runtime/internal/sys/zgoos_openbsd.go
+++ b/src/runtime/internal/sys/zgoos_openbsd.go
@@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
diff --git a/src/runtime/internal/sys/zgoos_plan9.go b/src/runtime/internal/sys/zgoos_plan9.go
index e632a90b2e..30aec46df3 100644
--- a/src/runtime/internal/sys/zgoos_plan9.go
+++ b/src/runtime/internal/sys/zgoos_plan9.go
@@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
diff --git a/src/runtime/internal/sys/zgoos_solaris.go b/src/runtime/internal/sys/zgoos_solaris.go
index 67b2ffbfcd..4bb8c99bce 100644
--- a/src/runtime/internal/sys/zgoos_solaris.go
+++ b/src/runtime/internal/sys/zgoos_solaris.go
@@ -14,6 +14,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
diff --git a/src/runtime/internal/sys/zgoos_windows.go b/src/runtime/internal/sys/zgoos_windows.go
index cf2d6f4fb0..d1f4290204 100644
--- a/src/runtime/internal/sys/zgoos_windows.go
+++ b/src/runtime/internal/sys/zgoos_windows.go
@@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
diff --git a/src/runtime/internal/sys/zgoos_zos.go b/src/runtime/internal/sys/zgoos_zos.go
index e5d79accb4..d22be46fc0 100644
--- a/src/runtime/internal/sys/zgoos_zos.go
+++ b/src/runtime/internal/sys/zgoos_zos.go
@@ -13,6 +13,7 @@ const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHurd = 0
const GoosIllumos = 0
+const GoosIos = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go
index e46327f9ce..4fa14996c2 100644
--- a/src/runtime/malloc.go
+++ b/src/runtime/malloc.go
@@ -207,7 +207,7 @@ const (
// 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
@@ -521,7 +521,7 @@ func mallocinit() {
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)
diff --git a/src/runtime/mgcscavenge.go b/src/runtime/mgcscavenge.go
index b74da1057a..9d6f551768 100644
--- a/src/runtime/mgcscavenge.go
+++ b/src/runtime/mgcscavenge.go
@@ -90,7 +90,7 @@ const (
//
// 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
diff --git a/src/runtime/mkpreempt.go b/src/runtime/mkpreempt.go
index 44dea22ef3..c2e14cdcd6 100644
--- a/src/runtime/mkpreempt.go
+++ b/src/runtime/mkpreempt.go
@@ -361,6 +361,9 @@ func genARM64() {
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)")
diff --git a/src/runtime/pprof/pprof_rusage.go b/src/runtime/pprof/pprof_rusage.go
index d42e6ed473..7954673811 100644
--- a/src/runtime/pprof/pprof_rusage.go
+++ b/src/runtime/pprof/pprof_rusage.go
@@ -19,7 +19,7 @@ func addMaxRSS(w io.Writer) {
switch runtime.GOOS {
case "linux", "android":
rssToBytes = 1024
- case "darwin":
+ case "darwin", "ios":
rssToBytes = 1
default:
panic("unsupported OS")
diff --git a/src/runtime/pprof/pprof_test.go b/src/runtime/pprof/pprof_test.go
index 7149bfb31f..43307aeab9 100644
--- a/src/runtime/pprof/pprof_test.go
+++ b/src/runtime/pprof/pprof_test.go
@@ -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.
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
@@ -280,7 +280,7 @@ func testCPUProfile(t *testing.T, matches matchFunc, need []string, avoid []stri
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" {
diff --git a/src/runtime/preempt_arm64.s b/src/runtime/preempt_arm64.s
index 3c27b52de1..d0e77659c3 100644
--- a/src/runtime/preempt_arm64.s
+++ b/src/runtime/preempt_arm64.s
@@ -13,6 +13,9 @@ TEXT ·asyncPreempt(SB),NOSPLIT|NOFRAME,$0-0
#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)
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index 5b6a30d40b..a1e2ed0680 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -503,7 +503,7 @@ func cpuinit() {
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
@@ -1158,7 +1158,7 @@ func mstart() {
// 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.
@@ -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.
// 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)
@@ -4077,7 +4077,7 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) {
// 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)
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go
index 9652b6a5a4..48e07f789b 100644
--- a/src/runtime/runtime2.go
+++ b/src/runtime/runtime2.go
@@ -1060,4 +1060,4 @@ var (
)
// 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")
diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go
index bbfc18e37b..a3d6f34c88 100644
--- a/src/runtime/signal_unix.go
+++ b/src/runtime/signal_unix.go
@@ -346,7 +346,7 @@ const preemptMSupported = true
// 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
@@ -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
// 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
}
diff --git a/src/runtime/sigqueue.go b/src/runtime/sigqueue.go
index 3bf07cb5a6..0605f5da80 100644
--- a/src/runtime/sigqueue.go
+++ b/src/runtime/sigqueue.go
@@ -105,7 +105,7 @@ Send:
break Send
case sigReceiving:
if atomic.Cas(&sig.state, sigReceiving, sigIdle) {
- if GOOS == "darwin" {
+ if GOOS == "darwin" || GOOS == "ios" {
sigNoteWakeup(&sig.note)
break Send
}
@@ -140,7 +140,7 @@ func signal_recv() uint32 {
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
}
@@ -194,7 +194,7 @@ func signal_enable(s uint32) {
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)
diff --git a/src/runtime/stack.go b/src/runtime/stack.go
index adcef071da..3802cd049e 100644
--- a/src/runtime/stack.go
+++ b/src/runtime/stack.go
@@ -66,7 +66,7 @@ const (
// 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
diff --git a/src/runtime/tls_arm64.h b/src/runtime/tls_arm64.h
index f60f4f6d5b..0804fa3502 100644
--- a/src/runtime/tls_arm64.h
+++ b/src/runtime/tls_arm64.h
@@ -15,6 +15,12 @@
#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
diff --git a/src/runtime/tls_arm64.s b/src/runtime/tls_arm64.s
index 999914d655..7846fac6c5 100644
--- a/src/runtime/tls_arm64.s
+++ b/src/runtime/tls_arm64.s
@@ -13,7 +13,7 @@ TEXT runtime·load_g(SB),NOSPLIT,$0
CBZ R0, nocgo
MRS_TPIDR_R0
-#ifdef GOOS_darwin
+#ifdef TLS_darwin
// Darwin sometimes returns unaligned pointers
AND $0xfffffffffffffff8, R0
#endif
@@ -29,7 +29,7 @@ TEXT runtime·save_g(SB),NOSPLIT,$0
CBZ R0, nocgo
MRS_TPIDR_R0
-#ifdef GOOS_darwin
+#ifdef TLS_darwin
// Darwin sometimes returns unaligned pointers
AND $0xfffffffffffffff8, R0
#endif