-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LocalVariable() doesn't work with Go's calling convention #59
Comments
I will think about it, but it seems there's no way to support local variables while generating Golang assembly listing. There are two problems:
|
I'll play with this and see what I can come up with. |
Here are some notes:
The For a local variable size of 24 bytes, the following prologue is emitted (note that an extra adjustment of 8 bytes is added to save
and epilogue:
So, if seems that if we can adjust the 0 in the |
@dgryski Thank you for the thorough analysis. However, there still a problem: In PeachPy
|
Good points. I'll see if I can get more info from the Go team. |
Interesting macros from the Go runtime:
|
The standard C prologue
doesn't work with Go assembly functions. After adjusting the stack pointer, references to arguments are still relative to the
FP
pseudoregister (%esp
in our case), but since%esp
has been decremented, these offsets are now wrong.Looking at objdump, it appears the Go prologue/epilogue for a small sub (including the stack growth check) is:
What there is documented is at https://golang.org/doc/asm
This will probably be easier once golang/go#16922 is resolved.
I'm not sure the status of the "red zone" w/r/t Go on AMD64. The limitation for syso files is to keep the stack usage below ~100 bytes, so that seems like a reasonable warning level to not need the stackgrowth check.
The text was updated successfully, but these errors were encountered: