]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
symtab.c (dump_symtab_base): Update dumping.
authorJan Hubicka <hubicka@ucw.cz>
Mon, 9 Jun 2014 02:30:30 +0000 (04:30 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 9 Jun 2014 02:30:30 +0000 (02:30 +0000)
* symtab.c (dump_symtab_base): Update dumping.
(symtab_make_decl_local): Clear only DECL_COMDAT.
* tree-vect-data-refs.c (Check that variable is static before
tampering with sections.
* cgraphclones.c (duplicate_thunk_for_node): Do not clear section name.
(cgraph_create_virtual_clone): Likewise.
* tree.c (decl_comdat_group, decl_comdat_group_id): Constify argument.
(decl_section_name, set_decl_section_name): New accessors.
(find_decls_types_r): Do not walk section name
* tree.h (DECL_SECTION_NAME): Implement using
decl_section_name.
(decl_comdat_group, decl_comdat_group_id): Constify.
(decl_section_name, set_decl_section_name): Update.
* varpool.c (varpool_finalize_named_section_flags): Use
get_section.
* cgraph.c (cgraph_add_thunk): Reset node instead of rebuilding.
(cgraph_make_node_local_1): Clear section and comdat group.
* cgraph.h (set_comdat_group): Sanity check.
(get_section, set_section): New.
* ipa-comdats.c (ipa_comdats): Use get_section.
* ipa.c (ipa_discover_readonly_nonaddressable_var): Likewise.
* lto-streamer-out.c: Do not follow section names.
* c-family/c-common.c (handle_section_attribute):
Update.
* lto-cgraph.c (lto_output_node): Output section.
(lto_output_varpool_node): Likewise.
(read_comdat_group): Rename to ...
(read_identifier): ... this one.
(read_string_cst): New function.
(input_node, input_varpool_node): Input section names.
* tree-emutls.c (get_emutls_init_templ_addr): Update.
(new_emutls_decl): Update.
(secname_for_decl): Check section names only of static
vars.
* config/mep/mep.c (mep_unique_section): Use set_decl_section_name.
* config/i386/winnt.c (i386_pe_unique_section): Likewise.
* config/i386/i386.c (x86_64_elf_unique_section): Likewise.
* config/c6x/c6x.c (c6x_elf_unique_section): Likewise.
* config/rs6000/rs6000.c (rs6000_xcoff_unique_section): Likewise.
* config/mcore/mcore.c (mcore_unique_section): Likewise.
* config/mips/mips.c (mips16_build_function_stub): Likewise.
* config/v850/v850.c (v850_insert_attributes): Likewise.
* config/h8300/h8300.c: (h8300_handle_eightbit_data_attribute):
Likewise.
(h8300_handle_tiny_data_attribute): Likewise.
* config/bfin/bfin.c (bfin_handle_l1_text_attribute): Likewise.
(bfin_handle_l2_attribute): Likewise.
* tree-streamer-in.c (lto_input_ts_decl_with_vis_tree_pointers): Do not read section name.

* lto.c (mentions_vars_p_decl_with_vis, compare_tree_sccs_1,
lto_fixup_prevailing_decls): Skip section names.

* go-gcc.cc (global_variable_set_init): Use
set_decl_section_name.

* gcc-interface/utils.c (process_attributes): Use it.

* c-decl.c (merge_decls): Use set_decl_section_name.
(duplicate_decls): Remove node if it exists.

* class.c (build_utf8_ref): Use set_decl_section_name.
(emit_register_classes_in_jcr_section): Likewise.
(emit_register_classes_in_jcr_section): Likewise.

* method.c (use_thunk): Use set_decl_section_name.
* optimize.c (maybe_clone_body): Use set_decl_section_name.
* decl.c (duplicate_decls): Likewise.
* vtable-class-hierarchy.c: Likewise.

From-SVN: r211363

45 files changed:
gcc/ChangeLog
gcc/ada/ChangeLog
gcc/ada/gcc-interface/utils.c
gcc/c-family/c-common.c
gcc/c/ChangeLog
gcc/c/c-decl.c
gcc/cgraph.c
gcc/cgraph.h
gcc/cgraphclones.c
gcc/config/bfin/bfin.c
gcc/config/c6x/c6x.c
gcc/config/h8300/h8300.c
gcc/config/i386/i386.c
gcc/config/i386/winnt.c
gcc/config/mcore/mcore.c
gcc/config/mep/mep.c
gcc/config/mips/mips.c
gcc/config/rs6000/rs6000.c
gcc/config/v850/v850.c
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/method.c
gcc/cp/optimize.c
gcc/cp/vtable-class-hierarchy.c
gcc/dwarf2out.c
gcc/go/ChangeLog
gcc/go/go-gcc.cc
gcc/ipa-comdats.c
gcc/ipa-visibility.c
gcc/ipa.c
gcc/java/ChangeLog
gcc/java/class.c
gcc/lto-cgraph.c
gcc/lto-streamer-out.c
gcc/lto/ChangeLog
gcc/lto/lto.c
gcc/symtab.c
gcc/tree-emutls.c
gcc/tree-streamer-in.c
gcc/tree-streamer-out.c
gcc/tree-vect-data-refs.c
gcc/tree.c
gcc/tree.h
gcc/varasm.c
gcc/varpool.c

index 6bc4baa0d6e84a669703667499b3b345469f0de9..2e6c5243103af24336b70840ab71d08384f0ec69 100644 (file)
@@ -1,3 +1,53 @@
+2014-06-07  Jan Hubicka  <hubicka@ucw.cz>
+
+       * symtab.c (dump_symtab_base): Update dumping.
+       (symtab_make_decl_local): Clear only DECL_COMDAT.
+       * tree-vect-data-refs.c (Check that variable is static before
+       tampering with sections.
+       * cgraphclones.c (duplicate_thunk_for_node): Do not clear section name.
+       (cgraph_create_virtual_clone): Likewise.
+       * tree.c (decl_comdat_group, decl_comdat_group_id): Constify argument.
+       (decl_section_name, set_decl_section_name): New accessors.
+       (find_decls_types_r): Do not walk section name
+       * tree.h (DECL_SECTION_NAME): Implement using
+       decl_section_name.
+       (decl_comdat_group, decl_comdat_group_id): Constify.
+       (decl_section_name, set_decl_section_name): Update.
+       * varpool.c (varpool_finalize_named_section_flags): Use
+       get_section.
+       * cgraph.c (cgraph_add_thunk): Reset node instead of rebuilding.
+       (cgraph_make_node_local_1): Clear section and comdat group.
+       * cgraph.h (set_comdat_group): Sanity check.
+       (get_section, set_section): New.
+       * ipa-comdats.c (ipa_comdats): Use get_section.
+       * ipa.c (ipa_discover_readonly_nonaddressable_var): Likewise.
+       * lto-streamer-out.c: Do not follow section names.
+       * c-family/c-common.c (handle_section_attribute):
+       Update.
+       * lto-cgraph.c (lto_output_node): Output section.
+       (lto_output_varpool_node): Likewise.
+       (read_comdat_group): Rename to ...
+       (read_identifier): ... this one.
+       (read_string_cst): New function.
+       (input_node, input_varpool_node): Input section names.
+       * tree-emutls.c (get_emutls_init_templ_addr): Update.
+       (new_emutls_decl): Update.
+       (secname_for_decl): Check section names only of static
+       vars.
+       * config/mep/mep.c (mep_unique_section): Use set_decl_section_name.
+       * config/i386/winnt.c (i386_pe_unique_section): Likewise.
+       * config/i386/i386.c (x86_64_elf_unique_section): Likewise.
+       * config/c6x/c6x.c (c6x_elf_unique_section): Likewise.
+       * config/rs6000/rs6000.c (rs6000_xcoff_unique_section): Likewise.
+       * config/mcore/mcore.c (mcore_unique_section): Likewise.
+       * config/mips/mips.c (mips16_build_function_stub): Likewise.
+       * config/v850/v850.c (v850_insert_attributes): Likewise.
+       * config/h8300/h8300.c: (h8300_handle_eightbit_data_attribute):
+       Likewise.
+       (h8300_handle_tiny_data_attribute): Likewise.
+       * config/bfin/bfin.c (bfin_handle_l1_text_attribute): Likewise.
+       (bfin_handle_l2_attribute): Likewise.
+
 2014-06-07  Jan Hubicka  <hubicka@ucw.cz>
 
        * symtab.c (symtab_nonoverwritable_alias): Copy VIRTUAL flag;
index 8ce8b256671205a51e27a55b46ccf472cc4e70b1..ccc2bc2a54fb08467a1b19fdcc66addc3fb6ff9f 100644 (file)
@@ -1,3 +1,7 @@
+2014-06-07  Jan Hubicka  <hubicka@ucw.cz>
+
+       * gcc-interface/utils.c (process_attributes): Use it.
+
 2014-05-22  Thomas Schwinge  <thomas@codesourcery.com>
 
        * gcc-interface/utils.c (DEF_FUNCTION_TYPE_0, DEF_FUNCTION_TYPE_6)
index 56636a62f1cd1b30c842754f52fe4a6c66a8d4fc..71761e3515f2f7055ee573208c045fd77d1a01bf 100644 (file)
@@ -2476,9 +2476,9 @@ process_attributes (tree *node, struct attrib **attr_list, bool in_place,
       case ATTR_LINK_SECTION:
        if (targetm_common.have_named_sections)
          {
-           DECL_SECTION_NAME (*node)
-             = build_string (IDENTIFIER_LENGTH (attr->name),
-                             IDENTIFIER_POINTER (attr->name));
+           set_decl_section_name (*node,
+                                  build_string (IDENTIFIER_LENGTH (attr->name),
+                                                IDENTIFIER_POINTER (attr->name)));
            DECL_COMMON (*node) = 0;
          }
        else
index fb6c61204c3803aef32234c92954f24148e0800c..4f480b04adecf94a479add8949e0c83ee10a0cea 100644 (file)
@@ -7442,7 +7442,7 @@ handle_section_attribute (tree *node, tree ARG_UNUSED (name), tree args,
              *no_add_attrs = true;
            }
          else
-           DECL_SECTION_NAME (decl) = TREE_VALUE (args);
+           set_decl_section_name (decl, TREE_VALUE (args));
        }
       else
        {
index 54d0de7faf519c5eaf3ec0de5490fd2d0bf5f813..47cf3cc309306a250fa05896fd365658da283cc1 100644 (file)
@@ -1,3 +1,8 @@
+2014-06-07  Jan Hubicka  <hubicka@ucw.cz>
+
+       * c-decl.c (merge_decls): Use set_decl_section_name.
+       (duplicate_decls): Remove node if it exists.
+
 2014-06-05  S. Gilles  <sgilles@terpmail.umd.edu>
 
        PR c/53119
index 8fb329691ec96e933de85be24cb02211d570821c..524b0647432e82a13142e08203e4641c519492a8 100644 (file)
@@ -2304,8 +2304,10 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
         We want to issue an error if the sections conflict but that
         must be done later in decl_attributes since we are called
         before attributes are assigned.  */
-      if (DECL_SECTION_NAME (newdecl) == NULL_TREE)
-       DECL_SECTION_NAME (newdecl) = DECL_SECTION_NAME (olddecl);
+      if ((DECL_EXTERNAL (olddecl) || TREE_PUBLIC (olddecl) || TREE_STATIC (olddecl))
+         && DECL_SECTION_NAME (newdecl) == NULL_TREE
+         && DECL_SECTION_NAME (olddecl))
+       set_decl_section_name (newdecl, DECL_SECTION_NAME (olddecl));
 
       /* Copy the assembler name.
         Currently, it can only be defined in the prototype.  */
@@ -2574,6 +2576,13 @@ duplicate_decls (tree newdecl, tree olddecl)
   merge_decls (newdecl, olddecl, newtype, oldtype);
 
   /* The NEWDECL will no longer be needed.  */
+  if (TREE_CODE (newdecl) == FUNCTION_DECL
+      || TREE_CODE (newdecl) == VAR_DECL)
+    {
+      struct symtab_node *snode = symtab_get_node (newdecl);
+      if (snode)
+       symtab_remove_node (snode);
+    }
   ggc_free (newdecl);
   return true;
 }
index fd460aa257fbd606bf8ef232d1b3aa26e3dcd065..c3a3eefe4eca0ca095532ccf65db673e0712849d 100644 (file)
@@ -641,14 +641,9 @@ cgraph_add_thunk (struct cgraph_node *decl_node ATTRIBUTE_UNUSED,
 
   node = cgraph_get_node (alias);
   if (node)
-    {
-      gcc_assert (node->definition);
-      gcc_assert (!node->alias);
-      gcc_assert (!node->thunk.thunk_p);
-      cgraph_remove_node (node);
-    }
-  
-  node = cgraph_create_node (alias);
+    cgraph_reset_node (node);
+  else
+    node = cgraph_create_node (alias);
   gcc_checking_assert (!virtual_offset
                       || wi::eq_p (virtual_offset, virtual_value));
   node->thunk.fixed_offset = fixed_offset;
@@ -2264,6 +2259,8 @@ cgraph_make_node_local_1 (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED)
     {
       symtab_make_decl_local (node->decl);
 
+      node->set_section (NULL);
+      node->set_comdat_group (NULL);
       node->externally_visible = false;
       node->forced_by_abi = false;
       node->local.local = true;
index 9c6f55896b0def9e2ca9dff03c9275ef46d6f164..882f1e81410dd5f637fe0e3c108c6e7f80ed8ad4 100644 (file)
@@ -157,9 +157,24 @@ public:
   /* Set comdat group.  */
   void set_comdat_group (tree group)
     {
+      gcc_checking_assert (!group || TREE_CODE (group) == IDENTIFIER_NODE
+                          || DECL_P (group));
       comdat_group_ = group;
     }
 
+  /* Return section.  */
+  tree get_section ()
+    {
+      return section_;
+    }
+
+  /* Set section.  */
+  void set_section (tree section)
+    {
+      gcc_checking_assert (!section || TREE_CODE (section) == STRING_CST);
+      section_ = section;
+    }
+
   /* Vectors of referring and referenced entities.  */
   struct ipa_ref_list ref_list;
 
@@ -175,6 +190,9 @@ public:
 
   /* Comdat group the symbol is in.  Can be private if GGC allowed that.  */
   tree comdat_group_;
+
+  /* Section name. Again can be private, if allowed.  */
+  tree section_;
 };
 
 enum availability
index 75eba6da59dbb5666b9e4696663c4d8f1c0a666d..6f83d74605877839d98adfae8abd170cae2c7282 100644 (file)
@@ -340,7 +340,6 @@ duplicate_thunk_for_node (cgraph_node *thunk, cgraph_node *node,
 
   DECL_NAME (new_decl) = clone_function_name (thunk->decl, "artificial_thunk");
   SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl));
-  DECL_SECTION_NAME (new_decl) = NULL;
 
   new_thunk = cgraph_create_node (new_decl);
   set_new_clone_decl_and_node_flags (new_thunk);
@@ -557,8 +556,6 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node,
      that is not weak also.
      ??? We cannot use COMDAT linkage because there is no
      ABI support for this.  */
-  if (old_node->get_comdat_group ())
-    DECL_SECTION_NAME (new_node->decl) = NULL;
   set_new_clone_decl_and_node_flags (new_node);
   new_node->clone.tree_map = tree_map;
   new_node->clone.args_to_skip = args_to_skip;
index 35408eb68cf61a60d120ca0a2029ecc1f639f760..3c6ed7b9a11e1f43a030ffbace7fcf999c68dc8a 100644 (file)
@@ -4769,7 +4769,7 @@ bfin_handle_l1_text_attribute (tree *node, tree name, tree ARG_UNUSED (args),
       *no_add_attrs = true;
     }
   else
-    DECL_SECTION_NAME (decl) = build_string (9, ".l1.text");
+    set_decl_section_name (decl, build_string (9, ".l1.text"));
 
   return NULL_TREE;
 }
@@ -4847,7 +4847,7 @@ bfin_handle_l2_attribute (tree *node, tree ARG_UNUSED (name),
          *no_add_attrs = true;
        }
       else
-       DECL_SECTION_NAME (decl) = build_string (9, ".l2.text");
+       set_decl_section_name (decl, build_string (9, ".l2.text"));
     }
   else if (TREE_CODE (decl) == VAR_DECL)
     {
@@ -4860,7 +4860,7 @@ bfin_handle_l2_attribute (tree *node, tree ARG_UNUSED (name),
          *no_add_attrs = true;
        }
       else
-       DECL_SECTION_NAME (decl) = build_string (9, ".l2.data");
+       set_decl_section_name (decl, build_string (9, ".l2.data"));
     }
 
   return NULL_TREE;
index f0d8cbb42fdd1612a1ca01888af4861af2da24fc..90a37481290e02f11aa2e2d87ae20e8c368256fb 100644 (file)
@@ -1060,7 +1060,7 @@ c6x_elf_unique_section (tree decl, int reloc)
 
       string = ACONCAT ((linkonce, prefix, ".", name, NULL));
 
-      DECL_SECTION_NAME (decl) = build_string (strlen (string), string);
+      set_decl_section_name (decl, build_string (strlen (string), string));
       return;
     }
   default_unique_section (decl, reloc);
