From owner-freebsd-arch@FreeBSD.ORG Wed Nov 5 13:40:13 2014 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A5465345 for ; Wed, 5 Nov 2014 13:40:13 +0000 (UTC) Received: from mail-wi0-x236.google.com (mail-wi0-x236.google.com [IPv6:2a00:1450:400c:c05::236]) (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 38D06B5A for ; Wed, 5 Nov 2014 13:40:13 +0000 (UTC) Received: by mail-wi0-f182.google.com with SMTP id d1so2038051wiv.3 for ; Wed, 05 Nov 2014 05:40:11 -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=eDeih+Y4JcNzYxuXszhLRp2xcjiYkSxWpdfODIOX4gk=; b=JCJDbh0XIpX6pU/OKB8vjsSMMaG1dDgfK3H49sTOE3xrC79gAANg19tHRlh6qnKtWW y9qsbp6ARkNPWt6jtA4EhOiAzKxBtATXNcqVxeGAusJ7pxMsNpQtjNr+P2Q/dsgKeHle 7NAoucZ21QJNAe9TSzzyS8+zF3PgcZ/KkcAZFG5QpCw/lfQqV3ilALF/9wkk+l5YEDVU PuREnXuU1KSvh/Y3JgPAnIcrIW02zHrdbKRZiKkaGg5nOeysZuaQRpBifL5LGAgufFdg kmjTmsXycoeX1Ep/OeSpMILPtmKVn6FK6H383aThbaeHdDD3GRDcPtgdKSMnj36loKMx JdJw== X-Received: by 10.180.36.229 with SMTP id t5mr32155923wij.56.1415194810231; Wed, 05 Nov 2014 05:40:10 -0800 (PST) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by mx.google.com with ESMTPSA id n4sm4109182wjb.40.2014.11.05.05.40.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Nov 2014 05:40:09 -0800 (PST) Sender: Baptiste Daroussin Date: Wed, 5 Nov 2014 14:40:07 +0100 From: Baptiste Daroussin To: Konstantin Belousov Subject: Re: Overlinking in base Message-ID: <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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="g6DVDhPhk1bqxDrC" Content-Disposition: inline In-Reply-To: <20141105133029.GH53947@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:40:13 -0000 --g6DVDhPhk1bqxDrC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 ? > >=20 > > Here you are: > > https://people.freebsd.org/~bapt/check-links.sh > >=20 > > Beware it is dirty :) > >=20 > > Run it as check-links.sh nameofthebinary >=20 > 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. >=20 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 requir= es 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=3D 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=3D 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). regards, Bapt --g6DVDhPhk1bqxDrC Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlRaKLYACgkQ8kTtMUmk6Ewl7ACghU3tcCk8YOj0EzEdlj4HXgaT DNUAn39NjeESZ4xiEAvefDfI141usQxn =86Gt -----END PGP SIGNATURE----- --g6DVDhPhk1bqxDrC--