Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alexrp@xamarin.com>2013-07-11 23:19:34 +0400
committerAlex Rønne Petersen <alexrp@xamarin.com>2013-07-12 00:11:29 +0400
commitf99f84a429374f4ce39e8376eb28f23e2a46a759 (patch)
tree2c6a0458e917c40d058aaf87dee395abf3e90c97
parent718ceb860149fffc8a96e547e10ca7fad4909d2c (diff)
Add ARM version detection to configure and use the resulting macros.
This defines ARM_VERSION_{5,6,7}. Several of these can be defined at once. For example ARM_VERSION_5 and ARM_VERSION_6 will both be defined if the target is an ARM v6 CPU. Previously, we defined HAVE_ARMV6 based on running a program. This obviously didn't work for cross-compilation. This new approach does, and detects more cases (v5, v6, v7) than the previous check (v6).
-rw-r--r--configure.in66
-rw-r--r--libgc/include/private/gc_locks.h4
-rw-r--r--mono/utils/mono-membar.h2
3 files changed, 54 insertions, 18 deletions
diff --git a/configure.in b/configure.in
index 9c0e6e773fa..15d3387657d 100644
--- a/configure.in
+++ b/configure.in
@@ -2592,9 +2592,9 @@ case "$host" in
arch_target=arm;
ACCESS_UNALIGNED="no"
JIT_SUPPORTED=yes
- CPPFLAGS="$CPPFLAGS -D__ARM_EABI__ -DHAVE_ARMV6=1"
+ CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
# libgc's gc_locks.h depends on this
- CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DHAVE_ARMV6"
+ CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC"
sgen_supported=true
;;
arm*-linux*)
@@ -2636,7 +2636,7 @@ if test "x$host" != "x$target"; then
arch_target=arm;
ACCESS_UNALIGNED="no"
JIT_SUPPORTED=yes
- CPPFLAGS="$CPPFLAGS -D__ARM_EABI__ -DHAVE_ARMV6=1"
+ CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
jit_wanted=true
# Can't use tls, since it depends on the runtime detection of tls offsets
# in mono-compiler.h
@@ -3044,18 +3044,54 @@ if test ${TARGET} = ARM; then
CPPFLAGS="$CPPFLAGS -DARM_FPU_$fpu=1"
unset fpu
- if test x$cross_compiling = xno; then
- AC_MSG_CHECKING(for ARMV6)
- AC_TRY_RUN([
- int main () { __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r" (0) : "memory"); return 0; }
- ], armv6=yes, armv6=no)
-
- AC_MSG_RESULT($armv6)
- if test ${armv6} = yes; then
- AC_DEFINE(HAVE_ARMV6, 1, "Host supports ARMV6 instructions")
- # libgc's gc_locks.h depends on this
- CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DHAVE_ARMV6"
- fi
+ dnl *********************************************
+ dnl *** Check which ARM version(s) we can use ***
+ dnl *********************************************
+ AC_MSG_CHECKING(which ARM version to use)
+
+ AC_TRY_COMPILE([], [
+ #if !defined(__ARM_ARCH_5T__) && !defined(__ARM_ARCH_5TE__) && !defined(__ARM_ARCH_5TEJ__)
+ #error Not on ARM v5.
+ #endif
+ return 0;
+ ], [
+ arm_v5=yes
+ ], [])
+
+ AC_TRY_COMPILE([], [
+ #if !defined(__ARM_ARCH_6J__) && !defined(__ARM_ARCH_6ZK__) && !defined(__ARM_ARCH_6K__) && !defined(__ARM_ARCH_6T2__) && !defined(__ARM_ARCH_6M__)
+ #error Not on ARM v6.
+ #endif
+ return 0;
+ ], [
+ arm_v5=yes
+ arm_v6=yes
+ ], [])
+
+ AC_TRY_COMPILE([], [
+ #if !defined(__ARM_ARCH_7A__) && !defined(__ARM_ARCH_7R__) && !defined(__ARM_ARCH_7EM__) && !defined(__ARM_ARCH_7M__)
+ #error Not on ARM v7.
+ #endif
+ return 0;
+ ], [
+ arm_v5=yes
+ arm_v6=yes
+ arm_v7=yes
+ ], [])
+
+ if test x$arm_v5 = xyes; then
+ AC_DEFINE(HAVE_ARMV5, 1, [ARM v5])
+ CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DHAVE_ARMV5=1"
+ fi
+
+ if test x$arm_v6 = xyes; then
+ AC_DEFINE(HAVE_ARMV6, 1, [ARM v6])
+ CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DHAVE_ARMV6=1"
+ fi
+
+ if test x$arm_v7 = xyes; then
+ AC_DEFINE(HAVE_ARMV7, 1, [ARM v7])
+ CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DHAVE_ARMV7=1"
fi
fi
diff --git a/libgc/include/private/gc_locks.h b/libgc/include/private/gc_locks.h
index e95cec0b4c1..36ccb8764d0 100644
--- a/libgc/include/private/gc_locks.h
+++ b/libgc/include/private/gc_locks.h
@@ -231,7 +231,7 @@
# define NACL_ALIGN()
# endif
inline static int GC_test_and_set(volatile unsigned int *addr) {
-#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7__)
+#if defined(__native_client__) || defined(HAVE_ARMV6)
int ret, tmp;
__asm__ __volatile__ (
"1:\n"
@@ -264,7 +264,7 @@
inline static void GC_clear(volatile unsigned int *addr) {
#ifdef HAVE_ARMV6
/* Memory barrier */
-#ifdef __native_client__
+#if defined(__native_client__) || defined(HAVE_ARMV7)
/* NaCl requires ARMv7 CPUs. */
__asm__ __volatile__("dsb" : : : "memory");
#else
diff --git a/mono/utils/mono-membar.h b/mono/utils/mono-membar.h
index d49f12d184a..ce3a5ea157e 100644
--- a/mono/utils/mono-membar.h
+++ b/mono/utils/mono-membar.h
@@ -132,7 +132,7 @@ static inline void mono_memory_write_barrier (void)
static inline void mono_memory_barrier (void)
{
#ifdef HAVE_ARMV6
-#ifdef __native_client__
+#if defined(__native_client__) || defined(HAVE_ARMV7)
/* NaCl requires ARMv7 CPUs. */
__asm__ __volatile__("dsb" : : : "memory");
#else