1 # This reproduces a bug with converting an unknown control flow jump table with
2 # entries pointing to code in function and its cold fragment.
4 # REQUIRES: system-linux
6 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
7 # RUN: llvm-strip --strip-unneeded %t.o
8 # RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
9 # RUN: llvm-bolt %t.exe -o %t.out --lite=0 -v=1 --strict=1 -print-cfg \
10 # RUN: -print-only=main 2>&1 | FileCheck %s
12 # CHECK: BOLT-INFO: marking main.cold.1 as a fragment of main
13 # CHECK: Binary Function "main" after building cfg
14 # CHECK: Unknown CF : true
15 # CHECK: jmpq *%r8 # UNKNOWN CONTROL FLOW
16 # CHECK: PIC Jump table JUMP_TABLE for function main
17 # CHECK-NEXT: 0x0000 : .Ltmp0
18 # CHECK-NEXT: 0x0004 : .Ltmp1
19 # CHECK-NEXT: 0x0008 : __ENTRY_main.cold.1
20 # CHECK-NEXT: 0x000c : .Ltmp1
27 leaq JUMP_TABLE
(%rip
), %r8
30 # exit through abort in main.cold.1, registers cold fragment the regular way
33 # jump table dispatch, jumping to label indexed by val in %ecx
36 movslq
(%r8,%rcx
,4), %rax
48 .type main.cold.1, %function
51 # load bearing nop: pad LBB4 so that it can't be treated
52 # as __builtin_unreachable by analyzeJumpTable
56 .size main.cold.1, .-main.cold.1
59 # jmp table, entries must be R_X86_64_PC32 relocs