Skip to content

Instantly share code, notes, and snippets.

@ryukinix
Last active October 20, 2017 08:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryukinix/76dc2defe8268d8b3e435aafa0a30c86 to your computer and use it in GitHub Desktop.
Save ryukinix/76dc2defe8268d8b3e435aafa0a30c86 to your computer and use it in GitHub Desktop.
Hello world in Rust ASM generated
pub fn main() {
println!("Hello world!");
}
.text
.file "rs.cgu-0.rs"
.section .text._ZN4core3fmt9Arguments6new_v117h36e209fa9374401fE,"ax",@progbits
.p2align 4, 0x90
.type _ZN4core3fmt9Arguments6new_v117h36e209fa9374401fE,@function
_ZN4core3fmt9Arguments6new_v117h36e209fa9374401fE:
.cfi_startproc
subq $16, %rsp
.Lcfi0:
.cfi_def_cfa_offset 24
movq %rdi, %rax
movq $0, (%rsp)
movq %rsi, (%rdi)
movq %rdx, 8(%rdi)
movq (%rsp), %rdx
movq %rdx, 16(%rdi)
movq 8(%rsp), %rdx
movq %rdx, 24(%rdi)
movq %rcx, 32(%rdi)
movq %r8, 40(%rdi)
addq $16, %rsp
retq
.Lfunc_end0:
.size _ZN4core3fmt9Arguments6new_v117h36e209fa9374401fE, .Lfunc_end0-_ZN4core3fmt9Arguments6new_v117h36e209fa9374401fE
.cfi_endproc
.section .text._ZN2rs4main17h9e8081a6883057b9E,"ax",@progbits
.p2align 4, 0x90
.type _ZN2rs4main17h9e8081a6883057b9E,@function
_ZN2rs4main17h9e8081a6883057b9E:
.cfi_startproc
subq $56, %rsp
.Lcfi1:
.cfi_def_cfa_offset 64
leaq 8(%rsp), %rdi
leaq ref.0(%rip), %rcx
xorl %eax, %eax
movl %eax, %r8d
movq _ZN2rs4main15__STATIC_FMTSTR17hf8343ca7f8c12d32E(%rip), %rsi
movq _ZN2rs4main15__STATIC_FMTSTR17hf8343ca7f8c12d32E+8(%rip), %rdx
callq _ZN4core3fmt9Arguments6new_v117h36e209fa9374401fE
leaq 8(%rsp), %rdi
callq _ZN3std2io5stdio6_print17h6764fcec13be5725E@PLT
addq $56, %rsp
retq
.Lfunc_end1:
.size _ZN2rs4main17h9e8081a6883057b9E, .Lfunc_end1-_ZN2rs4main17h9e8081a6883057b9E
.cfi_endproc
.section .text.main,"ax",@progbits
.globl main
.p2align 4, 0x90
.type main,@function
main:
.cfi_startproc
subq $24, %rsp
.Lcfi2:
.cfi_def_cfa_offset 32
leaq _ZN2rs4main17h9e8081a6883057b9E(%rip), %rax
movq %rdi, 16(%rsp)
movq %rax, %rdi
movq 16(%rsp), %rax
movq %rsi, 8(%rsp)
movq %rax, %rsi
movq 8(%rsp), %rdx
callq _ZN3std2rt10lang_start17hc7d7ddefc6ff9283E@PLT
addq $24, %rsp
retq
.Lfunc_end2:
.size main, .Lfunc_end2-main
.cfi_endproc
.type _ZN2rs4main15__STATIC_FMTSTR17hf8343ca7f8c12d32E,@object
.section .data.rel.ro._ZN2rs4main15__STATIC_FMTSTR17hf8343ca7f8c12d32E,"aw",@progbits
.p2align 3
_ZN2rs4main15__STATIC_FMTSTR17hf8343ca7f8c12d32E:
.quad ref.2
.quad 1
.size _ZN2rs4main15__STATIC_FMTSTR17hf8343ca7f8c12d32E, 16
.type ref.0,@object
.section .rodata.ref.0,"a",@progbits
.p2align 3
ref.0:
.size ref.0, 0
.type str.1,@object
.section .rodata.str.1,"a",@progbits
str.1:
.ascii "Hello world!\n"
.size str.1, 13
.type ref.2,@object
.section .data.rel.ro.ref.2,"aw",@progbits
.p2align 3
ref.2:
.quad str.1
.quad 13
.size ref.2, 16
.section ".note.GNU-stack","",@progbits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment