This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Check ifunc_resolver only on FUNCTION_DECL


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]