[PATCH] D130431: [BOLT] Fix split jump table issues

Huan Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 23 14:20:05 PDT 2022


nhuhuan created this revision.
Herald added a reviewer: rafauler.
Herald added a subscriber: ayermolo.
Herald added a reviewer: Amir.
Herald added a reviewer: maksfb.
Herald added a project: All.
nhuhuan requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.

1. Disassembly and branch target analysis are not decoupled, thus there are some dependencies when analyzing binaries with split function.

  analyzeJumpTable runs in two phases: (a) Detect jump table -- during disassembly (b) Populate jump table entries -- after disassembly

  A mismatch between (a) and (b) is caused by different context: For (a), instruction bounds check is bypassed
  - Jump table entries point to a function not disassembled yet
  - False positive For (b), instruction bounds check is enabled
  - Mismatched. Crashes.

    --> Mark functions mismatch between (a) and (b) as ignored.

2. Some functions are skipped, thus is not disassembled. If jump table entry points to the skipped function, there would be no target label

  --> Mark functions pointing to skipped functions as ignored.

3. postProcessJumpTables generates secondary entry points for target sibling fragments. These added entry points need to be validated by postProcessEntryPoints.

  --> Decouple postProcessJumpTables from postProcessEntryPoints.

Test Plan:

  ninja check-bolt


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130431

Files:
  bolt/lib/Core/BinaryContext.cpp
  bolt/lib/Core/BinaryFunction.cpp
  bolt/lib/Rewrite/RewriteInstance.cpp
  bolt/test/X86/fake_jtable.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130431.447099.patch
Type: text/x-patch
Size: 4590 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220723/db807e44/attachment.bin>


More information about the llvm-commits mailing list