diff options
author | Andrew Hsieh <andrewhsieh@google.com> | 2013-03-07 10:41:25 +0800 |
---|---|---|
committer | Andrew Hsieh <andrewhsieh@google.com> | 2013-03-07 21:41:27 +0800 |
commit | a38e7b29885b25278b1d356b2efd21622376695d (patch) | |
tree | b3d8e13f5686719c81ea42f318420352686c7cd1 /gcc-4.6/libgomp/config/linux/proc.c | |
parent | 1ed1c0506a4b26ebffb0e52e068c25cef2f4dfad (diff) | |
download | toolchain_gcc-a38e7b29885b25278b1d356b2efd21622376695d.tar.gz toolchain_gcc-a38e7b29885b25278b1d356b2efd21622376695d.tar.bz2 toolchain_gcc-a38e7b29885b25278b1d356b2efd21622376695d.zip |
Fix GCC 4.4.3/4.6/4.7 openmp support to use libgomp/config/linux
Android does support SYS_gettid and SYS_futex which allows
libgomp to use libgomp/config/linux/* instead of
libgomp/config/posix and enables more features such as
thread affinity.
For GCC4.4.3/ARM, the missing linux/futex.h is copied from
GCC 4.6
Also guard the new sc_nprocessors_actu with __ANDROID__,
and fix return value in proc.c
Change-Id: Ib22496075ac5e41c5f44f5160d1b34a5609c168b
Diffstat (limited to 'gcc-4.6/libgomp/config/linux/proc.c')
-rw-r--r-- | gcc-4.6/libgomp/config/linux/proc.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc-4.6/libgomp/config/linux/proc.c b/gcc-4.6/libgomp/config/linux/proc.c index 82e58f4f4..6cefc765f 100644 --- a/gcc-4.6/libgomp/config/linux/proc.c +++ b/gcc-4.6/libgomp/config/linux/proc.c @@ -235,7 +235,7 @@ sc_nprocessors_actu () if (buffer_len < 0) /* should not happen */ { fprintf(stderr,"Could not find %s: %s\n", file_name, strerror(errno)); - return; + return 1; } /* Count the CPU cores, the value may be 0 for single-core CPUs */ @@ -265,8 +265,10 @@ gomp_init_num_threads (void) return; } #endif -#ifdef _SC_NPROCESSORS_ONLN +#if defined(__ANDROID__) gomp_global_icv.nthreads_var = sc_nprocessors_actu (); +#elif defined(_SC_NPROCESSORS_ONLN) + gomp_global_icv.nthreads_var = sysconf (_SC_NPROCESSORS_ONLN); #endif } @@ -297,8 +299,10 @@ get_num_procs (void) return gomp_available_cpus; } #endif -#ifdef _SC_NPROCESSORS_ONLN +#if defined(__ANDROID__) return sc_nprocessors_actu (); +#elif defined(_SC_NPROCESSORS_ONLN) + return sysconf (_SC_NPROCESSORS_ONLN); #else return gomp_icv (false)->nthreads_var; #endif |