go-gcc.cc (immutable_struct_set_init): Always call resolve_unique_section.
authorIan Lance Taylor <iant@google.com>
Fri, 2 Aug 2013 18:24:19 +0000 (18:24 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Fri, 2 Aug 2013 18:24:19 +0000 (18:24 +0000)
* go-gcc.cc (immutable_struct_set_init): Always call
resolve_unique_section.

From-SVN: r201446

gcc/go/ChangeLog
gcc/go/go-gcc.cc

index db9d4443ac9a07986eb8df477acf7dc7780659ff..f0317c4a473229485ad95a73c3b619a1404b8007 100644 (file)
@@ -1,3 +1,8 @@
+2013-08-02  Ian Lance Taylor  <iant@google.com>
+
+       * go-gcc.cc (immutable_struct_set_init): Always call
+       resolve_unique_section.
+
 2013-07-24  Ian Lance Taylor  <iant@google.com>
 
        * go-gcc.cc (Gcc_backend::non_zero_size_type): If a struct has a
index 27c756e5496bc0122c0bdf75db8f2a0649e6691e..50dbb3128f1d6c9f5bb67ce6b84cb116700462cb 100644 (file)
@@ -1521,10 +1521,11 @@ Gcc_backend::immutable_struct_set_init(Bvariable* var, const std::string&,
        TREE_PUBLIC(decl) = 1;
     }
   else
-    {
-      make_decl_one_only(decl, DECL_ASSEMBLER_NAME(decl));
-      resolve_unique_section(decl, 1, 0);
-    }
+    make_decl_one_only(decl, DECL_ASSEMBLER_NAME(decl));
+
+  // These variables are often unneeded in the final program, so put
+  // them in their own section so that linker GC can discard them.
+  resolve_unique_section(decl, 1, 1);
 
   rest_of_decl_compilation(decl, 1, 0);
 }