This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Functions with different versions in libc and libpthread


"H . J . Lu" <hjl@valinux.com> writes:

> It looks like pread bound to pread@GLIBC_2.2 in libpthread.so.0 for
> test1 and bound pread@GLIBC_2.1 in libc.so.6 for test2.

And this is how it must be.  These are the lookup runs.  If you expect
the main application to use the pread from the thread library you have
to link with the thread library.

> I guess "test2 --direct" may work by accident since the wrong pread
> is used.

The --direct parameter doesn't change anything in the symbol lookup.
It just avoids running the test in a forked child.

> I think another problem may be in symbol resolution. With
> 
> # gcc ... -lpthread -lrt
> 
> libpthread.so.0 is searched before libc.so.6 at the run-time and with
> 
> # gcc ... -lrt
> 
> libpthread.so.0 is searched after libc.so.6 at the run-time. We already
> treat libpthread.so.0 as a special case for init. Should we also do it
> for symbol resolution?

No.  The above is exactly correct.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]