[gcc(refs/users/aoliva/heads/testme)] ifunc alias: follow alias links testing for ifunc_resolver
Alexandre Oliva
aoliva@gcc.gnu.org
Thu Aug 4 14:24:32 GMT 2022
https://gcc.gnu.org/g:f4b1a9fc2a729c93263f4fb19fb1614a8df21d32
commit f4b1a9fc2a729c93263f4fb19fb1614a8df21d32
Author: Alexandre Oliva <oliva@gnu.org>
Date: Thu Aug 4 09:21:15 2022 -0300
ifunc alias: follow alias links testing for ifunc_resolver
Diff:
---
gcc/cgraph.cc | 2 +-
gcc/cgraph.h | 10 ++++++++++
gcc/config/i386/i386.cc | 4 ++--
gcc/symtab.cc | 2 +-
gcc/tree-ssa-structalias.cc | 4 ++--
gcc/varasm.cc | 2 +-
6 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc
index 8d6ed38efa2..69988c6854a 100644
--- a/gcc/cgraph.cc
+++ b/gcc/cgraph.cc
@@ -2408,7 +2408,7 @@ static bool
cgraph_node_cannot_be_local_p_1 (cgraph_node *node, void *)
{
return !(!node->force_output
- && !node->ifunc_resolver
+ && !node->ifunc_resolver_p ()
/* Limitation of gas requires us to output targets of symver aliases
as global symbols. This is binutils PR 25295. */
&& !node->symver
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 4be67e3cea9..649f14b9cb4 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -1283,6 +1283,16 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node
calls_comdat_local flag after function transformations. */
bool check_calls_comdat_local_p ();
+ /* Check if function is an [alias to] ifunc resolver. */
+ bool ifunc_resolver_p () {
+ if (ifunc_resolver)
+ return true;
+ if (!alias)
+ return false;
+ cgraph_node *node = get_alias_target ();
+ return node && node->ifunc_resolver_p ();
+ }
+
/* Return true if function should be optimized for size. */
enum optimize_size_level optimize_for_size_p (void);
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 5e30dc884bf..e88621611c3 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -1020,7 +1020,7 @@ ix86_function_ok_for_sibcall (tree decl, tree exp)
/* When PIC register is used, it must be restored after ifunc
function returns. */
cgraph_node *node = cgraph_node::get (decl);
- if (node && node->ifunc_resolver)
+ if (node && node->ifunc_resolver_p ())
return false;
}
@@ -16062,7 +16062,7 @@ ix86_call_use_plt_p (rtx call_op)
/* NB: All ifunc functions must be called via PLT. */
cgraph_node *node
= cgraph_node::get (SYMBOL_REF_DECL (call_op));
- if (node && node->ifunc_resolver)
+ if (node && node->ifunc_resolver_p ())
return true;
}
return false;
diff --git a/gcc/symtab.cc b/gcc/symtab.cc
index f2d96c0268b..b3176f729ab 100644
--- a/gcc/symtab.cc
+++ b/gcc/symtab.cc
@@ -2480,7 +2480,7 @@ symtab_node::binds_to_current_def_p (symtab_node *ref)
return definition
&& get_alias_target()->binds_to_current_def_p (ref);
cgraph_node *cnode = dyn_cast <cgraph_node *> (this);
- if (cnode && cnode->ifunc_resolver)
+ if (cnode && cnode->ifunc_resolver_p ())
return false;
if (decl_binds_to_current_def_p (decl))
return true;
diff --git a/gcc/tree-ssa-structalias.cc b/gcc/tree-ssa-structalias.cc
index dcf13d939bd..6612ac917d4 100644
--- a/gcc/tree-ssa-structalias.cc
+++ b/gcc/tree-ssa-structalias.cc
@@ -6381,7 +6381,7 @@ create_variable_info_for (tree decl, const char *name, bool add_id)
if (in_ipa_mode
&& TREE_CODE (decl) == FUNCTION_DECL
&& (node = cgraph_node::get (decl))
- && node->ifunc_resolver)
+ && node->ifunc_resolver_p ())
{
varinfo_t fi = get_vi_for_tree (node->get_alias_target ()->decl);
constraint_expr rhs
@@ -8150,7 +8150,7 @@ associate_varinfo_to_alias (struct cgraph_node *node, void *data)
|| (node->thunk
&& ! node->inlined_to))
&& node->analyzed
- && !node->ifunc_resolver)
+ && !node->ifunc_resolver_p ())
insert_vi_for_tree (node->decl, (varinfo_t)data);
return false;
}
diff --git a/gcc/varasm.cc b/gcc/varasm.cc
index 4db8506b106..f5cbe67f3f1 100644
--- a/gcc/varasm.cc
+++ b/gcc/varasm.cc
@@ -7486,7 +7486,7 @@ default_binds_local_p_3 (const_tree exp, bool shlib, bool weak_dominate,
|| (!targetm.ifunc_ref_local_ok ()
&& TREE_CODE (exp) == FUNCTION_DECL
&& cgraph_node::get (exp)
- && cgraph_node::get (exp)->ifunc_resolver))
+ && cgraph_node::get (exp)->ifunc_resolver_p ()))
return false;
/* Static variables are always local. */
More information about the Gcc-cvs
mailing list