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 3:22 AM, Paolo Bonzini<bonzini@gnu.org> wrote:
> Richard Guenther wrote:
>>
>> On Tue, Jun 23, 2009 at 7:19 PM, H.J. Lu<hjl.tools@gmail.com> wrote:
>>>
>>> Hi,
>>>
>>> I opened a bug report:
>>>
>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40528
>>>
>>> with the third proposal:
>>>
>>> 3. Ifunc attribute with prototype, but without argument:
>>>
>>> int
>>> __attribute__ ((ifunc))
>>> foo (...)
>>> {
>>> ?<return address of foo_{1,2,3}>
>>> }
>>>
>>> We can call foo in the same file. Gcc checks the return value for
>>> foo.
>>>
>>> Any comments?
>>
>> I don't understand this third proposal.
>
> "int foo (...)" is only declared as a prototype and with the ifunc attribute
> dropped. ?The body of the function is actually compiled to .ifunc.foo or
> something like that, with a signature
>
> __typeof(foo) __attribute__ ((ifunc)) .ifunc.foo(void)
>
> and with ".gnu.indirect.function .ifunc.foo" emitted in the assembly instead
> of ".function".
>
> Via some magic mechanism, a further redeclaration of foo is prohibited.
>
> 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.

Since foo_ifunc isn't generated, you can't call foo_ifunc.


-- 
H.J.


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