[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: How do I link to nptl?



Liu, Bing Wei wrote:
>
> 14. find a common case, e.g. ex1.c of Linuxthreads examples
> 15. cp -d libc*so* /lib/nptl
> 16. cp -d elf/ld*so* /lib/nptl
> 17. cp -d nptl/libpthread*so* /lib/nptl
> 18. gcc -o ex1 ex1.c -lpthread
> -Wl,-dynamic-linker,/lib/nptl/ld-linux.so.2,-rpath,/lib/nptl
> /lib/libc.so.6: undefined reference to '__libc_stack_end GLIBC_2 1'
> collect2: ld returned 1 exit status
>
> Another question, you see I have used "with-tls" option. However, if
> I export LD_LIBRARY=/home/nptl/glibc:/home/nptl/glibc/nptl, I sttill
> got error message "cannot handle file 'libc.so.6' with TLS data". By
> the way, what does TLS stand for? I only know it's a feature
> introduced into the kernel.
>
> Thanks
> Bingwei
>

TLS stands for Thread-Local Storage, you can read all on it at
http://people.redhat.com/drepper/tls.pdf .
The reason you run into that linktime problem is because you're still
linking to the older libc.so.6; the announcement for nptl-0.1 (
http://marc.theaimsgroup.com/?l=linux-kernel&m=103248252713576&w=2 )
shows how to link your code correctly. The example needs to be adapted a
little, but it should be clear enough from there.
The runtime error message is generated by a non-TLS libc (or programs
linked to it statically), it will refuse to work with TLS enabled files.
Finally, you don't need linuxthreads when building glibc with nptl.

I hope this covers some of your questions.

Ferdinand





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]