index a0ff81b20b193ef4c3465d63d8915be97031b273..3c90340aaed644de10cee5048b342656ead5abfe 100644 (file)
@@ -5461,7 +5461,7 @@ h8300_handle_eightbit_data_attribute (tree *node, tree name,
 
   if (TREE_STATIC (decl) || DECL_EXTERNAL (decl))
     {
-      DECL_SECTION_NAME (decl) = build_string (7, ".eight");
+      set_decl_section_name (decl, build_string (7, ".eight"));
     }
   else
     {
@@ -5485,7 +5485,7 @@ h8300_handle_tiny_data_attribute (tree *node, tree name,
 
   if (TREE_STATIC (decl) || DECL_EXTERNAL (decl))
     {
-      DECL_SECTION_NAME (decl) = build_string (6, ".tiny");
+      set_decl_section_name (decl, build_string (6, ".tiny"));
     }
   else
     {
index 9105132cf1a2be155d7b6cd5cc5d216615dece64..2b5fbf7efbf30194504253e795bd30461cb9e025 100644 (file)
@@ -5193,7 +5193,7 @@ x86_64_elf_unique_section (tree decl, int reloc)
 
          string = ACONCAT ((linkonce, prefix, ".", name, NULL));
 
-         DECL_SECTION_NAME (decl) = build_string (strlen (string), string);
+         set_decl_section_name (decl, build_string (strlen (string), string));
          return;
        }
     }
index de607179715e84b46f8b1157dbb5c68469143e66..ee22375c227fe41c7ebf5c16545e2c1dfc9d1859 100644 (file)
@@ -438,7 +438,7 @@ i386_pe_unique_section (tree decl, int reloc)
   string = XALLOCAVEC (char, len + 1);
   sprintf (string, "%s%s", prefix, name);
 
-  DECL_SECTION_NAME (decl) = build_string (len, string);
+  set_decl_section_name (decl, build_string (len, string));
 }
 
 /* Local and global relocs can be placed always into readonly memory for
index 717591e43246c200bf3a9062d2fb1bd0f02f2272..f9af66b5b59cef1d0275030505caf6be5f9de45d 100644 (file)
@@ -3089,7 +3089,7 @@ mcore_unique_section (tree decl, int reloc ATTRIBUTE_UNUSED)
   
   sprintf (string, "%s%s", prefix, name);
 
-  DECL_SECTION_NAME (decl) = build_string (len, string);
+  set_decl_section_name (decl, build_string (len, string));
 }
 
 int
index 558883c47c3bb5e5c484f12b7f3d369d5ac042b4..2f2d0faee272f05a43e079677ce93c71deed6a12 100644 (file)
@@ -4658,7 +4658,7 @@ mep_unique_section (tree decl, int reloc)
 
   sprintf (string, "%s%s", prefix, name);
 
-  DECL_SECTION_NAME (decl) = build_string (len, string);
+  set_decl_section_name (decl, build_string (len, string));
 }
 
 /* Given a decl, a section name, and whether the decl initializer
index 71fc802ea86f777b226a92502b38c5c26bc1678b..73b6963ba659f546aed16e081be8842a0f7520e4 100644 (file)
@@ -6618,7 +6618,7 @@ mips16_build_function_stub (void)
   stubdecl = build_decl (BUILTINS_LOCATION,
                         FUNCTION_DECL, get_identifier (stubname),
                         build_function_type_list (void_type_node, NULL_TREE));
-  DECL_SECTION_NAME (stubdecl) = build_string (strlen (secname), secname);
+  set_decl_section_name (stubdecl, build_string (strlen (secname), secname));
   DECL_RESULT (stubdecl) = build_decl (BUILTINS_LOCATION,
                                       RESULT_DECL, NULL_TREE, void_type_node);
 
@@ -6872,7 +6872,7 @@ mips16_build_call_stub (rtx retval, rtx *fn_ptr, rtx args_size, int fp_code)
                             FUNCTION_DECL, stubid,
                             build_function_type_list (void_type_node,
                                                       NULL_TREE));
-      DECL_SECTION_NAME (stubdecl) = build_string (strlen (secname), secname);
+      set_decl_section_name (stubdecl, build_string (strlen (secname), secname));
       DECL_RESULT (stubdecl) = build_decl (BUILTINS_LOCATION,
                                           RESULT_DECL, NULL_TREE,
                                           void_type_node);
index e264e94008bd897706129c0b1bfa4b92d5b5213c..3e3a48784284618392d066f80266c61936e2f925 100644 (file)
@@ -29342,7 +29342,7 @@ rs6000_xcoff_unique_section (tree decl, int reloc ATTRIBUTE_UNUSED)
 
   name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
   name = (*targetm.strip_name_encoding) (name);
-  DECL_SECTION_NAME (decl) = build_string (strlen (name), name);
+  set_decl_section_name (decl, build_string (strlen (name), name));
 }
 
 /* Select section for constant in constant pool.
index e164586bfdcde309bc5efd0687d8fd14506409dd..070a5cbd7d16ee629c4858e3ea9f5cb865db23e0 100644 (file)
@@ -2644,7 +2644,7 @@ v850_insert_attributes (tree decl, tree * attr_ptr ATTRIBUTE_UNUSED )
          /* Only set the section name if specified by a pragma, because
             otherwise it will force those variables to get allocated storage
             in this module, rather than by the linker.  */
-         DECL_SECTION_NAME (decl) = chosen_section;
+         set_decl_section_name (decl, chosen_section);
        }
     }
 }
