PATCH: Add ifunc attribute
Ian Lance Taylor
iant@google.com
Sat Jun 13 06:11:00 GMT 2009
"H.J. Lu" <hongjiu.lu@intel.com> writes:
> +@item ifunc ("@var{function}")
> +@cindex @code{ifunc} attribute
> +The @code{ifunc} attribute only applies to global function definition,
> +which causes the definition to be emitted as an indirec function. For
> +instance,
> +
> +@smallexample
> +void* f_ifunc () __attribute__ ((ifunc ("f")));
> +@end smallexample
> +
> +defines @samp{f_ifunc} to be an indirect function for @samp{f}. This
> +attribute is ignored if @samp{f_ifunc} is undefined in the same
> +translation unit.
> +
> +See @code{STT_GNU_IFUNC} specified in @file{ifunc.txt} at
> +@uref{http://groups.google.com/group/generic-abi/files}.
> +
> +Not all target machines support this attribute.
This documentation needs to be much better. I think most people reading
this would not understand the feature. I would suggest something more
along these lines, but I would like to hear what other people think.
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?
Ian
More information about the Libc-alpha
mailing list