1# REQUIRES: system-linux 2 3## Check that BOLT correctly processes jump table that contains function start 4## as one of its entries. 5 6# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o 7# RUN: %clang %cflags %t.o -o %t.exe -no-pie -Wl,-q 8 9# RUN: llvm-bolt %t.exe --print-normalized --print-only=foo -o %t.out \ 10# RUN: 2>&1 | FileCheck %s 11 12 13 14 .text 15 .globl _start 16 .type _start, %function 17_start: 18 .cfi_startproc 19 call foo 20 ret 21 .cfi_endproc 22 .size _start, .-_start 23 24 .globl foo 25 .type foo, %function 26foo: 27 .cfi_startproc 28.LBB00: 29 movq 0x8(%rdi), %rdi 30 movzbl 0x1(%rdi), %eax 31.LBB00_br: 32 jmpq *"JUMP_TABLE/foo.0"(,%rax,8) 33# CHECK: jmpq {{.*}} # JUMPTABLE 34# CHECK-NEXT: Successors: {{.*}}, {{.*}}, {{.*}}, {{.*}}, {{.*}} 35 36.Ltmp87085: 37 xorl %eax, %eax 38 retq 39 40.Ltmp87086: 41 cmpb $0x0, 0x8(%rdi) 42 setne %al 43 retq 44 45.Ltmp87088: 46 movb $0x1, %al 47 retq 48 49.Ltmp87087: 50 movzbl 0x14(%rdi), %eax 51 andb $0x2, %al 52 shrb %al 53 retq 54 55 .cfi_endproc 56.size foo, .-foo 57 58# Jump tables 59.section .rodata 60"JUMP_TABLE/foo.0": 61 .quad .Ltmp87085 62 .quad .Ltmp87086 63 .quad .Ltmp87087 64 .quad .LBB00 65 .quad .Ltmp87088 66 67# CHECK: Jump table {{.*}} for function foo 68# CHECK-NEXT: 0x{{.*}} : 69# CHECK-NEXT: 0x{{.*}} : 70# CHECK-NEXT: 0x{{.*}} : 71# CHECK-NEXT: 0x{{.*}} : 72# CHECK-NEXT: 0x{{.*}} : 73