qbe

Internal scc patchset buffer for QBE
Log | Files | Refs | README | LICENSE

commit 56f4b5be4cce50048e3f7980c59079de4748c6b9
parent 28d9ca8eae01a44e7f8c398f44f2f0a577c3d336
Author: Quentin Carbonneaux <quentin@c9x.me>
Date:   Sun,  2 Apr 2023 15:44:28 +0200

amd64_sysv: fix offsets in thread-local Oaddr

Diffstat:
Mamd64/emit.c | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git 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;