the-ssd opened PR #12235 from the-ssd:cranelift-nostd-assembler to bytecodealliance:main:
Part of #12222, slightly refactored. Related to #1158.
Adds support for no_std compilation of cranelift-assmebler-x64. Required for cranelift-codegen to support no_std compilation.
the-ssd requested fitzgen for a review on PR #12235.
the-ssd requested wasmtime-default-reviewers for a review on PR #12235.
the-ssd requested wasmtime-compiler-reviewers for a review on PR #12235.
the-ssd updated PR #12235.
the-ssd updated PR #12235.
the-ssd submitted PR review.
the-ssd created PR review comment:
--no-default-featurescan be removed
the-ssd commented on PR #12235:
I guess the CI is running cargo test with all features, should I change core feature to std, or can you help me fix the CI?
bjorn3 submitted PR review.
bjorn3 created PR review comment:
Maybe just make this unconditionally
#![no_std]?
bjorn3 submitted PR review.
bjorn3 created PR review comment:
It should be fine to not add no_std support here I think. This binary is not meant to be compiled when building something that uses Cranelift or Wasmtime anyway. And it can't do anything useful with no_std.
bjorn3 submitted PR review.
bjorn3 created PR review comment:
bjorn3 submitted PR review.
bjorn3 created PR review comment:
Maybe order these above the
use crate::? stdlib -> extern dependencies -> local items is a common order for use items.
bjorn3 submitted PR review.
bjorn3 created PR review comment:
use core::fmt; use alloc::{format, string::String};
bjorn3 edited PR review comment.
bjorn3 submitted PR review.
bjorn3 created PR review comment:
use core::num::NonZeroU8;
the-ssd updated PR #12235.
the-ssd submitted PR review.
the-ssd created PR review comment:
It breaks when using
fuzz, becausearbitraryuses std
the-ssd submitted PR review.
the-ssd created PR review comment:
Yea, but the thing is I am not sure how to do it, cause it refuses to compile without this hack
the-ssd updated PR #12235.
the-ssd updated PR #12235.
the-ssd updated PR #12235.
the-ssd submitted PR review.
the-ssd created PR review comment:
Reordered in bb54410
bjorn3 submitted PR review.
bjorn3 created PR review comment:
If you want to check compiling cranelift-assembler-x64 try
cargo build -p cranelift-assembler-x64 --libto skip building the binary.
bjorn3 submitted PR review.
bjorn3 created PR review comment:
You could add
extern crate std;tofuzz.rsand add appropriate imports. It is only compiled when testing or fuzzing anyway.
the-ssd updated PR #12235.
the-ssd submitted PR review.
the-ssd created PR review comment:
c374cc9
the-ssd updated PR #12235.
the-ssd created PR review comment:
afd80f1
the-ssd submitted PR review.
the-ssd updated PR #12235.
the-ssd updated PR #12235.
the-ssd submitted PR review.
the-ssd created PR review comment:
removed
the-ssd updated PR #12235.
alexcrichton submitted PR review:
Thanks for this!
alexcrichton merged PR #12235.
the-ssd commented on PR #12235:
@alexcrichton Thank you too! This is almost everything needed for #12222. I still am not sure if the way I deal with OnceLock is good enough to be merged (because it just recomputes MachineEnv each time). And some architectures use
powiwhich libm doesn't have (only x86 and arm compile with no_std).
alexcrichton commented on PR #12235:
Want to rebase that PR after the recent merges and we can brainstorm over there? Should in theory be a bit easier to think about with a smaller diff
the-ssd commented on PR #12235:
@alexcrichton I have already rebased it, a lot of it is just adding prelude, fixing hashmap usage (also FxHashMap on no_std now works). Really the only thing is OnceLock. I removed it, but now it is recomputed each time. I can try to find a no_std replacement or move some stuff around in order to use sync_nostd.rs similar to the old PR.
Also I accidentally formated Cargo.toml, so maybe I should revert it
the-ssd edited a comment on PR #12235:
@alexcrichton I have already rebased it, a lot of it is are one line changes like adding prelude, fixing hashmap import (also FxHashMap on no_std now works). Really the only thing is OnceLock. I removed it, but now it's recomputed each time. I can try to find a no_std replacement or move some stuff around in order to use sync_nostd.rs like suggested in the old PR.
Also I accidentally formated Cargo.toml, so maybe I should revert it
Last updated: Jan 09 2026 at 13:15 UTC