Skip to content

Commit

Permalink
XS linker: fix mod symbol table #1232
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Soquet committed Oct 11, 2023
1 parent a122425 commit 37224ba
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion xs/tools/xsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ int main(int argc, char* argv[])
}

linker->symbolTable = fxNewLinkerChunkClear(linker, linker->symbolModulo * sizeof(txLinkerSymbol*));
fxNewLinkerSymbol(linker, gxIDStrings[0], 0);
fxNewLinkerSymbol(linker, gxIDStrings[0], 0, 0);

resource = linker->firstResource;
while (resource) {
Expand Down
2 changes: 1 addition & 1 deletion xs/tools/xsl.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ int main(int argc, char* argv[])

linker->symbolTable = fxNewLinkerChunkClear(linker, linker->symbolModulo * sizeof(txLinkerSymbol*));
if (archiving) {
fxNewLinkerSymbol(linker, gxIDStrings[0], 0);
fxNewLinkerSymbol(linker, gxIDStrings[0], 0, 0);
resource = linker->firstResource;
while (resource) {
fxBaseResource(linker, resource, base, size);
Expand Down
2 changes: 1 addition & 1 deletion xs/tools/xsl.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ extern txLinkerResource* fxNewLinkerResource(txLinker* linker, txString path, FI
extern txLinkerScript* fxNewLinkerScript(txLinker* linker, txString path, FILE** fileAddress);
extern txString fxNewLinkerString(txLinker* linker, txString buffer, txSize size);
extern txLinkerStrip* fxNewLinkerStrip(txLinker* linker, txString name);
extern txLinkerSymbol* fxNewLinkerSymbol(txLinker* linker, txString theString, txFlag flag);
extern txLinkerSymbol* fxNewLinkerSymbol(txLinker* linker, txString theString, txFlag flag, txBoolean table);
extern void fxReadSymbols(txLinker* linker, txString path, txFlag flag, FILE** fileAddress);
extern txString fxRealDirectoryPath(txLinker* linker, txString path);
extern txString fxRealFilePath(txLinker* linker, txString path);
Expand Down
13 changes: 8 additions & 5 deletions xs/tools/xslBase.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,11 @@ void fxBufferSymbols(txLinker* linker)
void fxDefaultSymbols(txLinker* linker)
{
int i;
for (i = 0; i < XS_ID_COUNT; i++) {
fxNewLinkerSymbol(linker, gxIDStrings[i], 0);
for (i = 0; i < XS_SYMBOL_ID_COUNT; i++) {
fxNewLinkerSymbol(linker, gxIDStrings[i], 0, 0);
}
for (; i < XS_ID_COUNT; i++) {
fxNewLinkerSymbol(linker, gxIDStrings[i], 0, 1);
}
}

Expand Down Expand Up @@ -346,7 +349,7 @@ txID* fxMapSymbols(txLinker* linker, txS1* symbolsBuffer, txFlag flag)
symbols = fxNewLinkerChunk(linker, c * sizeof(txID*));
symbols[0] = XS_NO_ID;
for (i = 1; i < c; i++) {
txLinkerSymbol* symbol = fxNewLinkerSymbol(linker, (txString)p, flag);
txLinkerSymbol* symbol = fxNewLinkerSymbol(linker, (txString)p, flag, 1);
symbols[i] = symbol->ID;
p += mxStringLength((char*)p) + 1;
}
Expand Down Expand Up @@ -506,7 +509,7 @@ txLinkerStrip* fxNewLinkerStrip(txLinker* linker, txString name)
return result;
}

txLinkerSymbol* fxNewLinkerSymbol(txLinker* linker, txString theString, txFlag flag)
txLinkerSymbol* fxNewLinkerSymbol(txLinker* linker, txString theString, txFlag flag, txBoolean table)
{
txString aString;
txSize aLength;
Expand Down Expand Up @@ -544,7 +547,7 @@ txLinkerSymbol* fxNewLinkerSymbol(txLinker* linker, txString theString, txFlag f
aSymbol->sum = aSum;
aSymbol->flag = flag;
linker->symbolArray[anID] = aSymbol;
if (anID >= XS_SYMBOL_ID_COUNT)
if (table)
linker->symbolTable[aModulo] = aSymbol;
linker->symbolIndex++;
}
Expand Down

0 comments on commit 37224ba

Please sign in to comment.