diff --git a/src/asm/output.cpp b/src/asm/output.cpp index e2a86adc..57c359e2 100644 --- a/src/asm/output.cpp +++ b/src/asm/output.cpp @@ -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(sectionMap.size() - search->second - 1); + return static_cast(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 § : sectionList) + writeSection(sect, file); putLong(assertions.size(), file); diff --git a/src/link/section.cpp b/src/link/section.cpp index 4715092e..86688425 100644 --- a/src/link/section.cpp +++ b/src/link/section.cpp @@ -14,8 +14,8 @@ std::vector> sectionList; std::unordered_map 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) { diff --git a/test/link/sdcc/no-script/out.err b/test/link/sdcc/no-script/out.err index f0ca0821..08e2fae6 100644 --- a/test/link/sdcc/no-script/out.err +++ b/test/link/sdcc/no-script/out.err @@ -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 diff --git a/test/link/section-union/same-export/out.err b/test/link/section-union/same-export/out.err index 318bc0eb..747d338f 100644 --- a/test/link/section-union/same-export/out.err +++ b/test/link/section-union/same-export/out.err @@ -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) diff --git a/test/link/symbols/good/ref.out.sym b/test/link/symbols/good/ref.out.sym index 1a0cfd96..773b0464 100644 --- a/test/link/symbols/good/ref.out.sym +++ b/test/link/symbols/good/ref.out.sym @@ -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 diff --git a/test/link/test.sh b/test/link/test.sh index 3c6d1ff4..4e3a07f9 100755 --- a/test/link/test.sh +++ b/test/link/test.sh @@ -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 diff --git a/test/run-tests.sh b/test/run-tests.sh index d4a22689..b6b3dda0 100755 --- a/test/run-tests.sh +++ b/test/run-tests.sh @@ -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