mirror of
https://github.com/open-simh/simtools.git
synced 2026-02-27 09:09:52 +00:00
Put undefined symbols in separate table.
Even though all regression tests pass, it feels better to do the undefined symbols similar to the implicit globals.
This commit is contained in:
@@ -213,8 +213,9 @@ void implicit_gbl(
|
||||
/* Either make the undefined symbol into an implicit global */
|
||||
add_sym(value->data.symbol->label, 0, SYMBOLFLAG_GLOBAL, &absolute_section, &implicit_st);
|
||||
} else {
|
||||
/* or add it to the symbol table, purely for listing purposes. */
|
||||
add_sym(value->data.symbol->label, 0, SYMBOLFLAG_UNDEFINED, &absolute_section, &symbol_st);
|
||||
/* or add it to the undefined symbol table,
|
||||
purely for listing purposes. */
|
||||
add_sym(value->data.symbol->label, 0, SYMBOLFLAG_UNDEFINED, &absolute_section, &undefined_st);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -265,6 +266,28 @@ void migrate_implicit(
|
||||
}
|
||||
}
|
||||
|
||||
/* Done between second pass and listing */
|
||||
/* Migrates the symbols from the "undefined" table into the main table. */
|
||||
|
||||
void migrate_undefined(
|
||||
void)
|
||||
{
|
||||
SYMBOL_ITER iter;
|
||||
SYMBOL *isym,
|
||||
*sym;
|
||||
|
||||
for (isym = first_sym(&undefined_st, &iter); isym != NULL; isym = next_sym(&undefined_st, &iter)) {
|
||||
sym = lookup_sym(isym->label, &symbol_st);
|
||||
if (sym) {
|
||||
continue; /* It's already in there. Great. */
|
||||
}
|
||||
isym->flags |= SYMBOLFLAG_UNDEFINED; /* Just in case */
|
||||
sym = add_sym(isym->label, isym->value, isym->flags, isym->section, &symbol_st);
|
||||
/* Just one other thing - migrate the stmtno */
|
||||
sym->stmtno = isym->stmtno;
|
||||
}
|
||||
}
|
||||
|
||||
int express_sym_offset(
|
||||
EX_TREE *value,
|
||||
SYMBOL **sym,
|
||||
|
||||
@@ -85,7 +85,7 @@ void write_globals(
|
||||
FILE *obj);
|
||||
void migrate_implicit(
|
||||
void);
|
||||
|
||||
|
||||
void migrate_undefined(
|
||||
void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -417,6 +417,7 @@ int main(
|
||||
fprintf(stderr, "%d Errors\n", errcount);
|
||||
|
||||
if (lstfile) {
|
||||
migrate_undefined(); /* Migrate the undefined symbols */
|
||||
list_symbol_table();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@ SYMBOL_TABLE macro_st; /* Macros */
|
||||
|
||||
SYMBOL_TABLE implicit_st; /* The symbols which may be implicit globals */
|
||||
|
||||
SYMBOL_TABLE undefined_st; /* The symbols which may be undefined */
|
||||
|
||||
|
||||
void list_section(SECTION *sec);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user