Skip to content

Instantly share code, notes, and snippets.

@yhaskell
Created April 7, 2018 20:56
Show Gist options
  • Save yhaskell/9d1549eba75b98c362830c0c4814bef5 to your computer and use it in GitHub Desktop.
Save yhaskell/9d1549eba75b98c362830c0c4814bef5 to your computer and use it in GitHub Desktop.
int test_static_value() {
static int static_value = 1;
return static_value++;
}
.file "static-var-test.c"
.text
.globl test_static_value
.type test_static_value, @function
test_static_value:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
movq %rsp, %rbp
.cfi_offset 6, -16
.cfi_def_cfa_register 6
movl static_value.1589(%rip), %eax
movl %eax, %edx
addl $1, %eax
movl %eax, static_value.1589(%rip)
movl %edx, %eax
leave
ret
.cfi_endproc
.LFE0:
.size test_static_value, .-test_static_value
.data
.align 4
.type static_value.1589, @object
.size static_value.1589, 4
static_value.1589:
.long 1
.ident "GCC: (Debian 4.4.5-8) 4.4.5"
.section .note.GNU-stack,"",@progbits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment