This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Add ifunc attribute


On Wed, Jun 24, 2009 at 4:54 PM, Richard Henderson<rth@twiddle.net> wrote:
> On 06/24/2009 03:22 AM, Paolo Bonzini wrote:
>>
>> Looks a bit too like DWIM and too little like a specification. I think I
>> prefer option 1, in some cases you may want to call the trampoline and
>> having it accessible can help. With
>>
>> __typeof (foo) *
>> __attribute__ ((ifunc ("foo")))
>> foo_ifunc (void)
>> {
>> <return address of foo_{1,2,3}>
>> }
>>
>> you could call foo_ifunc if you wish in principle, and the header file
>> only has the prototype of foo as expected.
>
> I think I have to agree with you, Paolo. ?This example is the sort of
> thing I'd expect to actually be writing.

You wouldn't call foo_ifunc but maybe one of foo_{1,2,3} directly.  At
least for non-trivial foo_ifunc implementations.

I still fail to see why we need the ifunc argument here though.

__typeof (foo) *
__attribute__((ifunc))
foo_ifunc (void) asm("foo")
{
  <return address of foo_{1,2,3}>
}

works for me.  Adding __attribute__((alias("foo_ifunc"))) should
make an alias available that you could call directly if you really
want to.

Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]