Most PS1 games have .sbss and .sdata for vars that have sizeof(X) <= -G 4. This also causes access to data in these sections in the same translation unit to use the $gp register.
This will need a way to set what the GP value should be in the yaml, by default on PSX it is usually a pointer to the .sdata section. Also the generated linker script should output _gp = .data_start or similar.
For the sections .sbss can be handled the same as .bss (although .sbss tends to actually appear in the binary which I think is covered by another issue). And .sdata is the same as .data but with a different section name.
A final bonus might be a way to tell splat about the -G N size value. If splat knows this value to be 8 for instance then it will know not to output any data bigger than 8 bytes without splitting it.
Tasks:
[x] Update `($gp) handling when parsing ASM
[x] Add _gp = ... to linker file
[ ] Create sbss segment type; TODO: flag/option to NOT discard it from output?
[ ] Create sdata segment type; same as data just different section type
[ ] BONUS: -G N support (small_data_max_size: 4) ? warn if larger?
Most PS1 games have
.sbss
and.sdata
for vars that have sizeof(X) <= -G 4. This also causes access to data in these sections in the same translation unit to use the$gp
register.Currently splat will output:
But this need to be use a symbol e.g:
This will need a way to set what the GP value should be in the yaml, by default on PSX it is usually a pointer to the
.sdata
section. Also the generated linker script should output_gp = .data_start
or similar.For the sections
.sbss
can be handled the same as.bss
(although.sbss
tends to actually appear in the binary which I think is covered by another issue). And.sdata
is the same as.data
but with a different section name.A final bonus might be a way to tell splat about the -G N size value. If splat knows this value to be 8 for instance then it will know not to output any data bigger than 8 bytes without splitting it.
Tasks:
_gp = ...
to linker filedata
just different section typesmall_data_max_size: 4
) ? warn if larger?