Add several tests for linker script syntax

Fixes a slice of #1276
This commit is contained in:
ISSOtm
2024-02-18 23:25:40 +01:00
parent 0769694839
commit b100c8ebee
21 changed files with 67 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
romx 2
"ROM1"

View File

@@ -0,0 +1,2 @@
error: script-different-bank.link(2): The linker script places section "ROM1" in ROMX bank 2, but it was already defined in bank 1
Linking failed with 1 error

View File

@@ -0,0 +1,2 @@
sram 1
"ROM1"

View File

@@ -0,0 +1,2 @@
error: script-different-type.link(2): "ROM1" is specified to be a SRAM section, but it is already a ROMX section
Linking failed with 1 error

View File

@@ -0,0 +1 @@
vram $

View File

@@ -0,0 +1,2 @@
error: script-lone-dollar.link(1): No hexadecimal digits found after '$'
Linking failed with 1 error

View File

@@ -0,0 +1 @@
vram %

View File

@@ -0,0 +1,2 @@
error: script-lone-percent.link(1): No binary digits found after '%'
Linking failed with 1 error

View File

@@ -0,0 +1,8 @@
rom0
romx
vram
sram
wram0
wramx
oam
hram

View File

@@ -0,0 +1,5 @@
error: script-missing-bank-no.link(2): A bank number must be specified for ROMX
error: script-missing-bank-no.link(3): A bank number must be specified for VRAM
error: script-missing-bank-no.link(4): A bank number must be specified for SRAM
error: script-missing-bank-no.link(6): A bank number must be specified for WRAMX
Linking failed with 4 errors

View File

@@ -0,0 +1,5 @@
ROM0
org 42
org %101010
org $2A
org 41 ; Error!

View File

@@ -0,0 +1,2 @@
error: script-num-fmt.link(5): Cannot decrease the current address (from $002a to $0029)
Linking failed with 1 error

View File

@@ -0,0 +1,8 @@
rom0 1
romx 0
vram 2
wram0 1
wramx 0
wramx 8
oam 1
hram 1

View File

@@ -0,0 +1,9 @@
error: script-oob-bank-num.link(1): ROM0 bank 1 doesn't exist (the maximum is 0)
error: script-oob-bank-num.link(2): ROMX bank 0 doesn't exist (the minimum is 1)
error: script-oob-bank-num.link(3): VRAM bank 2 doesn't exist (the maximum is 1)
error: script-oob-bank-num.link(4): WRAM0 bank 1 doesn't exist (the maximum is 0)
error: script-oob-bank-num.link(5): WRAMX bank 0 doesn't exist (the minimum is 1)
error: script-oob-bank-num.link(6): WRAMX bank 8 doesn't exist (the maximum is 7)
error: script-oob-bank-num.link(7): OAM bank 1 doesn't exist (the maximum is 0)
error: script-oob-bank-num.link(8): HRAM bank 1 doesn't exist (the maximum is 0)
Linking failed with 8 errors

View File

@@ -0,0 +1 @@
bonjour

View File

@@ -0,0 +1,2 @@
error: script-unk-keyword.link(1): Unknown keyword "bonjour"
Linking failed with 1 error

View File

@@ -0,0 +1,2 @@
rom0
"Wheeee"

View File

@@ -0,0 +1,2 @@
error: script-unknown-section.link(2): Unknown section "Wheeee"
Linking failed with 1 error

View File

@@ -0,0 +1,2 @@
rom0
"ROM0

View File

@@ -0,0 +1,2 @@
error: script-unterminated-string.link(2): Unterminated string
Linking failed with 1 error

5
test/link/script.asm Normal file
View File

@@ -0,0 +1,5 @@
; script*.link are tests for the linker script.
; So there isn't much to see here.
SECTION "ROM0", ROM0
SECTION "ROM1", ROMX,BANK[1]