alexcrichton opened PR #11860 from alexcrichton:rewrite-wasmtime-fiber-init to bytecodealliance:main:
This commit updates all implementations of
wasmtime_fiber_initto be defined in Rust rather than purely in inline assembly. There was never a need to define this function in inline assembly and as far as I can remember I did this originally for consistency with the other functions. The motivation for this PR is to avoid the need to figure out how to do PIC-relative addressing inwasmtime_fiber_initto get the symbol address ofwasmtime_fiber_start. This has apparently never worked on i686 platforms and this is now becoming a problem on nightly Rust where LLD complains about this (and presumably the default linker didn't?).In rewriting these functions I additionally fixed a few minor issues:
- On AArch64 the registers are now ordered differently to make the order more consistent on the stack.
- On s390x the unix.rs-specified 16-bytes-at-the-top-of-the-stack is now separate from the 160-byte register save area as opposed to having it folded into the same.
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton requested dicej for a review on PR #11860.
alexcrichton requested wasmtime-core-reviewers for a review on PR #11860.
alexcrichton commented on PR #11860:
Specifically this assembly sequence is not how to do PIC addressing on i686. Somehow the default bfd linker papered over this but LLD does not like this. Rather than figuring out the inline assembly, which I always dread, I instead rewrote all the functions in Rust to make them easier to understand (and also force rustc to figure out PIC for me)
dicej submitted PR review.
dicej created PR review comment:
Are the
// rdi,// rsi, and// rdxcomments relevant any more given this is no longer a naked function?
alexcrichton updated PR #11860.
alexcrichton created PR review comment:
Oops, nope forgot to remove them
alexcrichton submitted PR review.
alexcrichton has enabled auto merge for PR #11860.
alexcrichton merged PR #11860.
Last updated: Dec 06 2025 at 07:03 UTC