diff --git a/src/asm/section.c b/src/asm/section.c index 2776efe15..b3f1b8777 100644 --- a/src/asm/section.c +++ b/src/asm/section.c @@ -339,6 +339,9 @@ void out_SetLoadSection(char const *name, uint32_t type, uint32_t org, if (currentLoadSection) fatalerror("`LOAD` blocks cannot be nested\n"); + if (sect_HasData(type)) + fatalerror("`LOAD` blocks cannot be placed within a ROM section\n"); + struct Section *sect = getSection(name, type, org, attribs, false); loadOffset = curOffset; diff --git a/test/asm/load-rom.asm b/test/asm/load-rom.asm new file mode 100644 index 000000000..90445881b --- /dev/null +++ b/test/asm/load-rom.asm @@ -0,0 +1,5 @@ +SECTION "Hello", ROM0 + ld a, 1 +LOAD "Wello", ROM0 + ld a, 2 +ENDL diff --git a/test/asm/load-rom.err b/test/asm/load-rom.err new file mode 100644 index 000000000..a5fad9d9c --- /dev/null +++ b/test/asm/load-rom.err @@ -0,0 +1,2 @@ +FATAL: load-rom.asm(3): + `LOAD` blocks cannot be placed within a ROM section diff --git a/test/asm/load-rom.out b/test/asm/load-rom.out new file mode 100644 index 000000000..e69de29bb