From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1463 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: ldso : dladdr support Date: Wed, 8 Aug 2012 08:54:25 -0400 Message-ID: <20120808125425.GI27715@brightrain.aerifal.cx> References: <5020DA13.6080803@gmail.com> <20120807114627.GG30810@port70.net> <50212306.6070402@gmail.com> <20120807230933.GC27715@brightrain.aerifal.cx> <502237A1.1000805@gmail.com> <20120808115202.GL30810@port70.net> 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: dough.gmane.org 1344430438 15564 80.91.229.3 (8 Aug 2012 12:53:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Aug 2012 12:53:58 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-1464-gllmg-musl=m.gmane.org@lists.openwall.com Wed Aug 08 14:53:56 2012 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 1Sz5ll-0007ca-AM for gllmg-musl@plane.gmane.org; Wed, 08 Aug 2012 14:53:49 +0200 Original-Received: (qmail 26541 invoked by uid 550); 8 Aug 2012 12:53:48 -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 26533 invoked from network); 8 Aug 2012 12:53:48 -0000 Content-Disposition: inline In-Reply-To: <20120808115202.GL30810@port70.net> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:1463 Archived-At: On Wed, Aug 08, 2012 at 01:52:02PM +0200, Szabolcs Nagy wrote: > > + for (h1 &= (uint32_t)-2;; sym++) { > > + h2 = *hashval++; > > + if ((h1 == (h2 & ~1)) && !strcmp(s, strings + sym->st_name)) > > these is still a ~1 > > looking at it now probably writing out & 0xfffffffe > is the cleanest I prefer -2. It's the standard idiom used elsewhere in musl (e.g. in malloc, for alignment purposes, and for page masks) to say ("keep all bits starting with the value of 2 and up and discard the rest"). > another possibility is to have a plain find_sym function > which is simple and only supports sysv hash > and whenever it encounters a lib that has no sysv hash in > it a find_sym_gnu is called that does the hard work > (so using gnu only libs is penalized, i don't know how > common that case is though) It could easily be known in advance if there's any lib that has gnu-only, so I don't see this approach being very helpful. And it would increase code duplication, I think... Rich