This commit is contained in:
@@ -15359,6 +15359,25 @@ emit_lets(Cg *c, FILE *out, Node *file)
|
||||
Node *r = d->rhs;
|
||||
while (r != NULL && r->kind == N_CAST) r = r->lhs;
|
||||
if (r == NULL) continue;
|
||||
/* #119: a scalar `&fn` global — 8B zero ptr
|
||||
* placeholder + the &fn->DATAR reloc (the #117
|
||||
* helper at its second consumer). Pre-#119 this
|
||||
* fell through fold_int_literal -> continue -> no
|
||||
* DATA -> undefined ref / garbage deref. */
|
||||
{
|
||||
const char *fsym = node_fnptr_sym(c, r);
|
||||
if (fsym != NULL) {
|
||||
const char *sym = mod_mangle_value(c,
|
||||
d->str, d->module);
|
||||
fprintf(out, "DATAW %s(SB),\"", sym);
|
||||
for (int i = 0; i < 8; i++)
|
||||
emit_data_byte(out, 0);
|
||||
fputs("\"\n", out);
|
||||
fprintf(out, "DATAR %s+0(SB),%s(SB)\n",
|
||||
sym, fsym);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/* Same helper as emit_defs (#24): widens
|
||||
* the gate to cover N_UN(TK_MINUS/TILDE/PLUS,
|
||||
* leaf) so `let x: i8 = -1i8;` and friends
|
||||
|
||||
Reference in New Issue
Block a user