mirror of
https://github.com/Druthulu/BFM-decomp
synced 2026-10-06 01:04:13 -04:00
594a87e173
match_one masks relocations (26-bit jal field, HI16/LO16 immediates), so it verifies instruction SHAPE and is structurally blind to WHICH symbol each relocation names: a draft calling the wrong function or touching the wrong global reports a clean MATCH (§174 law 1c; wave K burned 5 gate attempts on two swapped globals). Until now only the whole-binary gate caught it, and it reports a hash, not a cause. But the target .s comment column carries the FINAL LINKED WORD, so the true address behind every masked field is recoverable arithmetically, and config/symbols*.txt maps it back to a name. This tool resolves what the DRAFT names, computes what the TARGET references, and compares -- /bin/bash, no rebuild, and it names the fix instead of reporting a mismatch. match_one --emit-streams additionally carries mine_relocs (kind/operand per index); existing consumers read mine/tgt only. THREE INSTRUMENT BUGS FOUND BY ITS OWN NEGATIVE CONTROLS, each fixed before any verdict was believed (R35/R39): - splat-derived func_/D_/jtbl_ names are not in the symbol FILES (their address IS their name), so the first run checked ZERO relocations on a draft whose every callee was correct -- a checker that looks clean while checking nothing (R32). - the nearest-symbol fallback used a 0x4000 window and labelled func_8001C9D0 as 'SsGetMute+0xC50'; a wrong label is worse than none. Tightened to 0x200 with an explicit splat-derived fallback. - MIPS o32 uses REL relocations: THE ADDEND IS IN THE INSTRUCTION, not the reloc entry. Reading it off the operand string reported 0 for every struct-field/array access and fabricated mismatches (the +1/+2/+3 signature on func_801F0734 was a byte-array walk, not three symbol errors). Also refuses to answer confidently when the streams are not index-aligned (shape differs), since a single inserted instruction shifts every later index -- my own NC produced exactly that phantom. NC: known-good drafts AGREE (3 and 5 relocs actually checked); a synthetic callee 4 bytes off is caught while match_one still says MATCH; a misaligned mutant is downgraded to advisory.