From 6f871a8af9a641f58b4fe407771e1f71a8117ac5 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 29 Mar 2020 00:58:02 +0900 Subject: [PATCH] [qfcc] Unalias def types before checking This fixes the typelinker test, but not the linking error in ruamoko/game that it was supposed to represent. I guess there's something more going on (maybe type encoding relocation issues). --- tools/qfcc/source/linker.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/qfcc/source/linker.c b/tools/qfcc/source/linker.c index 017461de0..ce708375e 100644 --- a/tools/qfcc/source/linker.c +++ b/tools/qfcc/source/linker.c @@ -282,6 +282,8 @@ alloc_data (int space, int size) static void resolve_external_def (defref_t *ext, defref_t *def) { + qfot_type_t *ext_type; + qfot_type_t *def_type; if (!(REF (ext)->flags & QFOD_EXTERNAL)) { def_error (REF (ext), "%s %x", WORKSTR (REF (ext)->name), REF (ext)->flags); @@ -292,7 +294,15 @@ resolve_external_def (defref_t *ext, defref_t *def) REF (def)->flags); linker_internal_error ("def is an external or local def"); } - if (REF (ext)->type != REF (def)->type) { + ext_type = WORKTYPE (REF(ext)->type); + if (ext_type->meta == ty_alias) { + ext_type = WORKTYPE (ext_type->t.alias.aux_type); + } + def_type = WORKTYPE (REF (def)->type); + if (def_type->meta == ty_alias) { + def_type = WORKTYPE (def_type->t.alias.aux_type); + } + if (ext_type != def_type) { linker_type_mismatch (REF (ext), REF (def)); return; }