diff options
| -rw-r--r-- | src/codegen.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/codegen.c b/src/codegen.c index b0306d6..b24fe38 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -541,6 +541,8 @@ void codegen_stmt(CodeGen* g, AstNode* ast) { void codegen_func(CodeGen* g, AstNode* ast) { g->current_func = ast; + + fprintf(g->out, ".globl %s\n", ast->name); fprintf(g->out, "%s:\n", ast->name); codegen_func_prologue(g, ast); @@ -587,8 +589,6 @@ void codegen(Program* prog, FILE* out) { } } - fprintf(g->out, ".globl main\n\n"); - fprintf(g->out, ".text\n\n"); for (int i = 0; i < prog->funcs->node_len; ++i) { AstNode* func = prog->funcs->node_items + i; |
