I don't see why it should be quite so magical. That is, I'd prefer the
definition of the address-returner to be more normal. e.g.:
static __typeof (foo) *
__typeof (foo) foo __attribute__ ((ifunc ("foo_ifunc")));
This is more like alias. The upshot is that there is nothing special about
the definition of foo_ifunc. It can be static or not as you want, its name
is a normal symbol. Then the definition of the STT_IFUNC symbol is
separate and refers to that symbol. Like an alias, it has to be defined in
the same module but the referenced symbol is not otherwise strange. It can
complain if __typeof (foo) != (__typeof (foo_ifunc) *), but that is all.
If someone wants to make it exported or whatever, that is their business.
There is nothing untoward about it. The definer of an STT_IFUNC symbol is
responsible for providing an entry point that is appropriate for the
dynamic linker's implicit calls. But there is no reason at all that this
same entry point cannot have other uses if its author wants it to.