From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5940 Path: news.gmane.org!not-for-mail From: Justin Cormack Newsgroups: gmane.linux.lib.musl.general Subject: Re: static build and dlopen Date: Wed, 27 Aug 2014 18:20:24 +0100 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 X-Trace: ger.gmane.org 1409160050 9718 80.91.229.3 (27 Aug 2014 17:20:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Aug 2014 17:20:50 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-5947-gllmg-musl=m.gmane.org@lists.openwall.com Wed Aug 27 19:20:45 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 1XMgth-00064a-2w for gllmg-musl@plane.gmane.org; Wed, 27 Aug 2014 19:20:37 +0200 Original-Received: (qmail 28422 invoked by uid 550); 27 Aug 2014 17:20:36 -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 28414 invoked from network); 27 Aug 2014 17:20:36 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=specialbusservice.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=4c9yMx/B+DjesGpRJIMMFi9OSfgIsGJK6E8lgEhXo0U=; b=O/EyOtGnYM9fmq+nqOfuUtEQk/Y143oG0W9lhbZiE1SX6j0yeo742tGN/fcDN6Xdsw v4St1YWRfpdcaedyoZy++ZBbApbjDm7d9SvVe1K3systkACLvSeEz+mEqHPh+AmUQZw6 tocfVTp6BfvY9ZisrmYP0Q0Cw8MCQ38S25rP4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=4c9yMx/B+DjesGpRJIMMFi9OSfgIsGJK6E8lgEhXo0U=; b=CgkTinWAiGucF+ZNVIsIE26zjmxTdjVPTrKsZs5iRy1NdVcJpOr87BpYrFRhKt3cb0 Z1lVkL6WoqY/lp9iS2WB+CQK5G26QZ1g3Ts9179pXIXJ/phG1JJQmv2nBm5op3B7LqSo UaZUV8XvexNzETAVaj3i66reK+u3Gb7PtWqB99eMqOlGAo/gtOoiHqv4d/XHwxSr1P5L NokGQqvGcevtjJYZa3Lce21n8pv5PcFQq66scT30qGyzvXcnZZpqkQ4BG5JzOjQ4L0Y5 /C1BCv1utClVjzkiodwNBj6yRMSu2xk6iCWDzFnJTgJg4i7HfcmCAVXy/Es5FsFlZyhO NlgA== X-Gm-Message-State: ALoCoQnPADeeLGrXh1cJCdbHsG2jo77cXcv+YdIgtDAVZcdbSdDNL7tUkNLaY6W+8g2Zwe6+NyAu X-Received: by 10.152.9.100 with SMTP id y4mr36115132laa.26.1409160024886; Wed, 27 Aug 2014 10:20:24 -0700 (PDT) In-Reply-To: Xref: news.gmane.org gmane.linux.lib.musl.general:5940 Archived-At: On Wed, Aug 27, 2014 at 6:01 PM, piranna@gmail.com wrote: > The de-facto standard in Node.js is that all the compiled modules are > static ones (.a files) with no external dependencies at all, just to > make it simpler to move to another environments. This contrast to how > Python works, where compiled modules are dynamic ones (.so). I'm > honestly not sure what are the low-level details of Node.js compiled > modules, but the general idea of Node.js modules is make them as > independent as possible and left to Node.js require() function to > manage the dependencies, so probably this would also apply to compiled > ones... Only point left here is if in fact .node files are in fact .a > files with a different extension or if they are wrapped someway, so in > that case dlopen() is efectively loading .a files (that would be a > surprise to me, but would left open the door to solve this problem...) 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). Justin