mirror of
https://github.com/gbdev/rgbds.git
synced 2026-09-22 13:47:05 +00:00
Fix memory region alignment checks
Turns out the checks could fail spuriously if the starting alignment is non-zero, e.g. `align 8,$C0` in HRAM. (Fixes #2113.) This was tripped up by a test added to exercise the linker's section placement algorithm on a similar aligment-related issue. :D Note that this may be caused by the code in question pre-dating alignment offsets, and we never checked. That said, these checks only work due to the regions' starting addresses being no more aligned than their size (..if that makes sense?), so allowing custom memory regions (#524) could violate that assumption and make those checks incorrect.
This commit is contained in:
@@ -21,3 +21,7 @@ SECTION "free align16", ROM0, ALIGN[16,$2222] ; Should be equivalent to the abov
|
||||
|
||||
SECTION "free align", ROM0, ALIGN[13,$1234] ; Has more than one suitable location, so cannot be trivially solved.
|
||||
assert @ == $1234 ; Assuming that it goes into the first suitable location.
|
||||
|
||||
|
||||
SECTION "hram align", HRAM, ALIGN[8, $84]
|
||||
assert @ == $FF84
|
||||
|
||||
Reference in New Issue
Block a user