GCC Middle and Back End API Reference
symtab.c File Reference


static hashval_t hash_node ()
static int eq_node ()
static hashval_t hash_node_by_assembler_name ()
static int eq_assembler_name ()
static void insert_to_assembler_name_hash ()
static void unlink_from_assembler_name_hash ()
void symtab_prevail_in_asm_name_hash ()
void symtab_register_node ()
void symtab_insert_node_to_hashtable ()
void symtab_unregister_node ()
symtab_node symtab_get_node ()
void symtab_remove_node ()
void symtab_initialize_asm_name_hash ()
symtab_node symtab_node_for_asm ()
void change_decl_assembler_name ()
void symtab_add_to_same_comdat_group (symtab_node new_node, symtab_node old_node)
void symtab_dissolve_same_comdat_group_list ()
const char * symtab_node_asm_name ()
const char * symtab_node_name ()
void dump_symtab_base ()
void dump_symtab_node ()
void dump_symtab ()
DEBUG_FUNCTION void debug_symtab_node ()
DEBUG_FUNCTION void debug_symtab ()
DEBUG_FUNCTION bool verify_symtab_base ()
DEBUG_FUNCTION void verify_symtab_node ()
DEBUG_FUNCTION void verify_symtab ()
bool resolution_used_from_other_file_p ()
bool symtab_used_from_object_file_p ()
void symtab_make_decl_local ()
enum availability symtab_node_availability ()
symtab_node symtab_alias_ultimate_target ()
void fixup_same_cpp_alias_visibility ()
bool symtab_resolve_alias ()
bool symtab_for_node_and_aliases (symtab_node node, bool(*callback)(symtab_node, void *), void *data, bool include_overwritable)
static bool symtab_nonoverwritable_alias_1 ()
symtab_node symtab_nonoverwritable_alias ()
bool symtab_semantically_equivalent_p (symtab_node a, symtab_node b)


const char *const ld_plugin_symbol_resolution_names []
static htab_t symtab_hash
static htab_t assembler_name_hash
symtab_node symtab_nodes
int symtab_order
static const char *const symtab_type_names [] = {"symbol", "function", "variable"}

Function Documentation

void change_decl_assembler_name ( )
   Set the DECL_ASSEMBLER_NAME and update symtab hashtables.  
     We can have user ASM names on things, like global register variables, that
     are not in the symbol table.  
DEBUG_FUNCTION void debug_symtab ( void  )
   Dump symbol table to stderr.  

References symtab_node_base::decl, error(), and symtab_get_node().

DEBUG_FUNCTION void debug_symtab_node ( )
   Dump symtab node NODE to stderr.  
void dump_symtab ( )
   Dump symbol table.  

References symtab_node_base::decl, and error().

void dump_symtab_base ( )
   Dump base fields of symtab nodes.  Not to be used directly.  
void dump_symtab_node ( )
   Dump symtab node.  
static int eq_assembler_name ( )
static int eq_node ( )
   Returns nonzero if P1 and P2 are equal.  

References symtab_node_base::decl, and decl_assembler_name_hash().

void fixup_same_cpp_alias_visibility ( )
   C++ FE sometimes change linkage flags after producing same body aliases.

   FIXME: C++ produce implicit aliases for virtual functions and vtables that
   are obviously equivalent.  The way it is doing so is however somewhat
   kludgy and interferes with the visibility code. As a result we need to
   copy the visibility from the target to get things right.  
     FIXME: It is not really clear why those flags should not be copied for
     functions, too.  

References symtab_node_base::alias, symtab_node_base::decl, and error().

static hashval_t hash_node ( )
   Returns a hash code for P.  

References symtab_node_base::decl.

static hashval_t hash_node_by_assembler_name ( )
   Returns a hash code for P.  

References symtab_node_base::decl, and decl_assembler_name_equal().

static void insert_to_assembler_name_hash ( )
   Insert NODE to assembler name hash.  
         Update also possible inline clones sharing a decl.  
bool resolution_used_from_other_file_p ( )
   Return true when RESOLUTION indicate that linker will use
   the symbol from non-LTO object files.  
