golang/go

cmd/asm, runtime: textflag for CABI

Open

#21,004 opened on Jul 13, 2017

View on GitHub
 (3 comments) (1 reaction) (0 assignees)Go (19,008 forks)batch import
NeedsFixhelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

The runtime assembly code includes many functions that are called from outside the runtime and are called with the C ABI. This means the functions first have to save callee-saved registers manually.

For example, see runtime·sigtramp in sys_linux_*.s.

Once after diagnosing a callee-save error, I failed to save all the callee-save registers. This meant months later, @aclements had to go through the same long debugging session. We could make this more robust (and potentially make our assembly a bit easier to read) by adding a CABI text flag, and have the assembler insert code for saving and restoring registers.

cc @ianlancetaylor

Contributor guide