return IsTypeFunc (Sym->Type) &&
SymIsDef (Sym) &&
(Sym->Flags & (SC_REF | SC_EXTERN));
-}
+}
+void SymSetAsmName (SymEntry* Sym)
+/* Set the assembler name for an external symbol from the name of the symbol */
+{
+ unsigned Len;
+
+ /* Cannot be used to change the name */
+ PRECONDITION (Sym->AsmName == 0);
+
+ /* The assembler name starts with an underline */
+ Len = strlen (Sym->Name);
+ Sym->AsmName = xmalloc (Len + 2);
+ Sym->AsmName[0] = '_';
+ memcpy (Sym->AsmName+1, Sym->Name, Len+1);
+}
+
+
+
void CvtRegVarToAuto (SymEntry* Sym)
/* Convert a register variable to an auto variable */
{
void SymUseAttr (SymEntry* Sym, struct Declaration* D);
/* Use the attributes from the declaration for this symbol */
+void SymSetAsmName (SymEntry* Sym);
+/* Set the assembler name for an external symbol from the name of the symbol */
+
void CvtRegVarToAuto (SymEntry* Sym);
/* Convert a register variable to an auto variable */
Entry->V.R.SaveOffs = StackPtr;
} else if ((Flags & SC_EXTERN) == SC_EXTERN) {
Entry->V.Label = Offs;
+ SymSetAsmName (Entry);
} else if ((Flags & SC_STATIC) == SC_STATIC) {
/* Generate the assembler name from the label number */
Entry->V.Label = Offs;
} else {
- unsigned Len;
-
/* Create a new entry */
Entry = NewSymEntry (Name, Flags);
}
/* 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);
+ SymSetAsmName (Entry);
/* Add the entry to the symbol table */
AddSymEntry (Tab, Entry);