index 54c7948bb8805920ba274183b6c5da8ad274e7b3..38a348cb9976b0076ac475a37b030275435dd445 100644 (file)
@@ -1,3 +1,10 @@
+2014-06-07  Jan Hubicka  <hubicka@ucw.cz>
+
+       * method.c (use_thunk): Use set_decl_section_name.
+       * optimize.c (maybe_clone_body): Use set_decl_section_name.
+       * decl.c (duplicate_decls): Likewise.
+       * vtable-class-hierarchy.c: Likewise.
+
 2014-06-06  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/60184
index b4d26b7af512632277d29ea0f58a33d19be252fb..13b5d0b34311ddb4555179835ccaa3e9df6751dc 100644 (file)
@@ -2019,8 +2019,10 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
         We want to issue an error if the sections conflict but that must be
         done later in decl_attributes since we are called before attributes
         are assigned.  */
-      if (DECL_SECTION_NAME (newdecl) == NULL_TREE)
-       DECL_SECTION_NAME (newdecl) = DECL_SECTION_NAME (olddecl);
+      if ((DECL_EXTERNAL (olddecl) || TREE_PUBLIC (olddecl) || TREE_STATIC (olddecl))
+         && DECL_SECTION_NAME (newdecl) == NULL_TREE
+         && DECL_SECTION_NAME (olddecl) != NULL_TREE)
+       set_decl_section_name (newdecl, DECL_SECTION_NAME (olddecl));
 
       if (TREE_CODE (newdecl) == FUNCTION_DECL)
        {
index f8fc01ff531e129d0d886b5ed90e80661e8028f3..0ae190ab52d8b6aa87bcf3b42c6b0bb716ad4211 100644 (file)
@@ -363,7 +363,7 @@ use_thunk (tree thunk_fndecl, bool emit_p)
          resolve_unique_section (thunk_fndecl, 0, flag_function_sections);
 
          /* Output the thunk into the same section as function.  */
-         DECL_SECTION_NAME (thunk_fndecl) = DECL_SECTION_NAME (function);
+         set_decl_section_name (thunk_fndecl, DECL_SECTION_NAME (function));
        }
     }
 
