diff options
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/codegen_decl.c | 6 | ||||
| -rw-r--r-- | src/codegen/codegen_stmt.c | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/codegen/codegen_decl.c b/src/codegen/codegen_decl.c index aecf45e..eb53911 100644 --- a/src/codegen/codegen_decl.c +++ b/src/codegen/codegen_decl.c @@ -380,10 +380,14 @@ void emit_struct_defs(ParserContext *ctx, ASTNode *node, FILE *out) { fprintf(out, " __attribute__((packed))"); } - else if (node->strct.align) + if (node->strct.align) { fprintf(out, " __attribute__((aligned(%d)))", node->strct.align); } + if (node->strct.is_export) + { + fprintf(out, " __attribute__((visibility(\"default\")))"); + } fprintf(out, ";\n\n"); } else if (node->type == NODE_ENUM) diff --git a/src/codegen/codegen_stmt.c b/src/codegen/codegen_stmt.c index 1679d97..c823b13 100644 --- a/src/codegen/codegen_stmt.c +++ b/src/codegen/codegen_stmt.c @@ -653,7 +653,7 @@ void codegen_node_single(ParserContext *ctx, ASTNode *node, FILE *out) int has_attrs = node->func.constructor || node->func.destructor || node->func.noinline || node->func.unused || node->func.weak || node->func.cold || node->func.hot || node->func.noreturn || - node->func.pure || node->func.section; + node->func.pure || node->func.section || node->func.is_export; if (has_attrs) { fprintf(out, "__attribute__(("); @@ -675,6 +675,7 @@ void codegen_node_single(ParserContext *ctx, ASTNode *node, FILE *out) EMIT_ATTR(node->func.hot, "hot"); EMIT_ATTR(node->func.noreturn, "noreturn"); EMIT_ATTR(node->func.pure, "pure"); + EMIT_ATTR(node->func.is_export, "visibility(\"default\")"); if (node->func.section) { if (!first) |
