Skip to content

Commit 9be6e40

Browse files
committed
[BOLT][TEST] Add .so instrumentation test
Summary: Shared object instrumentation test Test Plan: bin/llvm-lit -a bolt/test/X86/internal-call-instrument-so.s Reviewers: rafauler FBD34064557
1 parent f2c2e92 commit 9be6e40

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# This reproduces a bug with instrumentation crashes on internal call
2+
3+
# REQUIRES: system-linux,bolt-runtime
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+
45+
.globl _fini
46+
.type _fini, %function
47+
.p2align 4
48+
_fini:
49+
hlt
50+
.size _fini, .-_fini
51+
52+
.data
53+
.globl var
54+
var:
55+
.quad 0xdeadbeef

0 commit comments

Comments
 (0)