Link KPR library with natural callback initialization order #762

Merged
coah80 merged 1 commits from agent/bittle/kpr-lib-link into main 2026-10-02 07:13:46 +00:00
coah80 commented 2026-10-02 07:11:17 +00:00 (Migrated from github.com)

Scope

Follow up #754's 9/9 function matching with native linkage. Two explicit NULL initializers plus one Matching flag; no metadata, forced sections, padding objects, assembly, or new storage.

The flag-only attempt failed the DOL gate at five bytes. MWCC deferred the tentative file-static callbacks until after the function-local once variable: native .sbss was once+0, Romaji+8, DeadKeys+12; reference is DeadKeys+0, Romaji+4, once+8. Giving both existing callback pointers their natural explicit NULL initializers emits them at their declarations and reproduces the reference layout, preserving their local bindings and initial values.

Evidence

  • Before: instruction-aware ctxdiff 6/9, with five SDA21 relocation differences in KPRInitRegionUS, KPRInitQueue, and KPRPutChar despite objdiff reporting 9/9.
  • After: 9/9 ctxdiff exact. Both pointers remain 4 bytes, once remains 8 bytes, and .sbss stays 16 bytes. No additional data or byte padding.
  • All 1,027 source-object audit: only five KPR .text relocation targets change; every allocated section's raw bytes and every other unit remain unchanged.
  • Unit: 1,536/1,536 code and 1,104/1,104 data exact and now fully linked. +1,536 linked code, +1,104 linked data, +1 completed unit; no new exact-code attribution claimed.

Verification after rebase on c44fbd7209

  • Full 43U all_source/progress/report/ok build passes; DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d.
  • Pool identical 2/2; literal-reference audit 9 functions, 2 comparisons, 0 candidates/errors/skips.
  • Tests: literal 36, jump-table 27, pool 8, workflow 7 pass.
  • Global link-address audit: 0 differences; diff --check and main/leaf worktree checks pass.
  • Published tree bfb996f681 exactly matches the tested local tree.

Draft for review; no merge performed.

Note

Adds explicit NULL initializers to the static dead-key and Romaji processing function pointers in kpr_lib.c. This fixes the callback initialization order so the object builds as matching, and the kpr library is switched from NonMatching to Matching in configure.py.

Macroscope summarized c0ebdf4.

## Scope Follow up #754's 9/9 function matching with native linkage. Two explicit NULL initializers plus one Matching flag; no metadata, forced sections, padding objects, assembly, or new storage. The flag-only attempt failed the DOL gate at five bytes. MWCC deferred the tentative file-static callbacks until after the function-local once variable: native .sbss was once+0, Romaji+8, DeadKeys+12; reference is DeadKeys+0, Romaji+4, once+8. Giving both existing callback pointers their natural explicit NULL initializers emits them at their declarations and reproduces the reference layout, preserving their local bindings and initial values. ## Evidence - Before: instruction-aware ctxdiff 6/9, with five SDA21 relocation differences in KPRInitRegionUS, KPRInitQueue, and KPRPutChar despite objdiff reporting 9/9. - After: 9/9 ctxdiff exact. Both pointers remain 4 bytes, once remains 8 bytes, and .sbss stays 16 bytes. No additional data or byte padding. - All 1,027 source-object audit: only five KPR .text relocation targets change; every allocated section's raw bytes and every other unit remain unchanged. - Unit: 1,536/1,536 code and 1,104/1,104 data exact and now fully linked. +1,536 linked code, +1,104 linked data, +1 completed unit; no new exact-code attribution claimed. ## Verification after rebase on c44fbd720965dadcc282b8cea9f6fba352c2f559 - Full 43U all_source/progress/report/ok build passes; DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d. - Pool identical 2/2; literal-reference audit 9 functions, 2 comparisons, 0 candidates/errors/skips. - Tests: literal 36, jump-table 27, pool 8, workflow 7 pass. - Global link-address audit: 0 differences; diff --check and main/leaf worktree checks pass. - Published tree bfb996f6819734d99208875d32318f8c63c09cc7 exactly matches the tested local tree. Draft for review; no merge performed. <!-- 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 kpr library with explicit NULL callback initializers > Adds explicit `NULL` initializers to the static dead-key and Romaji processing function pointers in [kpr_lib.c](https://github.com/coah80/wii-ipl/pull/762/files#diff-32dda98f59ac49aef8b33f404a8da67145a34ce956531ce2d578f278e19d4928). This fixes the callback initialization order so the object builds as matching, and the kpr library is switched from NonMatching to Matching in [configure.py](https://github.com/coah80/wii-ipl/pull/762/files#diff-4d5f3192809ec1b9add6b33007e0c50031ad9a0a2f3f55a481b506468824db2c). > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized c0ebdf4.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-02 07:13:44 +00:00 (Migrated from github.com)

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.
Sign in to join this conversation.