Message ID | 20180524114325.GA26432@intel.com |
---|---|
State | New |
Headers | show |
Series | Check ifunc_resolver only on FUNCTION_DECL | expand |
On 05/24/2018 05:43 AM, 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. OK. jeff
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
On Fri, May 25, 2018 at 4:48 AM, H.J. Lu <hongjiu.lu@intel.com> wrote: > 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 > Dominique verified that it fixed all Darwin issues. I am checking it in.
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