Skip to content

[AUTOMATED] Name an Itanium virtual method after the function, not its vtable - #1607

Merged
mahaloz merged 7 commits into
Noelo-Lab:mainfrom
stefan-siebert:fix/itanium-vfunc-naming
Nov 16, 2026
Merged

mahaloz merged 7 commits into
Noelo-Lab:mainfrom
stefan-siebert:fix/itanium-vfunc-naming

Conversation

@stefan-siebert

Copy link
Copy Markdown
Contributor

On a GCC/Clang C++ ELF, itaniumrtti names every virtual method after the vtable that points at it, so the function inventory and call sites list routines as Class::vtable_<i>. The MSVC pass stopped doing this in #382.

$ kuna functions decompiler/crates/kuna-analysis/tests/fixtures/itaniumrtti_x86_64.so --json | grep -o '"name": "shapes::Widget::[^"]*"'
"name": "shapes::Widget::vtable_0"
"name": "shapes::Widget::vtable_for_Drawable_0"
"name": "shapes::Widget::vtable_1"
"name": "shapes::Widget::vtable_for_Drawable_1"
"name": "shapes::Widget::vtable_2"
"name": "shapes::Widget::vtable_3"
"name": "shapes::Widget::vtable_for_Drawable_2"

Fix

  • Slot functions are now <C>::vfunc_<i>, and <C>::vfunc_for_<Base>_<i> in a secondary sub-vtable, the same stem the MSVC pass uses. The data labels (<C>_vtable, <C>_vptr, <C>_vtable_for_<Base>) are unchanged.
  • is_vtable_slot_name also treats the vfunc_for_<Base>_<i> form as a slot-index name, so a real method name at a thunk's address outranks it. Before this change the secondary form was never treated as structural.
void shapes::Widget::vfunc_for_Drawable_2(long a0)
{
  shapes::Widget::vfunc_3(a0 + -0x10); // tail-call
}

Tests

  • tests/stages/kuna-itaniumvfunc.xml: with the option off, the thunk and the destructor call are sub_ names. With it on, they are named vfunc_* and no ::vtable_<i> appears. Before the fix, the four on-pass asserts fail.
  • tests/cli/elf-function-inventory-vfunc-labels.json: the Itanium counterpart of pe-function-inventory-labels.
  • verify_itaniumrtti and the engine.rs ranking tests are updated to the new names, and a negative test for the old stem was added. decompile-all speed on the fixture is unchanged (133.6 ms before, 130.5 ms after).

🤖 Generated with Claude Code

stefan-siebert and others added 5 commits November 16, 2026 20:21
…s vtable

itaniumrtti emits a Function symbol at the address each sub-vtable slot
points at and named it `<C>::vtable_<i>` (`<C>::vtable_for_<Base>_<i>` in a
secondary sub-vtable), so `kuna functions` and call sites showed routines
under vtable names. The MSVC sibling pass dropped that stem in Noelo-Lab#382 for the
same reason. The slot functions are now `<C>::vfunc_<i>` and
`<C>::vfunc_for_<Base>_<i>`; the data labels (`<C>_vtable`, `<C>_vptr`,
`<C>_vtable_for_<Base>`) are unchanged.

is_vtable_slot_name now recognises the secondary-sub-vtable form as a
structural slot-index name too, so a real method name at a thunk's address
outranks it. The bare `vtable_<i>` form is no longer emitted by any pass and
is no longer treated as a slot name.

Tests: tests/stages/kuna-itaniumvfunc.xml (off: sub_ names; on: the
Drawable thunk is Widget::vfunc_for_Drawable_2 and tail-calls
Widget::vfunc_3, and no `::vtable_<i>` appears; the pre-change code fails
the four on-pass asserts), tests/cli/elf-function-inventory-vfunc-labels.json,
verify_itaniumrtti and engine ranking tests updated. Stages baseline gains
the six new assertions. Speed: decompile-all on the fixture 133.6 ms ->
130.5 ms median (noise).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Roll back speculative context writes after RET-chain and raw-run probes.
- Preserve context propagation within each probe and normal flow decoding.
- Cover unrelated real-mode return IPs with the rejected-probe and real-transfer controls.
… covers

The private decode-context transaction also wraps the override-flow chain
extension and the funcboundflow entry/padding checks, which share the
out-of-band raw decoder with calltrampoline and callpopret.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKQeLQDThvbHGNoGw8h
@mahaloz

mahaloz commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

[AUTOMATED] Merged current main into the branch (1883935). The stage count in xml.rs and docs/baseline-stages.json conflicted; the count is now 767 and the baseline was re-merged. No other changes.

@mahaloz
mahaloz merged commit 0212a4f into Noelo-Lab:main Nov 16, 2026
stefan-siebert added a commit to stefan-siebert/kuna that referenced this pull request Nov 17, 2026
[AUTOMATED] main gained the Itanium vfunc_ slot naming (Noelo-Lab#1607). Conflicts:
the stage corpus count (now 768), the stages baseline (both sets of
assertions kept), the itaniumrtti row in phases.toml (vfunc_ wording plus
the constructor/destructor text), and the two files generated from it.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
coleleavitt added a commit to coleleavitt/kuna that referenced this pull request Nov 18, 2026
Brings the fork up to upstream main a42c036: the option-catalog restructuring
(Noelo-Lab#1522-Noelo-Lab#1532, 127 options made unconditional or folded into their parents),
the library-friendly bootstrap (Noelo-Lab#1602, LoadOptions/Languages), the mmap'd
image bytes (Noelo-Lab#1506), FID strict/evidence (Noelo-Lab#1547/Noelo-Lab#1549/Noelo-Lab#1550), FLIRT through
the flirt-sig crate (Noelo-Lab#1548/Noelo-Lab#1564), the Itanium ctor/dtor naming (Noelo-Lab#1606/Noelo-Lab#1607),
the MIPS relocation/$gp rework (Noelo-Lab#1520), Octeon atomics (Noelo-Lab#1516) and the rest.

Conflict resolutions that are more than taking both sides:
- fid/flirt: upstream's reviewed FID/FLIRT lineage replaces the fork's
  in-tree .sig reader and FID callee arbitration (`fidcallees`, `flirtsites`
  options dropped; FLIRT site checks are unconditional upstream).
- `callothernoreturn` dropped: upstream's `brktrap` ends the flow at the
  compiler-trap immediates only, and keeps the resumable `brk`s.
- `gortti` now defaults off: upstream's `gotypeglobals` (default on) names the
  same descriptors and itabs; both on named every address twice.
- `calleeretpurge` no longer runs under a Windows cspec, where upstream's
  `calleepurge` reads the callee's purge (and settles the other calls first).
- the prelinked-kernelcache peel declines upstream's mmap path, which has no
  owned bytes to rebase.
- stage tests that upstream pinned under its defaults turn the fork's
  default-on options off where those change the output (alloca, repstring,
  itaniumeh, tailcontract); fork tests re-pinned to upstream's renderings
  (partial global reads, libcnames stack objects, relocatable-object symbol
  names, the one-case switch RuleSwitchSingle folds).

Generated files re-derived: docs/options.md, phase_catalog.json, the catalog
counts (305 options), the stage corpus count (875 files + 83 datatests),
docs/baseline-stages.json (4958 assertions), and the AARCH64 slacomp digest
over the merged AARCH64neon.sinc. docs/baseline.json is untouched
(PARITY OK 675/675).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants