1 # This reproduces a bug with jump table identification where jump table has
2 # entries pointing to code in function and its cold fragment.
3 # The fragment is only reachable through jump table.
5 # REQUIRES: system-linux
7 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
8 # RUN: llvm-strip --strip-unneeded %t.o
9 # RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
10 # RUN: llvm-bolt %t.exe -o %t.out --lite=0 -v=1 2>&1 | FileCheck %s
12 # CHECK-NOT: unclaimed PC-relative relocations left in data
13 # CHECK: BOLT-INFO: marking main.cold.1 as a fragment of main
25 # jump table dispatch, jumping to label indexed by val in %ecx
27 leaq JUMP_TABLE
(%rip
), %r8
29 movslq
(%r8,%rcx
,4), %rax
40 # cold fragment is only reachable through jump table
42 .type main.cold.1, %function
45 # load bearing nop: pad LBB4 so that it can't be treated
46 # as __builtin_unreachable by analyzeJumpTable
50 .size main.cold.1, .-main.cold.1
53 # jmp table, entries must be R_X86_64_PC32 relocs