diff options
author | Ian Lance Taylor <iant@google.com> | 2012-11-29 18:11:17 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-11-29 18:11:17 +0000 |
commit | 744c3195ef778200a0acfc4779e3f2d48237bbf1 (patch) | |
tree | d146677ebcdb05c9d7a8c8b84cab5fb7fa9a0f99 /gcc/go/go-gcc.cc | |
parent | 53750ab003876bae145f36431392e2531e70e7cc (diff) | |
download | gcc-744c3195ef778200a0acfc4779e3f2d48237bbf1.zip gcc-744c3195ef778200a0acfc4779e3f2d48237bbf1.tar.gz gcc-744c3195ef778200a0acfc4779e3f2d48237bbf1.tar.bz2 |
compiler, runtime: Track fields with tag go:"track".
* go-gcc.cc: Include "output.h".
(global_variable): Add is_unique_section parameter.
(global_variable_set_init): Adjust unique section if necessary.
* Make-lang.in (go/go-gcc.o): Add dependency on output.h.
From-SVN: r193945
Diffstat (limited to 'gcc/go/go-gcc.cc')
-rw-r--r-- | gcc/go/go-gcc.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index 84bc972..f8bbaf4 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -28,6 +28,7 @@ #include "tree-iterator.h" #include "gimple.h" #include "toplev.h" +#include "output.h" #include "go-c.h" @@ -267,6 +268,7 @@ class Gcc_backend : public Backend Btype* btype, bool is_external, bool is_hidden, + bool in_unique_section, Location location); void @@ -1277,6 +1279,7 @@ Gcc_backend::global_variable(const std::string& package_name, Btype* btype, bool is_external, bool is_hidden, + bool in_unique_section, Location location) { tree type_tree = btype->get_tree(); @@ -1308,6 +1311,9 @@ Gcc_backend::global_variable(const std::string& package_name, } TREE_USED(decl) = 1; + if (in_unique_section) + resolve_unique_section (decl, 0, 1); + go_preserve_from_gc(decl); return new Bvariable(decl); @@ -1326,6 +1332,16 @@ Gcc_backend::global_variable_set_init(Bvariable* var, Bexpression* expr) if (var_decl == error_mark_node) return; DECL_INITIAL(var_decl) = expr_tree; + + // If this variable goes in a unique section, it may need to go into + // a different one now that DECL_INITIAL is set. + if (DECL_HAS_IMPLICIT_SECTION_NAME_P (var_decl)) + { + DECL_SECTION_NAME (var_decl) = NULL_TREE; + resolve_unique_section (var_decl, + compute_reloc_for_constant (expr_tree), + 1); + } } // Make a local variable. |