# HG changeset patch # User lost@l-w.ca # Date 1302462912 21600 # Node ID ceab04fd29698633e9df8d24110b1052e54d323f # Parent 87026ec7e1c2a8012dce9dc1a1891df9c543cb7f Fixed premature installation of external reference under UNDEFEXTERN pragma; should not resolve to external references until after the initial parsing pass diff -r 87026ec7e1c2 -r ceab04fd2969 lwasm/lwasm.c --- a/lwasm/lwasm.c Sat Apr 09 01:45:48 2011 -0600 +++ b/lwasm/lwasm.c Sun Apr 10 13:15:12 2011 -0600 @@ -70,7 +70,7 @@ } // check for "undefined" to import automatically - if (!im && CURPRAGMA(as -> cl, PRAGMA_UNDEFEXTERN)) + if ((as -> passno != 0) && !im && CURPRAGMA(as -> cl, PRAGMA_UNDEFEXTERN)) { im = lw_alloc(sizeof(importlist_t)); im -> symbol = lw_strdup(var); diff -r 87026ec7e1c2 -r ceab04fd2969 lwasm/lwasm.h --- a/lwasm/lwasm.h Sat Apr 09 01:45:48 2011 -0600 +++ b/lwasm/lwasm.h Sun Apr 10 13:15:12 2011 -0600 @@ -284,6 +284,7 @@ structtab_t *cstruct; // current structure lw_expr_t savedaddr; // old address counter before struct started int exportcheck; // set if we need to collapse out the section base to 0 + int passno; // set to the current pass number }; #ifndef ___symbol_c_seen___ diff -r 87026ec7e1c2 -r ceab04fd2969 lwasm/main.c --- a/lwasm/main.c Sat Apr 09 01:45:48 2011 -0600 +++ b/lwasm/main.c Sun Apr 10 13:15:12 2011 -0600 @@ -232,6 +232,7 @@ { if ((asmstate.flags & FLAG_DEPEND) && passlist[passnum].fordep == 0) continue; + asmstate.passno = passnum; debug_message(&asmstate, 50, "Doing pass %d (%s)\n", passnum, passlist[passnum].passname); (passlist[passnum].fn)(&asmstate); debug_message(&asmstate, 50, "After pass %d (%s)\n", passnum, passlist[passnum].passname);