forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BOLT] Ignore functions accessing false positive jump tables
Disassembly and branch target analysis are not decoupled, so any analysis that depends on disassembly may not operate properly. In specific, analyzeJumpTable uses instruction bounds check property. A jump table was analyzed twice: (a) during disassembly, and (b) after disassembly, so there are potentially some mismatched results. In this update, functions that access JTs which fail the second check will be marked as ignored. Test Plan: ``` ninja check-bolt ``` Reviewed By: Amir Differential Revision: https://reviews.llvm.org/D130431
- Loading branch information
Showing
2 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Currently disassembly is not decoupled from branch target analysis. | ||
# This causes a few checks related to availability of target insn to | ||
# fail for stripped binaries: | ||
# (a) analyzeJumpTable | ||
# (b) postProcessEntryPoints | ||
# This test checks if BOLT can safely support instruction bounds check | ||
# for cross-function targets. | ||
|
||
# REQUIRES: system-linux | ||
|
||
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o | ||
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q | ||
# RUN: llvm-bolt %t.exe -o %t.out -v=1 -print-cfg | ||
|
||
.text | ||
.globl main | ||
.type main, %function | ||
.p2align 2 | ||
main: | ||
LBB0: | ||
.cfi_startproc | ||
andl $0xf, %ecx | ||
cmpb $0x4, %cl | ||
ja .main.cold.1 | ||
LBB1: | ||
leaq FAKE_JUMP_TABLE(%rip), %r8 | ||
cmpq %r8, %r9 | ||
LBB2: | ||
xorq %rax, %rax | ||
ret | ||
.cfi_endproc | ||
.size main, .-main | ||
|
||
.globl main.cold.1 | ||
.type main.cold.1, %function | ||
.p2align 2 | ||
main.cold.1: | ||
.cfi_startproc | ||
nop | ||
LBB3: | ||
callq abort | ||
.cfi_endproc | ||
.size main.cold.1, .-main.cold.1 | ||
|
||
.rodata | ||
.globl FAKE_JUMP_TABLE | ||
FAKE_JUMP_TABLE: | ||
.long LBB2-FAKE_JUMP_TABLE | ||
.long LBB3-FAKE_JUMP_TABLE+0x1 |