diff lwasm/lwasm.c @ 376:91c0fe026940

Output incomplete references in object target
author lost@starbug
date Mon, 26 Apr 2010 17:59:30 -0600
parents 3498b2d88376
children 1624a36f12a3
line wrap: on
line diff
--- a/lwasm/lwasm.c	Mon Apr 26 17:14:04 2010 -0600
+++ b/lwasm/lwasm.c	Mon Apr 26 17:59:30 2010 -0600
@@ -629,13 +629,16 @@
 		if (l -> as -> output_format == OUTPUT_OBJ)
 		{
 			reloctab_t *re;
+			lw_expr_t te;
 			
 			// add "expression" record to section table
-			v = lw_expr_intval(l -> addr) + l -> outputl;
 			re = lw_alloc(sizeof(reloctab_t));
 			re -> next = l -> csect -> reloctab;
 			l -> csect -> reloctab = re;
-			re -> offset = v;
+			te = lw_expr_build(lw_expr_type_int, l -> outputl);
+			re -> offset = lw_expr_build(lw_expr_type_oper, lw_expr_oper_plus, l -> addr, te);
+			lw_expr_destroy(te);
+			lwasm_reduce_expr(l -> as, re -> offset);
 			re -> size = size;
 			re -> expr = lw_expr_copy(expr);