Question: Does uclibc support NPTL TLS ?

Khem Raj raj.khem at gmail.com
Thu May 28 02:00:34 UTC 2015


> On May 27, 2015, at 6:21 PM, Sheng Yong <shengyong1 at huawei.com> wrote:
> 
> Hi,
> 
> On 5/28/2015 3:18 AM, Rich Felker wrote:
>> On Wed, May 27, 2015 at 05:10:53PM +0800, Sheng Yong wrote:
>>> Hi,
>>> 
>>> I encountered a problem when I test thread local storage
>>> on my arm board (kernel 3.10.77 and uclibc 0.99.3.2).
>>> 
>>> Please let me know if I am doing something wrong for
>>> debugging TLS.
>>> 
>>> on my x86 host machine:
>>> root at kernel-host:~> cat tls.c
>>> __thread int i =5;
>>> 
>>> int
>>> main (int argc, char **argv)
>>> {
>>>  return 0;
>>> }
>>> 
>>> root at kernel-host:~> arm-linux-uclibceabi-gcc -o tls tls.c -g -lpthread
>> 
>> If you add output (printf("%d", i)) to the program and actually run
>> it, does it work? It looks to me like the failure you're observing is
>> the inability of gdb to find the TLS while debugging, which is
>> separate from whether TLS is supported.
> I test it, it can printf the value of `i'. I don't know if there are any options
> that impact on gcc or gdb. I checked the configure log and compile log, there is
> no optins `-disable-tls' or `-no-tls' or the like.
> 
> $ cat tls.c
> #include <stdio.h>
> 
> __thread int i =5;
> 
> int
> main (int argc, char **argv)
> {
> 	printf("%d\n", i);
> 	return 0;
> }
> 
> sh-4.2# ./tls
> 5
> 

Seems like gdb is not able to comprehend the TLS structure that uclibc is putting. So you need to investigate
that part, either gdb or libthread-db may be where the issue lies.

> thanks,
> Sheng
> 
>> 
>> Rich
>> 
>> 
> 
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://lists.busybox.net/mailman/listinfo/uclibc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 204 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20150527/02278194/attachment.asc>


More information about the uClibc mailing list