Commit 2ec974d9 by Ian Lance Taylor Committed by Ian Lance Taylor

go-gcc.cc (Gcc_backend::immutable_struct): Set TREE_PUBLIC if the struct is not hidden.

	* go-gcc.cc (Gcc_backend::immutable_struct): Set TREE_PUBLIC if
	the struct is not hidden.
	(Gcc_backend::immutable_struct_set_init): Don't set TREE_PUBLIC.

From-SVN: r202065
parent 652974f2
2013-08-28 Ian Lance Taylor <iant@google.com>
* go-gcc.cc (Gcc_backend::immutable_struct): Set TREE_PUBLIC if
the struct is not hidden.
(Gcc_backend::immutable_struct_set_init): Don't set TREE_PUBLIC.
2013-08-06 Ian Lance Taylor <iant@google.com> 2013-08-06 Ian Lance Taylor <iant@google.com>
* go-gcc.cc (Gcc_backend::immutable_struct_set_init): Use * go-gcc.cc (Gcc_backend::immutable_struct_set_init): Use
......
...@@ -1475,8 +1475,8 @@ Gcc_backend::temporary_variable(Bfunction* function, Bblock* bblock, ...@@ -1475,8 +1475,8 @@ Gcc_backend::temporary_variable(Bfunction* function, Bblock* bblock,
// Create a named immutable initialized data structure. // Create a named immutable initialized data structure.
Bvariable* Bvariable*
Gcc_backend::immutable_struct(const std::string& name, bool, bool, Gcc_backend::immutable_struct(const std::string& name, bool is_hidden,
Btype* btype, Location location) bool, Btype* btype, Location location)
{ {
tree type_tree = btype->get_tree(); tree type_tree = btype->get_tree();
if (type_tree == error_mark_node) if (type_tree == error_mark_node)
...@@ -1490,6 +1490,8 @@ Gcc_backend::immutable_struct(const std::string& name, bool, bool, ...@@ -1490,6 +1490,8 @@ Gcc_backend::immutable_struct(const std::string& name, bool, bool,
TREE_CONSTANT(decl) = 1; TREE_CONSTANT(decl) = 1;
TREE_USED(decl) = 1; TREE_USED(decl) = 1;
DECL_ARTIFICIAL(decl) = 1; DECL_ARTIFICIAL(decl) = 1;
if (!is_hidden)
TREE_PUBLIC(decl) = 1;
// We don't call rest_of_decl_compilation until we have the // We don't call rest_of_decl_compilation until we have the
// initializer. // initializer.
...@@ -1503,8 +1505,7 @@ Gcc_backend::immutable_struct(const std::string& name, bool, bool, ...@@ -1503,8 +1505,7 @@ Gcc_backend::immutable_struct(const std::string& name, bool, bool,
void void
Gcc_backend::immutable_struct_set_init(Bvariable* var, const std::string&, Gcc_backend::immutable_struct_set_init(Bvariable* var, const std::string&,
bool is_hidden, bool is_common, Btype*, bool, bool is_common, Btype*, Location,
Location,
Bexpression* initializer) Bexpression* initializer)
{ {
tree decl = var->get_tree(); tree decl = var->get_tree();
...@@ -1515,12 +1516,7 @@ Gcc_backend::immutable_struct_set_init(Bvariable* var, const std::string&, ...@@ -1515,12 +1516,7 @@ Gcc_backend::immutable_struct_set_init(Bvariable* var, const std::string&,
DECL_INITIAL(decl) = init_tree; DECL_INITIAL(decl) = init_tree;
// We can't call make_decl_one_only until we set DECL_INITIAL. // We can't call make_decl_one_only until we set DECL_INITIAL.
if (!is_common) if (is_common)
{
if (!is_hidden)
TREE_PUBLIC(decl) = 1;
}
else
make_decl_one_only(decl, DECL_ASSEMBLER_NAME(decl)); make_decl_one_only(decl, DECL_ASSEMBLER_NAME(decl));
// These variables are often unneeded in the final program, so put // These variables are often unneeded in the final program, so put
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment