From f7b32f5281888ee02f384230c48e91af2120f8b8 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 8 Feb 2023 14:02:55 -0500 Subject: [PATCH] runtime: skip darwin osinit_hack on ios Darwin needs the osinit_hack call to fix some bugs in the Apple libc that surface when Go programs call exec. On iOS, the functions that osinit_hack uses are not available, so signing fails. But on iOS exec is also unavailable, so the hack is not needed. Disable it there, which makes signing work again. Fixes #58323. Change-Id: I3f1472f852bb36c06854fe1f14aa27ad450c5945 Reviewed-on: https://go-review.googlesource.com/c/go/+/466516 Run-TryBot: Russ Cox Reviewed-by: Dave Anderson Reviewed-by: Michael Knyszek TryBot-Result: Gopher Robot Auto-Submit: Russ Cox Reviewed-by: Bryan Mills Reviewed-by: Than McIntosh --- src/runtime/sys_darwin.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runtime/sys_darwin.go b/src/runtime/sys_darwin.go index 8bff695f5729d8..5ba697e3047f46 100644 --- a/src/runtime/sys_darwin.go +++ b/src/runtime/sys_darwin.go @@ -213,7 +213,9 @@ func pthread_kill_trampoline() // //go:nosplit func osinit_hack() { - libcCall(unsafe.Pointer(abi.FuncPCABI0(osinit_hack_trampoline)), nil) + if GOOS == "darwin" { // not ios + libcCall(unsafe.Pointer(abi.FuncPCABI0(osinit_hack_trampoline)), nil) + } return } func osinit_hack_trampoline()