index 3f89b8197a2892e11baee617cf4980c115afeaa3..ffa5258cba6cc1caed637df196d37ec9e6284c16 100644 (file)
@@ -476,7 +476,6 @@ maybe_clone_body (tree fn)
         to it. By doing so, it also corrupted the comdat group. */
       if (DECL_ONE_ONLY (fn))
        cgraph_get_create_node (clone)->set_comdat_group (cxx_comdat_group (clone));
-      DECL_SECTION_NAME (clone) = DECL_SECTION_NAME (fn);
       DECL_USE_TEMPLATE (clone) = DECL_USE_TEMPLATE (fn);
       DECL_EXTERNAL (clone) = DECL_EXTERNAL (fn);
       DECL_INTERFACE_KNOWN (clone) = DECL_INTERFACE_KNOWN (fn);
@@ -487,6 +486,7 @@ maybe_clone_body (tree fn)
       DECL_DLLIMPORT_P (clone) = DECL_DLLIMPORT_P (fn);
       DECL_ATTRIBUTES (clone) = copy_list (DECL_ATTRIBUTES (fn));
       DECL_DISREGARD_INLINE_LIMITS (clone) = DECL_DISREGARD_INLINE_LIMITS (fn);
+      set_decl_section_name (clone, DECL_SECTION_NAME (fn));
 
       /* Adjust the parameter names and locations.  */
       parm = DECL_ARGUMENTS (fn);
index 6da17c731343785c0db4723dee7168f5e4c606e6..3963d7338051d3c5948237eb0afe35e0e1eeeaf0 100644 (file)
@@ -1247,8 +1247,8 @@ vtable_find_or_create_map_decl (tree base_type)
       /* Put these mmap variables in thr .vtable_map_vars section, so
          we can find and protect them.  */
 
