xref: /llvm-project/bolt/test/X86/internal-call-instrument-so.s (revision 11791ae7b0b05b8bd8d806331ff51da618912cf8)
1## This reproduces a bug with instrumentation crashes on internal call
2
3# REQUIRES: system-linux,bolt-runtime,target=x86_64{{.*}}
4
5# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
6# Delete our BB symbols so BOLT doesn't mark them as entry points
7# RUN: llvm-strip --strip-unneeded %t.o
8# RUN: ld.lld %t.o -o %t.exe -q -shared -fini=_fini
9# RUN: llvm-bolt --instrument %t.exe --relocs -o %t.out
10
11  .text
12  .globl  _start
13  .type _start, %function
14  .p2align  4
15_start:
16  push   %rbp
17  mov    %rsp,%rbp
18  push   %r12
19  push   %rbx
20  sub    $0x120,%rsp
21  mov    $0x3,%rbx
22.J1:
23  cmp    $0x0,%rbx
24  je     .J2
25  callq  .J3
26  nopl   (%rax,%rax,1)
27  lea    var@GOTPCREL(%rip),%rax
28  retq
29.J2:
30  add    $0x120,%rsp
31  pop    %rbx
32  pop    %r12
33  jmp    .J4
34.J3:
35  pop    %rax
36  add    $0x4,%rax
37  dec    %rbx
38  jmp    .J1
39.J4:
40  pop    %rbp
41  retq
42  .size _start, .-_start
43
44  .globl  _fini
45  .type _fini, %function
46  .p2align  4
47_fini:
48  hlt
49  .size _fini, .-_fini
50
51  .data
52  .globl var
53var:
54  .quad 0xdeadbeef
55