svn commit: r228435 - in head/libexec/rtld-elf: . amd64 arm i386 ia64 mips powerpc powerpc64 sparc64

Kostik Belousov kostikbel at gmail.com
Mon Dec 12 11:19:05 UTC 2011


On Mon, Dec 12, 2011 at 11:03:15AM +0000, Konstantin Belousov wrote:
> Author: kib
> Date: Mon Dec 12 11:03:14 2011
> New Revision: 228435
> URL: http://svn.freebsd.org/changeset/base/228435
> 
> Log:
>   Add support for STT_GNU_IFUNC and R_MACHINE_IRELATIVE GNU extensions to
>   rtld on 386 and amd64. This adds runtime bits neccessary for the use
>   of the dispatch functions from the dynamically-linked executables and
>   shared libraries.
>   
>   To allow use of external references from the dispatch function, resolution
>   of the R_MACHINE_IRESOLVE relocations in PLT is postponed until GOT entries
>   for PLT are prepared, and normal resolution of the GOT entries is finished.
>   Similar to how it is done by GNU, IRELATIVE relocations are resolved in
>   advance, instead of normal lazy handling for PLT.
>   
>   Move the init_pltgot() call before the relocations for the object are
>   processed.
>   
>   MFC after:	3 weeks

An example use of the facilities is provided at
http://vger.kernel.org/~davem/cgi-bin/blog.cgi/2010/02/07
Inner working is described by
http://www.airs.com/blog/archives/403

To use this feature on FreeBSD, you need patched gas from recent
binutils. Patch is available at
http://people.freebsd.org/~kib/misc/gas_ifunc_freebsd.1.patch.
The 4.6 gcc should be configured with --enable-gnu-indirect-function
option to turn on the 'ifunc' function attributes, no patch for
compiler is required.

Only dynamically linked executables and shared objects are supported,
support for static binaries requires changes for csu. Since in-tree
toolchain cannot handle dispatch, and I am only interested in the
dynamic linking case, I did not modified csu. If we ever need dispatch
for system libraries (cases like CPU-optimized string functions, or
math) and have a capable toolchain, I promise to add support for
static binaries.

I handled just x86oids. If maintainer of missed architecture wants to
implement dispatch, I am willing to help (as usual).

Does anybody on toolchain@ know how to submit the gas change to
maintainers for inclusion into mainline, or better, can submit it
himself ? I assume that no copyright assignment is required for this
trivial flip of settings.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-toolchain/attachments/20111212/063432ae/attachment.pgp


More information about the freebsd-toolchain mailing list