-      DECL_SECTION_NAME (var_decl) = build_string (strlen (".vtable_map_vars"),
-                                                   ".vtable_map_vars");
+      set_decl_section_name (var_decl, build_string (strlen (".vtable_map_vars"),
+                                                     ".vtable_map_vars"));
       DECL_HAS_IMPLICIT_SECTION_NAME_P (var_decl) = true;
       DECL_INITIAL (var_decl) = initial_value;
 
index 7c930746e7b384cc2700ada807dbb9397f3ed0b4..b38243f91d52491a413c4f72223666d0e795ac48 100644 (file)
@@ -13611,7 +13611,9 @@ secname_for_decl (const_tree decl)
 {
   const char *secname;
 
-  if (VAR_OR_FUNCTION_DECL_P (decl) && DECL_SECTION_NAME (decl))
+  if (VAR_OR_FUNCTION_DECL_P (decl)
+      && (DECL_EXTERNAL (decl) || TREE_PUBLIC (decl) || TREE_STATIC (decl))
+      && DECL_SECTION_NAME (decl))
     {
       tree sectree = DECL_SECTION_NAME (decl);
       secname = TREE_STRING_POINTER (sectree);
index 7cab8567c288741bde71a76a8e0d472a5d05400c..6d61c75f59c48c76d50c1495b8c97727e81169d6 100644 (file)
@@ -1,3 +1,8 @@
+2014-06-07  Jan Hubicka  <hubicka@ucw.cz>
+
+       * go-gcc.cc (global_variable_set_init): Use
+       set_decl_section_name.
+
 2014-06-04  Ian Lance Taylor  <iant@google.com>
 
        * go-gcc.cc (Gcc_backend::implicit_variable): Add is_common and
index df4b6708bfa32576662b6e7ed940da4863bce51e..7e67eed6af6803a7cd00533e7b18825410a2d68a 100644 (file)
@@ -2376,7 +2376,7 @@ Gcc_backend::global_variable_set_init(Bvariable* var, Bexpression* expr)
   // 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;
+      set_decl_section_name (var_decl, NULL);
       resolve_unique_section (var_decl,
                              compute_reloc_for_constant (expr_tree),
                              1);
index 41e27fd42ab431ee97b517a929f62996a7831f8e..69269009ac75375b1af1c780da3f4868637d7531 100644 (file)
@@ -243,7 +243,7 @@ ipa_comdats (void)
             || symbol->force_output
             || symbol->used_from_other_partition
             || TREE_THIS_VOLATILE (symbol->decl)
-            || DECL_SECTION_NAME (symbol->decl)
+            || symbol->get_section ()
             || (TREE_CODE (symbol->decl) == FUNCTION_DECL
                 && (DECL_STATIC_CONSTRUCTOR (symbol->decl)
                     || DECL_STATIC_DESTRUCTOR (symbol->decl))))
index 645884021a886f61243ea89e879d3daa027f4ade..039b756b39a6d27b576a13a401ff4229125b83d1 100644 (file)
@@ -512,6 +512,7 @@ function_and_variable_visibility (bool whole_program)
                     next = next->same_comdat_group)
                {
                  next->set_comdat_group (NULL);
+                 next->set_section (NULL);
                  symtab_make_decl_local (next->decl);
                  next->unique_name = ((next->resolution == LDPR_PREVAILING_DEF_IRONLY
                                        || next->unique_name
@@ -526,6 +527,8 @@ function_and_variable_visibility (bool whole_program)
            }
          if (TREE_PUBLIC (node->decl))
            node->set_comdat_group (NULL);
+         if (DECL_COMDAT (node->decl))
+           node->set_section (NULL);
          symtab_make_decl_local (node->decl);
        }
 
@@ -643,6 +646,7 @@ function_and_variable_visibility (bool whole_program)
                     next = next->same_comdat_group)
                {
                  next->set_comdat_group (NULL);
+                 next->set_section (NULL);
                  symtab_make_decl_local (next->decl);
                  next->unique_name = ((next->resolution == LDPR_PREVAILING_DEF_IRONLY
                                        || next->unique_name
@@ -653,6 +657,8 @@ function_and_variable_visibility (bool whole_program)
            }
          if (TREE_PUBLIC (vnode->decl))
            vnode->set_comdat_group (NULL);
+         if (DECL_COMDAT (vnode->decl))
+           vnode->set_section (NULL);
          symtab_make_decl_local (vnode->decl);
          vnode->resolution = LDPR_PREVAILING_DEF_IRONLY;
        }
index 5850d2818295aaea7043a80e8e946a01cdf65f0c..07f6c15592b97ab3d657bd98f1653cafc5933a69 100644 (file)
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -714,7 +714,7 @@ ipa_discover_readonly_nonaddressable_vars (void)
            /* Making variable in explicit section readonly can cause section
               type conflict. 
               See e.g. gcc.c-torture/compile/pr23237.c */
-           && DECL_SECTION_NAME (vnode->decl) == NULL)
+           && vnode->get_section () == NULL)
          {
            if (!TREE_READONLY (vnode->decl) && dump_file)
              fprintf (dump_file, " %s (read-only)", vnode->name ());
index 70991cc46938d6649449cf48843920e2e5c11473..55210830645784c2b1b25e5c55dbeba6573b8446 100644 (file)
@@ -1,3 +1,9 @@
+2014-06-07  Jan Hubicka  <hubicka@ucw.cz>
+
+       * class.c (build_utf8_ref): Use set_decl_section_name.
+       (emit_register_classes_in_jcr_section): Likewise.
+       (emit_register_classes_in_jcr_section): Likewise.
+
 2014-05-17  Trevor Saunders  <tsaunders@mozilla.com>
 
        * class.c (add_method_1): Adjust.
index a1e4a86033b0f5a230b5c0d33d2c9a3b0462a844..fb0c0d45b456b27db4112fd7aa2f27a4f77abdde 100644 (file)
@@ -991,7 +991,7 @@ build_utf8_ref (tree name)
                       | SECTION_MERGE | (SECTION_ENTSIZE & decl_size));
          sprintf (buf, ".rodata.jutf8.%d", decl_size);
          switch_to_section (get_section (buf, flags, NULL));
-         DECL_SECTION_NAME (decl) = build_string (strlen (buf), buf);
+         set_decl_section_name (decl, build_string (strlen (buf), buf));
        }
     }
 
@@ -2805,8 +2805,6 @@ emit_register_classes_in_jcr_section (void)
   cdecl = build_decl (UNKNOWN_LOCATION,
                      VAR_DECL, get_identifier ("_Jv_JCR_SECTION_data"),
                      class_array_type);
-  DECL_SECTION_NAME (cdecl) = build_string (strlen (JCR_SECTION_NAME),
-                                           JCR_SECTION_NAME);
   DECL_ALIGN (cdecl) = POINTER_SIZE;
   DECL_USER_ALIGN (cdecl) = 1;
   DECL_INITIAL (cdecl) = build_constructor (class_array_type, init);
