From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8490 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: dynamic linker bootstrap/rcrt changes Date: Fri, 11 Sep 2015 02:45:04 -0400 Message-ID: <20150911064504.GA21467@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 1441953927 30487 80.91.229.3 (11 Sep 2015 06:45:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Sep 2015 06:45:27 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8502-gllmg-musl=m.gmane.org@lists.openwall.com Fri Sep 11 08:45:26 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1ZaI5M-0004vu-72 for gllmg-musl@m.gmane.org; Fri, 11 Sep 2015 08:45:24 +0200 Original-Received: (qmail 14308 invoked by uid 550); 11 Sep 2015 06:45:20 -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 14267 invoked from network); 11 Sep 2015 06:45:16 -0000 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:8490 Archived-At: Working on static-PIE and FDPIC has shown the current approach (symbol name lookup of "__dls2") to getting from stage 1 to stage 2 is not what we should be doing. It requires -rdynamic for static PIE to work, which is clunky and potentially bloated for large programs, and for FDPIC the symbol lookup does not produce a callable function pointer but rather an actual code address. What I'd like to do is punt on having _[dl]start_c make the call into __dls2 and instead have it return, leaving the calling asm again responsible for chaining into the next stage. This brings back a small asm burden I'd tried to eliminate, but it reduces code size and eliminates the above problems. One way we might could mitigate the asm burden is by having the crt asm leave an extra N words below the original sp (argv-1) when making the calls. This would give us space to pass state from stage 1 to stage 2 (and possibly beyond) without the need for per-arch asm to shuffle around argument registers and individual stack slots. This would make it so each stage could take a single argument, orig_sp. Rich