Add -B/--backtrace option to RGBASM and RGBLINK (#1787)

This commit is contained in:
Rangi
2025-08-11 14:30:14 -04:00
committed by GitHub
parent 92a9c73ee7
commit 5f8b7474b4
303 changed files with 2729 additions and 2409 deletions

View File

@@ -14,6 +14,7 @@
#include "platform.hpp"
#include "link/assign.hpp"
#include "link/fstack.hpp"
#include "link/main.hpp"
#include "link/section.hpp"
#include "link/symbol.hpp"
@@ -280,7 +281,7 @@ void sdobj_ReadFile(FileStackNode const &src, FILE *file, std::vector<Symbol> &f
// The following is required for fragment offsets to be reliably predicted
for (FileSection &entry : fileSections) {
if (!strcmp(token, entry.section->name.c_str())) {
fatalAt(where, "Area \"%s\" already defined earlier", token);
fatalAt(where, "Area \"%s\" already defined", token);
}
}
char const *sectName = token; // We'll deal with the section's name depending on type
@@ -422,14 +423,14 @@ void sdobj_ReadFile(FileStackNode const &src, FILE *file, std::vector<Symbol> &f
|| (symbolSection && !symbolSection->isAddressFixed)) {
sym_AddSymbol(symbol); // This will error out
} else if (otherValue != symbolValue) {
errorNoDump(
"\"%s\" is defined as %" PRId32 " at ", symbol.name.c_str(), symbolValue
fatalTwoAt(
symbol,
*other,
"\"%s\" is defined as %" PRId32 ", but was already defined as %" PRId32,
symbol.name.c_str(),
symbolValue,
otherValue
);
symbol.src->dump(symbol.lineNo);
fprintf(stderr, ", but as %" PRId32 " at ", otherValue);
other->src->dump(other->lineNo);
putc('\n', stderr);
exit(1);
}
} else {
// Add a new definition