DCPUTeam / DCPUToolchain

[ARCHIVED] The code repository for the DCPU-16 Toolchain.
http://dcputoolcha.in/
MIT License
96 stars 14 forks source link

Linker does not re-correct adjustment addresses past removed code without corruption #191

Open patflick opened 11 years ago

patflick commented 11 years ago

According to IRC user 'acruid' the following code does not link:

.SECTION DATA

:region
.FILL 0x30 0

.SECTION TEXT

SET A, region

.OUTPUT TEXT
.JUMP
.OUTPUT DATA

he was calling it with this:

dtasm  -o build.dobj16 main.dasm16
dtld -l kernel -o build.dkrn16 build.dobj16
Assertion failed: word != NULL, file ldbin.c, line 541

Note: this is a minimal example of his error. The code works if the .FILL is ommited.

hach-que commented 11 years ago

This is reproducible with something as simple as:

.SECTION DATA

region:
SET B, 0x20

.SECTION TEXT

SET A, region
hach-que commented 11 years ago

It seems the fix above re-enabled that line which causes silent corruption. I've commented it out again (with more information) and placed a proper error message describing the bug when it's encountered (rather than the assertion failure).