Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: "Bradley D. LaRonde" <brad@laronde.org>
To: "Richard Sandiford" <rsandifo@redhat.com>
Cc: <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: Sun, 9 May 2004 16:52:17 -0400	[thread overview]
Message-ID: <012701c43607$83aa65f0$8d01010a@prefect> (raw)
In-Reply-To: 874qqpg2ti.fsf@redhat.com

----- 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: Sunday, May 09, 2004 9:14 AM
Subject: Re: uclibc mips ld.so and undefined symbols with nonzero symbol
table entry st_value


> "Bradley D. LaRonde" <brad@laronde.org> writes:
> > I guess that the point of these procedure stubs is to keep
> > pointer-to-function values consistent between executables and share
> > libraries.  Is that what binutils is trying to accomplish here?
>
> No, it's to enable lazy binding.  The idea is that when the dynamic
> loader loads libpthread.so, it doesn't need to resolve malloc()
> immediately, it can just leave the GOT entry pointing to the stub.
> Then, when the stub is called, it will ask the dynamic linker to
> find the true address of malloc() and update the GOT accordingly.
> This is supposed to reduce start-up time.
>
> An object should never use stubs if takes the address of the function.
> It should only use a stub for some symbol foo if every use of foo is
> for a direct call.

OK.  So in a case where an object does take a pointer, does that mean that
ld.so must fix the GOT entry for that symbol before handing control to the
app (i.e. no lazy binding for that symbol)?


> If the dynamic loader is choosing libpthread's stub over the real
> definition in libc.so, that sounds on the face of it like a dynamic
> loader bug.

OK.


> > But should stubs really be getting involved here?  As Thiemo Seufer
pointed
> > out to me, readelf shows me that every undefined symbol in every shared
> > library in /lib on my x86 debian box has the st_value member for the
symbol
> > table entry set to zero.
>
> The x86 and MIPS ABIs are very different though.

I notice that the debian mipsel libpthread.so.0 in
http://ftp.debian.org/pool/main/g/glibc/libc6_2.2.5-11.5_mipsel.deb has
st_value == 0 for every UND FUNC, just like my x86 debian libraries.  This
is very different than the uClibc libpthread.so where every UND FUNC has
st_value != 0.  Interestingly if I link glibc's libpthread with uClibc's
libc.so I see that most UND FUNCs then have st_value != 0.

I would like to see how uClibc ld.so behaves I could somehow get ld to not
generate any stubs in  libpthread.  Any idea why libpthread gets full stubs
when linked with uClibc libc.so but no stubs when linked with glibc libc.so?


Regards,
Brad

WARNING: multiple messages have this Message-ID (diff)
From: "Bradley D. LaRonde" <brad@laronde.org>
To: Richard Sandiford <rsandifo@redhat.com>
Cc: 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: Sun, 9 May 2004 16:52:17 -0400	[thread overview]
Message-ID: <012701c43607$83aa65f0$8d01010a@prefect> (raw)
Message-ID: <20040509205217.7si8sunh98J63u1MvgoYkxHh3Jdd1GMiR3w8UvAzvls@z> (raw)
In-Reply-To: 874qqpg2ti.fsf@redhat.com

----- 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: Sunday, May 09, 2004 9:14 AM
Subject: Re: uclibc mips ld.so and undefined symbols with nonzero symbol
table entry st_value


> "Bradley D. LaRonde" <brad@laronde.org> writes:
> > I guess that the point of these procedure stubs is to keep
> > pointer-to-function values consistent between executables and share
> > libraries.  Is that what binutils is trying to accomplish here?
>
> No, it's to enable lazy binding.  The idea is that when the dynamic
> loader loads libpthread.so, it doesn't need to resolve malloc()
> immediately, it can just leave the GOT entry pointing to the stub.
> Then, when the stub is called, it will ask the dynamic linker to
> find the true address of malloc() and update the GOT accordingly.
> This is supposed to reduce start-up time.
>
> An object should never use stubs if takes the address of the function.
> It should only use a stub for some symbol foo if every use of foo is
> for a direct call.

OK.  So in a case where an object does take a pointer, does that mean that
ld.so must fix the GOT entry for that symbol before handing control to the
app (i.e. no lazy binding for that symbol)?


> If the dynamic loader is choosing libpthread's stub over the real
> definition in libc.so, that sounds on the face of it like a dynamic
> loader bug.

OK.


> > But should stubs really be getting involved here?  As Thiemo Seufer
pointed
> > out to me, readelf shows me that every undefined symbol in every shared
> > library in /lib on my x86 debian box has the st_value member for the
symbol
> > table entry set to zero.
>
> The x86 and MIPS ABIs are very different though.

I notice that the debian mipsel libpthread.so.0 in
http://ftp.debian.org/pool/main/g/glibc/libc6_2.2.5-11.5_mipsel.deb has
st_value == 0 for every UND FUNC, just like my x86 debian libraries.  This
is very different than the uClibc libpthread.so where every UND FUNC has
st_value != 0.  Interestingly if I link glibc's libpthread with uClibc's
libc.so I see that most UND FUNCs then have st_value != 0.

I would like to see how uClibc ld.so behaves I could somehow get ld to not
generate any stubs in  libpthread.  Any idea why libpthread gets full stubs
when linked with uClibc libc.so but no stubs when linked with glibc libc.so?


Regards,
Brad

  parent reply	other threads:[~2004-05-09 20:54 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 [this message]
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                 ` uclibc mips ld.so and undefined symbols with nonzero symbol " Daniel Jacobowitz
2004-05-11 14:21                   ` 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='012701c43607$83aa65f0$8d01010a@prefect' \
    --to=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