mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-25 04:22:07 +00:00
Add more tests for unionized sections + fix bugs
Implementing those tests found a few bugs... oops
This commit is contained in:
@@ -155,6 +155,10 @@ static struct Section *getSection(char const *pzName, enum SectionType type,
|
||||
if (pSect->nOrg != -1 && pSect->nOrg != org)
|
||||
fail("Section \"%s\" already declared as fixed at different address $%x",
|
||||
pSect->pzName, pSect->nOrg);
|
||||
else if (pSect->nAlign != 0
|
||||
&& ((pSect->nAlign - 1) & org))
|
||||
fail("Section \"%s\" already declared as aligned to %u bytes",
|
||||
pSect->pzName, pSect->nAlign);
|
||||
else
|
||||
/* Otherwise, just override */
|
||||
pSect->nOrg = org;
|
||||
@@ -207,7 +211,7 @@ static struct Section *getSection(char const *pzName, enum SectionType type,
|
||||
fail("Section \"%s\" already declared as unaligned",
|
||||
pSect->pzName);
|
||||
else
|
||||
fail("Section \"%s\" already declared as aligned to %u bits",
|
||||
fail("Section \"%s\" already declared as aligned to %u bytes",
|
||||
pSect->pzName, pSect->nAlign);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,10 @@ void sect_ForEach(void (*callback)(struct Section *, void *), void *arg)
|
||||
|
||||
static void mergeSections(struct Section *target, struct Section *other)
|
||||
{
|
||||
if (target->type != other->type)
|
||||
errx(1, "Section \"%s\" is defined with conflicting types %s and %s",
|
||||
other->name,
|
||||
typeNames[target->type], typeNames[other->type]);
|
||||
if (other->isAddressFixed) {
|
||||
if (target->isAddressFixed) {
|
||||
if (target->org != other->org)
|
||||
|
||||
Reference in New Issue
Block a user