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;
+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
*/
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 */
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
}
}
- /* 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,
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);