mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Prevent RGBLINK from crashing when getting the bank of a constant
This commit is contained in:
@@ -260,6 +260,11 @@ static int32_t computeRPNExpr(struct Patch const *patch,
|
||||
patch->fileName,
|
||||
fileSymbols[value]->name);
|
||||
value = 1;
|
||||
} else if (!symbol->section) {
|
||||
error("%s: Requested BANK() of non-label symbol \"%s\"",
|
||||
patch->fileName,
|
||||
fileSymbols[value]->name);
|
||||
value = 1;
|
||||
} else {
|
||||
value = symbol->section->bank;
|
||||
}
|
||||
|
||||
2
test/link/bank-const/a.asm
Normal file
2
test/link/bank-const/a.asm
Normal file
@@ -0,0 +1,2 @@
|
||||
CONSTANT equ 0
|
||||
EXPORT CONSTANT
|
||||
2
test/link/bank-const/b.asm
Normal file
2
test/link/bank-const/b.asm
Normal file
@@ -0,0 +1,2 @@
|
||||
SECTION "Test", ROM0[0]
|
||||
db BANK(CONSTANT)
|
||||
2
test/link/bank-const/err.out
Normal file
2
test/link/bank-const/err.out
Normal file
@@ -0,0 +1,2 @@
|
||||
error: bank-const/b.asm(2): Requested BANK() of non-label symbol "CONSTANT"
|
||||
Linking failed with 1 error
|
||||
@@ -80,6 +80,12 @@ $RGBLINK -o $gbtemp2 $otemp
|
||||
i="high-low.asm" tryCmp $gbtemp $gbtemp2
|
||||
rc=$(($? || $rc))
|
||||
|
||||
$RGBASM -o $otemp bank-const/a.asm
|
||||
$RGBASM -o $gbtemp2 bank-const/b.asm
|
||||
$RGBLINK -o $gbtemp $gbtemp2 $otemp > $outtemp 2>&1
|
||||
i="bank-const.asm" tryDiff bank-const/err.out $outtemp
|
||||
rc=$(($? || $rc))
|
||||
|
||||
$RGBASM -o $otemp section-union/good/a.asm
|
||||
$RGBASM -o $gbtemp2 section-union/good/b.asm
|
||||
$RGBLINK -o $gbtemp -l section-union/good/script.link $otemp $gbtemp2
|
||||
|
||||
Reference in New Issue
Block a user