brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · eb87b96 Raw
88 lines · plain
1## Check that llvm-bolt correctly updates ambiguous jump table entries that2## can correspond to either builtin_unreachable() or could be a pointer to3## the next function.4 5# REQUIRES: system-linux6 7# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o8# RUN: %clang %cflags %t.o -o %t.exe -no-pie -Wl,-q9 10# RUN: llvm-bolt %t.exe --print-normalized --print-only=foo -o %t.out \11# RUN:   2>&1 | FileCheck %s12 13 14 15  .text16  .globl _start17  .type _start, %function18_start:19  .cfi_startproc20  call foo21  ret22  .cfi_endproc23  .size _start, .-_start24 25  .globl foo26  .type foo, %function27foo:28	.cfi_startproc29.LBB00:30          movq	0x8(%rdi), %rdi31          movzbl	0x1(%rdi), %eax32.LBB00_br:33	        jmpq	*"JUMP_TABLE/foo.0"(,%rax,8)34# CHECK:  jmpq {{.*}} # JUMPTABLE35# CHECK-NEXT: Successors: {{.*}}, {{.*}}, {{.*}}, {{.*}}, {{.*}}36 37.Ltmp87085:38	xorl	%eax, %eax39	retq40 41.Ltmp87086:42	cmpb	$0x0, 0x8(%rdi)43	setne	%al44	retq45 46.Ltmp87088:47	movb	$0x1, %al48	retq49 50.Ltmp87087:51	movzbl	0x14(%rdi), %eax52	andb	$0x2, %al53	shrb	%al54	retq55 56	.cfi_endproc57.size foo, .-foo58 59  .globl bar60  .type bar, %function61bar:62	.cfi_startproc63  ret64	.cfi_endproc65  .size bar, .-bar66 67# Jump tables68.section .rodata69  .global jump_table70jump_table:71"JUMP_TABLE/foo.0":72  .quad bar73  .quad	.Ltmp8708574  .quad bar75  .quad	.Ltmp8708676  .quad	.Ltmp8708777  .quad	.LBB0078  .quad	.Ltmp8708879  .quad bar80  .quad	.LBB0081 82# CHECK: Jump table {{.*}} for function foo83# CHECK-NEXT: 0x{{.*}} : bar84# CHECK-NEXT: 0x{{.*}} :85# CHECK-NEXT: 0x{{.*}} : bar86# CHECK-NEXT: 0x{{.*}} :87# CHECK-NEXT: 0x{{.*}} :88