Thomas Buschmann
|
Re: Thread-Local Storage: gcc's __thread
|
Thomas Buschmann
03/25/2008 10:53 AM
post6100
|
Re: Thread-Local Storage: gcc's __thread
Thank you for the quick reply.
The following is a minimal example for triggering the error:
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
__thread int tls=0;
void* fnc(void *arg);
int main(int argc,char**argv)
{
pthread_t thread1;
pthread_create(&thread1,0,fnc,0);
printf("main tls= %d\n",tls);
return EXIT_SUCCESS;
}
void* fnc(void *arg)
{
int i;
for(i=0;i<100;i++)
tls++;
printf("thread %d, tls= %d\n",pthread_self(),tls);
}
Compiling with
>> qcc -V3.3.5,gcc_ntox86 -S tls_minimal.c
on qnx 6.3.2 works.
However
>> gcc tls_minmal.s
>> qcc -V2.95.3,gcc_ntox86 -S tls_minimal.c
>> as tls_minimal.s
all fail.
Will "__thread" be supported in the upcoming release (6.4.0 with gcc
4.2)?
Sincerely,
Thomas Buschmann
On Tue, 2008-03-25 at 09:15 -0400, Ryan Mansfield wrote:
> > Hello,
> > Is gcc's __thread keyword (http://gcc.gnu.org/onlinedocs/gcc-3.3.1/gcc/Thread-
> > Local.html) supported in qnx neutrino? Code such as
> > __thread int global=0;
> > compiles, but the assembler fails with errors such as "Error: junk `@NTPOFF'
> > after expression".
>
> No, we don't have support for gcc's thread-local storage.
>
> It shouldn't compile -- it should fail at the compiler stage not the assembler. Which compiler and target are you
using?
>
> qcc -V3.3.5,gcc_ntox86 tls.c
> tls.c:1: error: thread-local storage not supported for this target
>
> Regards,
>
> Ryan Mansfield
>
>
>
> _______________________________________________
> QNX Momentics Community Support
> http://community.qnx.com/sf/go/post6091
>
--
Dipl.-Ing. Thomas Buschmann
Technische Universitaet Muenchen
Lehrstuhl fuer Angewandte Mechanik
Boltzmannstrasse 15, D-85747 Garching
Phone: +49 89/289-15228
Fax : +49 89/289-15213
eMail: buschmann@amm.mw.tum.de
WWW : http://www.amm.mw.tum.de/People/buschmann.html
|
|
|