gcc-patches@gcc.gnu.org
[Top] [All Lists]

Re: PATCH: Add ifunc attribute

Subject: Re: PATCH: Add ifunc attribute
From: Roland McGrath
Date: Wed, 24 Jun 2009 11:10:45 -0700 PDT
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) *
        foo_ifunc (void)
        {
          return &foo_1;
        }

        __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.


Thanks,
Roland

<Prev in Thread] Current Thread [Next in Thread>