LOAD blocks cannot create a ROM section

Fixes #576
This commit is contained in:
Rangi
2020-12-16 11:32:03 -05:00
committed by Eldred Habert
parent 1d9cc01ae1
commit 063a22ddf9
4 changed files with 11 additions and 0 deletions

View File

@@ -339,6 +339,9 @@ void out_SetLoadSection(char const *name, uint32_t type, uint32_t org,
if (currentLoadSection) if (currentLoadSection)
fatalerror("`LOAD` blocks cannot be nested\n"); fatalerror("`LOAD` blocks cannot be nested\n");
if (sect_HasData(type))
error("`LOAD` blocks cannot create a ROM section\n");
struct Section *sect = getSection(name, type, org, attribs, false); struct Section *sect = getSection(name, type, org, attribs, false);
loadOffset = curOffset; loadOffset = curOffset;

5
test/asm/load-rom.asm Normal file
View File

@@ -0,0 +1,5 @@
SECTION "Hello", ROM0
ld a, 1
LOAD "Wello", ROM0
ld a, 2
ENDL

3
test/asm/load-rom.err Normal file
View File

@@ -0,0 +1,3 @@
ERROR: load-rom.asm(3):
`LOAD` blocks cannot create a ROM section
error: Assembly aborted (1 errors)!

0
test/asm/load-rom.out Normal file
View File