mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: ldso : dladdr support
Date: Fri, 17 Aug 2012 01:39:34 -0400	[thread overview]
Message-ID: <20120817053934.GS27715@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAKAk8daQn1oghHt4cRoZp+B4OmBHejJC6_o7zxAwMjpciACY=w@mail.gmail.com>

On Thu, Aug 16, 2012 at 12:41:48AM +0200, boris brezillon wrote:
> > Sorry for taking a while to get back to you. I haven't had as much
> > time to work on musl the past couple weeks and some other topics (like
> > mips dynamic linking) had priority, but I hope to have more again for
> > a while now. Here's a quick review of some things that will hopefully
> > turn into a discussion for improving/simplifying the code.
> No problem.
> Thanks for the review.
> Do you want to discuss it on irc or keep going on the mailing list?

List is best I think, but I don't mind having some specific
discussions that need more real-time feedback on IRC.

> > BTW, while I _want_ it to be safe, it's possible that early switches
> > (early meaning prior to the comment in __dynlink that says libc is now
> > fully functional) will actually fail to work/crash on some archs... So
> > this needs consideration too.
> >
> I didn't knew that. Could explain me why?

The compiler may compile a switch to something like:

jmp *local_jmptable@GOTOFF(%ebx,%ecx,4)

where the local_jmptable needs to contain absolute jump addresses.
Prior to relocation, it will obly have the load-address-relative
addresses.

> > I'm not seeing why this function needs hash tables at all. It's not
> > looking up symbols, just iterating over the entire symbol table, no?
> > Please explain if I'm mistaken.
> I don't see any other way to know the sym table size except reading
> the .dynsym section header.

Indeed, I missed the fact that there's no DT_* entry reporting the
symbol table size. I checked how readelf reports the number of
entries, and it's using the section headers. I'm under the impression
that using them would not be valid for the dynamic linker; reportedly
ELF files are supposed to be valid even with the section headers
stripped.

> That's why I'm iterating over the hash table.
> For sysv hash the nchain (second entry of hash table) gives the sym table size.
> For gnu hash It's a little bit more complicated (see
> https://blogs.oracle.com/ali/entry/gnu_hash_elf_sections).

Wow, leave it to the GNU folks to take something simple and make it
difficult...

> Should we parse the .dynsym section header and store the sym table
> size in dso struct?
> Do you see any other way to get the dynsym table size or at least
> iterate over the dynsym table (specific pattern for last element ?).

I've been looking but I don't see any way yet.

Rich


  reply	other threads:[~2012-08-17  5:39 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-07  9:04 musl
2012-08-07 11:46 ` Szabolcs Nagy
2012-08-07 14:15   ` musl
2012-08-07 14:53     ` Szabolcs Nagy
2012-08-07 23:09     ` Rich Felker
2012-08-08  9:55       ` musl
2012-08-08 11:52         ` Szabolcs Nagy
2012-08-08 12:54           ` Rich Felker
2012-08-08 13:57           ` musl
2012-08-11 23:05             ` Rich Felker
2012-08-15 22:41               ` boris brezillon
2012-08-17  5:39                 ` Rich Felker [this message]
2012-08-19 16:42                   ` musl
2012-08-20  2:06                     ` Rich Felker
2012-08-20 12:55                       ` musl
2012-08-20 14:32                         ` musl
2012-08-23 21:39                           ` Rich Felker
2012-08-23 22:21                             ` Rich Felker
2012-08-24  7:29                               ` musl
2012-08-24 18:38                                 ` Rich Felker
2012-08-25  7:42                                   ` boris brezillon
2012-08-25 12:35                                     ` Rich Felker
2012-08-25 22:13                                   ` musl
2012-08-25 22:37                                     ` musl
2012-08-26  0:00                                   ` musl
2012-08-24  8:12                               ` Szabolcs Nagy
2012-08-24  8:56                                 ` musl
2012-08-24  9:38                                   ` Szabolcs Nagy
2012-08-25 21:34                               ` musl
2012-08-25 21:42                                 ` Rich Felker
2012-08-16 18:03               ` musl
2012-08-17 16:35               ` musl
2012-08-08 12:49         ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120817053934.GS27715@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).