* 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
+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;
+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)
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
*no_add_attrs = true;
}
else
- DECL_SECTION_NAME (decl) = TREE_VALUE (args);
+ set_decl_section_name (decl, TREE_VALUE (args));
}
else
{
+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
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. */
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;
}
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;
{
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;
/* 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;
/* 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
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);
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;
*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;
}
*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)
{
*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;
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);
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
{
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
{
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;
}
}
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
sprintf (string, "%s%s", prefix, name);
- DECL_SECTION_NAME (decl) = build_string (len, string);
+ set_decl_section_name (decl, build_string (len, string));
}
int
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
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);
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);
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.
/* 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);
}
}
}
+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
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)
{
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));
}
}
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);
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);
/* 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;
{
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);
+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
// 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);
|| 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))))
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
}
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);
}
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
}
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;
}
/* 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 ());
+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.
| 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));
}
}
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);
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);
int i;
bool alias_p;
const char *comdat;
+ const char *section;
tree group;
boundary_p = !lto_symtab_encoder_in_partition_p (encoder, node);
else
comdat = "";
lto_output_data_stream (ob->main_stream, comdat, strlen (comdat) + 1);
+
if (group)
{
if (node->same_comdat_group && !boundary_p)
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);
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,
/* 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)
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);
}
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);
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,
int order;
int i, count;
tree group;
+ tree section;
order = streamer_read_hwi (ib) + order_base;
clone_ref = streamer_read_hwi (ib);
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'
}
else
node->same_comdat_group = (symtab_node *) (intptr_t) LCC_NOT_FOUND;
+ if (section)
+ node->set_section (section);
if (node->thunk.thunk_p)
{
int ref = LCC_NOT_FOUND;
int order;
tree group;
+ tree section;
order = streamer_read_hwi (ib) + order_base;
decl_index = streamer_read_uhwi (ib);
}
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);
}
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
/* 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))
{
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))
+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.
/* 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;
}
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))
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))
{
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))
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;
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);
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. */
/* 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
gcc_assert (TREE_CODE (id) == IDENTIFIER_NODE);
SET_DECL_ASSEMBLER_NAME (expr, id);
}
-
- DECL_SECTION_NAME (expr) = stream_read_tree (ib, data_in);
}
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);
}
/* 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;
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)
/* 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)
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. */
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))
/* 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. */
|| ((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. */
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))
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
&& !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);
}