Save object file name of each symbol in linker

This is useful to generate error messages when there is a symbol that
appears in more than one object file.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
Antonio Niño Díaz
2017-07-22 15:16:38 +01:00
parent 4e2a035838
commit 92449a4fe4
5 changed files with 34 additions and 17 deletions

View File

@@ -12,8 +12,10 @@
struct ISymbol {
char *pzName;
SLONG nValue;
SLONG nBank;
//-1 = const
SLONG nBank; /* -1 = constant */
char tzObjFileName[_MAX_PATH + 1]; /* Object file where the symbol was defined. */
char tzFileName[_MAX_PATH + 1]; /* Source file where the symbol was defined. */
ULONG nFileLine; /* Line where the symbol was defined. */
struct ISymbol *pNext;
};
@@ -76,7 +78,8 @@ sym_GetBank(char *tzName)
}
void
sym_CreateSymbol(char *tzName, SLONG nValue, SLONG nBank)
sym_CreateSymbol(char *tzName, SLONG nValue, SLONG nBank, char *tzObjFileName,
char *tzFileName, ULONG nFileLine)
{
if (strcmp(tzName, "@") == 0)
return;
@@ -102,6 +105,11 @@ sym_CreateSymbol(char *tzName, SLONG nValue, SLONG nBank)
(*ppSym)->nValue = nValue;
(*ppSym)->nBank = nBank;
(*ppSym)->pNext = NULL;
strncpy((*ppSym)->tzObjFileName, tzObjFileName,
sizeof((*ppSym)->tzObjFileName));
strncpy((*ppSym)->tzFileName, tzFileName,
sizeof((*ppSym)->tzFileName));
(*ppSym)->nFileLine = nFileLine;
}
}
}