1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-09 06:29:38 +00:00

Generate assembler names for symbols

git-svn-id: svn://svn.cc65.org/cc65/trunk@3048 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2004-05-26 13:44:53 +00:00
parent 2cdef2d58f
commit 72923eb316

View File

@ -528,7 +528,7 @@ static void AddSymEntry (SymTable* T, SymEntry* S)
/* First symbol */
T->SymHead = S;
}
T->SymCount++;
++T->SymCount;
/* Insert the symbol into the hash chain */
S->NextHash = T->Tab[Hash];
@ -637,6 +637,9 @@ SymEntry* AddLabelSym (const char* Name, unsigned Flags)
/* Set a new label number */
Entry->V.Label = GetLocalLabel ();
/* Generate the assembler name of the label */
Entry->AsmName = xstrdup (LocalLabelName (Entry->V.Label));
/* Add the entry to the label table */
AddSymEntry (LabelTab, Entry);
@ -671,7 +674,9 @@ SymEntry* AddLocalSym (const char* Name, const type* Type, unsigned Flags, int O
Entry->V.R.RegOffs = Offs;
Entry->V.R.SaveOffs = oursp; /* ### Cleaner! */
} else if ((Flags & SC_STATIC) == SC_STATIC) {
/* Generate the assembler name from the label number */
Entry->V.Label = Offs;
Entry->AsmName = xstrdup (LocalLabelName (Entry->V.Label));
} else if ((Flags & SC_STRUCTFIELD) == SC_STRUCTFIELD) {
Entry->V.Offs = Offs;
} else {
@ -761,6 +766,8 @@ SymEntry* AddGlobalSym (const char* Name, const type* Type, unsigned Flags)
} else {
unsigned Len;
/* Create a new entry */
Entry = NewSymEntry (Name, Flags);
@ -775,6 +782,12 @@ SymEntry* AddGlobalSym (const char* Name, const type* Type, unsigned Flags)
Entry->V.F.Seg = 0;
}
/* Add the assembler name of the symbol */
Len = strlen (Name);
Entry->AsmName = xmalloc (Len + 2);
Entry->AsmName[0] = '_';
memcpy (Entry->AsmName+1, Name, Len+1);
/* Add the entry to the symbol table */
AddSymEntry (Tab, Entry);
}