Use ld's fill command instead of doing it manually with mkrom

This commit is contained in:
Ryan Dwyer 2021-11-02 21:18:53 +10:00
parent 255eb0474a
commit b5eaaaeab2
4 changed files with 7 additions and 23 deletions

View File

@ -636,6 +636,13 @@ SECTIONS
_accessingpakSegmentRomEnd = 0;
#endif
.fill : AT(__rompos)
{
FILL(0xff);
. = 0x02000000 - __rompos - 1;
BYTE(0xff);
}
/DISCARD/ : {
* (.MIPS.abiflags);
* (.options);

View File

@ -63,7 +63,6 @@ int main(int argc, char **argv)
pack_lib();
pack_data();
pack_game();
pack_fill();
rom_update_crc();

View File

@ -71,7 +71,6 @@ bool map_get_segment_rompos(char *funcname, uint32_t *start, uint32_t *end);
void pack_lib(void);
void pack_data(void);
void pack_game(void);
void pack_fill(void);
void piracy_patch(void);

View File

@ -134,24 +134,3 @@ void pack_lib(void)
free(buffer);
}
/**
* Fill from the end of the last segment to the end of the ROM with 0xff.
*/
void pack_fill(void)
{
uint32_t offset;
map_get_segment_rompos("accessingpak", NULL, &offset);
if (offset == 0) {
// We're probably building ntsc-beta, which doesn't have the
// accessingpak segment.
map_get_segment_rompos("copyright", NULL, &offset);
}
while (offset < 1024 * 1024 * 32) {
state.rom[offset] = 0xff;
offset++;
}
}