1 .text 2 .globl bar 3bar: 4 .cfi_startproc 5 leal (%edi, %edi), %eax 6 ret 7 .cfi_endproc 8 9 .globl asm_main 10asm_main: 11 .cfi_startproc 12 pushq %rbp 13 .cfi_def_cfa_offset 16 14 .cfi_offset %rbp, -16 15 movq %rsp, %rbp 16 .cfi_def_cfa_register %rbp 17 movl $47, %edi 18 19 # install tramp as return address 20 # (similar to signal return trampolines on some platforms) 21 leaq tramp(%rip), %rax 22 pushq %rax 23 jmp bar # call, with return address pointing to tramp 24 25 popq %rbp 26 .cfi_def_cfa %rsp, 8 27 ret 28 .cfi_endproc 29 30 .globl tramp 31tramp: 32 .cfi_startproc 33 .cfi_signal_frame 34 # Emit cfi to line up with the frame created by asm_main 35 .cfi_def_cfa_offset 16 36 .cfi_offset %rbp, -16 37 .cfi_def_cfa_register %rbp 38 # copy asm_main's epilog to clean up the frame 39 popq %rbp 40 .cfi_def_cfa %rsp, 8 41 ret 42 .cfi_endproc 43