doc: document wasm import symbol mangling#159138
Conversation
|
r? @tiif rustbot has assigned @tiif. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
The fact that there even is a mangled name is an implementation detail, right? There wouldn't be a need to specify a name in the symbol table in the linking section given a small modification to the wasm object file linking tool convention to allow an external import to be identified by import location rather than symbol name, which would then result in no symbol name being assigned to it at all. I don't think this modification is planned, but there is nothing stopping such a modification from being made afaik. |
Thanks, that makes sense. I was presenting the current mangled linker symbol as if it were part of wasm_import_module's semantics. I’ll clarify that this is an implementation detail of the current wasm codegen/linker setup and may change. |
|
@rustbot reroll |
|
@rustbot reroll |
|
@bors r+ rollup |
…=davidtwco doc: document wasm import symbol mangling Document that foreign items from wasm_import_module extern blocks are mangled even with #[no_mangle] or #[link_name], so same-named imports from different WebAssembly modules remain distinct.
…=davidtwco doc: document wasm import symbol mangling Document that foreign items from wasm_import_module extern blocks are mangled even with #[no_mangle] or #[link_name], so same-named imports from different WebAssembly modules remain distinct.
Rollup of 18 pull requests Successful merges: - #138618 (Support using const pointers in asm `const` operand) - #150161 (Remove 'static requirement on try_as_dyn) - #158362 (trait solver: account for universes from replace_bound_vars) - #159173 (Add allowed list check on EII implementations attributes) - #159466 (cmse: clear variant-dependent padding in `enum`s) - #159718 (Make `DocLinkResMap` an `FxIndexMap`) - #155795 (constify `vec![1, 2, 3]` macro) - #157776 (ci: Enable autodiff tests on x86_64 linux) - #157905 (Update comments and add tests for `-Zrandomize-layout` for some guaranteed ZSTs) - #159041 (Reorganize `tests/ui/issues` [22/N]) - #159108 (Reorganize `tests/ui/issues` [23/N]) - #159138 (doc: document wasm import symbol mangling) - #159531 (Reorganize `tests/ui/issues` [28/N]) - #159608 (early_otherwise: Don't hoist dereferences when the otherwise branch is reachable) - #159612 (Reorganize `tests/ui/issues` [29/N]) - #159653 (run `tests/assembly-llvm/asm/aarch64-types.rs` for `aarch64_be`) - #159759 (rustc-dev-guide subtree update) - #159761 (Remove outdated comment for resolve_vars_with_obligations)
…=davidtwco doc: document wasm import symbol mangling Document that foreign items from wasm_import_module extern blocks are mangled even with #[no_mangle] or #[link_name], so same-named imports from different WebAssembly modules remain distinct.
…=davidtwco doc: document wasm import symbol mangling Document that foreign items from wasm_import_module extern blocks are mangled even with #[no_mangle] or #[link_name], so same-named imports from different WebAssembly modules remain distinct.
Rollup of 19 pull requests Successful merges: - #150161 (Remove 'static requirement on try_as_dyn) - #158362 (trait solver: account for universes from replace_bound_vars) - #159173 (Add allowed list check on EII implementations attributes) - #159466 (cmse: clear variant-dependent padding in `enum`s) - #159718 (Make `DocLinkResMap` an `FxIndexMap`) - #155795 (constify `vec![1, 2, 3]` macro) - #157776 (ci: Enable autodiff tests on x86_64 linux) - #157905 (Update comments and add tests for `-Zrandomize-layout` for some guaranteed ZSTs) - #158766 (Promote riscv64-unknown-linux-musl to tier 2 with host tools) - #159041 (Reorganize `tests/ui/issues` [22/N]) - #159108 (Reorganize `tests/ui/issues` [23/N]) - #159138 (doc: document wasm import symbol mangling) - #159531 (Reorganize `tests/ui/issues` [28/N]) - #159608 (early_otherwise: Don't hoist dereferences when the otherwise branch is reachable) - #159612 (Reorganize `tests/ui/issues` [29/N]) - #159653 (run `tests/assembly-llvm/asm/aarch64-types.rs` for `aarch64_be`) - #159667 (Make some parser structured suggestions verbose and tweak their wording) - #159759 (rustc-dev-guide subtree update) - #159761 (Remove outdated comment for resolve_vars_with_obligations)
…=davidtwco doc: document wasm import symbol mangling Document that foreign items from wasm_import_module extern blocks are mangled even with #[no_mangle] or #[link_name], so same-named imports from different WebAssembly modules remain distinct.
Rollup of 20 pull requests Successful merges: - #150161 (Remove 'static requirement on try_as_dyn) - #159412 (Reorganize `tests/ui/issues` [26/N]) - #159466 (cmse: clear variant-dependent padding in `enum`s) - #157905 (Update comments and add tests for `-Zrandomize-layout` for some guaranteed ZSTs) - #158479 (Reject static item as direct const generic arg) - #159041 (Reorganize `tests/ui/issues` [22/N]) - #159108 (Reorganize `tests/ui/issues` [23/N]) - #159138 (doc: document wasm import symbol mangling) - #159531 (Reorganize `tests/ui/issues` [28/N]) - #159608 (early_otherwise: Don't hoist dereferences when the otherwise branch is reachable) - #159612 (Reorganize `tests/ui/issues` [29/N]) - #159653 (run `tests/assembly-llvm/asm/aarch64-types.rs` for `aarch64_be`) - #159719 (tests: add UI test for `.swap()` suggestion) - #159737 (rustfmt fix: allow file not found errors for external mods annotated with `#[my_macro]`) - #159759 (rustc-dev-guide subtree update) - #159761 (Remove outdated comment for resolve_vars_with_obligations) - #159764 (use `minicore::simd::Simd` more) - #159773 (Remove outdated workaround for `P` type) - #159778 (use lowest edition the test accepts) - #159788 (Avoid ICEing in RPIT method chain suggestion)
Rollup merge of #159138 - kn1g78:doc-wasm-symbol-mangling, r=davidtwco doc: document wasm import symbol mangling Document that foreign items from wasm_import_module extern blocks are mangled even with #[no_mangle] or #[link_name], so same-named imports from different WebAssembly modules remain distinct.
Rollup of 20 pull requests Successful merges: - rust-lang/rust#150161 (Remove 'static requirement on try_as_dyn) - rust-lang/rust#159412 (Reorganize `tests/ui/issues` [26/N]) - rust-lang/rust#159466 (cmse: clear variant-dependent padding in `enum`s) - rust-lang/rust#157905 (Update comments and add tests for `-Zrandomize-layout` for some guaranteed ZSTs) - rust-lang/rust#158479 (Reject static item as direct const generic arg) - rust-lang/rust#159041 (Reorganize `tests/ui/issues` [22/N]) - rust-lang/rust#159108 (Reorganize `tests/ui/issues` [23/N]) - rust-lang/rust#159138 (doc: document wasm import symbol mangling) - rust-lang/rust#159531 (Reorganize `tests/ui/issues` [28/N]) - rust-lang/rust#159608 (early_otherwise: Don't hoist dereferences when the otherwise branch is reachable) - rust-lang/rust#159612 (Reorganize `tests/ui/issues` [29/N]) - rust-lang/rust#159653 (run `tests/assembly-llvm/asm/aarch64-types.rs` for `aarch64_be`) - rust-lang/rust#159719 (tests: add UI test for `.swap()` suggestion) - rust-lang/rust#159737 (rustfmt fix: allow file not found errors for external mods annotated with `#[my_macro]`) - rust-lang/rust#159759 (rustc-dev-guide subtree update) - rust-lang/rust#159761 (Remove outdated comment for resolve_vars_with_obligations) - rust-lang/rust#159764 (use `minicore::simd::Simd` more) - rust-lang/rust#159773 (Remove outdated workaround for `P` type) - rust-lang/rust#159778 (use lowest edition the test accepts) - rust-lang/rust#159788 (Avoid ICEing in RPIT method chain suggestion)
Document that foreign items from wasm_import_module extern blocks are mangled even with #[no_mangle] or #[link_name], so same-named imports from different WebAssembly modules remain distinct.