From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10868 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Reviving planned ldso changes Date: Tue, 3 Jan 2017 00:43:51 -0500 Message-ID: <20170103054351.GA8459@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1483422247 2023 195.159.176.226 (3 Jan 2017 05:44:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 3 Jan 2017 05:44:07 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-10881-gllmg-musl=m.gmane.org@lists.openwall.com Tue Jan 03 06:44:04 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1cOHtD-0008NT-8B for gllmg-musl@m.gmane.org; Tue, 03 Jan 2017 06:44:03 +0100 Original-Received: (qmail 15498 invoked by uid 550); 3 Jan 2017 05:44:05 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 15472 invoked from network); 3 Jan 2017 05:44:04 -0000 Content-Disposition: inline Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:10868 Archived-At: One item that's been on the agenda for a long time (maybe 1.5 years now?) is planned dynamic linker improvements. The thread "Further dynamic linker optimizations" from summer 2015 covered parts but maybe not all of what I had in mind. - Instead of a global flag for each library, have a separate linked list for globally visible libraries. This will speed up symbol lookup (by skipping non-global ones, and skipping checking the global flag) and also makes it so that load order searching can be done based on the order in which the libraries became global, rather than their original load order when they might have been non-global. - Dependency-order ctor execution. I think the walk order looks something like, starting at a given node (initially the main app or new library being loaded dynamically), traversing to its first deps[] entry that hasn't been constructed, or, if none remain, executing its ctors then traversing back to its needed_by. This process avoids the need for any call recursion and should be near-optimal (if not optimal) provided the position in a dso's deps[] list is saved in the dso struct. - Recursive dlopen improvements. The thread "dlopen deadlock" from January 2016 covers some of the issues. I don't think we reached a complete conclusion/solution, but for reasonable cases where it's clear that dlopen *should* work without deadlock, I think we have a proposed design that works. - Possibly other optimizations I've left out... Rich