Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Nov 2014 14:54:31 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Baptiste Daroussin <bapt@FreeBSD.org>
Cc:        arch@FreeBSD.org
Subject:   Re: Overlinking in base
Message-ID:  <20141105125431.GD53947@kib.kiev.ua>
In-Reply-To: <20141105113839.GG10388@ivaldir.etoilebsd.net>
References:  <20141105113839.GG10388@ivaldir.etoilebsd.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20141105125431.GD53947>