Allow exporting global external variables

This commit is contained in:
2025-08-24 16:54:48 +02:00
parent fd3729ba16
commit c95466622a
7 changed files with 56 additions and 52 deletions

View File

@@ -295,10 +295,6 @@ namespace elna::gcc
{
constant->accept(this);
}
for (boot::type_declaration *const type : unit->types)
{
type->accept(this);
}
for (boot::variable_declaration *const variable : unit->variables)
{
variable->accept(this);
@@ -312,13 +308,11 @@ namespace elna::gcc
void generic_visitor::visit(boot::procedure_declaration *definition)
{
tree fndecl = this->symbols->lookup(definition->identifier.name);
TREE_PUBLIC(fndecl) = definition->identifier.exported;
if (!definition->body.has_value())
{
return;
}
push_struct_function(fndecl, false);
DECL_STRUCT_FUNCTION(fndecl)->language = ggc_cleared_alloc<language_function>();
@@ -738,11 +732,6 @@ namespace elna::gcc
this->current_expression = NULL_TREE;
}
void generic_visitor::visit(boot::type_declaration *declaration)
{
TREE_PUBLIC(this->symbols->lookup(declaration->identifier.name)) = declaration->identifier.exported;
}
void generic_visitor::visit(boot::variable_declaration *declaration)
{
for (const auto& variable_identifier : declaration->identifiers)
@@ -775,12 +764,11 @@ namespace elna::gcc
{
DECL_INITIAL(declaration_tree) = elna_pointer_nil_node;
}
TREE_PUBLIC(declaration_tree) = variable_identifier.exported;
this->current_expression = NULL_TREE;
if (lang_hooks.decls.global_bindings_p())
{
TREE_STATIC(declaration_tree) = 1;
TREE_STATIC(declaration_tree) = !variable_identifier.exported && !declaration->is_extern;
varpool_node::get_create(declaration_tree);
varpool_node::finalize_decl(declaration_tree);
}