1 # This reproduces a bug with instrumentation when trying to instrument
2 # a function with only tail calls. Such functions can clobber red zone,
3 # see https://github.com/llvm/llvm-project/issues/61114.
5 # REQUIRES: system-linux,bolt-runtime
7 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
8 # RUN: %clang %cflags -no-pie %t.o -o %t.exe -Wl,-q
10 # RUN: llvm-bolt %t.exe --instrument --instrumentation-file=%t.fdata \
11 # RUN: -o %t.instrumented
12 # RUN: %t.instrumented arg1 arg2
13 # RUN: llvm-objdump %t.instrumented --disassemble-symbols=main | FileCheck %s
15 # CHECK: leaq 0x80(%rsp), %rsp
17 # RUN: FileCheck %s --input-file %t.fdata --check-prefix=CHECK-FDATA
18 # CHECK-FDATA: 1 main {{.*}} 1 targetFunc 0 0 1
29 pushq
%rax
# We save the target function address in the stack
30 subq $
0x18, %rsp
# Set up a dummy stack frame
32 jb
.LBBerror # Add control flow so we don't have a trivial case
45 movq $
1, %rax
# Finish with an error if we go this path
50 .type targetFunc, %function
55 .size targetFunc, .-targetFunc