summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJannis Harder <jix@jixco.de>2012-07-27 23:19:53 +0200
committerJannis Harder <jix@jixco.de>2012-08-01 15:32:21 +0200
commitaaea0fc13842636103f6b7a5143d6b287e23faf9 (patch)
tree1eba809ff14c71c10a793d5742ac6bda67746475
parentd36aecd48c10d17c89ffefb6aa22c5cdfa0cd13e (diff)
downloadyasm-aaea0fc13842636103f6b7a5143d6b287e23faf9.tar.gz
Add segments to label addresses
Generate addresses with a segment part for labels inside a section with a defined vseg
-rw-r--r--modules/objfmts/bin/bin-objfmt.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/modules/objfmts/bin/bin-objfmt.c b/modules/objfmts/bin/bin-objfmt.c
index 7748f1e4..5286c7ee 100644
--- a/modules/objfmts/bin/bin-objfmt.c
+++ b/modules/objfmts/bin/bin-objfmt.c
@@ -533,8 +533,20 @@ bin_objfmt_expr_xform(/*@returned@*/ /*@only@*/ yasm_expr *e,
bsd = yasm_section_get_data(sect, &bin_section_data_cb);
assert(bsd != NULL);
yasm_intnum_calc(dist, YASM_EXPR_ADD, bsd->ivstart);
- e->terms[i].type = YASM_EXPR_INT;
- e->terms[i].data.intn = dist;
+ if (bsd->ivseg != NULL) {
+ yasm_expr *sube;
+ yasm_intnum *seg;
+
+ seg = yasm_intnum_copy(bsd->ivseg);
+ sube = yasm_expr_create(YASM_EXPR_SEGOFF,
+ yasm_expr_int(seg),
+ yasm_expr_int(dist), e->line);
+ e->terms[i].type = YASM_EXPR_EXPR;
+ e->terms[i].data.expn = sube;
+ } else {
+ e->terms[i].type = YASM_EXPR_INT;
+ e->terms[i].data.intn = dist;
+ }
}
/* Transform our special symrecs into the appropriate value */