From ac79f8fd02cb365ce0edaf8d5c17d400afd1287a Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Fri, 1 May 2026 19:44:44 +0200 Subject: [PATCH] mcf comments --- amd64/emit.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/amd64/emit.c b/amd64/emit.c index a757b80..e82c0b5 100644 --- a/amd64/emit.c +++ b/amd64/emit.c @@ -544,7 +544,8 @@ emitins(Ins i, E *e) regtoa(i.to.val, SLong)); break; } - if (!T.apple && con->sym.type == SThr) { + switch (con->sym.type) { + case SThr: /* derive the symbol address from the TCB * address at offset 0 of %fs */ emitf("movq %%fs:0, %L=", &i, e); @@ -557,8 +558,7 @@ emitins(Ins i, E *e) regtoa(i.to.val, SLong), regtoa(i.to.val, SLong)); break; - } - if (!T.apple && con->sym.type == SExtThr) { + case SExtThr: /* initial-exec TLS: load offset from * GOT, add to thread-base register */ assert(!con->bits.i); @@ -568,8 +568,7 @@ emitins(Ins i, E *e) sym[0] == '"' ? "" : T.assym, sym, regtoa(i.to.val, SLong)); break; - } - if (con->sym.type == SExt) { + case SExt: /* load address from the GOT */ assert(!con->bits.i); fprintf(e->f, @@ -577,8 +576,10 @@ emitins(Ins i, E *e) sym[0] == '"' ? "" : T.assym, sym, regtoa(i.to.val, SLong)); break; + default: + goto Table; } - goto Table; + break; case Ocall: /* calls simply have a weird syntax in AT&T * assembly... */