diff --git a/include/link/lexer.hpp b/include/link/lexer.hpp index 5416110f..e1ae9b71 100644 --- a/include/link/lexer.hpp +++ b/include/link/lexer.hpp @@ -3,11 +3,9 @@ #ifndef RGBDS_LINK_LEXER_HPP #define RGBDS_LINK_LEXER_HPP -#include #include -[[gnu::format(printf, 1, 2)]] -void lexer_Error(char const *fmt, ...); +void lexer_TraceCurrent(); void lexer_IncludeFile(std::string &&path); void lexer_IncLineNo(); diff --git a/include/link/warning.hpp b/include/link/warning.hpp index bbb4f659..c30d8bb5 100644 --- a/include/link/warning.hpp +++ b/include/link/warning.hpp @@ -49,8 +49,8 @@ void warning(char const *fmt, ...); void error(FileStackNode const *src, uint32_t lineNo, char const *fmt, ...); [[gnu::format(printf, 1, 2)]] void error(char const *fmt, ...); - -void scriptError(char const *name, uint32_t lineNo, char const *fmt, va_list args); +[[gnu::format(printf, 1, 2)]] +void scriptError(char const *fmt, ...); [[gnu::format(printf, 3, 4), noreturn]] void fatal(FileStackNode const *src, uint32_t lineNo, char const *fmt, ...); diff --git a/src/link/layout.cpp b/src/link/layout.cpp index 63e0daec..816eace0 100644 --- a/src/link/layout.cpp +++ b/src/link/layout.cpp @@ -10,7 +10,6 @@ #include "helpers.hpp" #include "util.hpp" -#include "link/lexer.hpp" // lexer_Error #include "link/section.hpp" #include "link/warning.hpp" @@ -47,7 +46,7 @@ void layout_SetFloatingSectionType(SectionType type) { void layout_SetSectionType(SectionType type) { if (nbbanks(type) != 1) { - lexer_Error("A bank number must be specified for %s", sectionTypeInfo[type].name.c_str()); + scriptError("A bank number must be specified for %s", sectionTypeInfo[type].name.c_str()); // Keep going with a default value for the bank index. } @@ -58,7 +57,7 @@ void layout_SetSectionType(SectionType type, uint32_t bank) { SectionTypeInfo const &typeInfo = sectionTypeInfo[type]; if (bank < typeInfo.firstBank) { - lexer_Error( + scriptError( "%s bank %" PRIu32 " does not exist (the minimum is %" PRIu32 ")", typeInfo.name.c_str(), bank, @@ -66,7 +65,7 @@ void layout_SetSectionType(SectionType type, uint32_t bank) { ); bank = typeInfo.firstBank; } else if (bank > typeInfo.lastBank) { - lexer_Error( + scriptError( "%s bank %" PRIu32 " does not exist (the maximum is %" PRIu32 ")", typeInfo.name.c_str(), bank, @@ -79,11 +78,11 @@ void layout_SetSectionType(SectionType type, uint32_t bank) { void layout_SetAddr(uint32_t addr) { if (activeType == SECTTYPE_INVALID) { - lexer_Error("Cannot set the current address: no memory region is active"); + scriptError("Cannot set the current address: no memory region is active"); return; } if (activeBankIdx == UINT32_MAX) { - lexer_Error("Cannot set the current address: the bank is floating"); + scriptError("Cannot set the current address: the bank is floating"); return; } @@ -91,9 +90,9 @@ void layout_SetAddr(uint32_t addr) { SectionTypeInfo const &typeInfo = sectionTypeInfo[activeType]; if (addr < pc) { - lexer_Error("Cannot decrease the current address (from $%04x to $%04x)", pc, addr); + scriptError("Cannot decrease the current address (from $%04x to $%04x)", pc, addr); } else if (addr > endaddr(activeType)) { // Allow "one past the end" sections. - lexer_Error( + scriptError( "Cannot set the current address to $%04" PRIx32 ": %s ends at $%04" PRIx16, addr, typeInfo.name.c_str(), @@ -108,7 +107,7 @@ void layout_SetAddr(uint32_t addr) { void layout_MakeAddrFloating() { if (activeType == SECTTYPE_INVALID) { - lexer_Error("Cannot make the current address floating: no memory region is active"); + scriptError("Cannot make the current address floating: no memory region is active"); return; } @@ -119,7 +118,7 @@ void layout_MakeAddrFloating() { void layout_AlignTo(uint32_t alignment, uint32_t alignOfs) { if (activeType == SECTTYPE_INVALID) { - lexer_Error("Cannot align: no memory region is active"); + scriptError("Cannot align: no memory region is active"); return; } @@ -130,7 +129,7 @@ void layout_AlignTo(uint32_t alignment, uint32_t alignOfs) { uint32_t alignSize = 1u << alignment; if (alignOfs >= alignSize) { - lexer_Error( + scriptError( "Cannot align: The alignment offset (%" PRIu32 ") must be less than alignment size (%" PRIu32 ")", alignOfs, @@ -149,7 +148,7 @@ void layout_AlignTo(uint32_t alignment, uint32_t alignOfs) { uint16_t &pc = curAddr[activeType][activeBankIdx]; if (alignment > 16) { - lexer_Error("Cannot align: The alignment (%" PRIu32 ") must be less than 16", alignment); + scriptError("Cannot align: The alignment (%" PRIu32 ") must be less than 16", alignment); return; } @@ -160,7 +159,7 @@ void layout_AlignTo(uint32_t alignment, uint32_t alignOfs) { uint32_t alignSize = 1u << alignment; if (alignOfs >= alignSize) { - lexer_Error( + scriptError( "Cannot align: The alignment offset (%" PRIu32 ") must be less than alignment size (%" PRIu32 ")", alignOfs, @@ -174,7 +173,7 @@ void layout_AlignTo(uint32_t alignment, uint32_t alignOfs) { } if (uint16_t offset = pc - typeInfo.startAddr; length > typeInfo.size - offset) { - lexer_Error( + scriptError( "Cannot align: the next suitable address after $%04" PRIx16 " is $%04" PRIx16 ", past $%04" PRIx16, pc, @@ -189,7 +188,7 @@ void layout_AlignTo(uint32_t alignment, uint32_t alignOfs) { void layout_Pad(uint32_t length) { if (activeType == SECTTYPE_INVALID) { - lexer_Error("Cannot increase the current address: no memory region is active"); + scriptError("Cannot increase the current address: no memory region is active"); return; } @@ -203,7 +202,7 @@ void layout_Pad(uint32_t length) { assume(pc >= typeInfo.startAddr); if (uint16_t offset = pc - typeInfo.startAddr; length + offset > typeInfo.size) { - lexer_Error( + scriptError( "Cannot increase the current address by %u bytes: only %u bytes to $%04" PRIx16, length, typeInfo.size - offset, @@ -216,14 +215,14 @@ void layout_Pad(uint32_t length) { void layout_PlaceSection(std::string const &name, bool isOptional) { if (activeType == SECTTYPE_INVALID) { - lexer_Error("No memory region has been specified to place section \"%s\" in", name.c_str()); + scriptError("No memory region has been specified to place section \"%s\" in", name.c_str()); return; } Section *section = sect_GetSection(name.c_str()); if (!section) { if (!isOptional) { - lexer_Error("Undefined section \"%s\"", name.c_str()); + scriptError("Undefined section \"%s\"", name.c_str()); } return; } @@ -234,7 +233,7 @@ void layout_PlaceSection(std::string const &name, bool isOptional) { if (section->type == SECTTYPE_INVALID) { // A section that has data must get assigned a type that requires data. if (!sect_HasData(activeType) && !section->data.empty()) { - lexer_Error( + scriptError( "\"%s\" is specified to be a %s section, but it contains data", name.c_str(), typeInfo.name.c_str() @@ -242,7 +241,7 @@ void layout_PlaceSection(std::string const &name, bool isOptional) { } else if (sect_HasData(activeType) && section->data.empty() && section->size != 0) { // A section that lacks data can only be assigned to a type that requires data // if it's empty. - lexer_Error( + scriptError( "\"%s\" is specified to be a %s section, but it does not contain data", name.c_str(), typeInfo.name.c_str() @@ -255,7 +254,7 @@ void layout_PlaceSection(std::string const &name, bool isOptional) { } } } else if (section->type != activeType) { - lexer_Error( + scriptError( "\"%s\" is specified to be a %s section, but it is already a %s section", name.c_str(), typeInfo.name.c_str(), @@ -268,7 +267,7 @@ void layout_PlaceSection(std::string const &name, bool isOptional) { } else { uint32_t bank = activeBankIdx + typeInfo.firstBank; if (section->isBankFixed && bank != section->bank) { - lexer_Error( + scriptError( "The linker script places section \"%s\" in %s bank %" PRIu32 ", but it was already defined in bank %" PRIu32, name.c_str(), @@ -284,7 +283,7 @@ void layout_PlaceSection(std::string const &name, bool isOptional) { if (!isPcFloating) { uint16_t &org = curAddr[activeType][activeBankIdx]; if (section->isAddressFixed && org != section->org) { - lexer_Error( + scriptError( "The linker script assigns section \"%s\" to address $%04" PRIx16 ", but it was already at $%04" PRIx16, name.c_str(), @@ -293,7 +292,7 @@ void layout_PlaceSection(std::string const &name, bool isOptional) { ); } else if (section->isAlignFixed && (org & section->alignMask) != section->alignOfs) { uint8_t alignment = std::countr_one(section->alignMask); - lexer_Error( + scriptError( "The linker script assigns section \"%s\" to address $%04" PRIx16 ", but that would be ALIGN[%" PRIu8 ", %" PRIu16 "] instead of the requested ALIGN[%" PRIu8 ", %" PRIu16 "]", @@ -312,7 +311,7 @@ void layout_PlaceSection(std::string const &name, bool isOptional) { uint16_t curOfs = org - typeInfo.startAddr; if (section->size > typeInfo.size - curOfs) { uint16_t overflowSize = section->size - (typeInfo.size - curOfs); - lexer_Error( + scriptError( "The linker script assigns section \"%s\" to address $%04" PRIx16 ", but then it would overflow %s by %" PRIu16 " byte%s", name.c_str(), diff --git a/src/link/lexer.cpp b/src/link/lexer.cpp index fcf90983..da9be6d2 100644 --- a/src/link/lexer.cpp +++ b/src/link/lexer.cpp @@ -11,6 +11,7 @@ #include "helpers.hpp" #include "itertools.hpp" +#include "style.hpp" #include "util.hpp" #include "link/warning.hpp" @@ -27,12 +28,52 @@ struct LexerStackEntry { static std::vector lexerStack; -void lexer_Error(char const *fmt, ...) { - LexerStackEntry &context = lexerStack.back(); - va_list args; - va_start(args, fmt); - scriptError(context.path.c_str(), context.lineNo, fmt, args); - va_end(args); +static void printStackEntry(LexerStackEntry const &context) { + style_Set(stderr, STYLE_CYAN, true); + fputs(context.path.c_str(), stderr); + style_Set(stderr, STYLE_CYAN, false); + fprintf(stderr, "(%" PRIu32 ")", context.lineNo); +} + +void lexer_TraceCurrent() { + size_t n = lexerStack.size(); + + if (warnings.traceDepth == TRACE_COLLAPSE) { + fputs(" ", stderr); // Just three spaces; the fourth will be handled by the loop + for (size_t i = 0; i < n; ++i) { + style_Reset(stderr); + fprintf(stderr, " %s ", i == 0 ? "at" : "<-"); + printStackEntry(lexerStack[n - i - 1]); + } + putc('\n', stderr); + } else if (warnings.traceDepth == 0 || static_cast(warnings.traceDepth) >= n) { + for (size_t i = 0; i < n; ++i) { + style_Reset(stderr); + fprintf(stderr, " %s ", i == 0 ? "at" : "<-"); + printStackEntry(lexerStack[n - i - 1]); + putc('\n', stderr); + } + } else { + size_t last = warnings.traceDepth / 2; + size_t first = warnings.traceDepth - last; + size_t skipped = n - warnings.traceDepth; + for (size_t i = 0; i < first; ++i) { + style_Reset(stderr); + fprintf(stderr, " %s ", i == 0 ? "at" : "<-"); + printStackEntry(lexerStack[n - i - 1]); + putc('\n', stderr); + } + style_Reset(stderr); + fprintf(stderr, " ...%zu more%s\n", skipped, last ? "..." : ""); + for (size_t i = n - last; i < n; ++i) { + style_Reset(stderr); + fputs(" <- ", stderr); + printStackEntry(lexerStack[n - i - 1]); + putc('\n', stderr); + } + } + + style_Reset(stderr); } void lexer_IncludeFile(std::string &&path) { @@ -46,7 +87,7 @@ void lexer_IncludeFile(std::string &&path) { std::string badPath = std::move(newContext.path); lexerStack.pop_back(); // This error will occur in `prevContext`, *before* incrementing the line number! - lexer_Error( + scriptError( "Failed to open included linker script \"%s\": %s", badPath.c_str(), strerror(errno) ); } @@ -119,7 +160,7 @@ static yy::parser::symbol_type parseBinNumber(char const *prefix) { LexerStackEntry &context = lexerStack.back(); int c = context.file.sgetc(); if (!isBinDigit(c)) { - lexer_Error("No binary digits found after %s", prefix); + scriptError("No binary digits found after %s", prefix); return yy::parser::make_number(0); } @@ -142,7 +183,7 @@ static yy::parser::symbol_type parseOctNumber(char const *prefix) { LexerStackEntry &context = lexerStack.back(); int c = context.file.sgetc(); if (!isOctDigit(c)) { - lexer_Error("No octal digits found after %s", prefix); + scriptError("No octal digits found after %s", prefix); return yy::parser::make_number(0); } @@ -177,7 +218,7 @@ static yy::parser::symbol_type parseHexNumber(char const *prefix) { LexerStackEntry &context = lexerStack.back(); int c = context.file.sgetc(); if (!isHexDigit(c)) { - lexer_Error("No hexadecimal digits found after %s", prefix); + scriptError("No hexadecimal digits found after %s", prefix); return yy::parser::make_number(0); } @@ -225,14 +266,14 @@ static yy::parser::symbol_type parseString() { std::string str; for (; c != '"'; c = context.file.sgetc()) { if (c == EOF || isNewline(c)) { - lexer_Error("Unterminated string"); + scriptError("Unterminated string"); break; } context.file.sbumpc(); if (c == '\\') { c = context.file.sgetc(); if (c == EOF || isNewline(c)) { - lexer_Error("Unterminated string"); + scriptError("Unterminated string"); break; } else if (c == 'n') { c = '\n'; @@ -243,7 +284,7 @@ static yy::parser::symbol_type parseString() { } else if (c == '0') { c = '\0'; } else if (c != '\\' && c != '"' && c != '\'') { - lexer_Error("Cannot escape character %s", printChar(c)); + scriptError("Cannot escape character %s", printChar(c)); } context.file.sbumpc(); } @@ -320,10 +361,10 @@ yy::parser::symbol_type yylex() { return search->second(); } - lexer_Error("Unknown keyword `%s`", ident.c_str()); + scriptError("Unknown keyword `%s`", ident.c_str()); return yylex(); } else { - lexer_Error("Unexpected character %s", printChar(c)); + scriptError("Unexpected character %s", printChar(c)); // Keep reading characters until the EOL, to avoid reporting too many errors. for (c = context.file.sgetc(); !isNewline(c); c = context.file.sgetc()) { if (c == EOF) { diff --git a/src/link/script.y b/src/link/script.y index 8f19e781..e9cde6b8 100644 --- a/src/link/script.y +++ b/src/link/script.y @@ -14,6 +14,7 @@ %code { #include "link/lexer.hpp" #include "link/layout.hpp" + #include "link/warning.hpp" yy::parser::symbol_type yylex(); // Provided by layout.cpp } @@ -110,5 +111,5 @@ optional: /******************** Error handler ********************/ void yy::parser::error(std::string const &msg) { - lexer_Error("%s", msg.c_str()); + scriptError("%s", msg.c_str()); } diff --git a/src/link/warning.cpp b/src/link/warning.cpp index ef268478..451a5d31 100644 --- a/src/link/warning.cpp +++ b/src/link/warning.cpp @@ -8,6 +8,7 @@ #include "style.hpp" #include "link/fstack.hpp" +#include "link/lexer.hpp" // clang-format off: nested initializers Diagnostics warnings = { @@ -102,17 +103,13 @@ void error(char const *fmt, ...) { warnings.incrementErrors(); } -void scriptError(char const *name, uint32_t lineNo, char const *fmt, va_list args) { - style_Set(stderr, STYLE_RED, true); - fputs("error: ", stderr); - style_Set(stderr, STYLE_CYAN, true); - fputs(name, stderr); - style_Set(stderr, STYLE_CYAN, false); - fprintf(stderr, "(%" PRIu32 ")", lineNo); - style_Reset(stderr); - fputs(": ", stderr); - vfprintf(stderr, fmt, args); - putc('\n', stderr); +void scriptError(char const *fmt, ...) { + va_list args; + va_start(args, fmt); + printDiag(nullptr, 0, fmt, args, "error", STYLE_RED, nullptr, nullptr); + va_end(args); + + lexer_TraceCurrent(); warnings.incrementErrors(); } diff --git a/test/link/linkerscript-escapes-test.out b/test/link/linkerscript-escapes-test.out index ab92df28..3e4f9acf 100644 --- a/test/link/linkerscript-escapes-test.out +++ b/test/link/linkerscript-escapes-test.out @@ -1,2 +1,3 @@ -error: linkerscript-escapes-test.link(4): Cannot escape character '{' +error: Cannot escape character '{' + at linkerscript-escapes-test.link(4) Linking failed with 1 error diff --git a/test/link/linkerscript-include.out b/test/link/linkerscript-include.out index b61a1fc0..61aeab4c 100644 --- a/test/link/linkerscript-include.out +++ b/test/link/linkerscript-include.out @@ -1,2 +1,3 @@ -error: linkerscript-include.inc(1): The linker script assigns section "test" to address $0000, but it was already at $002a +error: The linker script assigns section "test" to address $0000, but it was already at $002a + at linkerscript-include.inc(1) <- linkerscript-include.link(4) Linking failed with 1 error diff --git a/test/link/linkerscript-noexist.out b/test/link/linkerscript-noexist.out index d6bacadf..f36e71b2 100644 --- a/test/link/linkerscript-noexist.out +++ b/test/link/linkerscript-noexist.out @@ -1,2 +1,3 @@ -error: linkerscript-noexist.link(1): Failed to open included linker script "linkerscript-noexist.inc": No such file or directory +error: Failed to open included linker script "linkerscript-noexist.inc": No such file or directory + at linkerscript-noexist.link(1) Linking failed with 1 error diff --git a/test/link/script-align-17.out b/test/link/script-align-17.out index 757e2875..4f1e6139 100644 --- a/test/link/script-align-17.out +++ b/test/link/script-align-17.out @@ -1,2 +1,3 @@ -error: script-align-17.link(2): Cannot align: The alignment (17) must be less than 16 +error: Cannot align: The alignment (17) must be less than 16 + at script-align-17.link(2) Linking failed with 1 error diff --git a/test/link/script-different-bank.out b/test/link/script-different-bank.out index 08c9278a..5d2994d7 100644 --- a/test/link/script-different-bank.out +++ b/test/link/script-different-bank.out @@ -1,2 +1,3 @@ -error: script-different-bank.link(2): The linker script places section "ROM1" in ROMX bank 2, but it was already defined in bank 1 +error: The linker script places section "ROM1" in ROMX bank 2, but it was already defined in bank 1 + at script-different-bank.link(2) Linking failed with 1 error diff --git a/test/link/script-different-type.out b/test/link/script-different-type.out index 004f0b2d..00de95d1 100644 --- a/test/link/script-different-type.out +++ b/test/link/script-different-type.out @@ -1,2 +1,3 @@ -error: script-different-type.link(2): "ROM1" is specified to be a SRAM section, but it is already a ROMX section +error: "ROM1" is specified to be a SRAM section, but it is already a ROMX section + at script-different-type.link(2) Linking failed with 1 error diff --git a/test/link/script-ds-overflow.out b/test/link/script-ds-overflow.out index bf537260..340aa0d2 100644 --- a/test/link/script-ds-overflow.out +++ b/test/link/script-ds-overflow.out @@ -1,3 +1,5 @@ -error: script-ds-overflow.link(3): Cannot increase the current address by 1 bytes: only 0 bytes to $4000 -error: script-ds-overflow.link(7): Cannot increase the current address by 65535 bytes: only 0 bytes to $ffff +error: Cannot increase the current address by 1 bytes: only 0 bytes to $4000 + at script-ds-overflow.link(3) +error: Cannot increase the current address by 65535 bytes: only 0 bytes to $ffff + at script-ds-overflow.link(7) Linking failed with 2 errors diff --git a/test/link/script-excess-align-ofs.out b/test/link/script-excess-align-ofs.out index 8412034b..3df19173 100644 --- a/test/link/script-excess-align-ofs.out +++ b/test/link/script-excess-align-ofs.out @@ -1,2 +1,3 @@ -error: script-excess-align-ofs.link(2): Cannot align: The alignment offset (2) must be less than alignment size (2) +error: Cannot align: The alignment offset (2) must be less than alignment size (2) + at script-excess-align-ofs.link(2) Linking failed with 1 error diff --git a/test/link/script-huge-ds.out b/test/link/script-huge-ds.out index fbd99ca8..4c09ddcd 100644 --- a/test/link/script-huge-ds.out +++ b/test/link/script-huge-ds.out @@ -1,2 +1,3 @@ -error: script-huge-ds.link(2): Cannot increase the current address by 65536 bytes: only 16384 bytes to $4000 +error: Cannot increase the current address by 65536 bytes: only 16384 bytes to $4000 + at script-huge-ds.link(2) Linking failed with 1 error diff --git a/test/link/script-lone-dollar.out b/test/link/script-lone-dollar.out index d1ac75f4..f2f6eaf9 100644 --- a/test/link/script-lone-dollar.out +++ b/test/link/script-lone-dollar.out @@ -1,2 +1,3 @@ -error: script-lone-dollar.link(1): No hexadecimal digits found after '$' +error: No hexadecimal digits found after '$' + at script-lone-dollar.link(1) Linking failed with 1 error diff --git a/test/link/script-lone-percent.out b/test/link/script-lone-percent.out index f95c5d5d..a4635a4d 100644 --- a/test/link/script-lone-percent.out +++ b/test/link/script-lone-percent.out @@ -1,2 +1,3 @@ -error: script-lone-percent.link(1): No binary digits found after '%' +error: No binary digits found after '%' + at script-lone-percent.link(1) Linking failed with 1 error diff --git a/test/link/script-missing-bank-no.out b/test/link/script-missing-bank-no.out index e3cced81..5c418d48 100644 --- a/test/link/script-missing-bank-no.out +++ b/test/link/script-missing-bank-no.out @@ -1,5 +1,9 @@ -error: script-missing-bank-no.link(2): A bank number must be specified for ROMX -error: script-missing-bank-no.link(3): A bank number must be specified for VRAM -error: script-missing-bank-no.link(4): A bank number must be specified for SRAM -error: script-missing-bank-no.link(6): A bank number must be specified for WRAMX +error: A bank number must be specified for ROMX + at script-missing-bank-no.link(2) +error: A bank number must be specified for VRAM + at script-missing-bank-no.link(3) +error: A bank number must be specified for SRAM + at script-missing-bank-no.link(4) +error: A bank number must be specified for WRAMX + at script-missing-bank-no.link(6) Linking failed with 4 errors diff --git a/test/link/script-num-fmt.out b/test/link/script-num-fmt.out index 3ea2a44a..b8650793 100644 --- a/test/link/script-num-fmt.out +++ b/test/link/script-num-fmt.out @@ -1,2 +1,3 @@ -error: script-num-fmt.link(9): Cannot decrease the current address (from $002a to $0029) +error: Cannot decrease the current address (from $002a to $0029) + at script-num-fmt.link(9) Linking failed with 1 error diff --git a/test/link/script-oob-bank-num.out b/test/link/script-oob-bank-num.out index 4b77b3e0..2f4a6e58 100644 --- a/test/link/script-oob-bank-num.out +++ b/test/link/script-oob-bank-num.out @@ -1,9 +1,17 @@ -error: script-oob-bank-num.link(1): ROM0 bank 1 does not exist (the maximum is 0) -error: script-oob-bank-num.link(2): ROMX bank 0 does not exist (the minimum is 1) -error: script-oob-bank-num.link(3): VRAM bank 2 does not exist (the maximum is 1) -error: script-oob-bank-num.link(4): WRAM0 bank 1 does not exist (the maximum is 0) -error: script-oob-bank-num.link(5): WRAMX bank 0 does not exist (the minimum is 1) -error: script-oob-bank-num.link(6): WRAMX bank 8 does not exist (the maximum is 7) -error: script-oob-bank-num.link(7): OAM bank 1 does not exist (the maximum is 0) -error: script-oob-bank-num.link(8): HRAM bank 1 does not exist (the maximum is 0) +error: ROM0 bank 1 does not exist (the maximum is 0) + at script-oob-bank-num.link(1) +error: ROMX bank 0 does not exist (the minimum is 1) + at script-oob-bank-num.link(2) +error: VRAM bank 2 does not exist (the maximum is 1) + at script-oob-bank-num.link(3) +error: WRAM0 bank 1 does not exist (the maximum is 0) + at script-oob-bank-num.link(4) +error: WRAMX bank 0 does not exist (the minimum is 1) + at script-oob-bank-num.link(5) +error: WRAMX bank 8 does not exist (the maximum is 7) + at script-oob-bank-num.link(6) +error: OAM bank 1 does not exist (the maximum is 0) + at script-oob-bank-num.link(7) +error: HRAM bank 1 does not exist (the maximum is 0) + at script-oob-bank-num.link(8) Linking failed with 8 errors diff --git a/test/link/script-oob-org.out b/test/link/script-oob-org.out index b0517043..b92bbc97 100644 --- a/test/link/script-oob-org.out +++ b/test/link/script-oob-org.out @@ -1,10 +1,19 @@ -error: script-oob-org.link(2): Cannot set the current address to $4000: ROM0 ends at $3fff -error: script-oob-org.link(3): Cannot set the current address to $4001: ROM0 ends at $3fff -error: script-oob-org.link(6): Cannot decrease the current address (from $4000 to $3fff) -error: script-oob-org.link(7): Cannot set the current address to $8000: ROMX ends at $7fff -error: script-oob-org.link(8): Cannot set the current address to $8001: ROMX ends at $7fff -error: script-oob-org.link(11): Cannot decrease the current address (from $ff80 to $0000) -error: script-oob-org.link(12): Cannot decrease the current address (from $ff80 to $ff7f) -error: script-oob-org.link(14): Cannot set the current address to $ffff: HRAM ends at $fffe -error: script-oob-org.link(15): Cannot set the current address to $10000: HRAM ends at $fffe +error: Cannot set the current address to $4000: ROM0 ends at $3fff + at script-oob-org.link(2) +error: Cannot set the current address to $4001: ROM0 ends at $3fff + at script-oob-org.link(3) +error: Cannot decrease the current address (from $4000 to $3fff) + at script-oob-org.link(6) +error: Cannot set the current address to $8000: ROMX ends at $7fff + at script-oob-org.link(7) +error: Cannot set the current address to $8001: ROMX ends at $7fff + at script-oob-org.link(8) +error: Cannot decrease the current address (from $ff80 to $0000) + at script-oob-org.link(11) +error: Cannot decrease the current address (from $ff80 to $ff7f) + at script-oob-org.link(12) +error: Cannot set the current address to $ffff: HRAM ends at $fffe + at script-oob-org.link(14) +error: Cannot set the current address to $10000: HRAM ends at $fffe + at script-oob-org.link(15) Linking failed with 9 errors diff --git a/test/link/script-overflowing-sect.out b/test/link/script-overflowing-sect.out index 9f58ef78..abff2ab0 100644 --- a/test/link/script-overflowing-sect.out +++ b/test/link/script-overflowing-sect.out @@ -1,2 +1,3 @@ -error: script-overflowing-sect.link(5): The linker script assigns section "ROM2 1" to address $8000, but then it would overflow ROMX by 1 byte +error: The linker script assigns section "ROM2 1" to address $8000, but then it would overflow ROMX by 1 byte + at script-overflowing-sect.link(5) Linking failed with 1 error diff --git a/test/link/script-syntax-error.out b/test/link/script-syntax-error.out index 80230875..c0f109f5 100644 --- a/test/link/script-syntax-error.out +++ b/test/link/script-syntax-error.out @@ -1,3 +1,5 @@ -error: script-syntax-error.link(2): syntax error, unexpected ORG, expecting end of line or OPTIONAL -error: script-syntax-error.link(5): syntax error, unexpected string, expecting end of line or FLOATING or number +error: syntax error, unexpected ORG, expecting end of line or OPTIONAL + at script-syntax-error.link(2) +error: syntax error, unexpected string, expecting end of line or FLOATING or number + at script-syntax-error.link(5) Linking failed with 2 errors diff --git a/test/link/script-typeless-bank.out b/test/link/script-typeless-bank.out index 75173cf9..5ec13e2b 100644 --- a/test/link/script-typeless-bank.out +++ b/test/link/script-typeless-bank.out @@ -1,2 +1,3 @@ -error: script-typeless-bank.link(1): No memory region has been specified to place section "The section isn't even known" in +error: No memory region has been specified to place section "The section isn't even known" in + at script-typeless-bank.link(1) Linking failed with 1 error diff --git a/test/link/script-unk-keyword.out b/test/link/script-unk-keyword.out index 08eaba06..1712fa2b 100644 --- a/test/link/script-unk-keyword.out +++ b/test/link/script-unk-keyword.out @@ -1,2 +1,3 @@ -error: script-unk-keyword.link(1): Unknown keyword `bonjour` +error: Unknown keyword `bonjour` + at script-unk-keyword.link(1) Linking failed with 1 error diff --git a/test/link/script-unknown-section.out b/test/link/script-unknown-section.out index 3e7b3d1a..8ffe7b8c 100644 --- a/test/link/script-unknown-section.out +++ b/test/link/script-unknown-section.out @@ -1,2 +1,3 @@ -error: script-unknown-section.link(2): Undefined section "Wheeee" +error: Undefined section "Wheeee" + at script-unknown-section.link(2) Linking failed with 1 error diff --git a/test/link/script-unterminated-string.out b/test/link/script-unterminated-string.out index a7f1ead9..b6655f65 100644 --- a/test/link/script-unterminated-string.out +++ b/test/link/script-unterminated-string.out @@ -1,4 +1,7 @@ -error: script-unterminated-string.link(2): Unterminated string -error: script-unterminated-string.link(4): Unterminated string -error: script-unterminated-string.link(5): Unterminated string +error: Unterminated string + at script-unterminated-string.link(2) +error: Unterminated string + at script-unterminated-string.link(4) +error: Unterminated string + at script-unterminated-string.link(5) Linking failed with 3 errors diff --git a/test/link/section-attributes-mismatch.out b/test/link/section-attributes-mismatch.out index ad2d63b8..7d64074e 100644 --- a/test/link/section-attributes-mismatch.out +++ b/test/link/section-attributes-mismatch.out @@ -1,2 +1,3 @@ -error: section-attributes-mismatch.link(3): The linker script assigns section "sec" to address $0018, but that would be ALIGN[4, 8] instead of the requested ALIGN[4, 2] +error: The linker script assigns section "sec" to address $0018, but that would be ALIGN[4, 8] instead of the requested ALIGN[4, 2] + at section-attributes-mismatch.link(3) Linking failed with 1 error