Repository navigation
[AUTOMATED] fix(entry): preserve loader selectors - #350
Merged
Merged
Conversation
- Probe bytes when section metadata is absent. - Keep address spaces and relocatable coordinates.
phix33
force-pushed
the
fix/et-rel-entry-model
branch
from
September 2, 2026 21:33
dbc9185 to
0058dea
Compare
Contributor
Author
|
Rebased onto current main. The selector and object-location changes now compose with the new function-size inventory, so native CLI and WASM JSON retain both object_location and size. |
Conflict resolution - `decompile.rs`: keep main's `decompile_all` import beside the branch's `EntrySelector` one. - `decompile_all.rs (run_functions)`: keep main's `functions_json` + zero-discovery-error shape and add `object_location` to that renderer, rather than the branch's inlined JSON, which predated both. Review fixes - `kuna decompile <obj> <ambiguous-name>` printed a console transcript capped at its FIRST 2000 characters instead of the ambiguity report — in the default mode that cap lands inside the `option ...` preamble, so the PR's own repro command showed the user nothing. `check_errors` now recovers the selector diagnostic verbatim, candidate lines included, behind the unmapped-entry probe so an external stays an external. - `resolve_entry(Name)` did not apply the `symbolnamebound` fold that `find_entry_by_name` documents as load-bearing, so `--functions <original name>` stopped resolving on a hostile deep-scope name. Bounded in the one shared place. - `kuna xrefs --to <name>` fell through `find_entry_by_name`'s new None-on-ambiguity into `lookup_symbol`, which answers for the first match — the guess this branch exists to refuse. `xrefs` landed on main after the branch, so nothing had reconciled the two. Ambiguity is now reported. - `entry_selectors.rs` hard-coded `target/debug/decomp_dbg`, failing the case outright under `cargo test --release`; it now takes the sibling of its own `kuna`. - `find_entry_by_name`'s doc no longer claims first-match. Tests: two new cases (default-mode ambiguity, `xrefs` ambiguity). Gates: make test 675/675 PARITY OK; make test-stages 574/574 PARITY OK; cargo test --workspace green; make check-spec OK; kuna catalog --check OK. [AUTOMATED] Prepared by Claude Code and reviewed by the maintainer before submission.
mahaloz
added a commit
that referenced
this pull request
Sep 3, 2026
The PR was CONFLICTING against main, which is why no `pull_request` workflow run ever appeared for it: GitHub does not run those when it cannot compute the merge commit, so the PR presented as "CodeQL green" with not one gate executed -- the exact failure mode the tests.yml header warns about. `open_pr.sh --merge` would have refused it (a required suite that is `missing` is treated the same as one that is `skipped`), which is that guard earning its place against a real case. Both conflicts were additive-on-both-sides and are unioned, not picked: - `decompile_all.rs` -- the import block; #350 added EntryLookupError / EntrySelector / ObjectLocation, this branch added the xrefs index, Address, BTreeSet/VecDeque and Rc for `--reachable-from`. - `docs/cli.md` -- #350 documented `object_location`, this branch documented `--summary` and the `total` field. #350 touches loader/entry selectors, which is where `unmappedentry` and `entrymainproto` live, so a clean textual merge proves nothing here. Re-verified on the merged build: the unmappedentry witness still drops 0x349688c1 by default and restores it with `--option unmappedentry off`; entrymainproto still types argc/argv/envp on the PE CRT fixture; and #350's own property -- a loader `main` symbol surviving discovery -- holds. Gates re-run after the merge: make test PARITY OK · make test-stages PARITY OK · make test-cli 10/10 · make check-spec OK · kuna catalog --check OK · counters no drift. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
Relocatable objects can contain same-named local functions at the same section-relative offset.
kuna decompilesilently selects the first definition instead of reporting the ambiguity.The fix
.section+0xOFFSETandSECTION_INDEX:0xOFFSET; report candidates for ambiguous names or raw offsets and reject unmapped addresses.object_locationin JSON output.The tests
Added console, CLI, and WASM cases for collisions, section-qualified selection, invalid coordinates, sectionless mappings, non-default address spaces, and Thumb symbols. The duplicate-name CLI case fails without the fix.