From: Daniel Jacobowitz <dan@debian.org>
To: "Bradley D. LaRonde" <brad@laronde.org>
Cc: Richard Sandiford <rsandifo@redhat.com>,
uclibc@uclibc.org, linux-mips@linux-mips.org
Subject: Re: uclibc mips ld.so and undefined symbols with nonzero symbol table entry st_value
Date: Tue, 11 May 2004 10:03:51 -0400 [thread overview]
Message-ID: <20040511140351.GA13367@nevyn.them.org> (raw)
In-Reply-To: <02fd01c43709$981a24a0$8d01010a@prefect>
On Mon, May 10, 2004 at 11:39:41PM -0400, Bradley D. LaRonde wrote:
> ----- Original Message -----
> From: "Richard Sandiford" <rsandifo@redhat.com>
> To: "Bradley D. LaRonde" <brad@laronde.org>
> Cc: <uclibc@uclibc.org>; <linux-mips@linux-mips.org>
> Sent: Monday, May 10, 2004 4:41 PM
> Subject: Re: uclibc mips ld.so and undefined symbols with nonzero symbol
> table entry st_value
>
>
> > "Bradley D. LaRonde" <brad@laronde.org> writes:
> > > I read this in the spec:
> > >
> > > All externally visible symbols, both defined and undefined,
> > > must be hashed into the hash table.
> > >
> > > Should libpthread's malloc stub be added to the hash table?
> >
> > Yes.
> >
> > > I guess not, but I think that might be happening (haven't verified),
> > > and libdl finding it in there and thinking it is the real deal, not
> > > realizing it is just a stub.
> >
> > If you have an undefined function symbol with st_value != 0, then
> > that st_value must be for a stub. That's how the loader can (and is
> > supposed to) tell the difference.
> >
> > It's probably a good idea to look at how glibc handles this.
>
> uClibc/ldso/ldso/mips/elfinterp.c around line 288 looks like this:
>
>
> /* Relocate the global GOT entries for the object */
> while(i--) {
> if (sym->st_shndx == SHN_UNDEF) {
> if (ELF32_ST_TYPE(sym->st_info) == STT_FUNC && sym->st_value)
> *got_entry = sym->st_value + (unsigned long) tpnt->loadaddr;
> else {
> *got_entry = (unsigned long) _dl_find_hash(strtab +
> sym->st_name, tpnt->symbol_scope, ELF_RTYPE_CLASS_COPY);
> }
> }
>
>
> If I change that ELF_RTYPE_CLASS_COPY to ELF_RTYPE_CLASS_PLT to tell
> _dl_find_hash to ignore stubs when resolving undefined functions without
> stubs, the dlopen tests all pass. dlopen gets a pointer to the libc.so
> malloc instead of a pointer to the libpthread malloc stub. Yay! :-)
>
> Does that look like the correct fix?
Probably, since MIPS doesn't have a copy reloc.
--
Daniel Jacobowitz
next prev parent reply other threads:[~2004-05-11 14:04 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-03 21:25 uclibc mips ld.so and undefined symbols with nonzero symbol table entry st_value Bradley D. LaRonde
2004-05-03 21:25 ` Bradley D. LaRonde
2004-05-09 13:14 ` Richard Sandiford
2004-05-09 13:14 ` Richard Sandiford
2004-05-09 20:52 ` Bradley D. LaRonde
2004-05-09 20:52 ` Bradley D. LaRonde
2004-05-10 7:40 ` Richard Sandiford
2004-05-10 7:40 ` Richard Sandiford
2004-05-10 18:05 ` Bradley D. LaRonde
2004-05-10 18:05 ` Bradley D. LaRonde
2004-05-10 18:21 ` Richard Sandiford
2004-05-10 18:21 ` Richard Sandiford
2004-05-10 20:36 ` Bradley D. LaRonde
2004-05-10 20:36 ` Bradley D. LaRonde
2004-05-10 20:41 ` Richard Sandiford
2004-05-10 20:41 ` Richard Sandiford
2004-05-10 20:44 ` Richard Sandiford
2004-05-10 20:44 ` Richard Sandiford
2004-05-11 3:39 ` Bradley D. LaRonde
2004-05-11 3:39 ` Bradley D. LaRonde
2004-05-11 5:48 ` [uClibc] Re: uclibc mips ld.so and undefined symbols with nonzerosymbol " Joakim Tjernlund
2004-05-11 5:48 ` Joakim Tjernlund
2004-05-11 14:03 ` Daniel Jacobowitz [this message]
2004-05-11 14:21 ` uclibc mips ld.so and undefined symbols with nonzero symbol " Bradley D. LaRonde
2004-05-11 14:21 ` Bradley D. LaRonde
2004-05-11 14:23 ` Daniel Jacobowitz
2004-05-11 16:33 ` [uClibc] Re: uclibc mips ld.so and undefined symbols with nonzerosymbol " Joakim Tjernlund
2004-05-11 16:33 ` Joakim Tjernlund
2004-05-11 16:55 ` Bradley D. LaRonde
2004-05-11 16:55 ` Bradley D. LaRonde
2004-05-11 21:50 ` Joakim Tjernlund
2004-05-11 21:50 ` Joakim Tjernlund
2004-05-10 12:21 ` Joakim Tjernlund
2004-05-10 12:21 ` Joakim Tjernlund
2004-05-10 12:36 ` Joakim Tjernlund
2004-05-10 12:36 ` Joakim Tjernlund
2004-05-10 14:23 ` Joakim Tjernlund
2004-05-10 14:23 ` Joakim Tjernlund
2004-05-11 7:27 ` [uClibc] Re: uclibc mips ld.so and undefined symbols withnonzerosymbol " Joakim Tjernlund
2004-05-11 7:27 ` Joakim Tjernlund
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=20040511140351.GA13367@nevyn.them.org \
--to=dan@debian.org \
--cc=brad@laronde.org \
--cc=linux-mips@linux-mips.org \
--cc=rsandifo@redhat.com \
--cc=uclibc@uclibc.org \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox