mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Don't comment "; Next fragment/union" in .map files for empty section pieces
Fixes #1821
This commit is contained in:
@@ -433,25 +433,28 @@ uint16_t forEachSection(SortedSections const §List, F callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void writeMapSymbols(Section const *sect) {
|
static void writeMapSymbols(Section const *sect) {
|
||||||
for (uint16_t org = sect->org; sect; sect = sect->nextu.get()) {
|
uint16_t org = sect->org;
|
||||||
|
|
||||||
|
for (bool announced = true; sect; sect = sect->nextu.get(), announced = false) {
|
||||||
for (Symbol *sym : sect->symbols) {
|
for (Symbol *sym : sect->symbols) {
|
||||||
// Don't output symbols that begin with an illegal character
|
// Don't output symbols that begin with an illegal character
|
||||||
if (sym->name.empty() || !startsIdentifier(sym->name[0])) {
|
if (sym->name.empty() || !startsIdentifier(sym->name[0])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// Announce this "piece" before its contents
|
||||||
|
if (!announced) {
|
||||||
|
if (sect->modifier == SECTION_UNION) {
|
||||||
|
fputs("\t ; Next union\n", mapFile);
|
||||||
|
} else if (sect->modifier == SECTION_FRAGMENT) {
|
||||||
|
fputs("\t ; Next fragment\n", mapFile);
|
||||||
|
}
|
||||||
|
announced = true;
|
||||||
|
}
|
||||||
// Space matches "\tSECTION: $xxxx ..."
|
// Space matches "\tSECTION: $xxxx ..."
|
||||||
fprintf(mapFile, "\t $%04" PRIx32 " = ", sym->label().offset + org);
|
fprintf(mapFile, "\t $%04" PRIx32 " = ", sym->label().offset + org);
|
||||||
writeSymName(sym->name, mapFile);
|
writeSymName(sym->name, mapFile);
|
||||||
putc('\n', mapFile);
|
putc('\n', mapFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Announce the following "piece"
|
|
||||||
if (SectionModifier mod = sect->nextu ? sect->nextu->modifier : SECTION_NORMAL;
|
|
||||||
mod == SECTION_UNION) {
|
|
||||||
fputs("\t ; Next union\n", mapFile);
|
|
||||||
} else if (mod == SECTION_FRAGMENT) {
|
|
||||||
fputs("\t ; Next fragment\n", mapFile);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
18
test/link/fragment-literals/a.asm
Normal file
18
test/link/fragment-literals/a.asm
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
section "PrintHL", rom0
|
||||||
|
PrintHL::
|
||||||
|
; ...
|
||||||
|
ret
|
||||||
|
|
||||||
|
section "PrintNth", rom0
|
||||||
|
PrintNth::
|
||||||
|
ld hl, [[
|
||||||
|
dw [[ db "one\0" ]]
|
||||||
|
dw [[ db "two\0" ]]
|
||||||
|
dw [[ db "three\0" ]]
|
||||||
|
dw [[ db "four\0" ]]
|
||||||
|
]]
|
||||||
|
ld d, 0
|
||||||
|
ld e, a
|
||||||
|
add hl, de
|
||||||
|
add hl, de
|
||||||
|
call PrintHL
|
||||||
BIN
test/link/fragment-literals/ref.out.bin
Normal file
BIN
test/link/fragment-literals/ref.out.bin
Normal file
Binary file not shown.
10
test/link/fragment-literals/ref.out.map
Normal file
10
test/link/fragment-literals/ref.out.map
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
SUMMARY:
|
||||||
|
ROM0: 39 bytes used / 16345 free
|
||||||
|
|
||||||
|
ROM0 bank #0:
|
||||||
|
SECTION: $0000-$0025 ($0026 bytes) ["PrintNth"]
|
||||||
|
$0000 = PrintNth
|
||||||
|
SECTION: $0026-$0026 ($0001 byte) ["PrintHL"]
|
||||||
|
$0026 = PrintHL
|
||||||
|
EMPTY: $0027-$3fff ($3fd9 bytes)
|
||||||
|
TOTAL EMPTY: $3fd9 bytes
|
||||||
3
test/link/fragment-literals/ref.out.sym
Normal file
3
test/link/fragment-literals/ref.out.sym
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
; File generated by rgblink
|
||||||
|
00:0000 PrintNth
|
||||||
|
00:0026 PrintHL
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
SECTION FRAGMENT "rom", ROM0
|
SECTION FRAGMENT "rom", ROM0
|
||||||
Part3::
|
; No labels in this fragment
|
||||||
LOAD FRAGMENT "ram", WRAM0
|
LOAD FRAGMENT "ram", WRAM0
|
||||||
wPart3::
|
wPart3::
|
||||||
jr wPart1
|
jr wPart1
|
||||||
jr wPart3
|
jr wPart3
|
||||||
ENDL
|
ENDL
|
||||||
Part3End::
|
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ ROM0 bank #0:
|
|||||||
$0000 = Part1
|
$0000 = Part1
|
||||||
$0004 = Part1End
|
$0004 = Part1End
|
||||||
; Next fragment
|
; Next fragment
|
||||||
$0010 = Part3
|
|
||||||
$0014 = Part3End
|
|
||||||
; Next fragment
|
|
||||||
$0004 = Part2
|
$0004 = Part2
|
||||||
$0010 = Part2End
|
$0010 = Part2End
|
||||||
EMPTY: $0014-$3fff ($3fec bytes)
|
EMPTY: $0014-$3fff ($3fec bytes)
|
||||||
|
|||||||
@@ -3,7 +3,5 @@
|
|||||||
00:0004 Part1End
|
00:0004 Part1End
|
||||||
00:0004 Part2
|
00:0004 Part2
|
||||||
00:0010 Part2End
|
00:0010 Part2End
|
||||||
00:0010 Part3
|
|
||||||
00:0014 Part3End
|
|
||||||
00:c000 wPart1
|
00:c000 wPart1
|
||||||
00:c004 wPart3
|
00:c004 wPart3
|
||||||
|
|||||||
@@ -174,6 +174,16 @@ for test in fragment-align/*; do
|
|||||||
evaluateTest
|
evaluateTest
|
||||||
done
|
done
|
||||||
|
|
||||||
|
test="fragment-literals"
|
||||||
|
startTest
|
||||||
|
"$RGBASM" -o "$otemp" "$test"/a.asm
|
||||||
|
continueTest
|
||||||
|
rgblinkQuiet -o "$gbtemp" -m "$outtemp" -n "$outtemp2" "$otemp"
|
||||||
|
tryCmpRom "$test"/ref.out.bin
|
||||||
|
tryDiff "$test"/ref.out.map "$outtemp"
|
||||||
|
tryDiff "$test"/ref.out.sym "$outtemp2"
|
||||||
|
evaluateTest
|
||||||
|
|
||||||
test="high-low"
|
test="high-low"
|
||||||
startTest
|
startTest
|
||||||
"$RGBASM" -o "$otemp" "$test"/a.asm
|
"$RGBASM" -o "$otemp" "$test"/a.asm
|
||||||
|
|||||||
Reference in New Issue
Block a user