4 ms·
Is the asm!() macro going to stabilize? It seems important to ever make a real OS, right?
by jeffdavis 6y ago
Is the asm!() macro going to stabilize? It seems important to ever make a real OS, right?
- pavehawk2007 6y agoHello, all signs point to no. I've seen many threads about stabilizing asm, but most seem to say no this won't happen. In fact, the Rust compiler now throws a warning that asm!() is deprecated in favor of llvm_asm!(). This is the only reason I am still using nightly builds...because I'm forced to use the asm language feature, which is unstable, and because it's unstable, it cannot be used on the stable channel. Edit: to respond to the second half, for out-of-the-box Rust builds, yes, I need global_asm! and asm!. However, asm! is for inline assembly only. Originally, I used GNU's assembler to assemble and then linked using GNU's ld. However, I have since switched to trying to make Rust do everything through its build manager, cargo.
- jcranmer 6y agoThere is a proposal for a new asm! macro: https://github.com/Amanieu/rfcs/blob/inline-asm/text/0000-inline-asm.md https://github.com/Amanieu/rfcs/blob/inline-asm/text/0000-in... (note that the last updated date was 2 days ago, as of the time of this comment). It looks like what you're referring to is the interim plan to rename asm! to llvm_asm! (which will never be stabilized), since it's a very thin wrapper over the current LLVM inline asm support, and then replace asm! with a better implementation. There is a working group specifically for inline asm, so it will happen eventually... but it's not going to be a quick process--think about how long async/await takes, and inline asm is actually rather close to that in terms of all the issues that come out of it.
- pavehawk2007 6y agoWow, that looks like a lot of work went into this RFC. I'm glad it's being taken seriously, and I anxiously await the outcome--whatever that might be. Thank you!
- steveklabnik 6y agoIt's closer than it's ever been! The rough plan: * move asm! to llvm_asm. https://github.com/rust-lang/rust/pull/68404 https://github.com/rust-lang/rust/pull/68404 * implement the actual asm! we want to stabilize: https://github.com/rust-lang/rfcs/pull/2873 https://github.com/rust-lang/rfcs/pull/2873 * stabilize it
- pavehawk2007 6y agoI stand corrected! Thanks for the info!
- steveklabnik 6y agoIt's all good. I think that was the prevailing sentiment for years, but Amanieu put in the work, and things are looking bright. It hasn't been accepted yet, of course, so anything could happen. But stuff is moving in that direction, it seems.
- jeffdavis 6y agoCool! Curious why not WASM also? I have no use case for that, just asking.
- steveklabnik 6y agoSorry, I'm not entirely sure what you're asking?
- pjmlp 6y agoNot really, one can always make use of an external assembler.