xref: /llvm-project/bolt/test/X86/internal-call-instrument.s (revision 11791ae7b0b05b8bd8d806331ff51da618912cf8)
1## This reproduces a bug with instrumentation crashes on internal call
2
3# REQUIRES: x86_64-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: %clang %cflags %t.o -o %t.exe -Wl,-q
9
10# RUN: llvm-bolt --instrument %t.exe --relocs -o %t.out
11
12  .text
13  .globl _start
14  .type _start, %function
15  .p2align  4
16_start:
17  call main
18  ret
19  .size _start, .-_start
20
21  .globl  main
22  .type main, %function
23  .p2align  4
24main:
25  push   %rbp
26  mov    %rsp,%rbp
27  push   %r12
28  push   %rbx
29  sub    $0x120,%rsp
30  mov    $0x3,%rbx
31  movq   rel(%rip), %rdi
32.J1:
33  cmp    $0x0,%rbx
34  je     .J2
35  callq  .J3
36  nopl   (%rax,%rax,1)
37  movabs $0xdeadbeef,%rax
38  retq
39.J2:
40  add    $0x120,%rsp
41  pop    %rbx
42  pop    %r12
43  jmp    .J4
44.J3:
45  pop    %rax
46  add    $0x4,%rax
47  dec    %rbx
48  jmp    .J1
49.J4:
50  pop    %rbp
51  retq
52end:
53  .size main, .-main
54
55  .globl  _fini
56  .type _fini, %function
57  .p2align  4
58_fini:
59  hlt
60  .size _fini, .-_fini
61
62  .data
63rel: .quad end
64