Fix #77 by performing symrec-symrec -> subst placeholder transformation

recursively in yasm_expr__bc_dist_subst(); before this we would only do
one level, which fails on simple structures like the old NASM align approach
of "($$-$) & value" (as the $$-$ is one level down in the expression).

svn path=/trunk/yasm/; revision=1635
0.6.0
Peter Johnson 18 years ago
parent 3e8d2c2e7a
commit 9b2aaa97bd
  1. 9
      libyasm/expr.c
  2. 2
      libyasm/tests/Makefile.inc
  3. 3
      libyasm/tests/opt-oldalign.asm
  4. 35
      libyasm/tests/opt-oldalign.hex

@ -339,6 +339,12 @@ expr_bc_dist_subst_cb(yasm_expr__item *ei, yasm_bytecode *precbc,
return 1;
}
static yasm_expr *
expr_xform_bc_dist_subst(yasm_expr *e, void *d)
{
return expr_xform_bc_dist_base(e, d, expr_bc_dist_subst_cb);
}
int
yasm_expr__bc_dist_subst(yasm_expr **ep, void *cbd,
void (*callback) (unsigned int subst,
@ -350,7 +356,8 @@ yasm_expr__bc_dist_subst(yasm_expr **ep, void *cbd,
my_cbd.callback = callback;
my_cbd.cbd = cbd;
my_cbd.subst = 0;
*ep = expr_xform_bc_dist_base(*ep, &my_cbd, expr_bc_dist_subst_cb);
*ep = yasm_expr__level_tree(*ep, 1, 1, 1, 0, &expr_xform_bc_dist_subst,
&my_cbd, NULL);
return my_cbd.subst;
}

@ -45,6 +45,8 @@ EXTRA_DIST += libyasm/tests/opt-immexpand.asm
EXTRA_DIST += libyasm/tests/opt-immexpand.hex
EXTRA_DIST += libyasm/tests/opt-immnoexpand.asm
EXTRA_DIST += libyasm/tests/opt-immnoexpand.hex
EXTRA_DIST += libyasm/tests/opt-oldalign.asm
EXTRA_DIST += libyasm/tests/opt-oldalign.hex
EXTRA_DIST += libyasm/tests/opt-struc.asm
EXTRA_DIST += libyasm/tests/opt-struc.hex
EXTRA_DIST += libyasm/tests/timesover-err.asm

@ -0,0 +1,3 @@
mov ax, 5
times ($$-$) & 1Fh nop ; Long word alignment
mov bx, 5

@ -0,0 +1,35 @@
b8
05
00
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
bb
05
00
Loading…
Cancel
Save