go1.28 sparc64 port — 20260823: cgo
The headline: cgo works. Go→C calls, C→Go callbacks, signals and
profiling during cgo execution, thread exit through pthread TSD
destructors, and both internal and external linking of cgo binaries.
With CGO_ENABLED=1, go test std cmd runs 380 packages green — the full
runtime suite, every cgo/callback/traceback/profiling test, and all of
cmd/go's script tests. The only failures are the known disassembler gap
(cmd/objdump, cmd/pprof), two net tests that need CONFIG_DUMMY in the
kernel, and the moddeps provenance check (inherent to carrying a
vendored x/sys patch until sparc64 support is upstream).
What it took
SPARC register windows and a stack-moving runtime disagree about %i6:
it is simultaneously this ABI's frame pointer and the hardware's stack
pointer for the adjacent register window, which the kernel spills and
fills at its own discretion — and walks in clone(). The frame pointer
now lives in %l5, the frame anchor in %l5's own window-image slot,
and the return-address chain slot outside the %i7 image that signal
handling can overwrite. Every Go↔C transition opens or flushes windows
explicitly, the vDSO window carries g, and sigFetchG can recover g from
the signal stack. The commit messages carry the full analysis.
Also in this release: internal linking consumes host ELF objects (psABI
GOTDATA code models, a patched-code PLT, GOT with GLOB_DAT; DT_PLTGOT
names the PLT as the SPARC dynamic linker expects); TrailingZeros is a
hardware POPC intrinsic, keeping the allocator hot path inlined; and the
toolchain no longer intermittently fails to build itself.
Still missing
The race detector; -buildmode beyond exe (pie/c-archive/c-shared need a
PIC code model, expensive on an ISA without PC-relative addressing); the
disassembler.
Attribution
The assembler backend and core runtime assembly were revived from
minux/go.sparc64 @ 9b8610d — the original gc SPARC64 port effort by
Aram Hăvărneanu and others. See README.sparc64.md.