thread errno problem

matthieu castet castet.matthieu at free.fr
Tue Nov 18 22:19:19 UTC 2008


Hi,

I run the attached program with uclibc linuxthread.old, uclibc android 
and glibc nptl with different link options (static/shared) and 
(-lpthread/-lc -lpthread) [1].

It seems the -lc -lpthread is broken. It is because there no forwarder 
for __errno_location and __h_errno_location in shared mode. So the 
linker will take the first one it found : the libc one.
The correct solution could be to do something similar to 
__pthread_mutex_init.

For static mode I think it can't be solved, but we should emit a link 
warning/error.


Matthieu

PS : linuxthread.old errno seems broken also on -lpthread mode...

[1]
linuxthread.old
*********************
-lpthread
m 0(=0)
t 0 (=0)
m 4(=1)
t 4(=4)
*********************
-lc -lpthread
m 0(=0)
t 1 (=0)
m 4(=1)
t 2(=4)
static
*********************
-lpthread
m 0(=0)
t 0 (=0)
m 4(=1)
t 4(=4)
*********************
-lc -lpthread
m 0(=0)
t 1 (=0)
m 4(=1)
t 2(=4)


android
*********************
-lpthread
m 0(=0)
m 1(=1)
t 0 (=0)
t 4(=4)
*********************
-lc -lpthread
m 0(=0)
m 1(=1)
t 2 (=0)
t 4(=4)
static
*********************
-lpthread
m 0(=0)
m 1(=1)
t 0 (=0)
t 4(=4)
*********************
-lc -lpthread
m 0(=0)
m 1(=1)
t 2 (=0)
t 4(=4)


glibc nptl
*********************
-lpthread
m 0(=0)
t 0 (=0)
m 1(=1)
t 4(=4)
*********************
-lc -lpthread
m 0(=0)
t 0 (=0)
m 1(=1)
t 4(=4)
static
*********************
-lpthread
m 0(=0)
t 0 (=0)
m 1(=1)
t 4(=4)
*********************
-lc -lpthread
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libpthread.a(lowlevellock.o): 
In function `__lll_lock_wait_private':
(.text+0x0): multiple definition of `__lll_lock_wait_private'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libc.a(libc-lowlevellock.o):(.text+0x0): 
first defined here
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libpthread.a(lowlevellock.o): 
In function `__lll_unlock_wake_private':
(.text+0x110): multiple definition of `__lll_unlock_wake_private'
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libc.a(libc-lowlevellock.o):(.text+0x30): 
first defined here
collect2: ld returned 1 exit status
-------------- next part --------------
A non-text attachment was scrubbed...
Name: err.c
Type: text/x-csrc
Size: 421 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20081118/92ff21e1/attachment-0002.c 


More information about the uClibc mailing list