diff options
Diffstat (limited to 'amd64')
-rw-r--r-- | amd64/emit.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/amd64/emit.c b/amd64/emit.c index 7b2681e..46de3d9 100644 --- a/amd64/emit.c +++ b/amd64/emit.c @@ -372,6 +372,7 @@ emitins(Ins i, Fn *fn, FILE *f) int64_t val; int o, t0; Ins ineg; + Con *con; char *sym; switch (i.op) { @@ -498,10 +499,14 @@ emitins(Ins i, Fn *fn, FILE *f) /* derive the symbol address from the TCB * address at offset 0 of %fs */ assert(isreg(i.to)); - sym = str(fn->con[i.arg[0].val].sym.id); - emitf("movq %%fs:0, %=", &i, fn, f); - fprintf(f, "\tleaq %s%s@tpoff(%%%s), %%%s\n", - sym[0] == '"' ? "" : T.assym, sym, + con = &fn->con[i.arg[0].val]; + sym = str(con->sym.id); + emitf("movq %%fs:0, %L=", &i, fn, f); + fprintf(f, "\tleaq %s%s@tpoff", + sym[0] == '"' ? "" : T.assym, sym); + if (con->bits.i) + fprintf(f, "%+"PRId64, con->bits.i); + fprintf(f, "(%%%s), %%%s\n", regtoa(i.to.val, SLong), regtoa(i.to.val, SLong)); break; |