1 ## This reproduces a bug with jump table identification where jump table has
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 --print-cfg --print-only=main \
10 # RUN: 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
22 # exit through abort in main.cold.1, registers cold fragment the regular way
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 # Insert padding between functions, so that the next instruction cannot be
41 # treated as __builtin_unreachable destination for the jump table.
45 .type main.cold.1, %function
50 .size main.cold.1, .-main.cold.1
53 # jmp table, entries must be R_X86_64_PC32 relocs
61 ## Verify that the entry corresponding to the cold fragment was added to
64 # CHECK: PIC Jump table
65 # CHECK-NEXT: 0x{{.*}} :
66 # CHECK-NEXT: 0x{{.*}} :
67 # CHECK-NEXT: 0x{{.*}} : main.cold.1
68 # CHECK-NEXT: 0x{{.*}} :