From fb0c8e16c329da6f0caafa2d5ae48e625a00b652 Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Tue, 3 Feb 2026 15:10:09 +0000 Subject: runtime: update comments about known g offsets I can't find any evidence that most of these offsets are hard-coded anymore, and the locations they reference (liblink, libmach) definitely don't exist anymore. The stackguards are much more obviously hard-coded into and referenced from cmd/internal/obj/*, so update that reference. Change-Id: I814584846a85353a6373193ea9cd802ace1ed5ad Reviewed-on: https://go-review.googlesource.com/c/go/+/741540 LUCI-TryBot-Result: Go LUCI Reviewed-by: Cherry Mui --- src/runtime/runtime2.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index bf47955d0d..578458afa0 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -301,8 +301,6 @@ func setMNoWB(mp **m, new *m) { } type gobuf struct { - // The offsets of sp, pc, and g are known to (hard-coded in) libmach. - // // ctxt is unusual with respect to GC: it may be a // heap-allocated funcval, so GC needs to track it, but it // needs to be set and cleared from assembly, where it's @@ -479,12 +477,12 @@ type g struct { // It is stack.lo+StackGuard on g0 and gsignal stacks. // It is ~0 on other goroutine stacks, to trigger a call to morestackc (and crash). stack stack // offset known to runtime/cgo - stackguard0 uintptr // offset known to liblink - stackguard1 uintptr // offset known to liblink + stackguard0 uintptr // offset known to cmd/internal/obj/* + stackguard1 uintptr // offset known to cmd/internal/obj/* - _panic *_panic // innermost panic - offset known to liblink + _panic *_panic // innermost panic _defer *_defer // innermost defer - m *m // current m; offset known to arm liblink + m *m // current m sched gobuf syscallsp uintptr // if status==Gsyscall, syscallsp = sched.sp to use during gc syscallpc uintptr // if status==Gsyscall, syscallpc = sched.pc to use during gc -- cgit v1.3-5-g9baa