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

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Nov 05, 2014 at 02:40:07PM +0100, Baptiste Daroussin wrote:
> On Wed, Nov 05, 2014 at 03:30:29PM +0200, Konstantin Belousov wrote:
> > On Wed, Nov 05, 2014 at 01:59:57PM +0100, Baptiste Daroussin wrote:
> > > On Wed, Nov 05, 2014 at 02:54:31PM +0200, Konstantin Belousov wrote:
> > > > 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
> > 
> > Ok.  It is mostly fine, but you do not account for symbol versions of
> > the looked up symbols.  There were weird changes, e.g. isnanf story,
> > which essentially migrated from libc to libm.  I suspect such cases
> > are not very important.
> > 
> My proposal to fix this overlinking while still supporting static linkage
> Is to change the way we are declaring those dependencies, imho the library
> should declare what it needs in case of dynamic linking and what it needs in
> case of static linking, the binary Makefile should only list what it requires as
> a direct dependency and the framework should do all the magic.
> 
> This can be done via .pc files (and calling pkgconf) or can be done via .mk
> files in the library directory.
> 
> In the first case we could have something like:
> PCADD=	liba libb libc
> Which will result in the build system querying though pkgconf:
> pkgconf --libs (--static if calling static linkage)
> 
> In the second case we could do it via make(1)
> LIBADD=	liba libc libc
> this will open something like a ${PATHTOTHELIB}/link.mk which will define
> DYNAMIC_ADD
> STATIC_ADD
> 
> And this could be recursive.
> 
> (note that pkgconf is also recursive as well).

Well, there is third option, the linker option --as-needed (I think our
old binutils are new enough).  Personally, I would prefer make-based
solution described above, but --as-needed may be used as the the
check.

Or, we should have an easy escape to --no-as-needed.



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