Properly handle missing symbols

Fixes #512
This commit is contained in:
ISSOtm
2020-04-12 22:52:32 +02:00
parent 828edb7403
commit 023a3c037f
3 changed files with 11 additions and 1 deletions

View File

@@ -337,7 +337,11 @@ static int32_t computeRPNExpr(struct Patch const *patch,
symbol = getSymbol(fileSymbols, value);
if (strcmp(symbol->name, "@")) {
if (!symbol) {
error("%s: Unknown symbol \"%s\"",
patch->fileName,
fileSymbols[value]->name);
} else if (strcmp(symbol->name, "@")) {
value = symbol->value;
/* Symbols attached to sections have offsets */
if (symbol->section)

View File

@@ -0,0 +1,3 @@
SECTION "Test", ROM0
jp where
dw nothing

View File

@@ -0,0 +1,3 @@
error: sym-noexist.asm(3): Unknown symbol "nothing"
error: sym-noexist.asm(2): Unknown symbol "where"
Linking failed with 2 errors