mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Prevent creating labels outside of sections
This doesn't make sense, and causes RGBLINK to misbehave
This commit is contained in:
@@ -634,6 +634,10 @@ void sym_AddReloc(char *tzSym)
|
|||||||
|
|
||||||
nsym->pScope = scope;
|
nsym->pScope = scope;
|
||||||
nsym->pSection = pCurrentSection;
|
nsym->pSection = pCurrentSection;
|
||||||
|
/* Labels need to be assigned a section, except PC */
|
||||||
|
if (!pCurrentSection && strcmp(tzSym, "@"))
|
||||||
|
yyerror("Label \"%s\" created outside of a SECTION",
|
||||||
|
tzSym);
|
||||||
|
|
||||||
updateSymbolFilename(nsym);
|
updateSymbolFilename(nsym);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
ERROR: label-macro-arg.asm(45) -> label-macro-arg.asm::test_char(31):
|
||||||
|
Label "sizeof_" created outside of a SECTION
|
||||||
|
while expanding symbol "VAR_DEF"
|
||||||
ERROR: label-macro-arg.asm(45) -> label-macro-arg.asm::test_char(31):
|
ERROR: label-macro-arg.asm(45) -> label-macro-arg.asm::test_char(31):
|
||||||
Macro 'something' not defined
|
Macro 'something' not defined
|
||||||
$5
|
$5
|
||||||
|
|||||||
4
test/asm/label-outside-section.asm
Normal file
4
test/asm/label-outside-section.asm
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
bad:
|
||||||
|
SECTION "Test", ROM0
|
||||||
|
good:
|
||||||
|
PRINTT "OK!\n"
|
||||||
4
test/asm/label-outside-section.out
Normal file
4
test/asm/label-outside-section.out
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
ERROR: label-outside-section.asm(1):
|
||||||
|
Label "bad" created outside of a SECTION
|
||||||
|
error: Assembly aborted (1 errors)!
|
||||||
|
OK!
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
ERROR: line-continuation-whitespace.asm(7):
|
||||||
|
Label "foo" created outside of a SECTION
|
||||||
|
error: Assembly aborted (1 errors)!
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
ERROR: line-continuation.asm(7):
|
||||||
|
Label "foo" created outside of a SECTION
|
||||||
|
error: Assembly aborted (1 errors)!
|
||||||
|
|||||||
@@ -1,2 +1,4 @@
|
|||||||
|
ERROR: macro-@.asm(1):
|
||||||
|
Label "foo" created outside of a SECTION
|
||||||
ERROR: macro-@.asm(1):
|
ERROR: macro-@.asm(1):
|
||||||
Macro '@' not defined
|
Macro '@' not defined
|
||||||
|
|||||||
@@ -1,2 +1,4 @@
|
|||||||
|
ERROR: pops-restore-no-section.asm(9):
|
||||||
|
Label "DisallowedContent" created outside of a SECTION
|
||||||
ERROR: pops-restore-no-section.asm(10):
|
ERROR: pops-restore-no-section.asm(10):
|
||||||
Code generation before SECTION directive
|
Code generation before SECTION directive
|
||||||
|
|||||||
Reference in New Issue
Block a user