Skip to content

signal: add SignalMap for linux/sparc64 - #249

Open
shalseth wants to merge 1 commit into
moby:mainfrom
shalseth:sparc64-signals
Open

signal: add SignalMap for linux/sparc64#249
shalseth wants to merge 1 commit into
moby:mainfrom
shalseth:sparc64-signals

Conversation

@shalseth

Copy link
Copy Markdown

SPARC has no SIGSTKFLT, so x/sys/unix does not define it for sparc64 and the "STKFLT" entry in signal_linux.go does not compile there. SPARC uses SIGEMT in that slot, as the mips architectures do.

Add signal_linux_sparc64.go and exclude sparc64 from signal_linux.go, following signal_linux_mipsx.go. The new file is that one with the build tag changed and sigrtmax set to 64 rather than 127, which leaves sigrtmin and sigrtmax matching the generic file, so the SIGSTKFLT/SIGEMT swap is the only substantive difference.

One thing is still missing before the package builds on linux/sparc64: x/sys/unix has no syscall implementation for that architecture. That is a separate matter, being pursued upstream. This change was checked against a tree that has one, where the package's tests pass on an UltraSPARC T4-1.

SPARC has no SIGSTKFLT, so x/sys/unix does not define it for sparc64
and the "STKFLT" entry in signal_linux.go does not compile there. SPARC
uses SIGEMT in that slot, as the mips architectures do.

Add signal_linux_sparc64.go and exclude sparc64 from signal_linux.go,
following signal_linux_mipsx.go. The new file is that one with the
build tag changed and sigrtmax set to 64 rather than 127, which leaves
sigrtmin and sigrtmax matching the generic file, so the
SIGSTKFLT/SIGEMT swap is the only substantive difference.

One thing is still missing before the package builds on linux/sparc64:
x/sys/unix has no syscall implementation for that architecture. That is
a separate matter, being pursued upstream. This change was checked
against a tree that has one, where the package's tests pass on an
UltraSPARC T4-1.

Signed-off-by: Stian Halseth <stian@itx.no>

@kolyshkin kolyshkin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should put this on hold until x/sys/unix implements linux/sparc64 syscalls.

shalseth added a commit to shalseth/sys that referenced this pull request Aug 28, 2026
syscall_unix_gc.go and syscall_linux_gc.go declare Syscall, Syscall6,
RawSyscall, RawSyscall6, SyscallNoError and RawSyscallNoError for every
gc-built unix target, with the bodies supplied per architecture in
assembly. linux/sparc64 has the generated syscall, errno, sysnum and
type files and a hand-written syscall_linux_sparc64.go, but no
asm_linux_sparc64.s, so the package does not compile there at all, and
neither does anything importing it.

Add the file in the same shape as the other linux architectures: jump
to package syscall's implementations where they exist, and trap directly
for the two NoError variants. On SPARC the trap is ta 0x6d, with the
syscall number in %g1 and the arguments in %o0-%o5.

linux/mkall.go already lists sparc64, noting that it is "not fully
supported, but there is enough support already to generate Go type and
error definitions". This is the piece that makes that support reachable
rather than inert.

It is wanted downstream as well: moby/sys#249 adds a sparc64 signal map
and was put on hold by its maintainer pending "x/sys/unix implements
linux/sparc64 syscalls".

Built and tested on an UltraSPARC T4-1 running linux/sparc64 with a gc
toolchain that supports the architecture. The package compiles, and
being able to run its test suite is what turned up the two bugs fixed in
CL 822904 and CL 822906, which account for every failure it shows here
bar one that is specific to my kernel build.

Updates golang/go#55000
@shalseth

Copy link
Copy Markdown
Author

I think we should put this on hold until x/sys/unix implements linux/sparc64 syscalls.

Agreed, posted now on golang/sys#292.
Had some other x/sys PR's pending approval so held it, but looks like they are all getting merged now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants