Give __obj_exec_class a sterner beating.

When linking a def into a defspace, ensure it can be removed. This fixes
the missing __obj_exec_class def in qwaq.
This commit is contained in:
Bill Currie 2011-02-11 18:27:07 +09:00
parent 75d90d2f00
commit 8c01497936
2 changed files with 10 additions and 6 deletions

View file

@ -1160,10 +1160,13 @@ class_finish_module (void)
GETSTR (pr.source_file));
EMIT_DEF (module_sym->s.def->space, module->symtab, symtab_def);
exec_class_sym = new_symbol_type ("__obj_exec_class",
&type_obj_exec_class);
exec_class_sym = function_symbol (exec_class_sym, 0, 1);
make_function (exec_class_sym, 0, st_extern);
exec_class_sym = symtab_lookup (pr.symtab, "__obj_exec_class");
if (!exec_class_sym) {
exec_class_sym = new_symbol_type ("__obj_exec_class",
&type_obj_exec_class);
exec_class_sym = function_symbol (exec_class_sym, 0, 1);
make_function (exec_class_sym, 0, st_extern);
}
init_sym = new_symbol_type (".ctor", &type_function);
init_sym = function_symbol (init_sym, 0, 1);

View file

@ -113,10 +113,10 @@ new_def (const char *name, type_t *type, defspace_t *space,
def->type = type;
if (storage != st_extern) {
def->space = space;
def->offset = defspace_new_loc (space, type_size (type));
}
if (space) {
def->space = space;
*space->def_tail = def;
space->def_tail = &def->next;
}
@ -150,7 +150,8 @@ free_def (def_t *def)
for (d = &def->space->defs; *d && *d != def; d = &(*d)->next)
;
*d = def->next;
defspace_free_loc (def->space, def->offset, type_size (def->type));
if (!def->external)
defspace_free_loc (def->space, def->offset, type_size (def->type));
}
def->next = free_defs;
free_defs = def;