From 2ca6fb25a238842418019a3f9ee8d1beb1327f7e Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Mon, 31 Jan 2022 22:03:18 +0100 Subject: shared linkage logic for func/data --- amd64/emit.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'amd64') diff --git a/amd64/emit.c b/amd64/emit.c index 4cb340d..b8e9e8e 100644 --- a/amd64/emit.c +++ b/amd64/emit.c @@ -548,18 +548,9 @@ amd64_emitfn(Fn *fn, FILE *f) Ins *i, itmp; int *r, c, o, n, lbl; uint64_t fs; - char *p; - p = fn->name[0] == '"' ? "" : gassym; - fprintf(f, ".text\n"); - if (fn->export) - fprintf(f, ".globl %s%s\n", p, fn->name); - fprintf(f, - "%s%s:\n" - "\tpushq %%rbp\n" - "\tmovq %%rsp, %%rbp\n", - p, fn->name - ); + gasemitlnk(fn->name, &fn->lnk, ".text", f); + fputs("\tpushq %rbp\n\tmovq %rsp, %rbp\n", f); fs = framesz(fn); if (fs) fprintf(f, "\tsubq $%"PRIu64", %%rsp\n", fs); -- cgit 1.4.1