From e93ca9d828c55846f42c0bea00d227d8a9983233 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 29 Feb 2020 20:13:25 +0900 Subject: [PATCH] [qfcc] Fix infinite loop in linker --- tools/qfcc/source/linker.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tools/qfcc/source/linker.c b/tools/qfcc/source/linker.c index 3ce5ca3fd..5a9d367ce 100644 --- a/tools/qfcc/source/linker.c +++ b/tools/qfcc/source/linker.c @@ -1122,12 +1122,11 @@ undefined_def (qfo_def_t *def) if (func->code < 0) { continue; } - if ((pr_uint_t) func->code > reloc->offset) { - continue; - } - if (!best || reloc->offset - func->code < best_dist) { - best = func; - best_dist = reloc->offset - func->code; + if ((pr_uint_t) func->code <= reloc->offset) { + if (!best || reloc->offset - func->code < best_dist) { + best = func; + best_dist = reloc->offset - func->code; + } } func++; }