Hi again! I want to remind that issue is urgent for Android.

2014-08-13 12:13 GMT+04:00 Varvara Rainchik <varvara.s.rainc...@gmail.com>:
> *Ping*
>
> Thanks,
> Varvara
>
> 2014-08-06 14:05 GMT+04:00 Varvara Rainchik <varvara.s.rainc...@gmail.com>:
>> Hi,
>>
>> The issue was firstly observed on NDK gcc since TLS is not supported
>> in Android bionic. I also see the same failure on gcc configured for
>> linux with –disable-tls, libgomp make check log:
>>
>> FAIL: libgomp.c/affinity-1.c execution test
>> FAIL: libgomp.c/icv-2.c execution test
>> FAIL: libgomp.c/lock-3.c execution test
>> FAIL: libgomp.c/target-6.c execution test
>>
>> These tests except affinity-1.c fail because gomp_thread () function
>> returns null pointer. I’ve found 2 bugs, first one addresses this
>> problem on Windows:
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42616;
>> second one addresses original problem (for both cases, with and without TLS):
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36242.
>> Tests from both bugs fail with –disable-tls. So, it seems that non TLS
>> case was fixed just partially. The following patch solves the problem.
>> With this patch 3 tests from make check pass, affinity-1.c fails, but
>> I think it’s other non TLS problem.
>> Changes are bootstrapped and regtested on x86_64-linux.
>>
>>
>> 2014-08-06  Varvara Rainchik  <varvara.rainc...@intel.com>
>>
>>         * libgomp.h (gomp_thread): For non TLS case create thread data.
>>         * team.c (create_non_tls_thread_data): New function.
>>
>>
>> ---
>> diff --git a/libgomp/libgomp.h b/libgomp/libgomp.h
>> index a1482cc..cf3ec8f 100644
>> --- a/libgomp/libgomp.h
>> +++ b/libgomp/libgomp.h
>> @@ -479,9 +479,15 @@ static inline struct gomp_thread *gomp_thread (void)
>> }
>> #else
>> extern pthread_key_t gomp_tls_key;
>> +extern struct gomp_thread *create_non_tls_thread_data (void);
>> static inline struct gomp_thread *gomp_thread (void)
>> {
>> -  return pthread_getspecific (gomp_tls_key);
>> +  struct gomp_thread *thr = pthread_getspecific (gomp_tls_key);
>> +  if (thr == NULL)
>> +  {
>> +    thr = create_non_tls_thread_data ();
>> +  }
>> +  return thr;
>> }
>> #endif
>>
>> diff --git a/libgomp/team.c b/libgomp/team.c
>> index e6a6d8f..bf8bd4b 100644
>> --- a/libgomp/team.c
>> +++ b/libgomp/team.c
>> @@ -927,6 +927,17 @@ initialize_team (void)
>>      gomp_fatal ("could not create thread pool destructor.");
>> }
>>
>> +#ifndef HAVE_TLS
>> +struct gomp_thread *create_non_tls_thread_data (void)
>> +{
>> +  struct gomp_thread *thr = gomp_malloc (sizeof (struct gomp_thread));
>> +  pthread_setspecific (gomp_tls_key, thr);
>> +  gomp_sem_init (&thr->release, 0);
>> +
>> +  return thr;
>> +}
>> +#endif
>> +
>> static void __attribute__((destructor))
>> team_destructor (void)
>> {
>> ---
>>
>>
>> Is it ok?
>>
>>
>> Best regards,
>>
>> Varvara

Reply via email to