From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2432 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: static linking and dlopen Date: Sun, 9 Dec 2012 03:39:00 +0100 Message-ID: <20121209023900.GE23126@port70.net> References: <20121208225237.GV20323@brightrain.aerifal.cx> <50C3CA75.8000504@comcast.net> <20121208232301.GW20323@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1355020751 4731 80.91.229.3 (9 Dec 2012 02:39:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 9 Dec 2012 02:39:11 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2433-gllmg-musl=m.gmane.org@lists.openwall.com Sun Dec 09 03:39:24 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1ThWnc-0003GX-ES for gllmg-musl@plane.gmane.org; Sun, 09 Dec 2012 03:39:24 +0100 Original-Received: (qmail 26513 invoked by uid 550); 9 Dec 2012 02:39:12 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 26502 invoked from network); 9 Dec 2012 02:39:12 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:2432 Archived-At: * Paul Schutte [2012-12-09 02:04:43 +0200]: > I was wondering about distributing all libraries as static libraries and > then have the package manager link the application statically as the final > step of the installation. This way the package manager can keep track > of dependencies and re-link them if a library change. note that binaries built by the user outside of the package manager wont be relinked which may or may not be what you want static linking takes a lot of time and memory (gold is better at this than gnu ld, but a libc update would take some time either way) you cannot easily collapse dependency chains: eg. with x,y binaries, a,b,c objects and x->a->b->c y->b->c dependency chains, the b->c linking is done twice (so not much work can be shared between the linking of various binaries and the linking of a huge binary takes a lot of time even if an insignificant small part changes) other than dlopen the LD_PRELOAD and LD_LIBRARY_PATH hacks would not work, nor system components that depend on dynamic linking (vdso, proprietary libraries (graphics drivers etc), nsswitch, pam) i'm not saying your idea is bad, but it's non-trivial > Another idea would be to just install a stub where the binary would be. > First time you run this stub, it will link the binary and store it on the > disk in some sort of cache. Then just do an exec of that binary. Second i guess the stub would need setuid