[all-commits] [llvm/llvm-project] e5c19b: [BOLT] Skip function instead of aborting on jump t...

nitro via All-commits all-commits at lists.llvm.org
Wed Jul 15 14:50:49 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e5c19b0ebc54206348273fc2f7cf67cb195908ed
      https://github.com/llvm/llvm-project/commit/e5c19b0ebc54206348273fc2f7cf67cb195908ed
  Author: nitro <nitro123 at outlook.com>
  Date:   2026-07-15 (Wed, 15 Jul 2026)

  Changed paths:
    M bolt/lib/Core/BinaryContext.cpp
    A bolt/test/X86/jump-table-failed-reanalysis.s

  Log Message:
  -----------
  [BOLT] Skip function instead of aborting on jump table analysis failure (#206742)

`analyzeJumpTable()` runs twice on a candidate jump table: once from
`analyzeMemoryAt` while the referencing function is being disassembled,
and
again from `populateJumpTables()` after disassembly. The second run is
stricter,
because the check that an entry points at an instruction
(`getInstructionAtOffset`) only fires once the target function reaches
the
`Disassembled` state. A table can therefore be accepted the first time
and
rejected the second -- for instance when an entry lands at an address
with no
instruction (a symbol whose declared size is larger than its
disassembled
extent). `populateJumpTables()` reached `llvm_unreachable("jump table
heuristic
failure")` and aborted in that case.

Handle it the way BOLT already handles indirect branches it can't
analyze: drop
the table and skip the owning function(s) via `addFragmentsToSkip()`.
The
`JumpTable` is deliberately left in the maps so it is still freed by
`~BinaryContext` (an earlier attempt at this, 52cd00ca, was reverted in
468d4f6d
because it erased the table without deallocating it).

New test `jump-table-failed-reanalysis.s` builds such a table; before
this change
BOLT aborts, after it the function is skipped and the rest of the binary
is
processed normally.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list