From owner-freebsd-toolchain@FreeBSD.ORG Thu Mar 8 13:52:00 2012 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84FDD1065670 for ; Thu, 8 Mar 2012 13:52:00 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id D10728FC20 for ; Thu, 8 Mar 2012 13:51:59 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q28Dpeex021212; Thu, 8 Mar 2012 15:51:40 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q28DpdK9095367; Thu, 8 Mar 2012 15:51:39 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q28Dpb9q095366; Thu, 8 Mar 2012 15:51:37 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 8 Mar 2012 15:51:37 +0200 From: Konstantin Belousov To: freebsd-toolchain@freebsd.org Message-ID: <20120308135137.GP75778@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="AFmbwsUflYm/9XUC" Content-Disposition: inline User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: flo@freebsd.org, mips@freebsd.org, kan@freebsd.org, ia64@freebsd.org, Andrew Turner , John Marino Subject: init arrays patch X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Mar 2012 13:52:00 -0000 --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--