Improve error messages slightly

This commit is contained in:
ISSOtm
2019-11-06 08:48:24 +01:00
parent 7233f568a7
commit 44173dbe8b

View File

@@ -293,10 +293,10 @@ static void placeSection(struct Section *section)
snprintf(where, 64, "at $%02x:%04x", snprintf(where, 64, "at $%02x:%04x",
section->bank, section->org); section->bank, section->org);
else if (section->isAlignFixed) else if (section->isAlignFixed)
snprintf(where, 64, "in bank %02x with align mask %x", snprintf(where, 64, "in bank $%02x with align mask %x",
section->bank, ~section->alignMask); section->bank, ~section->alignMask);
else else
snprintf(where, 64, "in bank %02x", section->bank); snprintf(where, 64, "in bank $%02x", section->bank);
} else { } else {
if (section->isAddressFixed) if (section->isAddressFixed)
snprintf(where, 64, "at address $%04x", section->org); snprintf(where, 64, "at address $%04x", section->org);
@@ -313,8 +313,9 @@ static void placeSection(struct Section *section)
section->name, typeNames[section->type], where); section->name, typeNames[section->type], where);
/* If the section just can't fit the bank, report that */ /* If the section just can't fit the bank, report that */
else if (section->org + section->size > endaddr(section->type) + 1) else if (section->org + section->size > endaddr(section->type) + 1)
errx(1, "Unable to place \"%s\" (%s section) %s: section runs past end of region", errx(1, "Unable to place \"%s\" (%s section) %s: section runs past end of region ($%04x > $%04x)",
section->name, typeNames[section->type], where); section->name, typeNames[section->type], where,
section->org + section->size, endaddr(section->type) + 1);
/* Otherwise there is overlap with another section */ /* Otherwise there is overlap with another section */
else else
errx(1, "Unable to place \"%s\" (%s section) %s: section overlaps with \"%s\"", errx(1, "Unable to place \"%s\" (%s section) %s: section overlaps with \"%s\"",