aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.6
diff options
context:
space:
mode:
authorGeunsik Lim <leemgs@gmail.com>2012-12-25 14:28:35 +0900
committerGeunsik Lim <leemgs@gmail.com>2012-12-25 14:28:35 +0900
commit92c478dba755a1a2f6f00ff390666acbffd41982 (patch)
tree313fb17f436a7d19fbea06d64b11c2fe6dbfbd30 /gcc-4.6
parent40c7254330088e605a544fe4ab0c25beb63fce20 (diff)
downloadtoolchain_gcc-92c478dba755a1a2f6f00ff390666acbffd41982.zip
toolchain_gcc-92c478dba755a1a2f6f00ff390666acbffd41982.tar.gz
toolchain_gcc-92c478dba755a1a2f6f00ff390666acbffd41982.tar.bz2
Support OpenMP for task parallelism on Android-ICS/GCC-4.6.3
The patch supports OpenMP library to parallelize the existing C/C++ code rapidly/easily without any modification of android platform on multicore embedded devices. The original patch is made by Keith Obenschain (using GCC 4.4.3). .Archive - https://android-review.googlesource.com/#/c/34491/ I just moved GCC version from 4.4.3 to 4.6.3 for ktoolchain version 2.5. The patch is good to me when I evaluate a lot of C/C++ source code with OpenMP's #parama. Please, refer to the "kandroid toolchain" menu in www.kandroid.org to compile source code including bionic and openmp library on real Android devices. http://kandroid.org/board/board.php?board=toolchain&command=body&no=16 I tested Openmp library with the latest GCC 4.6.3 on Android/ARM devices as following. Please refer to the below example. geunsik@invain-rhel6$> ./arm-linux-androideabi-gcc openmptest.c -L /usr/local/ktoolchain-cortexa9-ver2.5-bionic/ arm-linux-androideabi/lib -lgomp -o openmptest [ENTER] geunsik@invain-rhel6$> geunsik@invain-rhel6$> geunsik@invain-rhel6$> file ./openmptest ./openmptest: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), not stripped Change-Id: I55b6a6c2205c09dd6b923f9da07b185167145e87 Signed-off-by: Geunsik Lim <leemgs@gmail.com> Acked-by: Geunsik Lim <geunsik.lim@gmail.com> Acked-by: Geunsik Lim <geunsik.lim@samsung.com>
Diffstat (limited to 'gcc-4.6')
-rw-r--r--gcc-4.6/gcc/config/arm/linux-eabi.h2
-rw-r--r--gcc-4.6/gcc/config/linux-android.h3
-rwxr-xr-xgcc-4.6/libgomp/configure52
-rw-r--r--gcc-4.6/libgomp/configure.ac9
-rw-r--r--gcc-4.6/libgomp/env.c1
5 files changed, 63 insertions, 4 deletions
diff --git a/gcc-4.6/gcc/config/arm/linux-eabi.h b/gcc-4.6/gcc/config/arm/linux-eabi.h
index 72f9bdd..bb1a681 100644
--- a/gcc-4.6/gcc/config/arm/linux-eabi.h
+++ b/gcc-4.6/gcc/config/arm/linux-eabi.h
@@ -87,7 +87,7 @@
#undef LIB_SPEC
#define LIB_SPEC \
LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LIB_SPEC, \
- GNU_USER_TARGET_LIB_SPEC " " ANDROID_LIB_SPEC)
+ ANDROID_LIB_SPEC " " GNU_USER_TARGET_LIB_SPEC )
#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
diff --git a/gcc-4.6/gcc/config/linux-android.h b/gcc-4.6/gcc/config/linux-android.h
index 033cfef..c6d9cdd 100644
--- a/gcc-4.6/gcc/config/linux-android.h
+++ b/gcc-4.6/gcc/config/linux-android.h
@@ -53,7 +53,8 @@
"--noexecstack"
#define ANDROID_LIB_SPEC \
- "%{!static: -ldl}"
+ "%{!static: -ldl}" \
+ "%{pthread:-lc}"
#define ANDROID_STARTFILE_SPEC \
"%{shared: crtbegin_so%O%s;:" \
diff --git a/gcc-4.6/libgomp/configure b/gcc-4.6/libgomp/configure
index 4017aa9..623b1a9 100755
--- a/gcc-4.6/libgomp/configure
+++ b/gcc-4.6/libgomp/configure
@@ -15030,7 +15030,54 @@ _ACEOF
if ac_fn_c_try_link "$LINENO"; then :
XPCFLAGS=" -Wc,-pthread"
else
- CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS"
+ 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 confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <pthread.h>
@@ -15053,6 +15100,9 @@ rm -f core conftest.err conftest.$ac_objext \
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
# Check for functions needed.
for ac_func in getloadavg clock_gettime strtoull
diff --git a/gcc-4.6/libgomp/configure.ac b/gcc-4.6/libgomp/configure.ac
index c3dcc0c..6db8054 100644
--- a/gcc-4.6/libgomp/configure.ac
+++ b/gcc-4.6/libgomp/configure.ac
@@ -184,6 +184,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(
@@ -191,7 +198,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.6/libgomp/env.c b/gcc-4.6/libgomp/env.c
index 92fa8c3..8b1e29e 100644
--- a/gcc-4.6/libgomp/env.c
+++ b/gcc-4.6/libgomp/env.c
@@ -44,6 +44,7 @@
#endif
#include <limits.h>
#include <errno.h>
+#include <asm/page.h>
#ifndef HAVE_STRTOULL
# define strtoull(ptr, eptr, base) strtoul (ptr, eptr, base)