Skip to content

bss subsegments seem to report a wrong vram_end #532

@Dragorn421

Description

@Dragorn421

Take this splat fork: main...Dragorn421:splat:0cd62fad9fdc5055604aaabc17188e7ea8084ecc

And the splat project: https://github.com/Dragorn421/oot-splat/tree/f513ff742c5db9329188bdd28716117010359860
with the following additional splat project yaml changes:

diff --git a/thelegendofzelda.yaml b/thelegendofzelda.yaml
index 5a45ae3..7d6802c 100644
--- a/thelegendofzelda.yaml
+++ b/thelegendofzelda.yaml
@@ -55,6 +55,8 @@ options:
   make_full_disasm_for_code: true
 
   dump_symbols: true
+  dump_symbols_segments: true
+  dump_symbols_references: true
 
 segments:
   - name: header

The linked splat fork when enabling those options attempts to add the segment and subsegment of each symbol to the .splat/splat_symbols.csv symbol dump csv file

However it fails to do so for bss subsegments, they are reported as None.


Upon further inspection I think that vram_end is computed wrong for bss (sub)segments:

    @property
    def vram_end(self) -> Optional[int]:
        if self.vram_start is not None and self.size is not None:
            return self.vram_start + self.size
        else:
            return None

where self.size is... the rom size of the segment:

    @property
    def size(self) -> Optional[int]:
        if self.rom_start is not None and self.rom_end is not None:
            return self.rom_end - self.rom_start
        else:
            return None

which is obviously 0 for bss (sub)segments


The linked splat fork pauses (calls input()) when encountering during symbol dump a symbol in the n64dd segment (the segment of interest in the linked splat project) for which no subsegment can be found, and logs the following (see splat fork's split.py:554):

D_801D9B90
0x801d9b90
[asm_801C6E80 (asm), asm_801C6E80 (.data), data_801D2E50 (data), asm_801C6E80 (.rodata), rodata_801D8E00 (rodata), asm_801C6E80 (.bss), bss_801D9B90 (bss)]
bss_801D9B90 (bss)
0x801d9b90
0x801d9b90

this shows that for symbol D_801D9B90 at vram 0x801d9b90 in segment n64dd (of which the subsegments are [asm_801C6E80 (asm), asm_801C6E80 (.data), data_801D2E50 (data), asm_801C6E80 (.rodata), rodata_801D8E00 (rodata), asm_801C6E80 (.bss), bss_801D9B90 (bss)]) no subsegment can be found, even though it should lie in the bss subsegment.
The last two values printed show that the bss subsegment vram range is according to splat 0x801d9b90-0x801d9b90, which is the wrong vram_end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions