# HG changeset patch # User William Astle # Date 1345000012 21600 # Node ID 8beb109dfd69dc6b768338fba1d0ca107ef07a52 # Parent 91f91557dc9e060d1a9c0a0c1c2de1b6bad58f47 Fix hang on undefined symbol in rmb under pragma undefextern Problem in the pass4.c implementation led to an infinite loop if any instructions failed to resolve. Instead, if a pass through the loop fails to resolve anything, bail out since it's clearly pointless to continue trying. diff -r 91f91557dc9e -r 8beb109dfd69 lwasm/pass4.c --- a/lwasm/pass4.c Mon Aug 13 17:22:13 2012 -0600 +++ b/lwasm/pass4.c Tue Aug 14 21:06:52 2012 -0600 @@ -40,6 +40,7 @@ int cnt; line_t *cl, *sl; struct line_expr_s *le; + int trycount = 0; // first, count the number of unresolved instructions for (cnt = 0, cl = as -> line_head; cl; cl = cl -> next) @@ -51,6 +52,7 @@ sl = as -> line_head; while (cnt > 0) { + trycount = cnt; debug_message(as, 60, "%d unresolved instructions", cnt); // find an unresolved instruction @@ -142,6 +144,8 @@ if (as -> errorcount > 0) return; } while (rc > 0); + if (trycount == cnt) + break; } }