apple tls is global

This commit is contained in:
Quentin Carbonneaux 2026-04-28 16:11:47 +02:00
parent 5ac78c67c9
commit a9796317aa
4 changed files with 7 additions and 6 deletions

View File

@ -549,7 +549,7 @@ emitins(Ins i, E *e)
regtoa(i.to.val, SLong));
break;
}
if (T.apple && con->sym.type == SThr) {
if (T.apple && (con->sym.type & SThr)) {
fprintf(e->f,
"\tmovq %s%s@TLVP(%%rip), %%%s\n",
sym[0] == '"' ? "" : T.assym, sym,

View File

@ -278,6 +278,10 @@ loadaddr(Con *c, char *rn, E *e)
s = "\tadrp\tR, SO\n"
"\tadd\tR, R, #:lo12:SO\n";
break;
case SExtThr:
if (!T.apple)
die("extern thread unavailable on arm64");
/* fall through */
case SThr:
if (T.apple)
s = "\tadrp\tR, S@tlvppage\n"
@ -295,9 +299,6 @@ loadaddr(Con *c, char *rn, E *e)
s = "\tadrp\tR, :got:SO\n"
"\tldr\tR, [R, #:got_lo12:SO]\n";
break;
case SExtThr:
die("extern thread not yet implemented on arm64");
break;
}
l = str(c->sym.id);

View File

@ -80,7 +80,7 @@ fixarg(Ref *pr, int k, int phi, Fn *fn)
c = &fn->con[r0.val];
if (T.apple
&& c->type == CAddr
&& c->sym.type == SThr) {
&& (c->sym.type & SThr)) {
r1 = newtmp("isel", Kl, fn);
*pr = r1;
if (c->bits.i) {

View File

@ -250,7 +250,7 @@ loadaddr(Con *c, char *rn, FILE *f)
fputc('\n', f);
break;
case SExtThr:
die("extern thread not yet implemented on rv64");
die("extern thread unavailable on rv64");
break;
default:
fprintf(f, "\tla %s, ", rn);