void symtab_add_to_same_comdat_group ( symtab_node  new_node,
symtab_node  old_node 
   Add NEW_ to the same comdat group that OLD is in.  

References symtab_node_base::next, and symtab_node_base::same_comdat_group.

symtab_node symtab_alias_ultimate_target ( )
   Given NODE, walk the alias chain to return the symbol NODE is alias of.
   If NODE is not an alias, return NODE.
   When AVAILABILITY is non-NULL, get minimal availability in the chain.  
     To determine visibility of the target, we follow ELF semantic of aliases.
     Here alias is an alternative assembler name of a given definition. Its
     availability prevails the availability of its target (i.e. static alias of
     weak definition is available.

     Weakref is a different animal (and not part of ELF per se). It is just
     alternative name of a given symbol used within one complation unit
     and is translated prior hitting the object file.  It inherits the
     visibility of its target (i.e. weakref of non-overwritable definition
     is non-overwritable, while weakref of weak definition is weak).

     If we ever get into supporting targets with different semantics, a target
     hook will be needed here.  

References symtab_node_availability().

void symtab_dissolve_same_comdat_group_list ( )
   Dissolve the same_comdat_group list in which NODE resides.  

References symtab_node_base::decl, and lang_hooks::decl_printable_name.

bool symtab_for_node_and_aliases ( symtab_node  node,
bool(*)(symtab_node, void *)  callback,
void *  data,
bool  include_overwritable 
   Call calback on NODE and aliases associated to NODE. 
   When INCLUDE_OVERWRITABLE is false, overwritable aliases and thunks are

Referenced by symtab_resolve_alias().

symtab_node symtab_get_node ( )
   Return symbol table node associated with DECL, if any,
   and NULL otherwise.  
     Check that we are called for sane type of object - functions
     and static or external variables.  
void symtab_initialize_asm_name_hash ( void  )
   Initalize asm name hash unless.  

Referenced by symtab_remove_node().

void symtab_insert_node_to_hashtable ( )
   Make NODE to be the one symtab hash is pointing to.  Used when reshaping tree
   of inline clones.  

References ipa_remove_all_references(), ipa_remove_all_referring(), symtab_node_base::ref_list, and symtab_node_base::same_comdat_group.

void symtab_make_decl_local ( )
   Make DECL local.  FIXME: We shouldn't need to mess with rtl this early,
   but other code such as notice_global_symbol generates rtl.  
     Update rtl flags.  
const char* symtab_node_asm_name ( )
   Return printable assembler name of NODE.
   This function is used only for debugging.  When assembler name
   is unknown go with identifier name.  
enum availability symtab_node_availability ( )
   Return availability of NODE.  
symtab_node symtab_node_for_asm ( )
   Return the cgraph node that has ASMNAME for its DECL_ASSEMBLER_NAME.
   Return NULL if there's no such node.  
const char* symtab_node_name ( )
   Return printable identifier name.  
symtab_node symtab_nonoverwritable_alias ( )
   If NODE can not be overwriten by static or dynamic linker to point to different
   definition, return NODE. Otherwise look for alias with such property and if
   none exists, introduce new one.  
     First try to look up existing alias or base object
     (if that is already non-overwritable).  
     If aliases aren't supported by the assembler, fail.  
     Otherwise create a new one.  
     Update the properties.  

References AVAIL_AVAILABLE, symtab_node_base::decl, and symtab_alias_ultimate_target().

static bool symtab_nonoverwritable_alias_1 ( )
   Worker searching nonoverwritable alias.  
void symtab_prevail_in_asm_name_hash ( )
   Arrange node to be first in its entry of assembler_name_hash.  
void symtab_register_node ( )
   Add node into symbol table.  This function is not used directly, but via
   cgraph/varpool node creation routines.  
     Be sure to do this last; C++ FE might create new nodes via
     DECL_ASSEMBLER_NAME langhook!  
void symtab_remove_node ( )
   Remove symtab NODE from the symbol table.  

References symtab_initialize_asm_name_hash().

bool symtab_resolve_alias ( )
   Add reference recording that NODE is alias of TARGET.
   The function can fail in the case of aliasing cycles; in this case
   it returns false.  
     Never let cycles to creep into the symbol table alias references;
     those will make alias walkers to be infinite.  
     "analyze" the node - i.e. mark the reference.  
     Alias targets become reudndant after alias is resolved into an reference.
     We do not want to keep it around or we would have to mind updating them
     when renaming symbols.  
     If alias has address taken, so does the target.  

References AVAIL_OVERWRITABLE, IPA_REF_ALIAS, symtab_node_base::ref_list, ipa_ref::referring, symtab_for_node_and_aliases(), and symtab_node_availability().

bool symtab_semantically_equivalent_p ( symtab_node  a,
symtab_node  b 
   Return true if A and B represents semantically equivalent symbols.  
     Equivalent functions are equivalent.  
     If symbol is not overwritable by different implementation,
     walk to the base object it defines.  
void symtab_unregister_node ( )
   Remove node from symbol table.  This function is not used directly, but via
   cgraph/varpool node removal routines.  
     During LTO symtab merging we temporarily corrupt decl to symtab node
bool symtab_used_from_object_file_p ( )
   Return true when NODE is known to be used from other (non-LTO) object file.
   Known only when doing LTO via linker plugin.  
static void unlink_from_assembler_name_hash ( )
   Remove NODE from assembler name hash.  
         Update also possible inline clones sharing a decl.  
DEBUG_FUNCTION void verify_symtab ( void  )
   Verify symbol table for internal consistency.  
DEBUG_FUNCTION bool verify_symtab_base ( )
   Verify common part of symtab nodes.  

References error().

DEBUG_FUNCTION void verify_symtab_node ( )
   Verify consistency of NODE.  

Variable Documentation

htab_t assembler_name_hash
   Hash table used to convert assembler names into nodes.  

Referenced by eq_assembler_name().

const char* const ld_plugin_symbol_resolution_names[]
Initial value:

Symbol table. Copyright (C) 2012-2013 Free Software Foundation, Inc. Contributed by Jan Hubicka

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.

htab_t symtab_hash
   Hash table used to convert declarations into nodes.  
symtab_node symtab_nodes
   Linked list of symbol table nodes.  
int symtab_order
   The order index of the next symtab node to be created.  This is
   used so that we can sort the cgraph nodes in order by when we saw
   them, to support -fno-toplevel-reorder.  

Referenced by input_overwrite_node().

const char* const symtab_type_names[] = {"symbol", "function", "variable"}