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


On Thu, Nov 09, 2000 at 09:49:37AM -0800, H . J . Lu wrote:
> On Thu, Nov 09, 2000 at 12:23:18AM -0800, Ulrich Drepper wrote:
> > "H . J . Lu" <hjl@valinux.com> writes:
> > 
> > > Some functions have different versions in libc and libpthread. For
> > > example, pread has GLIBC_2.1 in libc and GLIBC_2.2 in libpthread.
> > > I can imagine potential problems with it. Shouldn't a fuction have
> > > the same verion cross all libraries?
> > 
> > The names, although the same in all libraries, are completely
> > separated.  They don't stand alone, they are used as a tuple
> > (library,version).  It doesn't matter whether a symbol has different
> > names in different DSOs.
> > 
> 
> I am enclosing a testcase here taken from glibc 2.2:
> 
> # ldd /usr/lib/librt.so
>         libc.so.6 => /lib/libc.so.6 (0x40023000)
>         libpthread.so.0 => /lib/libpthread.so.0 (0x40149000)
>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
> # make
> cc -D_GNU_SOURCE -I.   -c -o tst-aio64.o tst-aio64.c
> cc -o test1 tst-aio64.o -lpthread -lrt
> cc -o test2 tst-aio64.o -lrt
> ./test1
> aio_write test ok
> aio_read test ok
> lio_listio (write) test ok
> aio_fsync (aio_write) test ok
> finished3
> finished2
> finished
> ./test2
> make: *** wait: No child processes.  Stop.
> make: *** Waiting for unfinished jobs....
> make: *** wait: No child processes.  Stop.
> # nm test1 | grep pread 
> 	U pread@@GLIBC_2.2
> # nm test2 | grep pread
> 	U pread@@GLIBC_2.1
> # ldd test2
>         librt.so.1 => /lib/librt.so.1 (0x40023000)
>         libc.so.6 => /lib/libc.so.6 (0x40035000)
>         libpthread.so.0 => /lib/libpthread.so.0 (0x4015b000)
>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
> 
> Even though libpthread.so.0 is linked with test2. But the wrong pread
> is used.
> 
> 

Ooops. Here is the testcase.

-- 
H.J. Lu (hjl@valinux.com)

ver.tar.gz


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