> On 05/09/13 07:02, Nathan Sidwell wrote:
> >On 05/08/13 18:47, Jan Hubicka wrote:
> 
> >>Thinking about it again, isn't decl_replaceable_p the thing you are looking 
> >>for
> >>here?
> >
> >that looks promising.  I'll try !decl_replaceable_p in the section anchor 
> >hook.
> 
> It does indeed seem to be the right predicate.
> tested with a ppc-linux target, ok?

Looks good to me.  We eventually ought to do some renaming and move all the 
predicates
to single place.  It is really hard to make sense of them as they are organized 
currently.

Honza
> 
> nathan

> 2013-05-13  Nathan Sidwell  <nat...@codesourcery.com>
> 
>       gcc/
>       * varasm.c (default_use_anchors_for_symbol_p): Use decl_replaceable_p.
> 
>       gcc/testsuite/
>       * gcc.dg/visibility-21.c: New.
> 
> Index: varasm.c
> ===================================================================
> --- varasm.c  (revision 198771)
> +++ varasm.c  (working copy)
> @@ -6582,10 +6582,18 @@ default_use_anchors_for_symbol_p (const_
>      {
>        /* Don't use section anchors for decls that might be defined by
>        other modules.  */
> -      if (!targetm.binds_local_p (decl))
> +      if (decl_replaceable_p (decl))
>       return false;
>  
>        /* Don't use section anchors for decls that will be placed in a
> Index: testsuite/gcc.dg/visibility-21.c
> ===================================================================
> --- testsuite/gcc.dg/visibility-21.c  (revision 0)
> +++ testsuite/gcc.dg/visibility-21.c  (revision 0)
> @@ -0,0 +1,13 @@
> +/* Test visibility attribute on function definition. */
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -fsection-anchors" } */
> +/* { dg-require-visibility "" } */
> +/* { dg-require-weak "" } */
> +/* { dg-final { scan-assembler-not "ANCHOR" } } */
> +
> +int __attribute__((weak, visibility("hidden"))) weak_hidden[3];
> +
> +int *f_weak_hidden ()
> +{
> +  return weak_hidden;
> +}

Reply via email to