73 lines · plain
1# REQUIRES: system-linux2 3## Check that BOLT correctly processes jump table that contains function start4## as one of its entries.5 6# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o7# RUN: %clang %cflags %t.o -o %t.exe -no-pie -Wl,-q8 9# RUN: llvm-bolt %t.exe --print-normalized --print-only=foo -o %t.out \10# RUN: 2>&1 | FileCheck %s11 12 13 14 .text15 .globl _start16 .type _start, %function17_start:18 .cfi_startproc19 call foo20 ret21 .cfi_endproc22 .size _start, .-_start23 24 .globl foo25 .type foo, %function26foo:27 .cfi_startproc28.LBB00:29 movq 0x8(%rdi), %rdi30 movzbl 0x1(%rdi), %eax31.LBB00_br:32 jmpq *"JUMP_TABLE/foo.0"(,%rax,8)33# CHECK: jmpq {{.*}} # JUMPTABLE34# CHECK-NEXT: Successors: {{.*}}, {{.*}}, {{.*}}, {{.*}}, {{.*}}35 36.Ltmp87085:37 xorl %eax, %eax38 retq39 40.Ltmp87086:41 cmpb $0x0, 0x8(%rdi)42 setne %al43 retq44 45.Ltmp87088:46 movb $0x1, %al47 retq48 49.Ltmp87087:50 movzbl 0x14(%rdi), %eax51 andb $0x2, %al52 shrb %al53 retq54 55 .cfi_endproc56.size foo, .-foo57 58# Jump tables59.section .rodata60"JUMP_TABLE/foo.0":61 .quad .Ltmp8708562 .quad .Ltmp8708663 .quad .Ltmp8708764 .quad .LBB0065 .quad .Ltmp8708866 67# CHECK: Jump table {{.*}} for function foo68# CHECK-NEXT: 0x{{.*}} :69# CHECK-NEXT: 0x{{.*}} :70# CHECK-NEXT: 0x{{.*}} :71# CHECK-NEXT: 0x{{.*}} :72# CHECK-NEXT: 0x{{.*}} :73