mirror of
https://github.com/cc65/cc65.git
synced 2025-01-12 17:30:50 +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)
|
void CvtRegVarToAuto (SymEntry* Sym)
|
||||||
/* Convert a register variable to an auto variable */
|
/* 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);
|
void SymUseAttr (SymEntry* Sym, struct Declaration* D);
|
||||||
/* Use the attributes from the declaration for this symbol */
|
/* 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);
|
void CvtRegVarToAuto (SymEntry* Sym);
|
||||||
/* Convert a register variable to an auto variable */
|
/* 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;
|
Entry->V.R.SaveOffs = StackPtr;
|
||||||
} else if ((Flags & SC_EXTERN) == SC_EXTERN) {
|
} else if ((Flags & SC_EXTERN) == SC_EXTERN) {
|
||||||
Entry->V.Label = Offs;
|
Entry->V.Label = Offs;
|
||||||
|
SymSetAsmName (Entry);
|
||||||
} else if ((Flags & SC_STATIC) == SC_STATIC) {
|
} else if ((Flags & SC_STATIC) == SC_STATIC) {
|
||||||
/* Generate the assembler name from the label number */
|
/* Generate the assembler name from the label number */
|
||||||
Entry->V.Label = Offs;
|
Entry->V.Label = Offs;
|
||||||
@ -809,8 +810,6 @@ SymEntry* AddGlobalSym (const char* Name, const Type* T, unsigned Flags)
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
unsigned Len;
|
|
||||||
|
|
||||||
/* Create a new entry */
|
/* Create a new entry */
|
||||||
Entry = NewSymEntry (Name, Flags);
|
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 */
|
/* Add the assembler name of the symbol */
|
||||||
Len = strlen (Name);
|
SymSetAsmName (Entry);
|
||||||
Entry->AsmName = xmalloc (Len + 2);
|
|
||||||
Entry->AsmName[0] = '_';
|
|
||||||
memcpy (Entry->AsmName+1, Name, Len+1);
|
|
||||||
|
|
||||||
/* Add the entry to the symbol table */
|
/* Add the entry to the symbol table */
|
||||||
AddSymEntry (Tab, Entry);
|
AddSymEntry (Tab, Entry);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user