diff options
author | Keith Obenschain <obenschaink@gmail.com> | 2012-03-23 17:14:06 -0400 |
---|---|---|
committer | Keith Obenschain <obenschaink@gmail.com> | 2012-03-23 17:14:06 -0400 |
commit | 1271761f530c0050154e8d526b95f952df551751 (patch) | |
tree | 4ce535cc9afdb94b354a23a9848ed0a3ca9ea7cf /gcc-4.4.3 | |
parent | cf90705c8503b3a763801a4f31f6f2272015f0dc (diff) | |
download | toolchain_gcc-1271761f530c0050154e8d526b95f952df551751.tar.gz toolchain_gcc-1271761f530c0050154e8d526b95f952df551751.tar.bz2 toolchain_gcc-1271761f530c0050154e8d526b95f952df551751.zip |
Modifications to enable OpenMP in Android.
This patch enables OpenMP support in the Android NDK by modifying the following:
Specify that pthreads are supported in -lc instead of -lpthread (linux-android.h)
Change the order of ANDROID_LIB_SPEC and LINUX_TARGET_LIB_SPEC so the above change will take precedence (linux-eabi.h)
Modified autoconf for libgomp to check to see if the pthread libraries exist in libc (configure.ac)
Added include to env.c so PAGE_SIZE is defined.
To enable these changes, add "--enable-libgomp" to configure command under build-gcc.sh.
Change-Id: I8b460159b768f64f5198ef5494346cdf75510250
Signed-off-by: Keith Obenschain <obenschaink@gmail.com>
Diffstat (limited to 'gcc-4.4.3')
-rw-r--r-- | gcc-4.4.3/gcc/config/arm/linux-eabi.h | 2 | ||||
-rw-r--r-- | gcc-4.4.3/gcc/config/linux-android.h | 3 | ||||
-rwxr-xr-x | gcc-4.4.3/libgomp/configure | 50 | ||||
-rw-r--r-- | gcc-4.4.3/libgomp/configure.ac | 9 | ||||
-rw-r--r-- | gcc-4.4.3/libgomp/env.c | 1 |
5 files changed, 62 insertions, 3 deletions
diff --git a/gcc-4.4.3/gcc/config/arm/linux-eabi.h b/gcc-4.4.3/gcc/config/arm/linux-eabi.h index 2ca881890..6ab0f52df 100644 --- a/gcc-4.4.3/gcc/config/arm/linux-eabi.h +++ b/gcc-4.4.3/gcc/config/arm/linux-eabi.h @@ -82,7 +82,7 @@ #undef LIB_SPEC #define LIB_SPEC \ LINUX_OR_ANDROID_LD (LINUX_TARGET_LIB_SPEC, \ - LINUX_TARGET_LIB_SPEC " " ANDROID_LIB_SPEC) + ANDROID_LIB_SPEC " " LINUX_TARGET_LIB_SPEC ) #undef STARTFILE_SPEC #define STARTFILE_SPEC \ diff --git a/gcc-4.4.3/gcc/config/linux-android.h b/gcc-4.4.3/gcc/config/linux-android.h index 5ca3858a2..f2a3d9c6f 100644 --- a/gcc-4.4.3/gcc/config/linux-android.h +++ b/gcc-4.4.3/gcc/config/linux-android.h @@ -50,7 +50,8 @@ "%{!frtti:%{!fno-rtti: -fno-rtti}}" #define ANDROID_LIB_SPEC \ - "%{!static: -ldl}" + "%{!static: -ldl} \ + %{pthread:-lc}" #define ANDROID_STARTFILE_SPEC \ "%{!shared:" \ diff --git a/gcc-4.4.3/libgomp/configure b/gcc-4.4.3/libgomp/configure index 5db715cf3..b5cfeb9ef 100755 --- a/gcc-4.4.3/libgomp/configure +++ b/gcc-4.4.3/libgomp/configure @@ -17364,6 +17364,50 @@ else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +CFLAGS="$save_CFLAGS" LIBS="$LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <pthread.h> + void *g(void *d) { return NULL; } +int +main () +{ +pthread_t t; pthread_create(&t,NULL,g,NULL); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -17417,6 +17461,9 @@ rm -f conftest.err conftest.$ac_objext \ fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext # Check for functions needed. @@ -22302,6 +22349,9 @@ ac_configure_args="${multilib_arg} ${ac_configure_args}" multi_basedir="$multi_basedir" CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} CC="$CC" +CXX="$CXX" +GFORTRAN="$GFORTRAN" +GCJ="$GCJ" AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" diff --git a/gcc-4.4.3/libgomp/configure.ac b/gcc-4.4.3/libgomp/configure.ac index a46f99c60..5bafe61d1 100644 --- a/gcc-4.4.3/libgomp/configure.ac +++ b/gcc-4.4.3/libgomp/configure.ac @@ -168,6 +168,13 @@ AC_LINK_IFELSE( void *g(void *d) { return NULL; }], [pthread_t t; pthread_create(&t,NULL,g,NULL);])], [XPCFLAGS=" -Wc,-pthread"], + [CFLAGS="$save_CFLAGS" LIBS="$LIBS" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [#include <pthread.h> + void *g(void *d) { return NULL; }], + [pthread_t t; pthread_create(&t,NULL,g,NULL);])], + [], [CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS" AC_LINK_IFELSE( [AC_LANG_PROGRAM( @@ -175,7 +182,7 @@ AC_LINK_IFELSE( void *g(void *d) { return NULL; }], [pthread_t t; pthread_create(&t,NULL,g,NULL);])], [], - [AC_MSG_ERROR([Pthreads are required to build libgomp])])]) + [AC_MSG_ERROR([Pthreads are required to build libgomp])])])]) # Check for functions needed. AC_CHECK_FUNCS(getloadavg clock_gettime strtoull) diff --git a/gcc-4.4.3/libgomp/env.c b/gcc-4.4.3/libgomp/env.c index c870433f3..6809fdfa1 100644 --- a/gcc-4.4.3/libgomp/env.c +++ b/gcc-4.4.3/libgomp/env.c @@ -43,6 +43,7 @@ #endif #include <limits.h> #include <errno.h> +#include <asm/page.h> #ifndef HAVE_STRTOULL # define strtoull(ptr, eptr, base) strtoul (ptr, eptr, base) |