mirror of
https://github.com/N64Recomp/N64Recomp.git
synced 2026-06-12 19:12:44 +00:00
When splat marks a fragment-internal symbol as undefined (e.g. 'D_8140DD78 = 0x8140DD78;' in undefined_syms_auto.ld), the elf parser records target_section = SectionAbsolute and target_section_offset = the symbol's literal vram. Previously the recompilation walker treated this as a non-relocatable reference and emitted the link-time literal as a lui+addiu pair. At runtime the containing fragment loads at a non-canonical address, so the access misses by the relocation delta and lands in unwritten memory. Same pattern as the prior bss-remap (28de57f) and unsorted-relocs (506b9fc) fixes: producer/consumer asymmetry where some references get RELOC and others bake in the link-time literal. Fix: after the bss → parent remap, walk the registered relocatable sections; if the absolute value falls inside one, redirect reloc_section to that section index and use bss_remap_offset_adjustment to subtract the new section's vram base. Downstream target_relocatable check then treats it correctly and emits RELOC_HI16/LO16. Verified on PokemonStadiumRecomp: the attract-path G_DL target 0x8140DD78 (a Gfx array in fragment34, used by fragment62) now emits as RELOC_HI16(147, 0xDD78) instead of literal 0x8141<<16. Stadium attract advances past the prior send_dl=1157 freeze; environment renders. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| analysis.cpp | ||
| analysis.h | ||
| cgenerator.cpp | ||
| config.cpp | ||
| config.h | ||
| elf.cpp | ||
| main.cpp | ||
| mdebug.cpp | ||
| mdebug.h | ||
| mod_symbols.cpp | ||
| operations.cpp | ||
| recompilation.cpp | ||
| symbol_lists.cpp | ||