PATCH: Add ifunc attribute
H.J. Lu
hjl.tools@gmail.com
Sat Jun 13 19:58:00 GMT 2009
On Sat, Jun 13, 2009 at 8:15 AM, Richard
Guenther<richard.guenther@gmail.com> wrote:
>>
>> I started to write my own version of the documentation, but I realized
>> that I don't even understand this. Which function is called by the
>> dynamic linker, "f" or "f_ifunc"? Why is the attribute ignored if
>> "f_ifunc" is not defined; shouldn't it be an error? I guess that means
>> that "f_ifunc" is called by the dynamic linker; in that case, what
>> happens if "func" is defined?
>
> Yeah. I would have proposed that
>
> void *foo (void) __attribute__((__ifunc__))
> {
> return zero;
> }
>
> would simply generate foo with indirect function type.
>
> This of course causes a problem if you have a declaration for
> the real foo available - but then you should better not have that,
> as the compiler will then derive wrong properties for the real foo
> from the ifunc wrapper body.
>
Glibc has ifunc testcases with a declaration of foo in the same file.
This proposal won't work with them.
---
H.J.
More information about the Libc-alpha
mailing list