macaw/x86/tests/x64/test-indirect-call.s
2017-09-27 15:54:43 -07:00

63 lines
1008 B
ArmAsm

.file "test-indirect-call.c"
.globl g
.data
.align 4
.type g, @object
.size g, 4
g:
.long -11
.comm fptr,8,8
.text
.globl callee
.type callee, @function
callee:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movl %edi, -4(%rbp)
movl -4(%rbp), %eax
addl %eax, %eax
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size callee, .-callee
.globl _start
.type _start, @function
_start:
.LFB1:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
leaq callee(%rip), %rax
movq %rax, fptr(%rip)
movq fptr(%rip), %rax
movl g(%rip), %edx
movl %edx, %edi
call *%rax
movl %eax, g(%rip)
#APP
# 15 "test-indirect-call.c" 1
movq $60,%rax
movq $0,%rdi
syscall
# 0 "" 2
#NO_APP
nop
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1:
.size _start, .-_start
.ident "GCC: (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005"
.section .note.GNU-stack,"",@progbits