From owner-freebsd-hackers@FreeBSD.ORG Sun Dec 16 14:03:45 2012 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D7AFA13C; Sun, 16 Dec 2012 14:03:45 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 2D6AA8FC0C; Sun, 16 Dec 2012 14:03:45 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.5/8.14.5) with ESMTP id qBGE3e8k094819; Sun, 16 Dec 2012 16:03:40 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.7.3 kib.kiev.ua qBGE3e8k094819 Received: (from kostik@localhost) by tom.home (8.14.5/8.14.5/Submit) id qBGE3egL094818; Sun, 16 Dec 2012 16:03:40 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 16 Dec 2012 16:03:40 +0200 From: Konstantin Belousov To: Baptiste Daroussin , hackers@freebsd.org Subject: Re: Fix overlinking in base aka import pkgconf Message-ID: <20121216140340.GY71906@kib.kiev.ua> References: <20121214235418.GF18884@ithaqua.etoilebsd.net> <20121215012233.GP71906@kib.kiev.ua> <20121215105643.GG18884@ithaqua.etoilebsd.net> <20121216130100.GD15112@felucia.tataz.chchile.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="zFHfQTJdDMtDGy0L" Content-Disposition: inline In-Reply-To: <20121216130100.GD15112@felucia.tataz.chchile.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 14:03:45 -0000 --zFHfQTJdDMtDGy0L Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Dec 16, 2012 at 02:01:00PM +0100, Jeremie Le Hen wrote: > Hi bapt, kib, >=20 > On Sat, Dec 15, 2012 at 11:56:43AM +0100, Baptiste Daroussin wrote: > > On Sat, Dec 15, 2012 at 03:22:34AM +0200, Konstantin Belousov wrote: > > > On Sat, Dec 15, 2012 at 12:54:19AM +0100, Baptiste Daroussin wrote: > > > > Hi, > > > >=20 > > > > Some of our binary are overlinked, the way we handle the linking do= esn't help > > > > for that. > > > What do you mean there ? Do you mean that some libraries specified fo= r the > > > linking stage of the final binary are not needed for the execution ? > >=20 > > I mean some library are registrer in the binary with DT_NEEDED tag wher= e they > > don't need to. > >=20 > > >=20 > > > >=20 > > > > On proposition could be to use pkgconf https://github.com/pkgconf/p= kgconf which > > > > is BSD license pkg-config implementation 100% compatible with pkg-c= onfig. > > > >=20 > > > > What I propose is to create a new PCADD variable for the Makefiles. > > > >=20 > > > > PCADD will invoke pkgconf to gather the libraries and the cflags fo= r a given > > > > project. > > > >=20 > > > > The second thing would be to create .pc files for all of our librar= ies. > > > >=20 > > > > for example: > > > > usr.bin/fstat dynamic build is overlinked > > > And how this is better than just removing the unneeded library from > > > the Makefile ? > >=20 > > In that case to statically build you need -lkvm -lutil -lprocstat but i= f you > > build dynamically you will only need -lproctast meaning you don't need = to be > > directly linked to libutil and libkvm. This means a breakage of libutil= will > > only have inpact on procstat and no more on fstat for example. >=20 > I think this could be solved by an implicit linker script contained in > .so and .a files, pointing to the real libraries. >=20 > We have already the SHLIB_LDSCRIPT variable to accomplish this for .so > files. It may be possible to do the same for .a files, though this > would require renaming the real archives to something like .a.0 (here > I'm just taking a similar scheme to the one used for DSO). >=20 > As a matter of fact, libprocstat.a would contain: >=20 > GROUP ( /usr/lib/libprocstat.a.0 /usr/lib/libkvm.a /usr/lib/libutil.a ) >=20 > Note that libkvm.a and libutil.a could be linker scripts as well. >=20 > Kib, do you see any problem to this proposition? Wouldn't you need to completely rewrite the handling of the .a files in the share/mk ? I somewhat dislike the mere thought that .a is not an archive any longer. Does it make sense from the overhead and complexity POV, for such small goal ? --zFHfQTJdDMtDGy0L Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJQzdS7AAoJEJDCuSvBvK1BHAkP/ir7TtycOje8jd5SSdEB2T3g ZGX9AS7xhwdG70z99KNL1kjuF26XNuQg7lJlpGb0+BUU2kt84pMq1ui5zUO7TlT/ 1st2hQoovRPjiss245j3f0iFIdRvqlvIAWTJrhi+a8V5ni+7NsgFGQoDiSLSgNdE PLwetkHCulyyu4v690lFmtlv83lUvko8HJ5x2PFBIp5jFf2vcKAiP2E22pUJD9bK sEKtKAwBm541IdqyvzFFlzxr3vdZgjCXEs69TLgyIL3FyvsBnkArQYlMG0DLonc1 Sya/px2p1iLuWMQCDpaRJlsJQ6NCxfTP8NltMmh3Q0BxDOa2Xh9c98gQGq2wIPv4 e53DcC9lOu4rE2WfEsdYUXl/Zrual8sMg5+IM3akJgBFoAOta9YOqIHKR2KKzCVF nqbTGtk9db+TU2e0dnzmQ6nP12qtHJqvrqaTG125pKtZS4DFjlIuL+PjlY3l0glb VCz+M5bM77QOIfghu8efy4fl5ooldA+PV2QyvoctQ9p7oDXwpWHWhY4HI9mdaXyS 9YOCmpCZhcvMnkuOlUzK+eAy82wpCWZKnq2cofBqv0yg+QShCYUJ0rXV7BxkUHJM C3042mhDAD+GLXzWV0K9LiguAnkRzdwsiTVxhaX8RyUVy2hot6v6U8aujF53fJN1 fTYwulHNb8pnCOilj69h =4LpY -----END PGP SIGNATURE----- --zFHfQTJdDMtDGy0L--