mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-23 03:22:08 +00:00
Implement unionized sections in RGBASM
This touched a lot more code than initially expected, for two reasons. First, this broke a big RGBASM assumption: that sections are always being written to at their end. This plus other problems required touching basically the entirety of `section.c`. Second, I tried different solutions to solve the above problem, and along the way I cleaned up many things around. (I believe that keeping this to "cleanup" commits yields subpar results, and since it's boring they get postponed anyways.) RGBLINK support still needs to be added, but this will come next.
This commit is contained in:
@@ -62,7 +62,7 @@ static int32_t Callback__LINE__(struct sSymbol const *self)
|
||||
|
||||
static int32_t CallbackPC(struct sSymbol const *self)
|
||||
{
|
||||
return self->pSection ? self->pSection->nOrg + self->pSection->nPC : 0;
|
||||
return self->pSection ? self->pSection->nOrg + curOffset : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -124,7 +124,6 @@ static struct sSymbol *createsymbol(char const *s)
|
||||
if (snprintf((*ppsym)->tzName, MAXSYMLEN + 1, "%s", s) > MAXSYMLEN)
|
||||
warning(WARNING_LONG_STR, "Symbol name is too long: '%s'", s);
|
||||
|
||||
(*ppsym)->isConstant = false;
|
||||
(*ppsym)->isExported = false;
|
||||
(*ppsym)->isBuiltin = false;
|
||||
(*ppsym)->isReferenced = false;
|
||||
@@ -349,7 +348,6 @@ struct sSymbol *sym_AddEqu(char const *tzSym, int32_t value)
|
||||
|
||||
nsym->nValue = value;
|
||||
nsym->type = SYM_EQU;
|
||||
nsym->isConstant = true;
|
||||
nsym->pScope = NULL;
|
||||
updateSymbolFilename(nsym);
|
||||
|
||||
@@ -417,7 +415,6 @@ struct sSymbol *sym_AddSet(char const *tzSym, int32_t value)
|
||||
|
||||
nsym->nValue = value;
|
||||
nsym->type = SYM_SET;
|
||||
nsym->isConstant = true;
|
||||
nsym->pScope = NULL;
|
||||
updateSymbolFilename(nsym);
|
||||
|
||||
@@ -479,9 +476,8 @@ struct sSymbol *sym_AddReloc(char const *tzSym)
|
||||
nsym->tzFileName, nsym->nFileLine);
|
||||
/* If the symbol already exists as a ref, just "take over" it */
|
||||
|
||||
nsym->nValue = nPC;
|
||||
nsym->nValue = curOffset;
|
||||
nsym->type = SYM_LABEL;
|
||||
nsym->isConstant = pCurrentSection && pCurrentSection->nOrg != -1;
|
||||
|
||||
if (exportall)
|
||||
nsym->isExported = true;
|
||||
|
||||
Reference in New Issue
Block a user