Handle objects without .data in pool_diff #478

Merged
coah80 merged 2 commits from agent/bittle/pool-missing-data into main 2026-10-01 21:11:02 +00:00
coah80 commented 2026-10-01 21:08:40 +00:00 (Migrated from github.com)

Separate tooling follow-up requested in #476's review. Rebased/checked against f4fd16f8 immediately before publishing.

  • An absent .data section now represents an empty string pool instead of raising KeyError.
  • Different string counts now return failure, so a missing section on one side cannot silently accept a nonempty pool on the other. Existing first-divergence comparison is preserved.
  • Eight focused tests cover absent/empty sections, extraction, equal pools, changed strings, and missing left/right pools.

Validation: python tools/decomp-assist/test_pool_diff.py passes 8/8; running the tool on both freshly built NAND driver objects now reports POOL IDENTICAL up to 0 (mine=0 base=0); git diff --check passes. This tool still compares string pools, not all data sections; objdiff and the DOL hash remain required.

No matching flags, original binaries, or C/C++ source changes. Left for Cole to review and merge.

Note

Handle ELF files without a .data section in pool_diff

  • pool_diff.pool now looks up the .data section directly and returns an empty list when it is absent, instead of raising a lookup error
  • pool_diff.main now returns 1 when the two pools differ in length, instead of reporting success after comparing only the common strings
  • Adds unit tests in test_pool_diff.py covering missing sections, empty data, string extraction, and pool-length mismatches

Macroscope summarized df26ca2.

Separate tooling follow-up requested in #476's review. Rebased/checked against `f4fd16f8` immediately before publishing. - An absent `.data` section now represents an empty string pool instead of raising `KeyError`. - Different string counts now return failure, so a missing section on one side cannot silently accept a nonempty pool on the other. Existing first-divergence comparison is preserved. - Eight focused tests cover absent/empty sections, extraction, equal pools, changed strings, and missing left/right pools. Validation: `python tools/decomp-assist/test_pool_diff.py` passes 8/8; running the tool on both freshly built NAND driver objects now reports `POOL IDENTICAL up to 0 (mine=0 base=0)`; `git diff --check` passes. This tool still compares string pools, not all data sections; objdiff and the DOL hash remain required. No matching flags, original binaries, or C/C++ source changes. Left for Cole to review and merge. <!-- Macroscope's pull request summary starts here --> <!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. --> <!-- If you delete either of the start / end markers from your PR's description, Macroscope will append its summary at the bottom of the description. --> > [!NOTE] > ### Handle ELF files without a `.data` section in `pool_diff` > - `pool_diff.pool` now looks up the `.data` section directly and returns an empty list when it is absent, instead of raising a lookup error > - `pool_diff.main` now returns 1 when the two pools differ in length, instead of reporting success after comparing only the common strings > - Adds unit tests in [test_pool_diff.py](https://github.com/coah80/wii-ipl/pull/478/files#diff-7450237af12b6ddcbac50e25387baec6679a0f0fbd0d93659ed03a46b033ca22) covering missing sections, empty data, string extraction, and pool-length mismatches > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized df26ca2.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-01 21:10:59 +00:00 (Migrated from github.com)

Reviewed and merged: the 8 unit tests pass locally, missing .data now reads as an empty pool, and the extra-strings case finally returns non-zero (that was a real bug). Good catch adding that. Feedback: keep tests next to the tool like this; and when you change an exit code, note in the body who consumes it (here nothing in CI depends on pool_diff's exit status, so it's safe).

Reviewed and merged: the 8 unit tests pass locally, missing .data now reads as an empty pool, and the extra-strings case finally returns non-zero (that was a real bug). Good catch adding that. Feedback: keep tests next to the tool like this; and when you change an exit code, note in the body who consumes it (here nothing in CI depends on pool_diff's exit status, so it's safe).
Sign in to join this conversation.