File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -138,10 +138,19 @@ class CompileItem : public HIRCompileBase
138
138
// convert to the actual function type
139
139
auto compiled_fn_type = TyTyCompile::compile (ctx->get_backend (), fnType);
140
140
141
+ unsigned int flags = 0 ;
142
+ bool is_main_fn = function.function_name .compare (" main" ) == 0 ;
143
+
144
+ // if its the main fn or pub visibility mark its as DECL_PUBLIC
145
+ // please see https://github.com/Rust-GCC/gccrs/pull/137
146
+ if (is_main_fn || function.has_visibility ())
147
+ flags |= Backend::function_is_visible;
148
+
149
+ // FIXME need name mangling
150
+ std::string asm_name = function.function_name ;
141
151
Bfunction *fndecl
142
152
= ctx->get_backend ()->function (compiled_fn_type, function.function_name ,
143
- " " /* asm_name */ , 0 /* flags */ ,
144
- function.get_locus ());
153
+ asm_name, flags, function.get_locus ());
145
154
ctx->insert_function_decl (function.get_mappings ().get_hirid (), fndecl);
146
155
147
156
// setup the params
You can’t perform that action at this time.
0 commit comments