This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Check ifunc_resolver only on FUNCTION_DECL
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: gcc-patches at gcc dot gnu dot org, Jan Hubicka <hubicka at ucw dot cz>, dominiq at lps dot ens dot fr
- Date: Fri, 25 May 2018 04:48:36 -0700
- Subject: Re: [PATCH] Check ifunc_resolver only on FUNCTION_DECL
- References: <20180524114325.GA26432@intel.com>
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
On Thu, May 24, 2018 at 04:43:25AM -0700, H.J. Lu wrote:
> Since ifunc_resolver is only valid on FUNCTION_DECL, check ifunc_resolver
> only on FUNCTION_DECL.
>
> Please test it on Darwin.
>
>
> H.J.
> ---
> PR target/85900
> PR target/85345
> * varasm.c (assemble_alias): Check ifunc_resolver only on
> FUNCTION_DECL.
> ---
> gcc/varasm.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/varasm.c b/gcc/varasm.c
> index 3bd9cbb69f0..bff43450a91 100644
> --- a/gcc/varasm.c
> +++ b/gcc/varasm.c
> @@ -5917,7 +5917,8 @@ assemble_alias (tree decl, tree target)
> # else
> if (!DECL_WEAK (decl))
> {
> - if (cgraph_node::get (decl)->ifunc_resolver)
> + if (TREE_CODE (decl) == FUNCTION_DECL
> + && cgraph_node::get (decl)->ifunc_resolver)
> error_at (DECL_SOURCE_LOCATION (decl),
> "ifunc is not supported in this configuration");
> else
> --
Please test it on Darwin.
H.J.
---
Since ifunc_resolver isn't set when an error is detected, we should
lookup ifunc attribute in this case.
PR target/85900
PR target/85345
* varasm.c (assemble_alias): Lookup ifunc attribute on error.
---
gcc/varasm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 6b9f87b203f..4d332f50270 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -5917,8 +5917,9 @@ assemble_alias (tree decl, tree target)
# else
if (!DECL_WEAK (decl))
{
+ /* NB: ifunc_resolver isn't set when an error is detected. */
if (TREE_CODE (decl) == FUNCTION_DECL
- && cgraph_node::get (decl)->ifunc_resolver)
+ && lookup_attribute ("ifunc", DECL_ATTRIBUTES (decl)))
error_at (DECL_SOURCE_LOCATION (decl),
"ifunc is not supported in this configuration");
else
--
2.17.0