Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Mar 2012 15:51:37 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        freebsd-toolchain@freebsd.org
Cc:        flo@freebsd.org, mips@freebsd.org, kan@freebsd.org, ia64@freebsd.org, Andrew Turner <andrew@fubar.geek.nz>, John Marino <draco@marino.st>
Subject:   init arrays patch
Message-ID:  <20120308135137.GP75778@deviant.kiev.zoral.com.ua>

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

--AFmbwsUflYm/9XUC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,
The latest version of the patch to add support for init and fini arrays
for FreeBSD is available at
http://people.freebsd.org/~kib/misc/init_array.7.patch

Apparently, some variant of ARM ABI mandates the use of arrays, so
there is a demand for the change. Also, it is another step to bring
us closer to modern ELF platform.

I decided to change ABI by no longer calling _init/_fini functions from
the crt1 for dynamic binaries. To keep the backward compatibility,
a new ELF note is added for binaries that have modern crt1. The rtld now
parses notes and calls _init/_fini itsef. This is done to easier the
implementation of the proper order between preinit array, _init and
init array.

The patch passes make universe, was tested by me on i386 and amd64, a
previous version of the patch was tested by Andrew on arm. The sparc64,
ia64, mips and both powerpc are not tested. Please note that ia64 also
has old kind of crt1, which calls _init and does not provide note. The
cause is that crt1.S for ia64 is written in assembly, which I do not
know, and have no access to machine.

Good test for the patch is to boot new world with old ports, which were
linked with old crt1. Also, there is a test suite at
http://people.freebsd.org/~kib/misc/rtld-init_array_tests.tbz
Use top-level script run_tests.sh to run the tests, possibly changing
the CC variable to point to your preferred compiler. Normal run shall
produce no output.

Looking for feedback, test results, esp. on the listed architectures.

--AFmbwsUflYm/9XUC
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (FreeBSD)

iEYEARECAAYFAk9YuWgACgkQC3+MBN1Mb4gkgACcCXELzfN2XuSb2m07z9QvTtMr
Mw0An218HlUBfYe0U8so4aCtoGPJPm7j
=uxxE
-----END PGP SIGNATURE-----

--AFmbwsUflYm/9XUC--



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