Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/bolt
diff options
context:
space:
mode:
authorAmir Ayupov <aaupov@fb.com>2022-02-08 08:14:32 +0300
committerAmir Ayupov <aaupov@fb.com>2022-02-08 23:43:06 +0300
commit9be6e40d1afb59bd33acab5bf8de830cff92c860 (patch)
tree23270bbbdeb36ed2f08579775869f074a8c1e73e /bolt
parentf2c2e924e73a76562b7cc6d8fd96df5b177eaf18 (diff)
[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
Diffstat (limited to 'bolt')
-rw-r--r--bolt/test/X86/internal-call-instrument-so.s55
1 files changed, 55 insertions, 0 deletions
diff --git a/bolt/test/X86/internal-call-instrument-so.s b/bolt/test/X86/internal-call-instrument-so.s
new file mode 100644
index 000000000000..67a6e4ec6478
--- /dev/null
+++ b/bolt/test/X86/internal-call-instrument-so.s
@@ -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