Add a few more linker script tests

This commit is contained in:
ISSOtm
2024-02-19 00:23:00 +01:00
parent 3860ab11c7
commit 18e83c17b4
16 changed files with 67 additions and 5 deletions

View File

@@ -422,7 +422,7 @@ static void alignTo(uint32_t alignment, uint32_t alignOfs) {
if (alignOfs >= alignSize) {
scriptError(context, "Cannot align: The alignment offset (%" PRIu32
") must be less than alignment size (%" PRIu32 ")\n",
") must be less than alignment size (%" PRIu32 ")",
alignOfs, alignSize);
return;
}
@@ -437,7 +437,7 @@ static void alignTo(uint32_t alignment, uint32_t alignOfs) {
auto &pc = curAddr[activeType][activeBankIdx];
if (alignment > 16) {
scriptError(context, "Cannot align: The alignment (%" PRIu32 ") must be less than 16\n",
scriptError(context, "Cannot align: The alignment (%" PRIu32 ") must be less than 16",
alignment);
return;
}
@@ -450,7 +450,7 @@ static void alignTo(uint32_t alignment, uint32_t alignOfs) {
if (alignOfs >= alignSize) {
scriptError(context, "Cannot align: The alignment offset (%" PRIu32
") must be less than alignment size (%" PRIu32 ")\n",
") must be less than alignment size (%" PRIu32 ")",
alignOfs, alignSize);
return;
}
@@ -546,9 +546,10 @@ static void placeSection(std::string const &name, bool isOptional) {
uint16_t curOfs = org - typeInfo.startAddr;
if (section->size > typeInfo.size - curOfs) {
scriptError(context, "The linker script assigns section \"%s\" to address $%04" PRIx16 ", but then it would overflow %s by %" PRIx16 " bytes",
uint16_t overflowSize = section->size - (typeInfo.size - curOfs);
scriptError(context, "The linker script assigns section \"%s\" to address $%04" PRIx16 ", but then it would overflow %s by %" PRIx16 " byte%s",
name.c_str(), org, typeInfo.name.c_str(),
(uint16_t)(section->size - (typeInfo.size - curOfs)));
overflowSize, overflowSize == 1 ? "" : "s");
// Fill as much as possible without going out of bounds.
org = typeInfo.startAddr + typeInfo.size;
} else {