rust: store local wrapper addresses in async stream/future vtables - #1699
Open
alexcrichton wants to merge 3 commits into
Open
rust: store local wrapper addresses in async stream/future vtables #1699alexcrichton wants to merge 3 commits into
alexcrichton wants to merge 3 commits into
Conversation
This is in preparation to try to test and expose a bug in the toolchain in a subsequent commit and fix it.
Under a position-independent dynamic library build, an intrinsic that is only address-taken (stored in the StreamVtable/FutureVtable, never called by name) is lowered by LLVM to a GOT.func global keyed by its mangled Rust symbol, and the canonical (module, field) wasm import is dropped. The component linker resolves GOT.func slots against library exports, but no library exports that mangled symbol and the canonical name is gone, so components using dynamic libraries fail to link. Emit a local wrapper for each of the intrinsics on wasm and store the wrapper's address in the vtable. The wrapper calls the canonical import by name (keeping the import live) and the address-take becomes an ordinary table relocation against a defined function, which the linker resolves.
dicej
approved these changes
Aug 26, 2026
| #[serde(default)] | ||
| externs: Vec<String>, | ||
|
|
||
| #[serde(default)] |
Collaborator
There was a problem hiding this comment.
Should probably have a doc comment since the other fields do.
| bail!("{error}") | ||
| } | ||
|
|
||
| /// TODO |
Collaborator
There was a problem hiding this comment.
TODO as in later or TODO as in for this PR?
Member
Author
There was a problem hiding this comment.
Oops, no this is just "TODO alex fix this before making a PR" which I pretty consistently always forget to do...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Under a position-independent dynamic library build, an intrinsic that is
only address-taken (stored in the StreamVtable/FutureVtable, never called
by name) is lowered by LLVM to a GOT.func global keyed by its mangled Rust
symbol, and the canonical (module, field) wasm import is dropped. The
component linker resolves GOT.func slots against library exports, but no
library exports that mangled symbol and the canonical name is gone, so
components using dynamic libraries fail to link.
Emit a local wrapper for each of the intrinsics on wasm and store the
wrapper's address in the vtable. The wrapper calls the canonical import
by name (keeping the import live) and the address-take becomes an
ordinary table relocation against a defined function, which the linker
resolves.