From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5944 Path: news.gmane.org!not-for-mail From: "piranna@gmail.com" Newsgroups: gmane.linux.lib.musl.general Subject: Re: static build and dlopen Date: Wed, 27 Aug 2014 22:07:43 +0200 Message-ID: References: <20140827152735.GB22308@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1409170103 11309 80.91.229.3 (27 Aug 2014 20:08:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Aug 2014 20:08:23 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-5951-gllmg-musl=m.gmane.org@lists.openwall.com Wed Aug 27 22:08:16 2014 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 1XMjVv-00064i-Sz for gllmg-musl@plane.gmane.org; Wed, 27 Aug 2014 22:08:15 +0200 Original-Received: (qmail 26582 invoked by uid 550); 27 Aug 2014 20:08:15 -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 26574 invoked from network); 27 Aug 2014 20:08:15 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=YO/oItokRLbnOVMj+iClTT20OMivAMABgYvd3rOw1oI=; b=ilhxme7a6IaMag5gOlcIRVyjOch4WaPUDakLIPCy/E4sdUL96+Un7lmNSvlc16UuMn PQCjTYM9fzapzOQAvRpf+FxQv6t8jnPzBBcfRtd+8VVkBF9UvlI/i6l84rBbYaQ1yBy6 VYvKtfyHZa0fgXwr6UKaKk7w7N4LOD7JrvHI9aaeOiVAtRw4Y/bG2oMW3dKsfrwM7FMe QKNmZR3TMrVVddiyGijH3kf+bXXbB2nxcGpSldtPj+uLfrmyPn/5UzFOaginvbYlX7cM OhcDaZqCIlE9J196NrSnwcIRSN3RzPifZP2CFPaSFyJVzUFVeJBeDvJcBssRNK5vfJ2K HfLQ== X-Received: by 10.180.211.137 with SMTP id nc9mr107981wic.53.1409170083683; Wed, 27 Aug 2014 13:08:03 -0700 (PDT) In-Reply-To: Xref: news.gmane.org gmane.linux.lib.musl.general:5944 Archived-At: > If this is really true, and they are static, then you should be able > to write a loader that has a function called dlopen etc but which is > not actually the full dynamic linker, just pretends to be, and will > work from a static binary. It could link in the modules at compile > time and just return static pointers (I have done this with Lua code, > pretending to be in a dynamic environment when actually in a static > one, just return pointers from dlsym calls that are fixed at compile > time). I'm not fully sure how Node.js compiled modules works, only that the standard is to generate them statically linked with no external dependencies. This leads to have full libraries inside each package (node-webrtc has a full copy of libjingle, for example...), but has the advantage that the system is more stable to change of dependencies or of enviroment, since each "project" is fully isolated from a code and libraries point of view. Regarding to your comment, are you suggesting to code a dlopen() function that mimics the behaviour of the dynamic one, but returning references to code already statically linked on the executable? If so, it's the same as if I would tape the node modules to the executable previously to know what the developer would use, and this is impossible... Have I misunderstood something? Good trick anyway, I'll pin your message for reference :-) --=20 "Si quieres viajar alrededor del mundo y ser invitado a hablar en un monton de sitios diferentes, simplemente escribe un sistema operativo Unix." =E2=80=93 Linus Tordvals, creador del sistema operativo Linux