[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
This commit is contained in:
Amir Ayupov 2022-02-07 21:14:32 -08:00
parent f2c2e924e7
commit 9be6e40d1a
1 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,55 @@
# This reproduces a bug with instrumentation crashes on internal call
# REQUIRES: system-linux,bolt-runtime
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
# Delete our BB symbols so BOLT doesn't mark them as entry points
# RUN: llvm-strip --strip-unneeded %t.o
# RUN: ld.lld %t.o -o %t.exe -q -shared -fini=_fini
# RUN: llvm-bolt -instrument %t.exe -relocs -o %t.out
.text
.globl _start
.type _start, %function
.p2align 4
_start:
push %rbp
mov %rsp,%rbp
push %r12
push %rbx
sub $0x120,%rsp
mov $0x3,%rbx
.J1:
cmp $0x0,%rbx
je .J2
callq .J3
nopl (%rax,%rax,1)
lea var@GOTPCREL(%rip),%rax
retq
.J2:
add $0x120,%rsp
pop %rbx
pop %r12
jmp .J4
.J3:
pop %rax
add $0x4,%rax
dec %rbx
jmp .J1
.J4:
pop %rbp
retq
.size _start, .-_start
.globl _fini
.type _fini, %function
.p2align 4
_fini:
hlt
.size _fini, .-_fini
.data
.globl var
var:
.quad 0xdeadbeef