gbdev / rgbds

Rednex Game Boy Development System - An assembly toolchain for the Nintendo Game Boy and Game Boy Color
https://rgbds.gbdev.io
MIT License
1.33k stars 171 forks source link

Report any section overflows at the end of assembly #1482

Closed Rangi42 closed 1 month ago

Rangi42 commented 1 month ago

Fixes #538

Also since this doesn't make space-declaring directives into no-ops when they occur after an overflow, now errors with those directives don't get silenced.

Rangi42 commented 1 month ago

Note that this also fixes a segfault when you INCBIN an unbounded-size file:

$ cat incbin-urandom.asm 
SECTION "test", ROM0
INCBIN "/dev/urandom"

$ rgbasm incbin-urandom.asm 
Segmentation fault (core dumped)

$ ./rgbasm incbin-urandom.asm 
FATAL: incbin-urandom.asm(2):
    Section size would overflow internal counter