https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88546
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org,
| |jsm28 at gcc dot gnu.org,
| |law at gcc dot gnu.org,
| |mpolacek at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Or another option would be to allow leaf attribute on the weakrefs, but we
haven't allowed that for a couple of releases already.
E.g.
extern int foo (void) __attribute__((leaf));
static __typeof (foo) bar __attribute__((weakref ("foo"), leaf));
static int a;
int
baz (void)
{
a = 1;
foo ();
return a;
}
int
qux (void)
{
a = 1;
bar ();
return a;
}
isn't optimized in qux because leaf attribute isn't on the weakref.
Weakrefs are a weird thing, they are static because it is an alias affecting
the local TU only, but they are effectively external calls most of the time.