diff --git a/tools/qfcc/source/linker.c b/tools/qfcc/source/linker.c index 0b215d9e8..dbf2267ea 100644 --- a/tools/qfcc/source/linker.c +++ b/tools/qfcc/source/linker.c @@ -222,7 +222,7 @@ fixup_def (qfo_t *qfo, qfo_def_t *def, int def_num) Hash_Add (defined_defs, def); } if (def->basic_type == ev_func && (def->flags & QFOD_INITIALIZED)) { - func = funcs.funcs + data->data[def->ofs].func_var + func_base; + func = funcs.funcs + data->data[def->ofs].func_var - 1 + func_base; func->def = def_num; } } diff --git a/tools/qfcc/source/obj_file.c b/tools/qfcc/source/obj_file.c index 39bf1f23c..12c93478b 100644 --- a/tools/qfcc/source/obj_file.c +++ b/tools/qfcc/source/obj_file.c @@ -82,7 +82,7 @@ allocate_stuff (void) function_t *func; num_defs = pr.scope->num_defs; - num_functions = pr.num_functions; + num_functions = pr.num_functions - 1; num_relocs = 0; for (def = pr.scope->head; def; def = def->def_next) { num_relocs += count_relocs (def->refs); @@ -167,7 +167,7 @@ setup_data (void) { qfo_def_t *def = defs; def_t *d; - qfo_function_t *func = functions + 1; + qfo_function_t *func = functions; function_t *f; qfo_reloc_t *reloc = relocs; dstatement_t *st;