summaryrefslogtreecommitdiff
path: root/gcc/ipa-icf.c
diff options
context:
space:
mode:
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-11 14:58:21 +0000
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-11 14:58:21 +0000
commite1daea7b1d01fa0eaa21b6e70349beccc47f97e2 (patch)
tree36d087fa42af05384912f0250f79574a53c1fd02 /gcc/ipa-icf.c
parent662274eebc1318f5a70fdb362da74f7913fbf1ba (diff)
downloadgcc-e1daea7b1d01fa0eaa21b6e70349beccc47f97e2.tar.gz
PR ipa/63622
PR ipa/63795 * g++.dg/ipa/ipa-icf-4.C: Add more precise dump scan. * g++.dg/ipa/ipa-icf-5.C: Add condition for target with symbol alias support. * ipa-icf.c (sem_function::merge): Add new target symbol alias support guard. (sem_variable::merge): Likewise. * ipa-icf.h (target_supports_symbol_aliases_p): New function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217355 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-icf.c')
-rw-r--r--gcc/ipa-icf.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index 84cc0ca0ba1..92ec82d7c8a 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -191,6 +191,18 @@ sem_item::dump (void)
}
}
+/* Return true if target supports alias symbols. */
+
+bool
+sem_item::target_supports_symbol_aliases_p (void)
+{
+#if !defined (ASM_OUTPUT_DEF) || (!defined(ASM_OUTPUT_WEAK_ALIAS) && !defined (ASM_WEAKEN_DECL))
+ return false;
+#else
+ return true;
+#endif
+}
+
/* Semantic function constructor that uses STACK as bitmap memory stack. */
sem_function::sem_function (bitmap_obstack *stack): sem_item (FUNC, stack),
@@ -589,7 +601,8 @@ sem_function::merge (sem_item *alias_item)
redirect_callers = false;
}
- if (create_alias && DECL_COMDAT_GROUP (alias->decl))
+ if (create_alias && (DECL_COMDAT_GROUP (alias->decl)
+ || !sem_item::target_supports_symbol_aliases_p ()))
{
create_alias = false;
create_thunk = true;
@@ -605,6 +618,14 @@ sem_function::merge (sem_item *alias_item)
local_original
= dyn_cast <cgraph_node *> (original->noninterposable_alias ());
+ if (!local_original)
+ {
+ if (dump_file)
+ fprintf (dump_file, "Noninterposable alias cannot be created.\n\n");
+
+ return false;
+ }
+
if (redirect_callers)
{
/* If alias is non-overwritable then
@@ -649,7 +670,7 @@ sem_function::merge (sem_item *alias_item)
alias->resolve_alias (original);
/* Workaround for PR63566 that forces equal calling convention
- to be used. */
+ to be used. */
alias->local.local = false;
original->local.local = false;
@@ -1155,6 +1176,13 @@ sem_variable::merge (sem_item *alias_item)
{
gcc_assert (alias_item->type == VAR);
+ if (!sem_item::target_supports_symbol_aliases_p ())
+ {
+ if (dump_file)
+ fprintf (dump_file, "Symbol aliases are not supported by target\n\n");
+ return false;
+ }
+
sem_variable *alias_var = static_cast<sem_variable *> (alias_item);
varpool_node *original = get_node ();