-
Notifications
You must be signed in to change notification settings - Fork 257
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
Fix get_sp implementation for s390x #389
Conversation
On s390x we use a biased CFA: the CFA of a function equal the SP at function entry plus a constant of 160. Therefore, the current implementation of get_sp, which uses _Unwind_GetCFA, is not an appropriate way to retrieve the current SP value on this platform. Instead, use _Unwind_GetGR to explicitly retrieve the value of the stack pointer register %r15.
Looks good to me, thanks! Do you know if it would be possible to get s390x working on CI through qemu? |
Probably. At least I was able to run the tests under the regular qemu provided by Ubuntu 20.04 using
It is a bit slow, but for a small package like backtrace-rs that's probably OK. |
As an aside, I keep seeing this warning when building backtrace-rs (with or without my patch):
Is this expected? |
Ah yeah if it's slightly slow that's fine! As for the warning it's fine to go ahead and fix, it's not intentional to have a warning! |
OK, this is now #391 |
Can this PR be committed now, or is having the CI a pre-requisite? This does fix a crash in wasmtime GC on Z. |
I'd ideally like to have CI since this has s390x-specific code, but if CI is difficult to add it can be handled later. |
This is now #392. It was indeed a bit more difficult than I initially expected, see the comment over there for details. |
👍 |
Thanks, @alexcrichton ! In order to use this in wasmtime now, I guess I'll have to wait until a new version is released, right? |
Indeed! I went ahead and published 0.3.55 too :) |
Works for me, thanks again! |
On s390x we use a biased CFA: the CFA of a function equal the SP
at function entry plus a constant of 160.
Therefore, the current implementation of get_sp, which uses
_Unwind_GetCFA, is not an appropriate way to retrieve the
current SP value on this platform.
Instead, use _Unwind_GetGR to explicitly retrieve the value
of the stack pointer register %r15.