1
0
mirror of https://github.com/cc65/cc65.git synced 2025-04-08 19:38:55 +00:00

Track export ids of debug symbols and write the to the object file.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5183 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2011-08-16 12:52:56 +00:00
parent 63c53499be
commit aa1a103154
3 changed files with 21 additions and 4 deletions

View File

@ -94,6 +94,7 @@ SymEntry* NewSymEntry (const StrBuf* Name, unsigned Flags)
S->Flags = Flags;
S->DebugSymId = ~0U;
S->ImportId = ~0U;
S->ExportId = ~0U;
S->Expr = 0;
S->ExprRefs = AUTO_COLLECTION_INITIALIZER;
S->ExportSize = ADDR_SIZE_DEFAULT;
@ -680,6 +681,15 @@ unsigned GetSymImportId (const SymEntry* S)
unsigned GetSymExportId (const SymEntry* S)
/* Return the export id for the given symbol */
{
PRECONDITION (S != 0 && (S->Flags & SF_IMPORT) && S->ExportId != ~0U);
return S->ExportId;
}
unsigned GetSymInfoFlags (const SymEntry* S, long* ConstVal)
/* Return a set of flags used when writing symbol information into a file.
* If the SYM_CONST bit is set, ConstVal will contain the constant value

View File

@ -95,7 +95,8 @@ struct SymEntry {
*/
unsigned Flags; /* Symbol flags */
unsigned DebugSymId; /* Debug symbol id */
unsigned ImportId; /* Id of import if this is one */
unsigned ImportId; /* Id of import if this is one */
unsigned ExportId; /* Id of export if this is one */
struct ExprNode* Expr; /* Symbol expression */
Collection ExprRefs; /* Expressions using this symbol */
unsigned char ExportSize; /* Export address size */
@ -338,6 +339,9 @@ long GetSymVal (SymEntry* Sym);
unsigned GetSymImportId (const SymEntry* Sym);
/* Return the import id for the given symbol */
unsigned GetSymExportId (const SymEntry* Sym);
/* Return the export id for the given symbol */
unsigned GetSymInfoFlags (const SymEntry* Sym, long* ConstVal);
/* Return a set of flags used when writing symbol information into a file.
* If the SYM_CONST bit is set, ConstVal will contain the constant value

View File

@ -592,9 +592,9 @@ void SymCheck (void)
}
}
/* Count exports */
/* Count exports, assign the export ID */
if (S->Flags & SF_EXPORT) {
++ExportCount;
S->ExportId = ExportCount++;
}
/* If the symbol is defined but has an unknown address size,
@ -865,10 +865,13 @@ void WriteDbgSyms (void)
ObjWriteVar (Size);
}
/* If the symbol is an import, write out its import id */
/* If the symbol is an im- or export, write out the ids */
if (SYM_IS_IMPORT (SymFlags)) {
ObjWriteVar (GetSymImportId (S));
}
if (SYM_IS_EXPORT (SymFlags)) {
ObjWriteVar (GetSymExportId (S));
}
/* Write the line infos */
WriteLineInfo (&S->LineInfos);