You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(This looks like a rustc bug to me, but I'm reporting it here since it can be trivially worked around in wasmtime.)
When wasmtime is linked with LTO some of the symbols which are passed into the global_asm! trampolines are not properly preserved and are stripped by LTO, resulting in a link-time compile failure.
We hit this after we upgraded from wasmtime 1.0.2 to wasmtime 5.0.0.
Steps to Reproduce
git clone https://github.com/paritytech/substrate.git
cd substrate
git fetch origin 10bf4bd0d9ed75c62bf9e094759fa9315e1c2017
git checkout 10bf4bd0d9ed75c62bf9e094759fa9315e1c2017
cd bin/node/cli
cargo build --profile=production
This will take quite a while; sorry, I don't have a more minimal reproduction on hand since the issue doesn't reproduce on a toy example and reducing the actual reproduction into a minimal example is tricky when it takes forever to reproduce.
There's a trivial workaround which fixes the issue:
diff --git a/crates/runtime/src/libcalls.rs b/crates/runtime/src/libcalls.rs
index 5bed4d8ef..626fb861f 100644
--- a/crates/runtime/src/libcalls.rs+++ b/crates/runtime/src/libcalls.rs@@ -109,7 +109,7 @@ pub mod trampolines {
// the `sym` operator to get the symbol here, but other targets
// like s390x need to use outlined assembly files which requires
// `no_mangle`.
- #[cfg_attr(target_arch = "s390x", no_mangle)]+ #[no_mangle]
unsafe extern "C" fn [<impl_ $name>](
vmctx : *mut VMContext,
$( $pname : libcall!(@ty $param), )*
I have verified that this "fixes" the issue. (Although of course ideally it'd be best to fix the underlying rustc bug.)
The text was updated successfully, but these errors were encountered:
koute
added
the
bug
Incorrect behavior in the current implementation that needs fixing
label
Feb 13, 2023
(This looks like a
rustc
bug to me, but I'm reporting it here since it can be trivially worked around inwasmtime
.)When
wasmtime
is linked with LTO some of the symbols which are passed into theglobal_asm!
trampolines are not properly preserved and are stripped by LTO, resulting in a link-time compile failure.We hit this after we upgraded from
wasmtime
1.0.2 towasmtime
5.0.0.Steps to Reproduce
This will take quite a while; sorry, I don't have a more minimal reproduction on hand since the issue doesn't reproduce on a toy example and reducing the actual reproduction into a minimal example is tricky when it takes forever to reproduce.
Expected Results
The compilation succeeds.
Actual Results
Linking fails.
Versions and Environment
wasmtime
5.0.0The issue also reproduces on macOS+aarch64.
Extra Info
There's a trivial workaround which fixes the issue:
I have verified that this "fixes" the issue. (Although of course ideally it'd be best to fix the underlying
rustc
bug.)The text was updated successfully, but these errors were encountered: