Don't output sections in reverse order (#1613)

This commit is contained in:
Rangi
2025-01-17 01:28:17 -05:00
committed by GitHub
parent fac5e35d24
commit 382ad17969
7 changed files with 20 additions and 20 deletions

View File

@@ -67,7 +67,7 @@ static uint32_t getSectIDIfAny(Section *sect) {
return UINT32_MAX;
if (auto search = sectionMap.find(sect->name); search != sectionMap.end())
return static_cast<uint32_t>(sectionMap.size() - search->second - 1);
return static_cast<uint32_t>(search->second);
fatalerror("Unknown section '%s'\n", sect->name.c_str());
}
@@ -347,8 +347,8 @@ void out_WriteObject() {
for (Symbol const *sym : objectSymbols)
writeSymbol(*sym, file);
for (auto it = sectionList.rbegin(); it != sectionList.rend(); it++)
writeSection(*it, file);
for (Section const &sect : sectionList)
writeSection(sect, file);
putLong(assertions.size(), file);

View File

@@ -14,8 +14,8 @@ std::vector<std::unique_ptr<Section>> sectionList;
std::unordered_map<std::string, size_t> sectionMap; // Indexes into `sectionList`
void sect_ForEach(void (*callback)(Section &)) {
for (auto it = sectionList.rbegin(); it != sectionList.rend(); it++)
callback(*it->get());
for (auto &ptr : sectionList)
callback(*ptr);
}
static void checkAgainstFixedAddress(Section const &target, Section const &other, uint16_t org) {

View File

@@ -1,8 +1,8 @@
error: Section "_INITIALIZER" has not been assigned a type by a linker script
error: Section "_GSFINAL" has not been assigned a type by a linker script
error: Section "_GSINIT" has not been assigned a type by a linker script
error: Section "_HOME" has not been assigned a type by a linker script
error: Section "_INITIALIZED" has not been assigned a type by a linker script
error: Section "_DATA" has not been assigned a type by a linker script
error: Section "_CODE" has not been assigned a type by a linker script
error: Section "_DATA" has not been assigned a type by a linker script
error: Section "_INITIALIZED" has not been assigned a type by a linker script
error: Section "_HOME" has not been assigned a type by a linker script
error: Section "_GSINIT" has not been assigned a type by a linker script
error: Section "_GSFINAL" has not been assigned a type by a linker script
error: Section "_INITIALIZER" has not been assigned a type by a linker script
Linking failed with 7 errors

View File

@@ -1 +1 @@
error: "Same" is defined as a label at section-union/same-export/a.asm(2), but as another label at section-union/same-export/b.asm(2)
error: "Same" is defined as a label at section-union/same-export/b.asm(2), but as another label at section-union/same-export/a.asm(2)

View File

@@ -5,8 +5,8 @@
00:0006 End
00:c000 wStart
00:c000 wStart
00:c000 wStart.long1
00:c000 wStart.word1
00:c000 wStart.long1
00:c002 wStart.word2
00:c004 wEnd
00:c004 wEnd

View File

@@ -145,7 +145,7 @@ startTest
"$RGBASM" -o "$otemp" "$test"/a.asm
"$RGBASM" -o "$gbtemp2" "$test"/b.asm
continueTest
rgblinkQuiet -o "$gbtemp" "$gbtemp2" "$otemp" 2>"$outtemp"
rgblinkQuiet -o "$gbtemp" "$otemp" "$gbtemp2" 2>"$outtemp"
tryDiff "$test"/out.err "$outtemp"
evaluateTest
@@ -237,7 +237,7 @@ startTest
"$RGBASM" -o "$otemp" "$test"/a.asm
"$RGBASM" -o "$gbtemp2" "$test"/b.asm
continueTest
rgblinkQuiet -o "$gbtemp" "$gbtemp2" "$otemp" 2>"$outtemp"
rgblinkQuiet -o "$gbtemp" "$otemp" "$gbtemp2" 2>"$outtemp"
tryDiff "$test"/out.err "$outtemp"
evaluateTest
@@ -319,7 +319,7 @@ startTest
"$RGBASM" -o "$otemp" "$test"/a.asm
"$RGBASM" -o "$gbtemp2" "$test"/b.asm
continueTest
rgblinkQuiet "$gbtemp2" "$otemp" 2>"$outtemp"
rgblinkQuiet "$otemp" "$gbtemp2" 2>"$outtemp"
tryDiff "$test"/out.err "$outtemp"
evaluateTest
@@ -328,7 +328,7 @@ startTest
"$RGBASM" -o "$otemp" "$test"/a.asm
"$RGBASM" -o "$gbtemp2" "$test"/b.asm
continueTest
rgblinkQuiet -o "$gbtemp" "$gbtemp2" "$otemp" 2>"$outtemp"
rgblinkQuiet -o "$gbtemp" "$otemp" "$gbtemp2" 2>"$outtemp"
tryDiff "$test"/out.err "$outtemp"
tryCmpRom "$test"/ref.out.bin
evaluateTest
@@ -364,7 +364,7 @@ startTest
"$RGBASM" -o "$otemp" "$test"/a.asm
"$RGBASM" -o "$gbtemp2" "$test"/b.asm
continueTest
rgblinkQuiet -o "$gbtemp" -n "$outtemp2" "$gbtemp2" "$otemp" 2>"$outtemp"
rgblinkQuiet -o "$gbtemp" -n "$outtemp2" "$otemp" "$gbtemp2" 2>"$outtemp"
tryDiff "$test"/out.err "$outtemp"
tryDiff "$test"/ref.out.sym "$outtemp2"
tryCmpRom "$test"/ref.out.bin

View File

@@ -74,6 +74,6 @@ if "$nonfree"; then
test_downstream pret pokered compare pokered.gbc ea9bcae617fdf159b045185467ae58b2e4a48b9a
test_downstream zladx LADX-Disassembly default azle.gbc d90ac17e9bf17b6c61624ad9f05447bdb5efc01a
fi
test_downstream AntonioND ucity all ucity.gbc 5e9ded318aa09cf479b30910ba6f2fba5d848fd4
test_downstream pinobatch libbet all libbet.gb 608d3f727d5c503b6d746d6dbf7b41ab6495e208
test_downstream AntonioND ucity all ucity.gbc d2f4a7db48ee208b1bd69a78bd492a1c9ac4a030
test_downstream pinobatch libbet all libbet.gb f117089aa056600e2d404bbcbac96b016fc64611
test_downstream LIJI32 SameBoy bootroms build/bin/BootROMs/cgb_boot.bin 113903775a9d34b798c2f8076672da6626815a91