@@ -2817,6 +2815,8 @@ emit_register_classes_in_jcr_section (void)
   DECL_ARTIFICIAL (cdecl) = 1;
   DECL_IGNORED_P (cdecl) = 1;
   DECL_PRESERVE_P (cdecl) = 1;
+  set_decl_section_name (cdecl, build_string (strlen (JCR_SECTION_NAME),
+                                             JCR_SECTION_NAME));
   pushdecl_top_level (cdecl);
   relayout_decl (cdecl);
   rest_of_decl_compilation (cdecl, 1, 0);
index 4f8d5b701ff9a34d0b7029f8ed3621fda93b3f23..a19197ded536323062f058229da2171331a36ab2 100644 (file)
@@ -396,6 +396,7 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
   int i;
   bool alias_p;
   const char *comdat;
+  const char *section;
   tree group;
 
   boundary_p = !lto_symtab_encoder_in_partition_p (encoder, node);
@@ -486,6 +487,7 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
   else
     comdat = "";
   lto_output_data_stream (ob->main_stream, comdat, strlen (comdat) + 1);
+
   if (group)
     {
       if (node->same_comdat_group && !boundary_p)
@@ -499,6 +501,13 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
       streamer_write_hwi_stream (ob->main_stream, ref);
     }
 
+  group = node->get_section ();
+  if (group)
+    section = TREE_STRING_POINTER (group);
+  else
+    section = "";
+  lto_output_data_stream (ob->main_stream, section, strlen (section) + 1);
+
   streamer_write_hwi_stream (ob->main_stream, node->tp_first_run);
 
   bp = bitpack_create (ob->main_stream);
@@ -563,6 +572,7 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, varpool_node *node,
   int ref;
   bool alias_p;
   const char *comdat;
+  const char *section;
   tree group;
 
   streamer_write_enum (ob->main_stream, LTO_symtab_tags, LTO_symtab_last_tag,
@@ -600,12 +610,14 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, varpool_node *node,
          /* in_other_partition.  */
     }
   streamer_write_bitpack (&bp);
+
   group = node->get_comdat_group ();
   if (group)
     comdat = IDENTIFIER_POINTER (group);
   else
     comdat = "";
   lto_output_data_stream (ob->main_stream, comdat, strlen (comdat) + 1);
+
   if (group)
     {
       if (node->same_comdat_group && !boundary_p)
@@ -618,6 +630,14 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, varpool_node *node,
        ref = LCC_NOT_FOUND;
       streamer_write_hwi_stream (ob->main_stream, ref);
     }
+
+  group = node->get_section ();
+  if (group)
+    section = TREE_STRING_POINTER (group);
+  else
+    section = "";
+  lto_output_data_stream (ob->main_stream, section, strlen (section) + 1);
+
   streamer_write_enum (ob->main_stream, ld_plugin_symbol_resolution,
                       LDPR_NUM_KNOWN, node->resolution);
 }
@@ -968,13 +988,33 @@ output_symtab (void)
   output_refs (encoder);
 }
 
-/* Return COMDAT_GROUP encoded in IB as a plain string.  */
+/* Return identifier encoded in IB as a plain string.  */
 
 static tree
-read_comdat_group (struct lto_input_block *ib)
+read_identifier (struct lto_input_block *ib)
 {
   unsigned int len = strnlen (ib->data + ib->p, ib->len - ib->p - 1);
-  tree group;
+  tree id;
+
+  if (ib->data[ib->p + len])
+    lto_section_overrun (ib);
+  if (!len)
+    {
+      ib->p++;
+      return NULL;
+    }
+  id = get_identifier (ib->data + ib->p);
+  ib->p += len + 1;
+  return id;
+}
+
+/* Return identifier encoded in IB as a plain string.  */
+
+static tree
+read_string_cst (struct lto_input_block *ib)
+{
+  unsigned int len = strnlen (ib->data + ib->p, ib->len - ib->p - 1);
+  tree id;
 
   if (ib->data[ib->p + len])
     lto_section_overrun (ib);
@@ -983,9 +1023,9 @@ read_comdat_group (struct lto_input_block *ib)
       ib->p++;
       return NULL;
     }
-  group = get_identifier (ib->data + ib->p);
+  id = build_string (len, ib->data + ib->p);
   ib->p += len + 1;
-  return group;
+  return id;
 }
 
 /* Overwrite the information in NODE based on FILE_DATA, TAG, FLAGS,
@@ -1077,6 +1117,7 @@ input_node (struct lto_file_decl_data *file_data,
   int order;
   int i, count;
   tree group;
+  tree section;
 
   order = streamer_read_hwi (ib) + order_base;
   clone_ref = streamer_read_hwi (ib);
@@ -1122,9 +1163,10 @@ input_node (struct lto_file_decl_data *file_data,
   if (tag == LTO_symtab_analyzed_node)
     ref = streamer_read_hwi (ib);
 
-  group = read_comdat_group (ib);
+  group = read_identifier (ib);
   if (group)
     ref2 = streamer_read_hwi (ib);
+  section = read_string_cst (ib);
 
   /* Make sure that we have not read this node before.  Nodes that
      have already been read will have their tag stored in the 'aux'
@@ -1151,6 +1193,8 @@ input_node (struct lto_file_decl_data *file_data,
     }
   else
     node->same_comdat_group = (symtab_node *) (intptr_t) LCC_NOT_FOUND;
+  if (section)
+    node->set_section (section);
 
   if (node->thunk.thunk_p)
     {
@@ -1183,6 +1227,7 @@ input_varpool_node (struct lto_file_decl_data *file_data,
   int ref = LCC_NOT_FOUND;
   int order;
   tree group;
+  tree section;
 
   order = streamer_read_hwi (ib) + order_base;
   decl_index = streamer_read_uhwi (ib);
@@ -1220,7 +1265,7 @@ input_varpool_node (struct lto_file_decl_data *file_data,
     }
   if (node->alias && !node->analyzed && node->weakref)
     node->alias_target = get_alias_symbol (node->decl);
-  group = read_comdat_group (ib);
+  group = read_identifier (ib);
   if (group)
     {
       node->set_comdat_group (group);
@@ -1230,6 +1275,9 @@ input_varpool_node (struct lto_file_decl_data *file_data,
     }
   else
     node->same_comdat_group = (symtab_node *) (intptr_t) LCC_NOT_FOUND;
+  section = read_string_cst (ib);
+  if (section)
+    node->set_section (section);
   node->resolution = streamer_read_enum (ib, ld_plugin_symbol_resolution,
                                                LDPR_NUM_KNOWN);
   gcc_assert (flag_ltrans
index 64e4f4b4530d383824c3abd39f33e8746e952901..ece0d3f1458765724dcf8495796070bd83b1b72c 100644 (file)
@@ -535,7 +535,6 @@ DFS_write_tree_body (struct output_block *ob,
       /* Make sure we don't inadvertently set the assembler name.  */
       if (DECL_ASSEMBLER_NAME_SET_P (expr))
        DFS_follow_tree_edge (DECL_ASSEMBLER_NAME (expr));
