aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2011-06-15 14:01:17 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2011-06-15 12:01:17 +0000
commit85ce937577ea720114fab3a8e5993be0cc6f6d7f (patch)
tree69ae811174a006e95d844f0fcb1b426efbb9c973 /gcc
parenta577c4054fc7aa9a5228feb6f0bdb37cf31997d5 (diff)
downloadgcc-85ce937577ea720114fab3a8e5993be0cc6f6d7f.zip
gcc-85ce937577ea720114fab3a8e5993be0cc6f6d7f.tar.gz
gcc-85ce937577ea720114fab3a8e5993be0cc6f6d7f.tar.bz2
cgraphunit.c (handle_alias_pairs): New function.
* cgraphunit.c (handle_alias_pairs): New function. (cgraph_finalize_compilation_unit): Use it. * ipa.c (cgraph_externally_visible_p): Remove hack marking asm names as externally visible. From-SVN: r175079
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/cgraphunit.c45
-rw-r--r--gcc/ipa.c8
3 files changed, 52 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d52725c..142856a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2011-06-13 Jan Hubicka <jh@suse.cz>
+
+ * cgraphunit.c (handle_alias_pairs): New function.
+ (cgraph_finalize_compilation_unit): Use it.
+ * ipa.c (cgraph_externally_visible_p): Remove hack marking asm names
+ as externally visible.
+
2011-06-15 Richard Guenther <rguenther@suse.de>
* expr.c (expand_expr_real_2): Reduce all integral types to
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 0e7842c..88d0fac 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -1175,6 +1175,49 @@ cgraph_analyze_functions (void)
ggc_collect ();
}
+/* Translate the ugly representation of aliases as alias pairs into nice
+ representation in callgraph. We don't handle all cases yet,
+ unforutnately. */
+
+static void
+handle_alias_pairs (void)
+{
+ alias_pair *p;
+ unsigned i;
+ struct cgraph_node *target_node;
+ struct cgraph_node *src_node;
+
+ for (i = 0; VEC_iterate (alias_pair, alias_pairs, i, p);)
+ {
+ if (TREE_CODE (p->decl) == FUNCTION_DECL
+ && !lookup_attribute ("weakref", DECL_ATTRIBUTES (p->decl))
+ && (target_node = cgraph_node_for_asm (p->target)) != NULL)
+ {
+ src_node = cgraph_get_node (p->decl);
+ if (src_node && src_node->local.finalized)
+ cgraph_reset_node (src_node);
+ /* Normally EXTERNAL flag is used to mark external inlines,
+ however for aliases it seems to be allowed to use it w/o
+ any meaning. See gcc.dg/attr-alias-3.c
+ However for weakref we insist on EXTERNAL flag being set.
+ See gcc.dg/attr-alias-5.c */
+ if (DECL_EXTERNAL (p->decl))
+ DECL_EXTERNAL (p->decl) = 0;
+ cgraph_create_function_alias (p->decl, target_node->decl);
+ VEC_unordered_remove (alias_pair, alias_pairs, i);
+ }
+ else
+ {
+ if (dump_file)
+ fprintf (dump_file, "Unhandled alias %s->%s\n",
+ IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (p->decl)),
+ IDENTIFIER_POINTER (p->target));
+
+ i++;
+ }
+ }
+}
+
/* Analyze the whole compilation unit once it is parsed completely. */
@@ -1200,6 +1243,7 @@ cgraph_finalize_compilation_unit (void)
/* Mark alias targets necessary and emit diagnostics. */
finish_aliases_1 ();
+ handle_alias_pairs ();
if (!quiet_flag)
{
@@ -1216,6 +1260,7 @@ cgraph_finalize_compilation_unit (void)
/* Mark alias targets necessary and emit diagnostics. */
finish_aliases_1 ();
+ handle_alias_pairs ();
/* Gimplify and lower thunks. */
cgraph_analyze_functions ();
diff --git a/gcc/ipa.c b/gcc/ipa.c
index 62510c6..b9ae579 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -612,14 +612,6 @@ cgraph_externally_visible_p (struct cgraph_node *node,
if (DECL_BUILT_IN (node->decl))
return true;
- /* FIXME: We get wrong symbols with asm aliases in callgraph and LTO.
- This is because very little of code knows that assembler name needs to
- mangled. Avoid touching declarations with user asm name set to mask
- some of the problems. */
- if (DECL_ASSEMBLER_NAME_SET_P (node->decl)
- && IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->decl))[0]=='*')
- return true;
-
/* If linker counts on us, we must preserve the function. */
if (cgraph_used_from_object_file_p (node))
return true;