Link the exact-matching NAND driver #476

Merged
coah80 merged 3 commits from agent/bittle/link-nand-driver into main 2026-10-01 21:03:40 +00:00
coah80 commented 2026-10-01 21:01:47 +00:00 (Migrated from github.com)

Changes

  • Promote fa/driver/nand_drv.c to Matching.
  • Explicitly zero-initialize its three small-data globals so MWCC emits them in the original order.
  • Restore the following SD driver's 32-byte .bss and .sbss input-section alignment. Without it, linking NAND removes original inter-object padding and shifts later addresses. No padding arrays, invented fields, assembly, or function-boundary changes.

Verification

Rebased on 21c9b95b and freshly rebuilt on Linux for 43U only. Published tree verified identical to the tested local tree.

  • NAND: 18/18 functions, 6,952/6,952 code bytes, 5,696/5,696 data bytes, 100% code/data linked. All five reported sections are 100%.
  • ctxdiff.py: all 18 functions have identical instruction counts and zero differences (local compatibility adapter resolves ELF relocation aliases; the repo's external odiff module is not included).
  • No .data string pool exists in either NAND object. pool_diff.py assumes .data and raises KeyError for this unit; explicit .sdata/.rodata comparisons match including zero alignment padding.
  • Full ninja all_source progress build/43U/report.json build/43U/ok passes.
  • DOL SHA-1: 26116613f624061ba99c8d1a299aaa6efa85670d.
  • Linked code: 61.40923% → 61.641335% (+6,952 bytes). One additional linked unit.
  • git diff --check and worktree checks pass.

Existing validation issue

tools/test_workflow_guards.py has one failure on unchanged main and this branch: the completion checker expects 1,026 units, while the live report contains 1,027. The terminal all-100% checker also correctly reports the remaining incomplete project; this PR does not claim global completion.

Build setup required a local wibo compatibility build for the pinned sjiswrap/compiler on this cloud host. No compiler binaries, original DOL, or environment-only tooling are committed.

Left as a draft for Cole's review. I will not merge this PR.

Note

Changes fa/driver/nand_drv.c from a NonMatching to a Matching object in the system module config, so it is now linked from source instead of the prebuilt object. Adds explicit zero initializers to the global NAND state definitions (Nanddisk_Internal_Info_Init, NAND_Init, fa_nanad_semid) and adds 32-byte alignment metadata to the .bss/.sbss ranges for the driver in splits.txt.

Macroscope summarized 4ea45ae.

## Changes - Promote `fa/driver/nand_drv.c` to Matching. - Explicitly zero-initialize its three small-data globals so MWCC emits them in the original order. - Restore the following SD driver's 32-byte `.bss` and `.sbss` input-section alignment. Without it, linking NAND removes original inter-object padding and shifts later addresses. No padding arrays, invented fields, assembly, or function-boundary changes. ## Verification Rebased on `21c9b95b` and freshly rebuilt on Linux for 43U only. Published tree verified identical to the tested local tree. - NAND: **18/18 functions, 6,952/6,952 code bytes, 5,696/5,696 data bytes, 100% code/data linked**. All five reported sections are 100%. - `ctxdiff.py`: all 18 functions have identical instruction counts and zero differences (local compatibility adapter resolves ELF relocation aliases; the repo's external `odiff` module is not included). - No `.data` string pool exists in either NAND object. `pool_diff.py` assumes `.data` and raises KeyError for this unit; explicit `.sdata`/`.rodata` comparisons match including zero alignment padding. - Full `ninja all_source progress build/43U/report.json build/43U/ok` passes. - DOL SHA-1: **26116613f624061ba99c8d1a299aaa6efa85670d**. - Linked code: **61.40923% → 61.641335%** (+6,952 bytes). One additional linked unit. - `git diff --check` and worktree checks pass. ## Existing validation issue `tools/test_workflow_guards.py` has one failure on unchanged main and this branch: the completion checker expects 1,026 units, while the live report contains 1,027. The terminal all-100% checker also correctly reports the remaining incomplete project; this PR does not claim global completion. Build setup required a local wibo compatibility build for the pinned sjiswrap/compiler on this cloud host. No compiler binaries, original DOL, or environment-only tooling are committed. Left as a draft for Cole's review. I will not merge this PR. <!-- 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] > ### Link the exact-matching NAND driver > Changes `fa/driver/nand_drv.c` from a `NonMatching` to a `Matching` object in the `system` module config, so it is now linked from source instead of the prebuilt object. Adds explicit zero initializers to the global NAND state definitions (`Nanddisk_Internal_Info_Init`, `NAND_Init`, `fa_nanad_semid`) and adds 32-byte alignment metadata to the `.bss`/`.sbss` ranges for the driver in [splits.txt](https://github.com/coah80/wii-ipl/pull/476/files#diff-d5132efbf4d83cc6fc61c89e9d57150d270f1361827760236aeab4e594f19366). > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized 4ea45ae.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-01 21:03:38 +00:00 (Migrated from github.com)

Reviewed and merged. Independent clean rebuild on the orchestrator gate: DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, nand_drv 18/18 instruction-exact with code/data 6952/6952 and 5696/5696 and every section at 100%, 0 regressions, 0 forbidden or readability hits. Both config changes are fine: = 0 initializers are plausible original source, and align:32 on sd_drv's .bss/.sbss describes the original object's input-section alignment rather than adding padding.

For future PRs:

  • This is the right shape: one unit, honest source, config changes explained, verification numbers in the body. Keep doing that.
  • When a split/alignment change is needed, cite the evidence (the address gap or the original object's section alignment), as you did here.
  • Rebase right before opening: this branch was one commit behind main. It merged cleanly, but a stale base makes the regression check compare against the wrong reference.
  • pool_diff.py raising KeyError on units without .data is a tooling bug; a separate small PR making it skip missing sections would help every worker.
  • The test_workflow_guards.py 1026 vs 1027 unit count is a stale constant on main; a one-line fix PR is welcome.
Reviewed and merged. Independent clean rebuild on the orchestrator gate: DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, nand_drv 18/18 instruction-exact with code/data 6952/6952 and 5696/5696 and every section at 100%, 0 regressions, 0 forbidden or readability hits. Both config changes are fine: `= 0` initializers are plausible original source, and `align:32` on sd_drv's .bss/.sbss describes the original object's input-section alignment rather than adding padding. For future PRs: - This is the right shape: one unit, honest source, config changes explained, verification numbers in the body. Keep doing that. - When a split/alignment change is needed, cite the evidence (the address gap or the original object's section alignment), as you did here. - Rebase right before opening: this branch was one commit behind main. It merged cleanly, but a stale base makes the regression check compare against the wrong reference. - pool_diff.py raising KeyError on units without .data is a tooling bug; a separate small PR making it skip missing sections would help every worker. - The test_workflow_guards.py 1026 vs 1027 unit count is a stale constant on main; a one-line fix PR is welcome.
Sign in to join this conversation.