From 1f068f0dc7bc997446a7aac44cfc70746ad918e0 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Tue, 18 Oct 2022 12:11:43 -0400 Subject: [PATCH] runtime: throw in unreachable exitThread Several OSes don't ever reach exitThread, On AIX, Plan9, Solaris, and Windows, we throw if this function is accidentally reached. Do the same on Darwin and OpenBSD for consistency. Change-Id: Icd189b11179755a28b3ec48b267349c57facbf24 Reviewed-on: https://go-review.googlesource.com/c/go/+/443717 Reviewed-by: Cherry Mui Reviewed-by: Michael Knyszek TryBot-Result: Gopher Robot Run-TryBot: Michael Pratt --- src/runtime/sys_darwin.go | 1 + src/runtime/sys_openbsd2.go | 1 + 2 files changed, 2 insertions(+) diff --git a/src/runtime/sys_darwin.go b/src/runtime/sys_darwin.go index 88af894409..18b0490ebb 100644 --- a/src/runtime/sys_darwin.go +++ b/src/runtime/sys_darwin.go @@ -476,6 +476,7 @@ func pthread_cond_signal_trampoline() // Not used on Darwin, but must be defined. func exitThread(wait *atomic.Uint32) { + throw("exitThread") } //go:nosplit diff --git a/src/runtime/sys_openbsd2.go b/src/runtime/sys_openbsd2.go index f755cd528c..49bad8ed1d 100644 --- a/src/runtime/sys_openbsd2.go +++ b/src/runtime/sys_openbsd2.go @@ -250,6 +250,7 @@ func sigaltstack_trampoline() // Not used on OpenBSD, but must be defined. func exitThread(wait *atomic.Uint32) { + throw("exitThread") } //go:nosplit -- 2.50.0