diff options
Diffstat (limited to 'gcc/cgraph.h')
-rw-r--r-- | gcc/cgraph.h | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/gcc/cgraph.h b/gcc/cgraph.h index e689fcd..7c643502 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -249,9 +249,10 @@ public: inline symtab_node *next_defined_symbol (void); /* Add reference recording that symtab node is alias of TARGET. + If TRANSPARENT is true make the alias to be transparent alias. The function can fail in the case of aliasing cycles; in this case it returns false. */ - bool resolve_alias (symtab_node *target); + bool resolve_alias (symtab_node *target, bool transparent = false); /* C++ FE sometimes change linkage flags after producing same body aliases. */ @@ -421,6 +422,28 @@ public: /* True when symbol is an alias. Set by ssemble_alias. */ unsigned alias : 1; + /* When true the alias is translated into its target symbol either by GCC + or assembler (it also may just be a duplicate declaration of the same + linker name). + + Currently transparent aliases come in three different flavors + - aliases having the same assembler name as their target (aka duplicated + declarations). In this case the assembler names compare via + assembler_names_equal_p and weakref is false + - aliases that are renamed at a time being output to final file + by varasm.c. For those DECL_ASSEMBLER_NAME have + IDENTIFIER_TRANSPARENT_ALIAS set and thus also their assembler + name must be unique. + Weakrefs belong to this cateogry when we target assembler without + .weakref directive. + - weakrefs that are renamed by assembler via .weakref directive. + In this case the alias may or may not be definition (depending if + target declaration was seen by the compiler), weakref is set. + Unless we are before renaming statics, assembler names are different. + + Given that we now support duplicate declarations, the second option is + redundant and will be removed. */ + unsigned transparent_alias : 1; /* True when alias is a weakref. */ unsigned weakref : 1; /* C++ frontend produce same body aliases and extra name aliases for @@ -2098,6 +2121,10 @@ public: /* Set the DECL_ASSEMBLER_NAME and update symtab hashtables. */ void change_decl_assembler_name (tree decl, tree name); + /* Return true if assembler names NAME1 and NAME2 leads to the same symbol + name. */ + static bool assembler_names_equal_p (const char *name1, const char *name2); + int cgraph_count; int cgraph_max_uid; int cgraph_max_summary_uid; @@ -2251,6 +2278,8 @@ symtab_node::real_symbol_p (void) if (DECL_ABSTRACT_P (decl)) return false; + if (transparent_alias && definition) + return false; if (!is_a <cgraph_node *> (this)) return true; cnode = dyn_cast <cgraph_node *> (this); |