-      DFS_follow_tree_edge (DECL_SECTION_NAME (expr));
     }
 
   if (CODE_CONTAINS_STRUCT (code, TS_FIELD_DECL))
@@ -973,7 +972,6 @@ hash_tree (struct streamer_tree_cache_d *cache, tree t)
     {
       if (DECL_ASSEMBLER_NAME_SET_P (t))
        visit (DECL_ASSEMBLER_NAME (t));
-      visit (DECL_SECTION_NAME (t));
     }
 
   if (CODE_CONTAINS_STRUCT (code, TS_FIELD_DECL))
index 87a8deafaf111a3eaf46c270a2ee0123e2cf4457..3edd6bab91f04e89adc14eacd6b07a9e353e507c 100644 (file)
@@ -1,3 +1,8 @@
+2014-06-07  Jan Hubicka  <hubicka@ucw.cz>
+
+       * lto.c (mentions_vars_p_decl_with_vis, compare_tree_sccs_1,
+       lto_fixup_prevailing_decls): Skip section names.
+
 2014-06-02  Andrew MacLeod  <amacleod@redhat.com>
 
        * lto-symtab.c: Include builtins.h.
index 431bd1800da0b05a2a44bdd700c231d8a27a09c9..9db7845889ed2609830ecbcd0aedeeee5ba8afa6 100644 (file)
@@ -767,7 +767,6 @@ mentions_vars_p_decl_with_vis (tree t)
 
   /* Accessor macro has side-effects, use field-name here. */
   CHECK_NO_VAR (t->decl_with_vis.assembler_name);
-  CHECK_NO_VAR (DECL_SECTION_NAME (t));
   return false;
 }
 
@@ -1529,7 +1528,6 @@ compare_tree_sccs_1 (tree t1, tree t2, tree **map)
       if (DECL_ASSEMBLER_NAME_SET_P (t1))
        compare_tree_edges (DECL_ASSEMBLER_NAME (t1),
                            DECL_ASSEMBLER_NAME (t2));
-      compare_tree_edges (DECL_SECTION_NAME (t1), DECL_SECTION_NAME (t2));
     }
 
   if (CODE_CONTAINS_STRUCT (code, TS_FIELD_DECL))
@@ -2718,7 +2716,6 @@ lto_fixup_prevailing_decls (tree t)
       if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
        {
          LTO_NO_PREVAIL (t->decl_with_vis.assembler_name);
-         LTO_NO_PREVAIL (DECL_SECTION_NAME (t));
        }
       if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON))
        {
index ab6c9d747e665f6e20c55eca6f803fd9e7ce8b2b..8265b4e1eb3849d023d79952da54e79576e1de83 100644 (file)
@@ -563,9 +563,9 @@ dump_symtab_base (FILE *f, symtab_node *node)
             IDENTIFIER_POINTER (node->get_comdat_group_id ()));
   if (DECL_ONE_ONLY (node->decl))
     fprintf (f, " one_only");
-  if (DECL_SECTION_NAME (node->decl))
-    fprintf (f, " section_name:%s",
-            TREE_STRING_POINTER (DECL_SECTION_NAME (node->decl)));
+  if (node->get_section ())
+    fprintf (f, " section:%s",
+            TREE_STRING_POINTER (node->get_section ()));
   if (DECL_VISIBILITY_SPECIFIED (node->decl))
     fprintf (f, " visibility_specified");
   if (DECL_VISIBILITY (node->decl))
@@ -877,11 +877,7 @@ symtab_make_decl_local (tree decl)
     DECL_COMMON (decl) = 0;
   else gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
 
-  if (DECL_COMDAT (decl))
-    {
-      DECL_SECTION_NAME (decl) = 0;
-      DECL_COMDAT (decl) = 0;
-    }
+  DECL_COMDAT (decl) = 0;
   DECL_WEAK (decl) = 0;
   DECL_EXTERNAL (decl) = 0;
   DECL_VISIBILITY_SPECIFIED (decl) = 0;
index 4d7598d8c0434335f56e5d3058c5039fb5743bbb..d7969bc266c7388e05ef1092ab347eb8b0a337f5 100644 (file)
@@ -245,7 +245,6 @@ get_emutls_init_templ_addr (tree decl)
   TREE_READONLY (to) = 1;
   DECL_IGNORED_P (to) = 1;
   DECL_CONTEXT (to) = DECL_CONTEXT (decl);
-  DECL_SECTION_NAME (to) = DECL_SECTION_NAME (decl);
   DECL_PRESERVE_P (to) = DECL_PRESERVE_P (decl);
 
   DECL_WEAK (to) = DECL_WEAK (decl);
@@ -265,10 +264,13 @@ get_emutls_init_templ_addr (tree decl)
 
   if (targetm.emutls.tmpl_section)
     {
-      DECL_SECTION_NAME (to)
-        = build_string (strlen (targetm.emutls.tmpl_section),
-                       targetm.emutls.tmpl_section);
+      set_decl_section_name
+       (to,
+         build_string (strlen (targetm.emutls.tmpl_section),
+                      targetm.emutls.tmpl_section));
     }
+  else
+    set_decl_section_name (to, DECL_SECTION_NAME (decl));
 
   /* Create varpool node for the new variable and finalize it if it is
      not external one.  */
@@ -323,9 +325,10 @@ new_emutls_decl (tree decl, tree alias_of)
   /* If the target wants the control variables grouped, do so.  */
   if (!DECL_COMMON (to) && targetm.emutls.var_section)
     {
-      DECL_SECTION_NAME (to)
-        = build_string (strlen (targetm.emutls.var_section),
-                       targetm.emutls.var_section);
+      set_decl_section_name 
+        (to,
+         build_string (strlen (targetm.emutls.var_section),
+                      targetm.emutls.var_section));
     }
 
   /* If this variable is defined locally, then we need to initialize the
index da7c096b82612ee7f0ea094cceaf8011eab2d558..8b3adebc6f3e89ee82853b96d42f7cedd7c931ec 100644 (file)
@@ -759,8 +759,6 @@ lto_input_ts_decl_with_vis_tree_pointers (struct lto_input_block *ib,
       gcc_assert (TREE_CODE (id) == IDENTIFIER_NODE);
       SET_DECL_ASSEMBLER_NAME (expr, id);
     }
-
-  DECL_SECTION_NAME (expr) = stream_read_tree (ib, data_in);
 }
 
 
index f7799bccd5f18459a7357384564daf6b9f17ffc7..dd148fa708089a847f0f01880afa12fa24fefbfb 100644 (file)
@@ -660,8 +660,6 @@ write_ts_decl_with_vis_tree_pointers (struct output_block *ob, tree expr,
     stream_write_tree (ob, DECL_ASSEMBLER_NAME (expr), ref_p);
   else
     stream_write_tree (ob, NULL_TREE, false);
-
-  stream_write_tree (ob, DECL_SECTION_NAME (expr), ref_p);
 }
 
 
index a4c439fb19ad860fa9a1d0e7718bcba45c77515e..e6be42ad32e98a04220c7b818ef3b428ea971f55 100644 (file)
@@ -5213,7 +5213,8 @@ vect_can_force_dr_alignment_p (const_tree decl, unsigned int alignment)
   /* Do not override explicit alignment set by the user when an explicit
      section name is also used.  This is a common idiom used by many
      software projects.  */
