Allow local symbols to be referenced

Local symbols can now be referenced outside the scope of their parent, by using the syntax “Parent.Chlid”.

- Local symbol names are now stored internally as “Parent.Child”.
- The symbol’s scope field no longer forms a linked list of the prior local symbols; it will now always contain the parent.
- Add the ability use EXPORT and GLOBAL with local symbols.
- Reduce duplication between findsymbol() and findpsymbol(), as well as between sym_AddLocalReloc() and sym_AddReloc().
This commit is contained in:
Ben10do
2017-06-12 19:12:24 +01:00
parent ff2321a8ce
commit ce8a13a562
4 changed files with 78 additions and 56 deletions

View File

@@ -260,11 +260,7 @@ writesymbol(struct sSymbol * pSym, FILE * f)
sectid = -1;
type = SYM_IMPORT;
} else {
if (pSym->nType & SYMF_LOCAL) {
strcpy(symname, pSym->pScope->tzName);
strcat(symname, pSym->tzName);
} else
strcpy(symname, pSym->tzName);
strcpy(symname, pSym->tzName);
if (pSym->nType & SYMF_EXPORT) {
/* Symbol should be exported */