From owner-freebsd-arch@FreeBSD.ORG Wed Nov 5 12:54:39 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 9D4BD362; Wed, 5 Nov 2014 12:54:39 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F9A23CE; Wed, 5 Nov 2014 12:54:38 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id sA5CsVnx070997 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 5 Nov 2014 14:54:31 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua sA5CsVnx070997 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id sA5CsV2r070996; Wed, 5 Nov 2014 14:54:31 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 5 Nov 2014 14:54:31 +0200 From: Konstantin Belousov To: Baptiste Daroussin Subject: Re: Overlinking in base Message-ID: <20141105125431.GD53947@kib.kiev.ua> References: <20141105113839.GG10388@ivaldir.etoilebsd.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20141105113839.GG10388@ivaldir.etoilebsd.net> User-Agent: Mutt/1.5.23 (2014-03-12) 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 autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home 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 12:54:39 -0000 On Wed, Nov 05, 2014 at 12:38:39PM +0100, Baptiste Daroussin wrote: > Hi all, > > We do overlink a lot in the base system. > > 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 > > Most of the overlink are due to LDADD having all the recursive libraries which > for dynamic linking we do not need. > > 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. > > I think anyway a binary Makefile should only declare its direct dependencies 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. Could you, please, share the script to see how the overlinking is checked ? > > I was already proposing in the past to import pkgconf in base to solve this as > the library will declare its dependencies in case of dynamic linking and/or in > case of static linking (which can be different) > > This can also be done in pure make(1) > > regards, > Bapt