"-lc -lpthread" link order works on x86_64 glibc-2.9, but cause hang on uClibc-0.9.32-rc1 on mipsel with NPTL

2011-01-11 Thread Jian Peng
"-lc -lpthread" link order works on Linux with glibc-2.9 on x86_64, but cause 
hang on uClibc-0.9.32-rc1 on mipsel with NPTL
The testing program is very simple as follow

#include 
#include 

int main(int argc, char *argv[])
{
pthread_cond_t cond;

printf(" ===  Start  Pthread Test !!!   === \n");

pthread_cond_init(&cond, NULL);

printf(" ===  End  Pthread Test !!!   === \n");

return 0;
}

In following build,

$ mipsel-linux-gcc main.c -o /tftpboot/maintest.1 -lpthread
$ mipsel-linux-gcc main.c -o /tftpboot/maintest.2 -pthread
$ mipsel-linux-gcc main.c -o /tftpboot/maintest.3 -pthread -lc
$ mipsel-linux-gcc main.c -o /tftpboot/maintest.4 -lc -pthread
$ mipsel-linux-gcc main.c -o /tftpboot/maintest.5 -lc -lpthread

Only maintest.1 and maintest.2 works as expected, while the rest hang as

# ./maintest.3
 ===  Start  Pthread Test !!!   ===

^C
#

The problem was reported before and treated as wrong linking order (should be 
-lpthread -lc), but for lots of complicated projects, it is very hard to 
control link order due to stacking of LD_FLAGS from multiple makefiles.
IMHO, this can be resolved by defining pthread_* as libc_hidden_def to avoid to 
be overridden by the one from libc.so.

Any suggestion?

Thanks,
Jian
___
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc


Re: "-lc -lpthread" link order works on x86_64 glibc-2.9, but cause hang on uClibc-0.9.32-rc1 on mipsel with NPTL

2011-01-11 Thread Timo Teräs
On 01/11/2011 10:03 AM, Jian Peng wrote:
> "-lc -lpthread" link order works on Linux with glibc-2.9 on x86_64, but cause 
> hang on uClibc-0.9.32-rc1 on mipsel with NPTL

Would be because uclibc on mipsel does not support protected symbols.

uclibc on x86 and some other platforms works too. I believe someone
should be working on making the protected symbol support generic.

- Timo
___
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc


Re: "-lc -lpthread" link order works on x86_64 glibc-2.9, but cause hang on uClibc-0.9.32-rc1 on mipsel with NPTL

2011-01-11 Thread Carmelo Amoroso
On 11/01/11 09:18, Timo Teräs wrote:
> On 01/11/2011 10:03 AM, Jian Peng wrote:
>> "-lc -lpthread" link order works on Linux with glibc-2.9 on x86_64, but 
>> cause hang on uClibc-0.9.32-rc1 on mipsel with NPTL
> 
> Would be because uclibc on mipsel does not support protected symbols.
> 
> uclibc on x86 and some other platforms works too. I believe someone
> should be working on making the protected symbol support generic.
> 
> - Timo

Hi,
I'll post a patch to cover all the arch in a generic way (see older emails with 
Jocke) tomorrow morning (CET time)

Carmelo


> ___
> uClibc mailing list
> uClibc@uclibc.org
> http://lists.busybox.net/mailman/listinfo/uclibc
> 

___
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc