Why very little documentation on "ifunc"?

Polytropon freebsd at edvax.de
Sat Mar 30 04:57:10 UTC 2019

On Sat, 30 Mar 2019 09:39:35 +0530, Mayuresh Kathe wrote:
> On 2019-03-30 08:59 AM, Polytropon wrote:
> > On Sat, 30 Mar 2019 07:28:23 +0530, Mayuresh Kathe wrote:
> >> Ever since I stumbled upon "ifunc" I have been unable to find good
> >> enough documentation regarding it under FreeBSD, that was till "Ed
> >> Maste" pointed out;
> >> https://jasoncc.github.io/gnu_gcc_glibc/gnu-ifunc.html
> >> 
> >> "ifunc" seems to be a really good tool, wonder why it isn't as well
> >> documented as rest of the stuff under FreeBSD.
> > 
> > From what I see, ifunc is part of GCC, and FreeBSD does no longer
> > use GCC as the system compiler (after switching to Clang/LLVM).
> > The case for ifunc documentation therefore has to be discussed
> > primarily in the context of GNU development tools.
> > 
> > 	https://sourceware.org/glibc/wiki/GNU_IFUNC
> > 
> > Of course, Clang/LLVM also has (limited) support for it:
> > 
> > 	https://clang.llvm.org/docs/AttributeReference.html#ifunc
> > 
> > So this is nothing FreeBSD-specific which should be covered by
> > OS documentation in the first place. But it could maybe find a
> > place in the FreeBSD Porter's Handbook.
> Not really, as "Ed Maste" had pointed out to me, "ifunc" was only 
> _designed_ by GNU, the "ifunc" implementation under FreeBSD is 
> completely native to FreeBSD.

Yes, that is correct. As I said, it originates in GCC, but Clang/LLVM
implements it, partially:

	Not all targets support this attribute. ELF target
	support depends on both the linker and runtime linker,
	and is available in at least lld 4.0 and later,
	binutils 2.20.1 and later, glibc v2.11.1 and later,
	and FreeBSD 9.1 and later. Non-ELF targets currently
	do not support this attribute.

So current FreeBSD has the required support for this mechanism.

> It's sad that an advanced technology such as "ifunc" is not even 
> documented in the Developer's Handbook.

True - it should at least be mentioned there, and including some
links to the relevant documentation of "the two big compilers".

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list