Mercurial > hg-old > index.cgi
diff lwasm/output.c @ 448:5cccf90bf838 3.0 tip
Fixed bug with complex external references generating invalid relocations in the object file
author | lost@l-w.ca |
---|---|
date | Fri, 05 Nov 2010 22:27:00 -0600 |
parents | 35a0b086bf4a |
children |
line wrap: on
line diff
--- a/lwasm/output.c Thu Nov 04 23:25:18 2010 -0600 +++ b/lwasm/output.c Fri Nov 05 22:27:00 2010 -0600 @@ -235,6 +235,7 @@ { int tt; int v; + int count = 1; unsigned char buf[16]; tt = lw_expr_type(e); @@ -243,10 +244,12 @@ { case lw_expr_type_oper: buf[0] = 0x04; + switch (lw_expr_whichop(e)) { case lw_expr_oper_plus: buf[1] = 0x01; + count = lw_expr_operandcount(e) - 1; break; case lw_expr_oper_minus: @@ -255,6 +258,7 @@ case lw_expr_oper_times: buf[1] = 0x03; + count = lw_expr_operandcount(e) - 1; break; case lw_expr_oper_divide: @@ -300,7 +304,8 @@ default: buf[1] = 0xff; } - writebytes(buf, 2, 1, of); + while (count--) + writebytes(buf, 2, 1, of); return 0; case lw_expr_type_int: