From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7788 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: Question re: dynamic linking in musl Date: Wed, 27 May 2015 15:06:31 +0200 Message-ID: <20150527130630.GG20259@port70.net> References: <20150527100844.GA306@alex-ThinkPad-L530> <5565A812.9090004@gmail.com> 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 1432732007 2755 80.91.229.3 (27 May 2015 13:06:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 May 2015 13:06:47 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-7800-gllmg-musl=m.gmane.org@lists.openwall.com Wed May 27 15:06:47 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 1Yxb2j-0000hI-Uq for gllmg-musl@m.gmane.org; Wed, 27 May 2015 15:06:46 +0200 Original-Received: (qmail 28118 invoked by uid 550); 27 May 2015 13:06:44 -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 28098 invoked from network); 27 May 2015 13:06:44 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: <5565A812.9090004@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Xref: news.gmane.org gmane.linux.lib.musl.general:7788 Archived-At: * Alex Dowad [2015-05-27 13:18:42 +0200]: > On 27/05/15 12:40, Alexander Monakov wrote: > >That is not how ELF symbol lookup works. Simply put, the symbol should be > >taken from whatever first module in the whole lookup chain provides it; e.g. > >if the executable exports a function that is also exported in libX11, the > >executable's definition prevails. > OK, I get it. So dynamic linking has O(n^2) runtime, with "n" being the > number of dynamic libraries you link against! yes, in the sense that a symbol lookup is O(n) and you may have O(n) such lookups. > >Recently I was working on some dynamic linker speedups for musl. On my > >testcase, Clang/LLVM with ~100-200 dynamic libraries and ~20000 symbols that > >need to be resolved in the dynamic linker, I obtained a speedup from 240 ms to > >110 ms, while glibc needs 50 ms with lazy binding and 140 without. So while > >musl's dynamic linker speed can be improved, still rrdtool is doing something > >odd in the first place if it's performance is bound like that. I'd like to > >understand that. If it's unavoidable, perhaps static linking is appropriate. > > > >(I didn't send my dynlink speedup patches yet; I intend to do that sometime > >soon) > That speedup will be very welcome, especially for clang! clang builds are > noticeably slower than gcc. Looking forward to it. > may be clang should be linked staticly then (if dynamic linker has meausrable overhead) btw i recently heard that benchmarks show that clang compiles very fast.. but only if it was compiled with gcc.. the irony ... > cob=(1) /lib/ld-musl-i386.so.1 > cfi=(47) /home/buildozer/aports/main/musl/src/musl-1.1.5/src/exit/atexit.c ... i386 pic code is slow even if the musl loader is magically fast so if you care about performance then static linking is the right solution.