Date: Wed, 5 Nov 2014 13:59:57 +0100 From: Baptiste Daroussin <bapt@FreeBSD.org> To: Konstantin Belousov <kostikbel@gmail.com> Cc: arch@FreeBSD.org Subject: Re: Overlinking in base Message-ID: <20141105125931.GJ10388@ivaldir.etoilebsd.net> In-Reply-To: <20141105125431.GD53947@kib.kiev.ua> References: <20141105113839.GG10388@ivaldir.etoilebsd.net> <20141105125431.GD53947@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
--EMQjp+MvU6EBGjHc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 05, 2014 at 02:54:31PM +0200, Konstantin Belousov wrote: > On Wed, Nov 05, 2014 at 12:38:39PM +0100, Baptiste Daroussin wrote: > > Hi all, > >=20 > > We do overlink a lot in the base system. > >=20 > > I wrote a script to check overlinking on the final binaries and running= it on > > /usr/bin files I got the following results: > > https://wiki.freebsd.org/Overlinking > >=20 > > Most of the overlink are due to LDADD having all the recursive librarie= s which > > for dynamic linking we do not need. > >=20 > > We might need them for static linking, but I think we should fix those. > Fix how ? Static libraries do not record dependencies, and linker > must get list of all libraries to satisfy undefined symbols. >=20 > >=20 > > I think anyway a binary Makefile should only declare its direct depende= ncies and > > not the dependencies of its dependencies. > No, this is wrong definition of overlinking. Binary X, which depends > on liba.so and libb.so, is overlinked, only when there is no symbol from > libb.so which is directly referenced from X. Mere fact that liba.so > needs libb.so and X records DT_NEEDED for both a and b, is not enough. That is what I do check and what I'm referencing, a good example is bsdtar = which links to all compression libs while libarchive itself does not expose any symbols from them. >=20 > Could you, please, share the script to see how the overlinking is > checked ? Here you are: https://people.freebsd.org/~bapt/check-links.sh Beware it is dirty :) Run it as check-links.sh nameofthebinary Best regards, Bapt --EMQjp+MvU6EBGjHc Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlRaH00ACgkQ8kTtMUmk6EwM6ACgsV9NtU61gvNZ1OplOZt0BQKP v70AnAyNK//25wttw1bMxptT9M7t6x0A =EsUl -----END PGP SIGNATURE----- --EMQjp+MvU6EBGjHc--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20141105125931.GJ10388>