mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
@@ -165,6 +165,9 @@ static void mergeSections(struct Section *target, struct Section *other, enum Se
|
||||
if (!target->data)
|
||||
errx(1, "Failed to concatenate \"%s\"'s fragments", target->name);
|
||||
memcpy(target->data + target->size - other->size, other->data, other->size);
|
||||
/* Adjust patches' PC offsets */
|
||||
for (uint32_t patchID = 0; patchID < other->nbPatches; patchID++)
|
||||
other->patches[patchID].pcOffset += other->offset;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
4
test/link/section-fragment/jr-offset-load/a.asm
Normal file
4
test/link/section-fragment/jr-offset-load/a.asm
Normal file
@@ -0,0 +1,4 @@
|
||||
SECTION FRAGMENT "output", ROM0
|
||||
LOAD FRAGMENT "loaded", SRAM
|
||||
ds 128
|
||||
ENDL
|
||||
6
test/link/section-fragment/jr-offset-load/b.asm
Normal file
6
test/link/section-fragment/jr-offset-load/b.asm
Normal file
@@ -0,0 +1,6 @@
|
||||
SECTION FRAGMENT "output", ROM0
|
||||
LOAD FRAGMENT "loaded", SRAM
|
||||
label:
|
||||
jr nz, label2
|
||||
label2:
|
||||
ENDL
|
||||
BIN
test/link/section-fragment/jr-offset-load/ref.out.bin
Normal file
BIN
test/link/section-fragment/jr-offset-load/ref.out.bin
Normal file
Binary file not shown.
2
test/link/section-fragment/jr-offset/a.asm
Normal file
2
test/link/section-fragment/jr-offset/a.asm
Normal file
@@ -0,0 +1,2 @@
|
||||
SECTION FRAGMENT "output", ROM0
|
||||
ds 128
|
||||
4
test/link/section-fragment/jr-offset/b.asm
Normal file
4
test/link/section-fragment/jr-offset/b.asm
Normal file
@@ -0,0 +1,4 @@
|
||||
SECTION FRAGMENT "output", ROM0
|
||||
label:
|
||||
jr nz, label2
|
||||
label2:
|
||||
BIN
test/link/section-fragment/jr-offset/ref.out.bin
Normal file
BIN
test/link/section-fragment/jr-offset/ref.out.bin
Normal file
Binary file not shown.
@@ -151,6 +151,24 @@ rc=$(($? || $rc))
|
||||
tryCmp overlay/out.gb $gbtemp
|
||||
rc=$(($? || $rc))
|
||||
|
||||
i="section-fragment/jr-offset.asm"
|
||||
startTest
|
||||
$RGBASM -o $otemp section-fragment/jr-offset/a.asm
|
||||
$RGBASM -o $gbtemp2 section-fragment/jr-offset/b.asm
|
||||
rgblinkQuiet -o $gbtemp $otemp $gbtemp2
|
||||
dd if=$gbtemp count=1 bs=$(printf %s $(wc -c < section-fragment/jr-offset/ref.out.bin)) > $otemp 2>/dev/null
|
||||
tryCmp section-fragment/jr-offset/ref.out.bin $otemp
|
||||
rc=$(($? || $rc))
|
||||
|
||||
i="section-fragment/jr-offset-load.asm"
|
||||
startTest
|
||||
$RGBASM -o $otemp section-fragment/jr-offset-load/a.asm
|
||||
$RGBASM -o $gbtemp2 section-fragment/jr-offset-load/b.asm
|
||||
rgblinkQuiet -o $gbtemp $otemp $gbtemp2
|
||||
dd if=$gbtemp count=1 bs=$(printf %s $(wc -c < section-fragment/jr-offset-load/ref.out.bin)) > $otemp 2>/dev/null
|
||||
tryCmp section-fragment/jr-offset-load/ref.out.bin $otemp
|
||||
rc=$(($? || $rc))
|
||||
|
||||
i="section-union/good.asm"
|
||||
startTest
|
||||
$RGBASM -o $otemp section-union/good/a.asm
|
||||
|
||||
Reference in New Issue
Block a user