gnzlbg / cargo-asm

cargo subcommand showing the assembly or llvm-ir generated for Rust code
https://github.com/gnzlbg/cargo-asm
Other
1.17k stars 36 forks source link

The first line of assembly is missing #171

Open RustyYato opened 4 years ago

RustyYato commented 4 years ago
pub fn inc(x: usize) -> usize {
    x + 1
}

I tried running cargo asm $crate_name::inc, and got

brand::inc:
 ret

Notice how the first line of assembly is missing (the add instruction)

Moreover, when I add a spin_loop_hint

pub fn inc(x: usize) -> usize {
    std::sync::atomic::spin_loop_hint();
    x + 1
}
brand::inc:
 lea     rax, [rcx, +, 1]
 ret

Notice how the first line of assembly is missing (the pause instruction). So, looks like it just isn't printing out the first line correctly, or the first line gets overwritten by the function name.

I'm running on windows (rust nightly-x86_64-pc-windows-msvc) with version 0.1.16