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:
ISSOtm
2026-09-18 21:19:37 +02:00
committed by Eldred Habert
parent 5b9903f358
commit c49828f7c9
3 changed files with 7 additions and 4 deletions
+4
View File
@@ -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