From e257a17cb9cc4dc76a79680616420e75ba030b5f Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 11 Jun 2014 07:51:23 +0200 Subject: varasm.c (set_implicit_section): New function. * varasm.c (set_implicit_section): New function. (resolve_unique_section): Use it to set implicit section for aliases, too. (get_named_text_section): Use symtab_get_node (decl)->implicit_section (default_function_section): Likewise. (decl_binds_to_current_def_p): Constify argument. * varasm.h (decl_binds_to_current_def_p): Update prototype. * asan.c (asan_protect_global): Use symtab_get_node (decl)->implicit_section. * symtab.c (dump_symtab_base): Dump implicit sections. (verify_symtab_base): Verify sanity of sectoins and comdats. (symtab_resolve_alias): Alias share the section of its target. (set_section_1): New function. (symtab_node::set_section): Move here, recurse to aliases. (verify_symtab): Check for duplicated symtab lists. * tree-core.h (implicit_section_name_p): Remove. * tree-vect-data-refs.c: Include varasm.h. (vect_can_force_dr_alignment_p): Fix conditional on when decl bints to current definition; use symtab_get_node (decl)->implicit_section. * cgraph.c (cgraph_make_node_local_1): Fix section set. * cgraph.h (struct symtab_node): Add implicit_section. (set_section): Rename to ... (set_section_for_node): ... this one. (set_section): Declare. * tree.h (DECL_HAS_IMPLICIT_SECTION_NAME_P): Remove. * lto-cgraph.c (lto_output_node, lto_output_varpool_node, input_overwrite_node, input_varpool_node): Stream implicit_section. * ipa.c (symtab_remove_unreachable_nodes): Do not check symtab before removal; it will fail in LTO. * vtable-class-hierarchy.c: Use symtab_get_node (var_decl)->implicit_section. * optimize.c (cdtor_comdat_group): Fix handling of aliases. (maybe_clone_body): Move symbol across comdat groups. * method.c (use_thunk): Copy implicit section flag. * go/go-gcc.cc (Gcc_backend::global_variable_set_init): Use symtab_get_node(var_decl)->implicit_section. * lto.c (read_cgraph_and_symbols): Remove unreachable symbols. (do_whole_program_analysis): Use verify_symtab. From-SVN: r211434 --- gcc/cgraph.h | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'gcc/cgraph.h') diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 882f1e8..dc286d9 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -93,6 +93,9 @@ public: unsigned forced_by_abi : 1; /* True when the name is known to be unique and thus it does not need mangling. */ unsigned unique_name : 1; + /* Specify whether the section was set by user or by + compiler via -ffunction-sections. */ + unsigned implicit_section : 1; /* True when body and other characteristics have been removed by symtab_remove_unreachable_nodes. */ unsigned body_removed : 1; @@ -162,17 +165,29 @@ public: comdat_group_ = group; } - /* Return section. */ - tree get_section () + /* Return section as STRING_CST. */ + tree get_section_name () { return section_; } - /* Set section. */ - void set_section (tree section) + /* Return section as string. */ + const char * get_section () + { + if (!section_) + return NULL; + return TREE_STRING_POINTER (section_); + } + + /* Set section, do not recurse into aliases. + When one wants to change section of symbol and its aliases, + use set_section */ + void set_section_for_node (tree section) { gcc_checking_assert (!section || TREE_CODE (section) == STRING_CST); section_ = section; + if (!section) + implicit_section = false; } /* Vectors of referring and referenced entities. */ @@ -193,6 +208,9 @@ public: /* Section name. Again can be private, if allowed. */ tree section_; + + /* Set section for symbol and its aliases. */ + void set_section (tree section); }; enum availability -- cgit v1.1