| 1 | // This is reduced test case for BOLT containing an internal call based on |
| 2 | // GetCoreDump (from google core dumper). |
| 3 | |
| 4 | .text |
| 5 | .globl getCallback |
| 6 | .type getCallback, %function |
| 7 | getCallback: |
| 8 | .cfi_startproc |
| 9 | pushq %rbp |
| 10 | movq %rsp, %rbp |
| 11 | pushq %r12 |
| 12 | pushq %rbx |
| 13 | subq $288, %rsp |
| 14 | callq .Lnext_instr |
| 15 | .Lnext_instr: |
| 16 | popq %rax |
| 17 | addq $17, %rax |
| 18 | addq $288, %rsp |
| 19 | popq %rbx |
| 20 | popq %r12 |
| 21 | popq %rbp |
| 22 | retq |
| 23 | .Lweird_callback: |
| 24 | mov $0xDEADBEEF, %rax |
| 25 | retq |
| 26 | .cfi_endproc |
| 27 | |
| 28 | |
| 29 | // This one is inspired by: |
| 30 | // |
| 31 | // e8 11 00 00 00 callq 17 <ListerThread+0x569> |
| 32 | // 0f 1f 84 00 00 00 00 00 nopl (%rax,%rax) |
| 33 | // 48 c7 c0 0f 00 00 00 movq $15, %rax |
| 34 | // 0f 05 syscall |
| 35 | // 58 popq %rax |
| 36 | // |
| 37 | .globl getCallback2 |
| 38 | .type getCallback2, %function |
| 39 | getCallback2: |
| 40 | .cfi_startproc |
| 41 | pushq %rbp |
| 42 | movq %rsp, %rbp |
| 43 | pushq %r12 |
| 44 | pushq %rbx |
| 45 | subq $288, %rsp |
| 46 | movq $3, %rbx |
| 47 | .Lheader: |
| 48 | cmpq $0, %rbx |
| 49 | jz .Lunwind |
| 50 | callq .Lbb |
| 51 | nopl (%rax, %rax) |
| 52 | mov $0xDEADBEEF, %rax |
| 53 | retq |
| 54 | .Lunwind: |
| 55 | addq $288, %rsp |
| 56 | popq %rbx |
| 57 | popq %r12 |
| 58 | jmp .Lend |
| 59 | .Lbb: |
| 60 | popq %rax |
| 61 | add $4, %rax |
| 62 | decq %rbx |
| 63 | jmp .Lheader |
| 64 | .Lend: |
| 65 | popq %rbp |
| 66 | retq |
| 67 | .cfi_endproc |
| 68 | |
| 69 | // This case emulates pseudo-inlined functions found in Intel MKL library. |
| 70 | .globl getCallback3 |
| 71 | .type getCallback3, %function |
| 72 | getCallback3: |
| 73 | .cfi_startproc |
| 74 | pushq %rbp |
| 75 | movq %rsp, %rbp |
| 76 | callq getCallback_inlined |
| 77 | jmp .L2end |
| 78 | nop |
| 79 | getCallback_inlined: |
| 80 | pushq %rbp |
| 81 | movq %rsp, %rbp |
| 82 | pushq %r12 |
| 83 | pushq %rbx |
| 84 | subq $288, %rsp |
| 85 | callq .L2next_instr |
| 86 | .L2next_instr: |
| 87 | popq %rax |
| 88 | addq $17, %rax |
| 89 | addq $288, %rsp |
| 90 | popq %rbx |
| 91 | popq %r12 |
| 92 | popq %rbp |
| 93 | retq |
| 94 | .L2weird_callback: |
| 95 | mov $0xDEADBEEF, %rax |
| 96 | retq |
| 97 | |
| 98 | .L2end: |
| 99 | popq %rbp |
| 100 | retq |
| 101 | .cfi_endproc |
| 102 | |