Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 8 Aug 2012 08:54:25 -0400
From: Rich Felker <>
Subject: Re: ldso : dladdr support

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...


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.