Skip to content

Instantly share code, notes, and snippets.

@KatrinaHoffert
Created February 18, 2015 02:23
Show Gist options
  • Save KatrinaHoffert/7e49391ef1979b6f4ad3 to your computer and use it in GitHub Desktop.
Save KatrinaHoffert/7e49391ef1979b6f4ad3 to your computer and use it in GitHub Desktop.
.file "hello.c"
.section .rdata,"dr"
.LC0:
.ascii "Hello, World!\0"
.text
.globl sayHello
.def sayHello; .scl 2; .type 32; .endef
.seh_proc sayHello
sayHello:
pushq %rbp
.seh_pushreg %rbp
movq %rsp, %rbp
.seh_setframe %rbp, 0
subq $32, %rsp
.seh_stackalloc 32
.seh_endprologue
leaq .LC0(%rip), %rcx
call puts
nop
addq $32, %rsp
popq %rbp
ret
.seh_endproc
.ident "GCC: (GNU) 4.9.2"
.def puts; .scl 2; .type 32; .endef
.file "main.c"
.def __main; .scl 2; .type 32; .endef
.text
.globl main
.def main; .scl 2; .type 32; .endef
.seh_proc main
main:
pushq %rbp
.seh_pushreg %rbp
movq %rsp, %rbp
.seh_setframe %rbp, 0
subq $32, %rsp
.seh_stackalloc 32
.seh_endprologue
call __main
call sayHello
movl $0, %eax
addq $32, %rsp
popq %rbp
ret
.seh_endproc
.ident "GCC: (GNU) 4.9.2"
.def sayHello; .scl 2; .type 32; .endef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment