On Sat, Feb 19, 2011 at 02:37:39PM +0100, Rene Engelhard wrote:
> On Sat, Feb 19, 2011 at 01:55:50PM +0100, Rene Engelhard wrote:
> > +.IF "$(ARM_TARGET)" == "ARMV6"
> 
> This is broken, too, afaics.
> In configure you set ARM_TARGET to e.g. 6 (WITHOUT ARMV)
> but there you use it WITH ARMV...

I fixed some more (even syntax errors) in the patch, can't attach it
right now since IZ is down, but here it is.

Will attach a new patch, which
 - defaults to armv4t
 - fixes syntax errors in the patch (test has no < and > but -lt and -gt,
   -a test is broken (either && or -a without test, missing $ before build_cpu)
 - remove the "x$something" nonsense for test which doesn't play well with
   test and -lt/-gt
 - you should not assume the build_cpu is stricly arm. on my debian sid on a
   sheevaplug the triplet is armv5tel-unknown-linux-gnu when not specifying
   arm-* manually on the configure line. There's a reason we have arm* in 
   configure.ins case statements :)

The original "patch" obviously wasn't tested at all...

Grüße/Regards,

René
diff -r 67e476e04669 configure.in
--- a/configure.in	Fri Nov 12 20:02:04 2010 +0100
+++ b/configure.in	Fri Feb 18 21:47:58 2011 +0100
@@ -828,6 +828,16 @@
 AC_ARG_ENABLE(dependency-tracking,
 [  --disable-dependency-tracking  Disables generation of dependency information.
 ],,)
+AC_ARG_WITH(arm-target,
+[  --arm-target        The minimal targeted arm processor
+                          used for the build environment.
+                          Cases :
+                            arm-target < 6 : armv4t compatibility
+                            arm-target = 6 : exact armv6 compatibility
+                    	    arm-target > 6 : armv7-a compatibility
+
+                          Usage: --with-arm-target=7
+],with_arm_target=$withval,with_arm_target=4)
 
 BUILD_TYPE="OOo"
 
@@ -5803,6 +5813,24 @@
 AC_SUBST(GSTREAMER_CFLAGS)
 AC_SUBST(GSTREAMER_LIBS)
 
+dnl ===================================================================
+dnl Check the ARM target
+dnl ===================================================================
+
+if test "$_os" = "Linux" && echo "$build_cpu" | $GREP -q arm; then
+    # default value
+    ARM_TARGET=ARMV4T
+    AC_MSG_CHECKING([which ARM processor optimization to use])
+    if test "$with_arm_target" -lt "6"; then
+	ARM_TARGET=ARMV4T
+    elif test "$with_arm_target" = "6"; then
+	ARM_TARGET=ARMV6
+    elif test "$with_arm_target" -gt "6"; then
+	ARM_TARGET=ARMV7
+    fi
+    AC_MSG_RESULT([$ARM_TARGET])
+    AC_SUBST(ARM_TARGET)
+fi
 
 dnl ===================================================================
 dnl Check whether the Cairo libraries are available.
diff -r 67e476e04669 sal/osl/unx/interlck.c
--- a/sal/osl/unx/interlck.c	Fri Nov 12 20:02:04 2010 +0100
+++ b/sal/osl/unx/interlck.c	Fri Feb 18 21:47:58 2011 +0100
@@ -134,6 +134,54 @@
     return nCount;
 }
 
+#elif defined ( GCC ) && defined ( ARM )
+
+/*****************************************************************************/
+/* osl_incrementInterlockedCount */
+/*****************************************************************************/
+oslInterlockedCount SAL_CALL osl_incrementInterlockedCount(oslInterlockedCount* pCount)
+{
+#if defined( ARMV7 ) || defined( ARMV6 )
+    register oslInterlockedCount nCount __asm__ ("r1");
+    int nResult;
+
+    __asm__ __volatile__ (
+"1:	ldrex %0, [%3]\n"
+"	add %0, %0, #1\n"
+"	strex %1, %0, [%3]\n"
+"	teq %1, #0\n"
+"	bne 1b"
+        : "=&r" (nCount), "=&r" (nResult), "=m" (*pCount)
+        : "r" (pCount)
+        : "memory");
+
+    return nCount;
+#else
+    return __sync_add_and_fetch( pCount, 1 );
+#endif
+}
+
+oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInterlockedCount* pCount)
+{
+#if defined( ARMV7 ) || defined( ARMV6 )
+    register oslInterlockedCount nCount __asm__ ("r1");
+    int nResult;
+
+    __asm__ __volatile__ (
+"0:	ldrex %0, [%3]\n"
+"	sub %0, %0, #1\n"
+"	strex %1, %0, [%3]\n"
+"	teq %1, #0\n"
+"	bne 0b"
+        : "=&r" (nCount), "=&r" (nResult), "=m" (*pCount)
+        : "r" (pCount)
+        : "memory");
+    return nCount;
+#else
+    return __sync_sub_and_fetch( pCount, 1 );
+#endif
+}
+
 #else
 /* use only if nothing else works, expensive due to single mutex for all reference counts */
 
diff -r 67e476e04669 set_soenv.in
--- a/set_soenv.in	Fri Nov 12 20:02:04 2010 +0100
+++ b/set_soenv.in	Fri Feb 18 21:47:58 2011 +0100
@@ -1694,6 +1694,7 @@
 ToFile( "SET_EXCEPTIONS",    $SET_EXCEPTIONS,    "e" );
 ToFile( "use_shl_versions",  $use_shl_versions,  "e" );
 ToFile( "FLIPCMD",           $FLIPCMD,           "e" );
+ToFile( "ARM_TARGET",          "@ARM_TARGET@",     "e" );
 #
 # Writing the variables to file.
 # (c = comment, e = environment variable, a = alias, n = newline )
diff -r 67e476e04669 solenv/inc/unxlngr.mk
--- a/solenv/inc/unxlngr.mk	Fri Nov 12 20:02:04 2010 +0100
+++ b/solenv/inc/unxlngr.mk	Fri Feb 18 21:47:58 2011 +0100
@@ -32,3 +32,19 @@
 CDEFS+=-DARM32
 CFLAGS+=-fno-omit-frame-pointer
 DLLPOSTFIX=lr
+
+.IF "$(ARM_TARGET)" == "ARMV4T"
+ARCH_FLAGS+=-march=armv4t
+CDEFS+=-DARMV4T
+.ENDIF
+
+.IF "$(ARM_TARGET)" == "ARMV6"
+ARCH_FLAGS+=-march=armv6
+CDEFS+=-DARMV6
+.ENDIF
+
+.IF "$(ARM_TARGET)" == "ARMV7"
+ARCH_FLAGS+=-march=armv7-a -mtune=cortex-a8 -mfpu=neon
+CDEFS+=-DARMV7
+.ENDIF
+

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to