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 10:17:11AM -0800, Ulrich Drepper wrote:
> "H . J . Lu" <hjl@valinux.com> writes:
> 
> > I am enclosing a testcase here taken from glibc 2.2:
> 
> What you see has nothing to do with symbol versioning.  Run test2 with
> --direct as the parameter.  This doesn't change the lookup, it only
> avoids the fork.  I don't know what the reason for this is but it's
> not symbol related.
> 

It looks like we may have 2 problems. I did

# LD_DEBUG=bindings LD_DEBUG_OUTPUT=test1 ./test1 --direct
# cat test1.31054
...
' [31056:       GLIBC_2.0binding file ]
/lib/libpthread.so.0 to /lib/libc.so.6: 31054:  normalbinding file  symbol
`./test1__gettimeofday to ' [/lib/libpthread.so.0GLIBC_2.0: ]
normal31056:     symbol `binding file pread/lib/libpthread.so.0' [ to
GLIBC_2.2/lib/libc.so.6]
: 31054:        normalbinding file  symbol
`/lib/libpthread.so.0__libc_nanosleep to ' [/lib/libc.so.6GLIBC_2.0: ]
normal symbol `__libc_pread' [GLIBC_2.1.3]
...
# LD_DEBUG=bindings LD_DEBUG_OUTPUT=test2 ./test2 --direc
# cat test2.31028
...
: 31028:        normalbinding file  symbol `./test2__sigsetjmp to '
[/lib/libc.so.6GLIBC_2.0: ]
normal31030:     symbol `binding file __fxstat/lib/libpthread.so.0' [ to
GLIBC_2.0/lib/libc.so.6]
: normal symbol `__gettimeofday31028:   ' [binding file GLIBC_2.0./test2]
 to 31030:      /lib/libc.so.6binding file : /lib/libpthread.so.0normal to
symbol `/lib/libc.so.6pread: ' [normalGLIBC_2.1 symbol `]
__libc_nanosleep' [GLIBC_2.031028:      ]
...

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. I guess
"test2 --direct" may work by accident since the wrong pread is used.
There may be cases where a correct pread is required. BTW, I may
be able to find a testcase where the wrong pread is used even with
"-lpthread -lrt" at the final link command.

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?


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

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