diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-08-24 22:55:19 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-08-24 22:55:19 +0900 |
| commit | 917ce0573ea9cc07195cc27a21b5b5374abbf6f2 (patch) | |
| tree | 89edd9d8b521078e6103f66b8451db5aaf71d64a | |
| parent | e96ab5201e14d902ee921393e611434cecc47289 (diff) | |
| download | ducc-917ce0573ea9cc07195cc27a21b5b5374abbf6f2.tar.gz ducc-917ce0573ea9cc07195cc27a21b5b5374abbf6f2.tar.zst ducc-917ce0573ea9cc07195cc27a21b5b5374abbf6f2.zip | |
feat: expose global symbols
| -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; |
