Format linker script error backtraces the same way as others (#1792)

This commit is contained in:
Rangi
2025-08-12 16:58:17 -04:00
committed by GitHub
parent 1bf1219e07
commit 50d0b101c3
28 changed files with 181 additions and 101 deletions

View File

@@ -3,11 +3,9 @@
#ifndef RGBDS_LINK_LEXER_HPP #ifndef RGBDS_LINK_LEXER_HPP
#define RGBDS_LINK_LEXER_HPP #define RGBDS_LINK_LEXER_HPP
#include <stdarg.h>
#include <string> #include <string>
[[gnu::format(printf, 1, 2)]] void lexer_TraceCurrent();
void lexer_Error(char const *fmt, ...);
void lexer_IncludeFile(std::string &&path); void lexer_IncludeFile(std::string &&path);
void lexer_IncLineNo(); void lexer_IncLineNo();

View File

@@ -49,8 +49,8 @@ void warning(char const *fmt, ...);
void error(FileStackNode const *src, uint32_t lineNo, char const *fmt, ...); void error(FileStackNode const *src, uint32_t lineNo, char const *fmt, ...);
[[gnu::format(printf, 1, 2)]] [[gnu::format(printf, 1, 2)]]
void error(char const *fmt, ...); void error(char const *fmt, ...);
[[gnu::format(printf, 1, 2)]]
void scriptError(char const *name, uint32_t lineNo, char const *fmt, va_list args); void scriptError(char const *fmt, ...);
[[gnu::format(printf, 3, 4), noreturn]] [[gnu::format(printf, 3, 4), noreturn]]
void fatal(FileStackNode const *src, uint32_t lineNo, char const *fmt, ...); void fatal(FileStackNode const *src, uint32_t lineNo, char const *fmt, ...);

View File

@@ -10,7 +10,6 @@
#include "helpers.hpp" #include "helpers.hpp"
#include "util.hpp" #include "util.hpp"
#include "link/lexer.hpp" // lexer_Error
#include "link/section.hpp" #include "link/section.hpp"
#include "link/warning.hpp" #include "link/warning.hpp"
@@ -47,7 +46,7 @@ void layout_SetFloatingSectionType(SectionType type) {
void layout_SetSectionType(SectionType type) { void layout_SetSectionType(SectionType type) {
if (nbbanks(type) != 1) { 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. // 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]; SectionTypeInfo const &typeInfo = sectionTypeInfo[type];
if (bank < typeInfo.firstBank) { if (bank < typeInfo.firstBank) {
lexer_Error( scriptError(
"%s bank %" PRIu32 " does not exist (the minimum is %" PRIu32 ")", "%s bank %" PRIu32 " does not exist (the minimum is %" PRIu32 ")",
typeInfo.name.c_str(), typeInfo.name.c_str(),
bank, bank,
@@ -66,7 +65,7 @@ void layout_SetSectionType(SectionType type, uint32_t bank) {
); );
bank = typeInfo.firstBank; bank = typeInfo.firstBank;
} else if (bank > typeInfo.lastBank) { } else if (bank > typeInfo.lastBank) {
lexer_Error( scriptError(
"%s bank %" PRIu32 " does not exist (the maximum is %" PRIu32 ")", "%s bank %" PRIu32 " does not exist (the maximum is %" PRIu32 ")",
typeInfo.name.c_str(), typeInfo.name.c_str(),
bank, bank,
@@ -79,11 +78,11 @@ void layout_SetSectionType(SectionType type, uint32_t bank) {
void layout_SetAddr(uint32_t addr) { void layout_SetAddr(uint32_t addr) {
if (activeType == SECTTYPE_INVALID) { 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; return;
} }
if (activeBankIdx == UINT32_MAX) { 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; return;
} }
@@ -91,9 +90,9 @@ void layout_SetAddr(uint32_t addr) {
SectionTypeInfo const &typeInfo = sectionTypeInfo[activeType]; SectionTypeInfo const &typeInfo = sectionTypeInfo[activeType];
if (addr < pc) { 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. } 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, "Cannot set the current address to $%04" PRIx32 ": %s ends at $%04" PRIx16,
addr, addr,
typeInfo.name.c_str(), typeInfo.name.c_str(),
@@ -108,7 +107,7 @@ void layout_SetAddr(uint32_t addr) {
void layout_MakeAddrFloating() { void layout_MakeAddrFloating() {
if (activeType == SECTTYPE_INVALID) { 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; return;
} }
@@ -119,7 +118,7 @@ void layout_MakeAddrFloating() {
void layout_AlignTo(uint32_t alignment, uint32_t alignOfs) { void layout_AlignTo(uint32_t alignment, uint32_t alignOfs) {
if (activeType == SECTTYPE_INVALID) { if (activeType == SECTTYPE_INVALID) {
lexer_Error("Cannot align: no memory region is active"); scriptError("Cannot align: no memory region is active");
return; return;
} }
@@ -130,7 +129,7 @@ void layout_AlignTo(uint32_t alignment, uint32_t alignOfs) {
uint32_t alignSize = 1u << alignment; uint32_t alignSize = 1u << alignment;
if (alignOfs >= alignSize) { if (alignOfs >= alignSize) {
lexer_Error( scriptError(
"Cannot align: The alignment offset (%" PRIu32 "Cannot align: The alignment offset (%" PRIu32
") must be less than alignment size (%" PRIu32 ")", ") must be less than alignment size (%" PRIu32 ")",
alignOfs, alignOfs,
@@ -149,7 +148,7 @@ void layout_AlignTo(uint32_t alignment, uint32_t alignOfs) {
uint16_t &pc = curAddr[activeType][activeBankIdx]; uint16_t &pc = curAddr[activeType][activeBankIdx];
if (alignment > 16) { 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; return;
} }
@@ -160,7 +159,7 @@ void layout_AlignTo(uint32_t alignment, uint32_t alignOfs) {
uint32_t alignSize = 1u << alignment; uint32_t alignSize = 1u << alignment;
if (alignOfs >= alignSize) { if (alignOfs >= alignSize) {
lexer_Error( scriptError(
"Cannot align: The alignment offset (%" PRIu32 "Cannot align: The alignment offset (%" PRIu32
") must be less than alignment size (%" PRIu32 ")", ") must be less than alignment size (%" PRIu32 ")",
alignOfs, 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) { 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 "Cannot align: the next suitable address after $%04" PRIx16 " is $%04" PRIx16
", past $%04" PRIx16, ", past $%04" PRIx16,
pc, pc,
@@ -189,7 +188,7 @@ void layout_AlignTo(uint32_t alignment, uint32_t alignOfs) {
void layout_Pad(uint32_t length) { void layout_Pad(uint32_t length) {
if (activeType == SECTTYPE_INVALID) { 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; return;
} }
@@ -203,7 +202,7 @@ void layout_Pad(uint32_t length) {
assume(pc >= typeInfo.startAddr); assume(pc >= typeInfo.startAddr);
if (uint16_t offset = pc - typeInfo.startAddr; length + offset > typeInfo.size) { 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, "Cannot increase the current address by %u bytes: only %u bytes to $%04" PRIx16,
length, length,
typeInfo.size - offset, typeInfo.size - offset,
@@ -216,14 +215,14 @@ void layout_Pad(uint32_t length) {
void layout_PlaceSection(std::string const &name, bool isOptional) { void layout_PlaceSection(std::string const &name, bool isOptional) {
if (activeType == SECTTYPE_INVALID) { 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; return;
} }
Section *section = sect_GetSection(name.c_str()); Section *section = sect_GetSection(name.c_str());
if (!section) { if (!section) {
if (!isOptional) { if (!isOptional) {
lexer_Error("Undefined section \"%s\"", name.c_str()); scriptError("Undefined section \"%s\"", name.c_str());
} }
return; return;
} }
@@ -234,7 +233,7 @@ void layout_PlaceSection(std::string const &name, bool isOptional) {
if (section->type == SECTTYPE_INVALID) { if (section->type == SECTTYPE_INVALID) {
// A section that has data must get assigned a type that requires data. // A section that has data must get assigned a type that requires data.
if (!sect_HasData(activeType) && !section->data.empty()) { if (!sect_HasData(activeType) && !section->data.empty()) {
lexer_Error( scriptError(
"\"%s\" is specified to be a %s section, but it contains data", "\"%s\" is specified to be a %s section, but it contains data",
name.c_str(), name.c_str(),
typeInfo.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) { } 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 // A section that lacks data can only be assigned to a type that requires data
// if it's empty. // if it's empty.
lexer_Error( scriptError(
"\"%s\" is specified to be a %s section, but it does not contain data", "\"%s\" is specified to be a %s section, but it does not contain data",
name.c_str(), name.c_str(),
typeInfo.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) { } else if (section->type != activeType) {
lexer_Error( scriptError(
"\"%s\" is specified to be a %s section, but it is already a %s section", "\"%s\" is specified to be a %s section, but it is already a %s section",
name.c_str(), name.c_str(),
typeInfo.name.c_str(), typeInfo.name.c_str(),
@@ -268,7 +267,7 @@ void layout_PlaceSection(std::string const &name, bool isOptional) {
} else { } else {
uint32_t bank = activeBankIdx + typeInfo.firstBank; uint32_t bank = activeBankIdx + typeInfo.firstBank;
if (section->isBankFixed && bank != section->bank) { if (section->isBankFixed && bank != section->bank) {
lexer_Error( scriptError(
"The linker script places section \"%s\" in %s bank %" PRIu32 "The linker script places section \"%s\" in %s bank %" PRIu32
", but it was already defined in bank %" PRIu32, ", but it was already defined in bank %" PRIu32,
name.c_str(), name.c_str(),
@@ -284,7 +283,7 @@ void layout_PlaceSection(std::string const &name, bool isOptional) {
if (!isPcFloating) { if (!isPcFloating) {
uint16_t &org = curAddr[activeType][activeBankIdx]; uint16_t &org = curAddr[activeType][activeBankIdx];
if (section->isAddressFixed && org != section->org) { if (section->isAddressFixed && org != section->org) {
lexer_Error( scriptError(
"The linker script assigns section \"%s\" to address $%04" PRIx16 "The linker script assigns section \"%s\" to address $%04" PRIx16
", but it was already at $%04" PRIx16, ", but it was already at $%04" PRIx16,
name.c_str(), 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) { } else if (section->isAlignFixed && (org & section->alignMask) != section->alignOfs) {
uint8_t alignment = std::countr_one(section->alignMask); uint8_t alignment = std::countr_one(section->alignMask);
lexer_Error( scriptError(
"The linker script assigns section \"%s\" to address $%04" PRIx16 "The linker script assigns section \"%s\" to address $%04" PRIx16
", but that would be ALIGN[%" PRIu8 ", %" PRIu16 ", but that would be ALIGN[%" PRIu8 ", %" PRIu16
"] instead of the requested 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; uint16_t curOfs = org - typeInfo.startAddr;
if (section->size > typeInfo.size - curOfs) { if (section->size > typeInfo.size - curOfs) {
uint16_t overflowSize = 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 "The linker script assigns section \"%s\" to address $%04" PRIx16
", but then it would overflow %s by %" PRIu16 " byte%s", ", but then it would overflow %s by %" PRIu16 " byte%s",
name.c_str(), name.c_str(),

View File

@@ -11,6 +11,7 @@
#include "helpers.hpp" #include "helpers.hpp"
#include "itertools.hpp" #include "itertools.hpp"
#include "style.hpp"
#include "util.hpp" #include "util.hpp"
#include "link/warning.hpp" #include "link/warning.hpp"
@@ -27,12 +28,52 @@ struct LexerStackEntry {
static std::vector<LexerStackEntry> lexerStack; static std::vector<LexerStackEntry> lexerStack;
void lexer_Error(char const *fmt, ...) { static void printStackEntry(LexerStackEntry const &context) {
LexerStackEntry &context = lexerStack.back(); style_Set(stderr, STYLE_CYAN, true);
va_list args; fputs(context.path.c_str(), stderr);
va_start(args, fmt); style_Set(stderr, STYLE_CYAN, false);
scriptError(context.path.c_str(), context.lineNo, fmt, args); fprintf(stderr, "(%" PRIu32 ")", context.lineNo);
va_end(args); }
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<size_t>(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) { void lexer_IncludeFile(std::string &&path) {
@@ -46,7 +87,7 @@ void lexer_IncludeFile(std::string &&path) {
std::string badPath = std::move(newContext.path); std::string badPath = std::move(newContext.path);
lexerStack.pop_back(); lexerStack.pop_back();
// This error will occur in `prevContext`, *before* incrementing the line number! // 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) "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(); LexerStackEntry &context = lexerStack.back();
int c = context.file.sgetc(); int c = context.file.sgetc();
if (!isBinDigit(c)) { 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); return yy::parser::make_number(0);
} }
@@ -142,7 +183,7 @@ static yy::parser::symbol_type parseOctNumber(char const *prefix) {
LexerStackEntry &context = lexerStack.back(); LexerStackEntry &context = lexerStack.back();
int c = context.file.sgetc(); int c = context.file.sgetc();
if (!isOctDigit(c)) { 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); return yy::parser::make_number(0);
} }
@@ -177,7 +218,7 @@ static yy::parser::symbol_type parseHexNumber(char const *prefix) {
LexerStackEntry &context = lexerStack.back(); LexerStackEntry &context = lexerStack.back();
int c = context.file.sgetc(); int c = context.file.sgetc();
if (!isHexDigit(c)) { 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); return yy::parser::make_number(0);
} }
@@ -225,14 +266,14 @@ static yy::parser::symbol_type parseString() {
std::string str; std::string str;
for (; c != '"'; c = context.file.sgetc()) { for (; c != '"'; c = context.file.sgetc()) {
if (c == EOF || isNewline(c)) { if (c == EOF || isNewline(c)) {
lexer_Error("Unterminated string"); scriptError("Unterminated string");
break; break;
} }
context.file.sbumpc(); context.file.sbumpc();
if (c == '\\') { if (c == '\\') {
c = context.file.sgetc(); c = context.file.sgetc();
if (c == EOF || isNewline(c)) { if (c == EOF || isNewline(c)) {
lexer_Error("Unterminated string"); scriptError("Unterminated string");
break; break;
} else if (c == 'n') { } else if (c == 'n') {
c = '\n'; c = '\n';
@@ -243,7 +284,7 @@ static yy::parser::symbol_type parseString() {
} else if (c == '0') { } else if (c == '0') {
c = '\0'; c = '\0';
} else if (c != '\\' && c != '"' && c != '\'') { } else if (c != '\\' && c != '"' && c != '\'') {
lexer_Error("Cannot escape character %s", printChar(c)); scriptError("Cannot escape character %s", printChar(c));
} }
context.file.sbumpc(); context.file.sbumpc();
} }
@@ -320,10 +361,10 @@ yy::parser::symbol_type yylex() {
return search->second(); return search->second();
} }
lexer_Error("Unknown keyword `%s`", ident.c_str()); scriptError("Unknown keyword `%s`", ident.c_str());
return yylex(); return yylex();
} else { } 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. // Keep reading characters until the EOL, to avoid reporting too many errors.
for (c = context.file.sgetc(); !isNewline(c); c = context.file.sgetc()) { for (c = context.file.sgetc(); !isNewline(c); c = context.file.sgetc()) {
if (c == EOF) { if (c == EOF) {

View File

@@ -14,6 +14,7 @@
%code { %code {
#include "link/lexer.hpp" #include "link/lexer.hpp"
#include "link/layout.hpp" #include "link/layout.hpp"
#include "link/warning.hpp"
yy::parser::symbol_type yylex(); // Provided by layout.cpp yy::parser::symbol_type yylex(); // Provided by layout.cpp
} }
@@ -110,5 +111,5 @@ optional:
/******************** Error handler ********************/ /******************** Error handler ********************/
void yy::parser::error(std::string const &msg) { void yy::parser::error(std::string const &msg) {
lexer_Error("%s", msg.c_str()); scriptError("%s", msg.c_str());
} }

View File

@@ -8,6 +8,7 @@
#include "style.hpp" #include "style.hpp"
#include "link/fstack.hpp" #include "link/fstack.hpp"
#include "link/lexer.hpp"
// clang-format off: nested initializers // clang-format off: nested initializers
Diagnostics<WarningLevel, WarningID> warnings = { Diagnostics<WarningLevel, WarningID> warnings = {
@@ -102,17 +103,13 @@ void error(char const *fmt, ...) {
warnings.incrementErrors(); warnings.incrementErrors();
} }
void scriptError(char const *name, uint32_t lineNo, char const *fmt, va_list args) { void scriptError(char const *fmt, ...) {
style_Set(stderr, STYLE_RED, true); va_list args;
fputs("error: ", stderr); va_start(args, fmt);
style_Set(stderr, STYLE_CYAN, true); printDiag(nullptr, 0, fmt, args, "error", STYLE_RED, nullptr, nullptr);
fputs(name, stderr); va_end(args);
style_Set(stderr, STYLE_CYAN, false);
fprintf(stderr, "(%" PRIu32 ")", lineNo); lexer_TraceCurrent();
style_Reset(stderr);
fputs(": ", stderr);
vfprintf(stderr, fmt, args);
putc('\n', stderr);
warnings.incrementErrors(); warnings.incrementErrors();
} }

View File

@@ -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 Linking failed with 1 error

View File

@@ -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 Linking failed with 1 error

View File

@@ -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 Linking failed with 1 error

View File

@@ -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 Linking failed with 1 error

View File

@@ -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 Linking failed with 1 error

View File

@@ -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 Linking failed with 1 error

View File

@@ -1,3 +1,5 @@
error: script-ds-overflow.link(3): Cannot increase the current address by 1 bytes: only 0 bytes to $4000 error: 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 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 Linking failed with 2 errors

View File

@@ -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 Linking failed with 1 error

View File

@@ -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 Linking failed with 1 error

View File

@@ -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 Linking failed with 1 error

View File

@@ -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 Linking failed with 1 error

View File

@@ -1,5 +1,9 @@
error: script-missing-bank-no.link(2): A bank number must be specified for ROMX error: A bank number must be specified for ROMX
error: script-missing-bank-no.link(3): A bank number must be specified for VRAM at script-missing-bank-no.link(2)
error: script-missing-bank-no.link(4): A bank number must be specified for SRAM error: A bank number must be specified for VRAM
error: script-missing-bank-no.link(6): A bank number must be specified for WRAMX 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 Linking failed with 4 errors

View File

@@ -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 Linking failed with 1 error

View File

@@ -1,9 +1,17 @@
error: script-oob-bank-num.link(1): ROM0 bank 1 does not exist (the maximum is 0) error: 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) at script-oob-bank-num.link(1)
error: script-oob-bank-num.link(3): VRAM bank 2 does not exist (the maximum is 1) error: ROMX bank 0 does not exist (the minimum is 1)
error: script-oob-bank-num.link(4): WRAM0 bank 1 does not exist (the maximum is 0) at script-oob-bank-num.link(2)
error: script-oob-bank-num.link(5): WRAMX bank 0 does not exist (the minimum is 1) error: VRAM bank 2 does not exist (the maximum is 1)
error: script-oob-bank-num.link(6): WRAMX bank 8 does not exist (the maximum is 7) at script-oob-bank-num.link(3)
error: script-oob-bank-num.link(7): OAM bank 1 does not exist (the maximum is 0) error: WRAM0 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) 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 Linking failed with 8 errors

View File

@@ -1,10 +1,19 @@
error: script-oob-org.link(2): Cannot set the current address to $4000: ROM0 ends at $3fff error: 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 at script-oob-org.link(2)
error: script-oob-org.link(6): Cannot decrease the current address (from $4000 to $3fff) error: Cannot set the current address to $4001: ROM0 ends at $3fff
error: script-oob-org.link(7): Cannot set the current address to $8000: ROMX ends at $7fff at script-oob-org.link(3)
error: script-oob-org.link(8): Cannot set the current address to $8001: ROMX ends at $7fff error: Cannot decrease the current address (from $4000 to $3fff)
error: script-oob-org.link(11): Cannot decrease the current address (from $ff80 to $0000) at script-oob-org.link(6)
error: script-oob-org.link(12): Cannot decrease the current address (from $ff80 to $ff7f) error: Cannot set the current address to $8000: ROMX ends at $7fff
error: script-oob-org.link(14): Cannot set the current address to $ffff: HRAM ends at $fffe at script-oob-org.link(7)
error: script-oob-org.link(15): Cannot set the current address to $10000: HRAM ends at $fffe 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 Linking failed with 9 errors

View File

@@ -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 Linking failed with 1 error

View File

@@ -1,3 +1,5 @@
error: script-syntax-error.link(2): syntax error, unexpected ORG, expecting end of line or OPTIONAL error: 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 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 Linking failed with 2 errors

View File

@@ -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 Linking failed with 1 error

View File

@@ -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 Linking failed with 1 error

View File

@@ -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 Linking failed with 1 error

View File

@@ -1,4 +1,7 @@
error: script-unterminated-string.link(2): Unterminated string error: Unterminated string
error: script-unterminated-string.link(4): Unterminated string at script-unterminated-string.link(2)
error: script-unterminated-string.link(5): Unterminated string error: Unterminated string
at script-unterminated-string.link(4)
error: Unterminated string
at script-unterminated-string.link(5)
Linking failed with 3 errors Linking failed with 3 errors

View File

@@ -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 Linking failed with 1 error