Add referenced_from_asm and must_remain_in_tu and propagate them for following patches.
gcc/ChangeLog: * cgraph.h: Add flags. * cgraphclones.cc (cgraph_node::create_clone): Propagate flags. * lto-cgraph.cc (lto_output_node): Likewise. (lto_output_varpool_node): Likewise. (input_overwrite_node): Likewise. (input_varpool_node): Likewise. gcc/lto/ChangeLog: * lto-symtab.cc (lto_cgraph_replace_node): Likewise. (lto_varpool_replace_node): Likewise. --- gcc/cgraph.h | 7 +++++++ gcc/cgraphclones.cc | 2 ++ gcc/lto-cgraph.cc | 8 ++++++++ gcc/lto/lto-symtab.cc | 4 ++++ 4 files changed, 21 insertions(+) diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 278479a5510..53b8e1d0e37 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -142,6 +142,7 @@ public: used_from_other_partition (false), in_other_partition (false), address_taken (false), in_init_priority_hash (false), need_lto_streaming (false), offloadable (false), ifunc_resolver (false), + referenced_from_asm (false), must_remain_in_tu (false), next_sharing_asm_name (NULL), previous_sharing_asm_name (NULL), same_comdat_group (NULL), ref_list (), alias_target (NULL), aux (NULL), @@ -626,6 +627,12 @@ public: /* Set when symbol is an IFUNC resolver. */ unsigned ifunc_resolver : 1; + /* Set when symbols is referenced from toplevel assembly and must not be + renamed. */ + unsigned referenced_from_asm : 1; + + /* Set when must remain in TU partition. */ + unsigned must_remain_in_tu : 1; /* Declaration representing the symbol. */ tree decl; diff --git a/gcc/cgraphclones.cc b/gcc/cgraphclones.cc index c160e8b6985..8e42cba6666 100644 --- a/gcc/cgraphclones.cc +++ b/gcc/cgraphclones.cc @@ -437,6 +437,8 @@ cgraph_node::create_clone (tree new_decl, profile_count prof_count, new_node->unit_id = unit_id; new_node->merged_comdat = merged_comdat; new_node->merged_extern_inline = merged_extern_inline; + new_node->referenced_from_asm = referenced_from_asm; + new_node->must_remain_in_tu = must_remain_in_tu; clone_info *info = clone_info::get (this); if (param_adjustments) diff --git a/gcc/lto-cgraph.cc b/gcc/lto-cgraph.cc index 86f676ce053..1f6a85d2e28 100644 --- a/gcc/lto-cgraph.cc +++ b/gcc/lto-cgraph.cc @@ -541,6 +541,8 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node, bp_pack_value (&bp, in_other_partition, 1); bp_pack_value (&bp, node->alias, 1); bp_pack_value (&bp, node->transparent_alias, 1); + bp_pack_value (&bp, node->referenced_from_asm, 1); + bp_pack_value (&bp, node->must_remain_in_tu, 1); bp_pack_value (&bp, node->weakref, 1); bp_pack_value (&bp, node->symver, 1); bp_pack_value (&bp, node->frequency, 2); @@ -627,6 +629,8 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, varpool_node *node, 1); bp_pack_value (&bp, node->alias, 1); bp_pack_value (&bp, node->transparent_alias, 1); + bp_pack_value (&bp, node->referenced_from_asm, 1); + bp_pack_value (&bp, node->must_remain_in_tu, 1); bp_pack_value (&bp, node->weakref, 1); bp_pack_value (&bp, node->symver, 1); bp_pack_value (&bp, node->analyzed && (!boundary_p || node->alias), 1); @@ -1254,6 +1258,8 @@ input_overwrite_node (struct lto_file_decl_data *file_data, } node->alias = bp_unpack_value (bp, 1); node->transparent_alias = bp_unpack_value (bp, 1); + node->referenced_from_asm = bp_unpack_value (bp, 1); + node->must_remain_in_tu = bp_unpack_value (bp, 1); node->weakref = bp_unpack_value (bp, 1); node->symver = bp_unpack_value (bp, 1); node->frequency = (enum node_frequency)bp_unpack_value (bp, 2); @@ -1443,6 +1449,8 @@ input_varpool_node (struct lto_file_decl_data *file_data, node->definition = bp_unpack_value (&bp, 1); node->alias = bp_unpack_value (&bp, 1); node->transparent_alias = bp_unpack_value (&bp, 1); + node->referenced_from_asm = bp_unpack_value (&bp, 1); + node->must_remain_in_tu = bp_unpack_value (&bp, 1); node->weakref = bp_unpack_value (&bp, 1); node->symver = bp_unpack_value (&bp, 1); node->analyzed = bp_unpack_value (&bp, 1); diff --git a/gcc/lto/lto-symtab.cc b/gcc/lto/lto-symtab.cc index 8d7fc6805e9..c985cbb7781 100644 --- a/gcc/lto/lto-symtab.cc +++ b/gcc/lto/lto-symtab.cc @@ -76,6 +76,8 @@ lto_cgraph_replace_node (struct cgraph_node *node, prevailing_node->merged_extern_inline = true; prevailing_node->merged_comdat |= node->merged_comdat; prevailing_node->merged_extern_inline |= node->merged_extern_inline; + prevailing_node->referenced_from_asm |= node->referenced_from_asm; + prevailing_node->must_remain_in_tu |= node->must_remain_in_tu; /* Redirect all incoming edges. */ compatible_p @@ -121,6 +123,8 @@ lto_varpool_replace_node (varpool_node *vnode, prevailing_node->force_output = true; if (vnode->forced_by_abi) prevailing_node->forced_by_abi = true; + prevailing_node->referenced_from_asm |= vnode->referenced_from_asm; + prevailing_node->must_remain_in_tu |= vnode->must_remain_in_tu; /* Be sure we can garbage collect the initializer. */ if (DECL_INITIAL (vnode->decl) -- 2.50.0