diff options
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -773,6 +773,33 @@ set_decl_section_name (tree node, const char *value) snode->set_section (value); } +/* Set section name of NODE to match the section name of OTHER. + + set_decl_section_name (decl, other) is equivalent to + set_decl_section_name (decl, DECL_SECTION_NAME (other)), but possibly more + efficient. */ +void +set_decl_section_name (tree decl, const_tree other) +{ + struct symtab_node *other_node = symtab_node::get (other); + if (other_node) + { + struct symtab_node *decl_node; + if (VAR_P (decl)) + decl_node = varpool_node::get_create (decl); + else + decl_node = cgraph_node::get_create (decl); + decl_node->set_section (*other_node); + } + else + { + struct symtab_node *decl_node = symtab_node::get (decl); + if (!decl_node) + return; + decl_node->set_section (NULL); + } +} + /* Return TLS model of a variable NODE. */ enum tls_model decl_tls_model (const_tree node) |