Skip to content

Tracking Issue for asm_goto_with_outputs #119364

Open

Description

@nbdd0121

The feature gate for the issue is #![feature(asm_goto_with_outputs)].

Summary

This now tracks the with_outputs variant since #131523. asm_goto was stabilized in 1.87.

This feature adds a label<block> operand type to asm!.

Example:

unsafe {
    asm!(
        "jmp {}",
        label {
            println!("Jumped from asm!");
        }
    );
}

The block must have unit type.

Steps

Unresolved Questions

@rustbot labels: +A-inline-assembly +F-asm

Activity

  1. added
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    on Dec 27, 2023
  2. added
    A-inline-assemblyArea: Inline assembly (`asm!(…)`)
    F-asm`#![feature(asm)]` (not `llvm_asm`)
    on Dec 27, 2023
  3. Noratrieb commented on Dec 27, 2023

    @Noratrieb
    Member

    Where is this coming from? Is there a lang MCP or anything like that?

  4. nbdd0121 commented on Dec 27, 2023

    @nbdd0121
    MemberAuthor

    This is outlined as a future possibility in RFC2873 which I am implementing in #119365.

  5. added 2 commits that reference this issue on Feb 25, 2024
  6. added 2 commits that reference this issue on Mar 8, 2024
  7. added a commit that references this issue on Mar 8, 2024
  8. added a commit that references this issue on Mar 16, 2024
  9. added a commit that references this issue on Mar 21, 2024
  10. 9 remaining items

  11. nikomatsakis commented on Sep 25, 2024

    @nikomatsakis
    Contributor
  12. added a commit that references this issue on Nov 21, 2024
  13. added a commit that references this issue on Nov 21, 2024
  14. added a commit that references this issue on Nov 25, 2024
  15. added a commit that references this issue on Nov 25, 2024
  16. added a commit that references this issue on Mar 17, 2025
  17. added a commit that references this issue on Mar 17, 2025
  18. programmerjake commented on Apr 14, 2025

    @programmerjake
    Member

    what happens with indirect branches to labels when stuff like IBT is in use? do labels start with endbr64 or equivalent? LLVM currently has a RFC up for removing generated endbr64 instructions to match GCC and maybe adding a way to add them back later

  19. nbdd0121 commented on Apr 15, 2025

    @nbdd0121
    MemberAuthor

    I think the current reading of reference isn't really clear on whether this label is allowed to be jumped to indirectly.

    I don't think it'll be a huge issue for now if LLVM removes the endbr64 instruction given that this is only recently stabilized and cf-protection is not stable yet in Rust. Also, if GCC doesn't generate endbr64 then a rustc_codegen_gcc probably wouldn't generate endbr64 either. To allow more room for different backend implementations, I'd be inclined to say let's add a line in the Rust reference to say that the labels should only be jumped to directly if there is an architectural distinction.

  20. Mark-Simulacrum commented on May 4, 2025

    @Mark-Simulacrum
    Member

    It looks like this is now the tracking issue for the with_outputs variant of the feature since #131523, so updating the title accordingly.

  21. changed the title [-]Tracking Issue for asm_goto[/-] [+]Tracking Issue for asm_goto_with_outputs[/+] on May 4, 2025
  22. jstarks commented on Dec 13, 2025

    @jstarks

    What's necessary to stabilize the with_outputs variant? Do we need to wait until the LLVM fix is available in the oldest supported LLVM version?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-inline-assemblyArea: Inline assembly (`asm!(…)`)C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCF-asm`#![feature(asm)]` (not `llvm_asm`)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions