Disallow SECTION UNION for ROM sections

Fixes #1855
This commit is contained in:
Rangi
2025-11-07 11:30:38 -05:00
parent fb9fa6038c
commit 395b03e88e
16 changed files with 31 additions and 104 deletions

View File

@@ -1,2 +1,6 @@
FATAL: `SECTION UNION` cannot contain fragment literals
error: Cannot declare ROM sections as `UNION`
at fragment-literal-in-union.asm(1)
error: Cannot output data outside of a `SECTION`
at fragment-literal-in-union.asm(2)
FATAL: Cannot output fragment literals outside of a `SECTION`
at fragment-literal-in-union.asm(3)

View File

@@ -0,0 +1,2 @@
SECTION UNION "wat", ROM0
db 42

View File

@@ -0,0 +1,5 @@
error: Cannot declare ROM sections as `UNION`
at section-union-data.asm(1)
error: Cannot output data outside of a `SECTION`
at section-union-data.asm(2)
Assembly aborted with 2 errors!

View File

@@ -1,2 +1,2 @@
section fragment "test", rom0
db 1
section fragment "test", wram0
w1:: db

View File

@@ -1,2 +1,2 @@
section union "test", rom0
db 2
section union "test", wram0
w2:: db

View File

@@ -1,10 +0,0 @@
IF !DEF(SECOND)
def DATA equs "ds 4"
ELSE
def DATA equs "db $aa, $bb, $cc, $dd"
ENDC
SECTION UNION "overlaid data", ROM0
{DATA}
PURGE DATA

View File

@@ -1,7 +0,0 @@
FATAL: Section "overlaid data" is of type `ROM0`, which cannot be `UNION`ized
Linking aborted with 1 error
---
error: Cannot declare ROM sections as `UNION`
at <stdin>(18)
FATAL: Cannot create section "overlaid data" (1 error)
at <stdin>(18)

View File

@@ -1,8 +0,0 @@
IF !DEF(SECOND)
def DATA = 1
ELSE
def DATA = 2
ENDC
SECTION UNION "different data", ROM0
db DATA

View File

@@ -1,7 +0,0 @@
FATAL: Section "different data" is of type `ROM0`, which cannot be `UNION`ized
Linking aborted with 1 error
---
error: Cannot declare ROM sections as `UNION`
at <stdin>(16)
FATAL: Cannot create section "different data" (1 error)
at <stdin>(16)

View File

@@ -1,8 +0,0 @@
IF !DEF(SECOND)
def SIZE = 69
ELSE
def SIZE = 420
ENDC
SECTION UNION "different section sizes", ROM0
ds SIZE

View File

@@ -1,7 +0,0 @@
FATAL: Section "different section sizes" is of type `ROM0`, which cannot be `UNION`ized
Linking aborted with 1 error
---
error: Cannot declare ROM sections as `UNION`
at <stdin>(16)
FATAL: Cannot create section "different section sizes" (1 error)
at <stdin>(16)

View File

@@ -1,10 +0,0 @@
IF !DEF(SECOND)
def INSTR equs "sbc a"
ELSE
def INSTR equs "db $9f"
ENDC
SECTION UNION "different syntaxes", ROM0
{INSTR}
PURGE INSTR

View File

@@ -1,7 +0,0 @@
FATAL: Section "different syntaxes" is of type `ROM0`, which cannot be `UNION`ized
Linking aborted with 1 error
---
error: Cannot declare ROM sections as `UNION`
at <stdin>(18)
FATAL: Cannot create section "different syntaxes" (1 error)
at <stdin>(18)

View File

@@ -1,10 +0,0 @@
IF !DEF(SECOND)
def DATA equs "ds 1\ndb $aa"
ELSE
def DATA equs "db $bb\nds 1"
ENDC
SECTION UNION "mutually-overlaid data", ROM0
{DATA}
PURGE DATA

View File

@@ -1,7 +0,0 @@
FATAL: Section "mutually-overlaid data" is of type `ROM0`, which cannot be `UNION`ized
Linking aborted with 1 error
---
error: Cannot declare ROM sections as `UNION`
at <stdin>(18)
FATAL: Cannot create section "mutually-overlaid data" (1 error)
at <stdin>(18)