]> git.sur5r.net Git - cc65/blobdiff - src/cc65/symentry.c
Fixed an error: For symbols declared as extern in local scope, the name for
[cc65] / src / cc65 / symentry.c
index e42c8bbaa52a45be4bcd537515a2f0deb1212045..1644c962f1e720ccebb25ec9511542b4e26541d4 100644 (file)
@@ -162,7 +162,7 @@ int SymIsOutputFunc (const SymEntry* Sym)
     return IsTypeFunc (Sym->Type)               &&
            SymIsDef (Sym)                       &&
            (Sym->Flags & (SC_REF | SC_EXTERN));
-}                                               
+}
 
 
 
@@ -209,6 +209,23 @@ void SymUseAttr (SymEntry* Sym, struct Declaration* D)
 
 
 
+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 */
 {