diff --git a/tools/qfcc/source/linker.c b/tools/qfcc/source/linker.c index f419435ab..7e83bd295 100644 --- a/tools/qfcc/source/linker.c +++ b/tools/qfcc/source/linker.c @@ -246,15 +246,10 @@ resolve_external_def (defref_t *ext, defref_t *def) linker_type_mismatch (REF (ext), REF (def)); return; } - if (def->space != ext->space) { - //FIXME this is here until I fix the main cause of problems: - //mishandling of obj_msgSend and obj_msgSend_super. - def_warning (REF (def), "help, help!"); - def_warning (REF (ext), "I'm being relocated!"); - } REF (ext)->offset = REF (def)->offset; REF (ext)->flags = REF (def)->flags; ext->merge = 1; + ext->space = def->space; ext->next = def->merge_list; def->merge_list = ext; } @@ -280,17 +275,11 @@ process_def (defref_t *ref, qfo_mspace_t *space) } else if (def->flags & QFOD_GLOBAL) { if (r) { if (REF (r)->flags & QFOD_SYSTEM) { - if (def->type != REF (r)->type) { - linker_type_mismatch (def, REF (r)); - return; - } /// System defs may be redefined only once. REF (r)->flags &= ~QFOD_SYSTEM; - if (ref->space != r->space) - internal_error (0, "help, help!"); + // treat the new def as external + resolve_external_def (ref, r); //FIXME copy stuff from new def to existing def??? - def->offset = REF(r)->offset; - def->flags = REF(r)->flags; } else { def_error (def, "%s redefined", WORKSTR (def->name)); def_error (REF (r), "previous definition"); diff --git a/tools/qfcc/source/method.c b/tools/qfcc/source/method.c index e8ed9dd2d..1d8788098 100644 --- a/tools/qfcc/source/method.c +++ b/tools/qfcc/source/method.c @@ -263,9 +263,12 @@ send_message (int super) } sym = symtab_lookup (pr.symtab, sm_name); if (!sym) { + symtab_t *save = current_symtab; + current_symtab = pr.symtab; sym = new_symbol_type (sm_name, sm_type); sym = function_symbol (sym, 0, 1); make_function (sym, 0, sym->table->space, st_extern); + current_symtab = save; } return new_symbol_expr (sym); }