Skip to content

asm! -> llvm_asm! #306

Closed
Closed

Description

@chrysn

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).

Activity

  1. chrysn commented on Sep 22, 2020

    @chrysn
    ContributorAuthor

    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.

  2. chrysn commented on Sep 22, 2020

    @chrysn
    ContributorAuthor

    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.

  3. ahomescu commented on Sep 22, 2020

    @ahomescu
    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!.

  4. self-assigned this
    on Sep 22, 2020
  5. fw-immunant commented on Apr 13, 2022

    @fw-immunant
    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions