mirror of
https://github.com/cc65/cc65.git
synced 2024-12-25 02:29:52 +00:00
Fixed an error: For symbols declared as extern in local scope, the name for
the external assembler symbol wasn't set. git-svn-id: svn://svn.cc65.org/cc65/trunk@5620 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
c09d6a7299
commit
515661e5f4
@ -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 */
|
||||
{
|
||||
|
@ -252,6 +252,9 @@ INLINE int SymHasAttr (const SymEntry* Sym, DeclAttrType A)
|
||||
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 */
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user