diff options
author | Quentin Carbonneaux <quentin@c9x.me> | 2023-04-02 15:44:28 +0200 |
---|---|---|
committer | Quentin Carbonneaux <quentin@c9x.me> | 2023-04-02 15:48:48 +0200 |
commit | 56f4b5be4cce50048e3f7980c59079de4748c6b9 (patch) | |
tree | e4f5f9571c322cb5ece5baf762d212719cfade9d /amd64 | |
parent | 28d9ca8eae01a44e7f8c398f44f2f0a577c3d336 (diff) | |
download | roux-56f4b5be4cce50048e3f7980c59079de4748c6b9.tar.gz |
amd64_sysv: fix offsets in thread-local Oaddr
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; |