-  if (DECL_SECTION_NAME (decl) != NULL_TREE
+  if (TREE_STATIC (decl) 
+      && DECL_SECTION_NAME (decl) != NULL_TREE
       && !DECL_HAS_IMPLICIT_SECTION_NAME_P (decl))
     return false;
 
index c6e4bcbacd883f76783fcb160c692a7e3fd653ea..9d8e6316c5879c0912c9ab06d095b780e0b52518 100644 (file)
@@ -608,7 +608,7 @@ decl_assembler_name (tree decl)
    DECL is associated with.  This can be either an IDENTIFIER_NODE or a
    decl, in which case its DECL_ASSEMBLER_NAME identifies the group.  */
 tree
-decl_comdat_group (tree node)
+decl_comdat_group (const_tree node)
 {
   struct symtab_node *snode = symtab_get_node (node);
   if (!snode)
@@ -618,7 +618,7 @@ decl_comdat_group (tree node)
 
 /* Likewise, but make sure it's been reduced to an IDENTIFIER_NODE.  */
 tree
-decl_comdat_group_id (tree node)
+decl_comdat_group_id (const_tree node)
 {
   struct symtab_node *snode = symtab_get_node (node);
   if (!snode)
@@ -626,6 +626,37 @@ decl_comdat_group_id (tree node)
   return snode->get_comdat_group_id ();
 }
 
+/* When the target supports named section, return its name as IDENTIFIER_NODE
+   or NULL if it is in no section.  */
+tree
+decl_section_name (const_tree node)
+{
+  struct symtab_node *snode = symtab_get_node (node);
+  if (!snode)
+    return NULL;
+  return snode->get_section ();
+}
+
+/* Set section section name of NODE to VALUE (that is expected to
+   be identifier node)  */
+void
+set_decl_section_name (tree node, tree value)
+{
+  struct symtab_node *snode;
+
+  if (value == NULL)
+    {
+      snode = symtab_get_node (node);
+      if (!snode)
+       return;
+    }
+  else if (TREE_CODE (node) == VAR_DECL)
+    snode = varpool_node_for_decl (node);
+  else
+    snode = cgraph_get_create_node (node);
+  snode->set_section (value);
+}
+
 /* Compute the number of bytes occupied by a tree with code CODE.
    This function cannot be used for nodes that have variable sizes,
    including TREE_VEC, INTEGER_CST, STRING_CST, and CALL_EXPR.  */
@@ -5264,10 +5295,6 @@ find_decls_types_r (tree *tp, int *ws, void *data)
          fld_worklist_push (DECL_FIELD_BIT_OFFSET (t), fld);
          fld_worklist_push (DECL_FCONTEXT (t), fld);
        }
-      else if (TREE_CODE (t) == VAR_DECL)
-       {
-         fld_worklist_push (DECL_SECTION_NAME (t), fld);
-       }
 
       if ((TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == PARM_DECL)
          && DECL_HAS_VALUE_EXPR_P (t))
index a3fb8669bf4212a76c60a5bce373fbb9b218b32b..0abf9fd116a2405c6806dbb07760bd7a4dff278f 100644 (file)
@@ -2368,8 +2368,7 @@ extern void decl_value_expr_insert (tree, tree);
 
 /* Records the section name in a section attribute.  Used to pass
    the name from decl_attributes to make_function_rtl and make_decl_rtl.  */
-#define DECL_SECTION_NAME(NODE) \
-  (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.section_name)
+#define DECL_SECTION_NAME(NODE) decl_section_name (NODE)
 
 /* Nonzero in a decl means that the gimplifier has seen (or placed)
    this variable in a BIND_EXPR.  */
@@ -3431,8 +3430,10 @@ tree_operand_check_code (const_tree __t, enum tree_code __code, int __i,
    || ((NODE) && TREE_TYPE ((NODE)) == error_mark_node))
 
 extern tree decl_assembler_name (tree);
-extern tree decl_comdat_group (tree);
-extern tree decl_comdat_group_id (tree);
+extern tree decl_comdat_group (const_tree);
+extern tree decl_comdat_group_id (const_tree);
+extern tree decl_section_name (const_tree);
+extern void set_decl_section_name (tree, tree);
 
 /* Compute the number of bytes occupied by 'node'.  This routine only
    looks at TREE_CODE and, if the code is TREE_VEC, TREE_VEC_LENGTH.  */
index eabc06ff5f725cf05d19df71e96677e40c919a4d..028e7409588924d8ac5501a29b5331eb29a207b3 100644 (file)
@@ -1369,6 +1369,7 @@ make_decl_rtl (tree decl)
      is called early and it needs to make DECL_RTL to get the name.
      we take care of recomputing the DECL_RTL after visibility is changed.  */
   if (TREE_CODE (decl) == VAR_DECL
+      && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))
       && DECL_SECTION_NAME (decl) != NULL_TREE
       && DECL_INITIAL (decl) == NULL_TREE
       && DECL_COMMON (decl))
@@ -6460,7 +6461,7 @@ default_unique_section (tree decl, int reloc)
 
   string = ACONCAT ((linkonce, prefix, ".", name, NULL));
 
-  DECL_SECTION_NAME (decl) = build_string (strlen (string), string);
+  set_decl_section_name (decl, build_string (strlen (string), string));
 }
 
 /* Like compute_reloc_for_constant, except for an RTX.  The return value
index 143cd3b3a64c4b7c9a003408a5fb7e844fbd35ae..ff6712764f116696ae3904e7fc90c870fd9bedac 100644 (file)
@@ -582,7 +582,7 @@ varpool_finalize_named_section_flags (varpool_node *node)
       && !DECL_EXTERNAL (node->decl)
       && TREE_CODE (node->decl) == VAR_DECL
       && !DECL_HAS_VALUE_EXPR_P (node->decl)
-      && DECL_SECTION_NAME (node->decl))
+      && node->get_section ())
     get_variable_section (node->decl, false);
 }