RGBLINK lists local symbols when encountering an unknown symbol reference (#1496)

This commit is contained in:
Sylvie
2024-09-06 21:31:13 -04:00
committed by GitHub
parent 7960a10228
commit 323028d9f2
17 changed files with 69 additions and 4 deletions

View File

@@ -0,0 +1,2 @@
section "a", rom0
ld hl, Label

View File

@@ -0,0 +1,2 @@
section "b", rom0
Label:

View File

@@ -0,0 +1 @@
def Label equ 42

View File

@@ -0,0 +1 @@
def Label = 123

View File

@@ -0,0 +1,2 @@
section "e", wram0
Label:

View File

@@ -0,0 +1,6 @@
error: symbols/unknown/a.asm(2): Unknown symbol "Label"
A label with that name is defined but not exported at symbols/unknown/b.asm(2)
A constant with that name is defined but not exported at symbols/unknown/c.asm(1)
A constant with that name is defined but not exported at symbols/unknown/d.asm(1)
...and 1 more symbol with that name is defined but not exported
Linking failed with 1 error

View File

@@ -8,10 +8,11 @@ gbtemp="$(mktemp)"
gbtemp2="$(mktemp)"
outtemp="$(mktemp)"
outtemp2="$(mktemp)"
outtemp3="$(mktemp)"
# Immediate expansion is the desired behavior.
# shellcheck disable=SC2064
trap "rm -f ${otemp@Q} ${gbtemp@Q} ${gbtemp2@Q} ${outtemp@Q} ${outtemp2@Q}" EXIT
trap "rm -f ${otemp@Q} ${gbtemp@Q} ${gbtemp2@Q} ${outtemp@Q} ${outtemp2@Q} ${outtemp3@Q}" EXIT
tests=0
failed=0
@@ -316,7 +317,7 @@ for i in section-union/*.asm; do
evaluateTest
done
test="symbols"
test="symbols/good"
startTest
"$RGBASM" -o "$otemp" "$test"/a.asm
"$RGBASM" -o "$gbtemp2" "$test"/b.asm
@@ -327,6 +328,18 @@ tryDiff "$test"/ref.out.sym "$outtemp2"
tryCmpRom "$test"/ref.out.bin
evaluateTest
test="symbols/unknown"
startTest
"$RGBASM" -o "$otemp" "$test"/a.asm
"$RGBASM" -o "$gbtemp" "$test"/b.asm
"$RGBASM" -o "$gbtemp2" "$test"/c.asm
"$RGBASM" -o "$outtemp" "$test"/d.asm
"$RGBASM" -o "$outtemp2" "$test"/e.asm
continueTest
rgblinkQuiet "$otemp" "$gbtemp" "$gbtemp2" "$outtemp" "$outtemp2" 2>"$outtemp3"
tryDiff "$test"/out.err "$outtemp3"
evaluateTest
if [[ "$failed" -eq 0 ]]; then
echo "${bold}${green}All ${tests} tests passed!${rescolors}${resbold}"
else