From owner-freebsd-arch@FreeBSD.ORG Wed Nov 5 13:00:02 2014 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 49CF055E for ; Wed, 5 Nov 2014 13:00:02 +0000 (UTC) Received: from mail-wi0-x22e.google.com (mail-wi0-x22e.google.com [IPv6:2a00:1450:400c:c05::22e]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D1E925F4 for ; Wed, 5 Nov 2014 13:00:01 +0000 (UTC) Received: by mail-wi0-f174.google.com with SMTP id d1so12321945wiv.7 for ; Wed, 05 Nov 2014 05:00:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=jg0ULKn5FNJrpGQCpMntiaOiV72awPbzxnpD3cXzJAw=; b=cuMNKuHMx3uYRE2tc/2yzjpvjqI7SshmtCpQM1sVO+zMkCFxo+/CosqrUmzM8cDAbz ODx2LTejPg50fUqmzgQwxrZWlZtHaDFxlWbfWDNbYXB8ocWy1YhuEvAxA0bIFhJo3Yzh M5zvaorbJe5DPSEJ+33FoY3RVVINAld/PKsHsmWaPl1mWxqjpvdYgorLEHUEz0p14OuA 8U84aJgBitMdQ1LV4PTZD5UaFmv6o4T+EL2Cna7uygDFq+HjIK2Sdq+WPabZZnALIYWQ 3m/cuuYCaYpHtdf8WiUxHZPfk43hccE1k4u+hUjWWRet7AoZCTDO9z9bMxdzfENvMgWE IF9w== X-Received: by 10.195.12.45 with SMTP id en13mr54714149wjd.8.1415192400094; Wed, 05 Nov 2014 05:00:00 -0800 (PST) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by mx.google.com with ESMTPSA id fa16sm15749717wid.5.2014.11.05.04.59.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Nov 2014 04:59:59 -0800 (PST) Sender: Baptiste Daroussin Date: Wed, 5 Nov 2014 13:59:57 +0100 From: Baptiste Daroussin To: Konstantin Belousov Subject: Re: Overlinking in base Message-ID: <20141105125931.GJ10388@ivaldir.etoilebsd.net> References: <20141105113839.GG10388@ivaldir.etoilebsd.net> <20141105125431.GD53947@kib.kiev.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EMQjp+MvU6EBGjHc" Content-Disposition: inline In-Reply-To: <20141105125431.GD53947@kib.kiev.ua> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: arch@FreeBSD.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Nov 2014 13:00:02 -0000 --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--