Files
BFM-decomp/tools
Drew T 713b093845 fix(phase-30 S47): three splitter defects blocking the monolithic-overlay carve
Found while scoping the jr carve for the 3 newly-onboarded binaries. My scoping said "one
unplaceable construct" — it was the first of four layers. Three are fixed here; the fourth is out
of this tool's scope and leaves the carve blocked.

1. asm_label_aliases: the scan could START inside a #define. `#define gte_SetRotMatrix(r0)
   __asm__ volatile ("lw $12, 0( %0 );" ...)` is textually `ident(...) __asm__(...)`, and
   cdecl._mask blanks string CONTENT — deleting the `;`s that would stop the greedy [^;{}]*.
   The match ran 116 lines and swallowed the real `aF8012EFB8 ... __asm__("func_8012EFB8");`,
   so the alias never entered the map and addr_of returned None. jr_isolate_all then refused to
   carve (R32, correctly), which presented as 112 isolate-fails that looked like a per-binary wall.
   Fixed: _mask_cpp_directives() — a preprocessor directive is the other place a match must not
   start. Masking comments/strings fixed the comment case and left this one.

2. _split_macro_body returned a `static inline` internal HELPER as the macro's definition, so
   _proto_from_lines hoisted `extern static inline void tail_8012F274(...);` into all 41 regions:
   invalid C (multiple storage classes) AND the wrong function — the exported definition sits
   below the helper and lost its implied declaration. Fixed: skip static definitions
   brace-balanced on the masked body. A static helper needs no hoisted declaration at all.

3. A declaration that WRAPS across continuation lines was taken as one line, so half became a
   `;`-less extern and the continuation was read as the definition header, producing
   `extern __asm__(""); void aF801466F0(...);` in 22 regions. Fixed: accumulate until the
   statement terminates, tested on the masked text. Same wrapped-declaration blindness
   family_remap._alias_decl_for records fixing at S33 — never propagated here (§134/§139).

Not fixed, and why: jtbl_rodata_pads reports "consumed 0 rodata .align(s) but 4 pad spec(s) given
— table-count drift vs the carve". The carve moves jtbl-owning functions into _jr_ regions but
leaves the pad specs on the residual gap object. jr_isolate_all's docstring states this class is
NOT isolate-fixable; it needs JTBL_PADS repointing in overlays.mk. 122 jr member-slots stay blocked.

Regression-checked: 1,948 macros parse with 0 malformed externs; alias maps unchanged on three
already-carved overlays. No build impact (splitters run offline). Carve reverted, tree clean.
2026-08-10 20:08:53 -06:00
..