You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
It's not just enough to want to save them, we need a place to save them. Where do we save them (xx(SP))? Do we need to reserve space for them, or does this flag do so?
Do we need to reserve space for them, or does this flag do so?
I think we would want the flag to automatically reserve space for them, just like we do for the frame pointer on x86 and the saved LR on LR machines.
This means the functions first have to save callee-saved registers manually.
Would this flag save all of the callee-save registers? That's potentially a lot of registers that aren't actually going to be clobbered. Where these bugs are really insidious are the C callee-save registers that are used implicitly by obj (so they never explicitly appear in the assembly).
The cases that I can think of are not hot functions, so I would be happy saving all callee-save registers. Though I agree just the invisible obj registers would be enough to let me breath easy.
As to where, reserved stack space. These are functions called from C, so there's stack to use.
gopherbot
removed
the
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
label
Jun 13, 2018
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
The text was updated successfully, but these errors were encountered: