$ the-wire · showcase
Go runtime moves cgo sigaction and mmap hooks into Go
By RepoJournal · Filed · About Go · Composed from the cited sources · methodology
Michael Matloob's series for #81450 is steadily converting runtime/cgo's C shims into regular Go functions, and today's sigaction port to linux/amd64 and linux/arm64 is the largest of the three.
runtime, runtime/cgo: implement sigaction in Go on linux golang/go
The C implementation of _cgo_sigaction on linux/amd64 and linux/arm64 (non-Android) is replaced with a Go version that calls libc dynamically and is invoked directly from runtime through a Go function hook. Only those two Linux platforms change for now; the Android path is untouched.
runtime, runtime/cgo: replace callC with asmcgocall trampoline golang/go
The Go-ABI callC assembly helper in runtime/cgo gives way to a C-ABI cgoCallTrampoline invoked via runtime.asmcgocall and runtime.cgocall. Go hooks in runtime/cgo now run on the normal Go stack and switch to the system stack only when calling C, so runtime callers no longer need to switch before invoking Go code.
runtime, runtime/cgo: rename cgoMmapFn and cgoMunmapFn to cgoMmap and cgoMunmap golang/go
cgoMmapFn and cgoMunmapFn lose the Fn suffix, renamed to cgoMmap and cgoMunmap now that they are regular Go functions rather than raw C function pointers. The rename follows from the same conversion and touches runtime and runtime/cgo internal names only.
test: add some zero-extension with late constants golang/go
Two tests covering zero-extension with late constants land ahead of CL 833045: both pass today and fail against its current patchset, so the commit adds them preemptively as coverage rather than as a fix.