Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Dec 2011 13:08:26 +0200
From:      Kostik Belousov <kostikbel@gmail.com>
To:        toolchain@freebsd.org
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r228435 - in head/libexec/rtld-elf: . amd64 arm i386 ia64 mips powerpc powerpc64 sparc64
Message-ID:  <20111212110826.GM50300@deviant.kiev.zoral.com.ua>
In-Reply-To: <201112121103.pBCB3FuT097580@svn.freebsd.org>
References:  <201112121103.pBCB3FuT097580@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--FYQbxHc1c8B/Anrp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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
>=20
> 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.
>  =20
>   To allow use of external references from the dispatch function, resolut=
ion
>   of the R_MACHINE_IRESOLVE relocations in PLT is postponed until GOT ent=
ries
>   for PLT are prepared, and normal resolution of the GOT entries is finis=
hed.
>   Similar to how it is done by GNU, IRELATIVE relocations are resolved in
>   advance, instead of normal lazy handling for PLT.
>  =20
>   Move the init_pltgot() call before the relocations for the object are
>   processed.
>  =20
>   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.

--FYQbxHc1c8B/Anrp
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (FreeBSD)

iEYEARECAAYFAk7l4KkACgkQC3+MBN1Mb4guPACgw8rUbLaX0VIlDbgKQcrP97Hw
sZUAoOckniL1/o/Q7XMsuI3hs5Vbqqcv
=eV03
-----END PGP SIGNATURE-----

--FYQbxHc1c8B/Anrp--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111212110826.GM50300>