Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asm! -> llvm_asm! #306

Closed
chrysn opened this issue Sep 19, 2020 · 4 comments
Closed

asm! -> llvm_asm! #306

chrysn opened this issue Sep 19, 2020 · 4 comments
Assignees

Comments

@chrysn
Copy link
Contributor

chrysn commented Sep 19, 2020

Current c2rust produces assembler in the style of asm!("cpsie i" : : : "memory" : "volatile"), which is the style nowadays used with the llvm_asm macro since rust-lang/rust#71007 was merged.

A short-term solution I'm currently using as a workaround is to replace " asm!(" with " llvm_asm!(" in the output (hoping nobody puts this into literals); that's the route I'd like to take for a fix in c2rust as well. It has produced working binaries, though I'm not sure it ever passed through the asm code. (But hey, at least it built).

(A long-term solution might be using modern asm!, but a) that can wait until stable and b) it's probably better suited for a separate ... casm2rust? project, if it's ever really needed at all).

@chrysn
Copy link
Contributor Author

chrysn commented Sep 22, 2020

A thing I missed originally (as I'm only using --emit-modules) but discovered in unrelated testing: The feature(asm) present when exporting transpiled code as a whole needs to become feature(llvm_asm) as well.

@chrysn
Copy link
Contributor Author

chrysn commented Sep 22, 2020

The third occurrence of asm, global_asm!, seems to be unaffected by this transition, and did not have its name changed when asm was renamed to llvm_asm.

@ahomescu
Copy link
Contributor

This makes sense to me, afaik when they introduced the new asm syntax they just renamed the old macro from asm! to llvm_asm!.

@ahomescu ahomescu self-assigned this Sep 22, 2020
@fw-immunant
Copy link
Contributor

Closing as this is no longer relevant: in current Rust, llvm_asm! is gone, asm! is stable since 1.59, and PR #374 landed translation that produces asm!. Anything left is tracked in #363.

chrysn added a commit to RIOT-OS/rust-riot-sys that referenced this issue May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants