mirror of
https://github.com/open-simh/simtools.git
synced 2026-04-28 20:57:22 +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 */
|
/* Either make the undefined symbol into an implicit global */
|
||||||
add_sym(value->data.symbol->label, 0, SYMBOLFLAG_GLOBAL, &absolute_section, &implicit_st);
|
add_sym(value->data.symbol->label, 0, SYMBOLFLAG_GLOBAL, &absolute_section, &implicit_st);
|
||||||
} else {
|
} else {
|
||||||
/* or add it to the symbol table, purely for listing purposes. */
|
/* or add it to the undefined symbol table,
|
||||||
add_sym(value->data.symbol->label, 0, SYMBOLFLAG_UNDEFINED, &absolute_section, &symbol_st);
|
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(
|
int express_sym_offset(
|
||||||
EX_TREE *value,
|
EX_TREE *value,
|
||||||
SYMBOL **sym,
|
SYMBOL **sym,
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ void write_globals(
|
|||||||
FILE *obj);
|
FILE *obj);
|
||||||
void migrate_implicit(
|
void migrate_implicit(
|
||||||
void);
|
void);
|
||||||
|
void migrate_undefined(
|
||||||
|
void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -417,6 +417,7 @@ int main(
|
|||||||
fprintf(stderr, "%d Errors\n", errcount);
|
fprintf(stderr, "%d Errors\n", errcount);
|
||||||
|
|
||||||
if (lstfile) {
|
if (lstfile) {
|
||||||
|
migrate_undefined(); /* Migrate the undefined symbols */
|
||||||
list_symbol_table();
|
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 implicit_st; /* The symbols which may be implicit globals */
|
||||||
|
|
||||||
|
SYMBOL_TABLE undefined_st; /* The symbols which may be undefined */
|
||||||
|
|
||||||
|
|
||||||
void list_section(SECTION *sec);
|
void list_section(SECTION *sec);
|
||||||
|
|
||||||
|
|||||||
@@ -370,6 +370,8 @@ extern SYMBOL_TABLE macro_st; /* Macros */
|
|||||||
|
|
||||||
extern SYMBOL_TABLE implicit_st; /* The symbols which may be implicit globals */
|
extern SYMBOL_TABLE implicit_st; /* The symbols which may be implicit globals */
|
||||||
|
|
||||||
|
extern SYMBOL_TABLE undefined_st; /* The symbols which may be undefined */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int hash_name(
|
int hash_name(
|
||||||
|
|||||||
Reference in New Issue
Block a user