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 as a fragment of main
16 .type _start, %function
20 .size _start, .-_start
23 .type main.cold, %function
32 # jump table dispatch, jumping to label indexed by val in %ecx
34 leaq JUMP_TABLE
(%rip
), %r8
36 movslq
(%r8,%rcx
,4), %rax
45 .size main.cold, .-main.cold
47 # main function, referenced from jump table in cold fragment
52 # load bearing nop: pad LBB4 so that it can't be treated
53 # as __builtin_unreachable by analyzeJumpTable
60 # jmp table, entries must be R_X86_64_PC32 relocs