]> git.sur5r.net Git - cc65/blobdiff - src/cc65/symtab.c
Fixed an error: For symbols declared as extern in local scope, the name for
[cc65] / src / cc65 / symtab.c
index db6541ee7fda8f9e1461232b7208c454d1d4014d..23b19695efc717024f0066f7622d91f133cb711d 100644 (file)
@@ -710,6 +710,7 @@ SymEntry* AddLocalSym (const char* Name, const Type* T, unsigned Flags, int Offs
             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;
@@ -809,8 +810,6 @@ SymEntry* AddGlobalSym (const char* Name, const Type* T, unsigned Flags)
 
     } else {
 
-        unsigned Len;
-
        /* Create a new entry */
        Entry = NewSymEntry (Name, Flags);
 
@@ -826,10 +825,7 @@ SymEntry* AddGlobalSym (const char* Name, const Type* T, unsigned 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);