Bug 823375 - Don't build or try to link NEON libs when the target doesn't support it. r=glandium
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Fri, 12 Apr 2013 12:00:29 +0200
changeset 128573 4078fd282b4ddffe82b945cbebd62cff6f965eb3
parent 128572 f26cd5d8fe7f8180a9f5f40882afcc78cd72cc68
child 128574 006605c1ccc58c786b437d03869d52f18a81f53e
push id24532
push userryanvm@gmail.com
push dateFri, 12 Apr 2013 19:06:49 +0000
treeherdermozilla-central@2aff2d574a1e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs823375
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 823375 - Don't build or try to link NEON libs when the target doesn't support it. r=glandium
build/autoconf/arch.m4
js/src/build/autoconf/arch.m4
media/webrtc/shared_libs.mk
--- a/build/autoconf/arch.m4
+++ b/build/autoconf/arch.m4
@@ -197,36 +197,48 @@ if test "$CPU_ARCH" = "arm"; then
                  [asm("uqadd8 r1, r1, r2");],
                  result="yes", result="no")
   AC_MSG_RESULT("$result")
   if test "$result" = "yes"; then
       AC_DEFINE(HAVE_ARM_SIMD)
       HAVE_ARM_SIMD=1
   fi
 
+  AC_MSG_CHECKING(ARM version support in compiler)
+  dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
+  ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
+  AC_MSG_RESULT("$ARM_ARCH")
+
   AC_MSG_CHECKING(for ARM NEON support in compiler)
   # We try to link so that this also fails when
   # building with LTO.
   AC_TRY_LINK([],
                  [asm(".fpu neon\n vadd.i8 d0, d0, d0");],
                  result="yes", result="no")
   AC_MSG_RESULT("$result")
   if test "$result" = "yes"; then
       AC_DEFINE(HAVE_ARM_NEON)
       HAVE_ARM_NEON=1
+
+      dnl We don't need to build NEON support if we're targetting a non-NEON device.
+      dnl This matches media/webrtc/trunk/webrtc/build/common.gypi.
+      if test -n "$ARM_ARCH"; then
+          if test "$ARM_ARCH" -lt 7; then
+              BUILD_ARM_NEON=0
+          else
+              BUILD_ARM_NEON=1
+          fi
+      fi
   fi
 
-  AC_MSG_CHECKING(ARM version support in compiler)
-  dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
-  ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
-  AC_MSG_RESULT("$ARM_ARCH")
 fi # CPU_ARCH = arm
 
 AC_SUBST(HAVE_ARM_SIMD)
 AC_SUBST(HAVE_ARM_NEON)
+AC_SUBST(BUILD_ARM_NEON)
 
 if test -n "$MOZ_ARCH"; then
   NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-arch=$MOZ_ARCH"
   NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-thumb=$MOZ_THUMB"
   NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-thumb-interwork=$MOZ_THUMB_INTERWORK"
   NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-fpu=$MOZ_FPU"
   NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-float-abi=$MOZ_FLOAT_ABI"
   NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-soft-float=$MOZ_SOFT_FLOAT"
--- a/js/src/build/autoconf/arch.m4
+++ b/js/src/build/autoconf/arch.m4
@@ -197,36 +197,48 @@ if test "$CPU_ARCH" = "arm"; then
                  [asm("uqadd8 r1, r1, r2");],
                  result="yes", result="no")
   AC_MSG_RESULT("$result")
   if test "$result" = "yes"; then
       AC_DEFINE(HAVE_ARM_SIMD)
       HAVE_ARM_SIMD=1
   fi
 
+  AC_MSG_CHECKING(ARM version support in compiler)
+  dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
+  ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
+  AC_MSG_RESULT("$ARM_ARCH")
+
   AC_MSG_CHECKING(for ARM NEON support in compiler)
   # We try to link so that this also fails when
   # building with LTO.
   AC_TRY_LINK([],
                  [asm(".fpu neon\n vadd.i8 d0, d0, d0");],
                  result="yes", result="no")
   AC_MSG_RESULT("$result")
   if test "$result" = "yes"; then
       AC_DEFINE(HAVE_ARM_NEON)
       HAVE_ARM_NEON=1
+
+      dnl We don't need to build NEON support if we're targetting a non-NEON device.
+      dnl This matches media/webrtc/trunk/webrtc/build/common.gypi.
+      if test -n "$ARM_ARCH"; then
+          if test "$ARM_ARCH" -lt 7; then
+              BUILD_ARM_NEON=0
+          else
+              BUILD_ARM_NEON=1
+          fi
+      fi
   fi
 
-  AC_MSG_CHECKING(ARM version support in compiler)
-  dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
-  ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
-  AC_MSG_RESULT("$ARM_ARCH")
 fi # CPU_ARCH = arm
 
 AC_SUBST(HAVE_ARM_SIMD)
 AC_SUBST(HAVE_ARM_NEON)
+AC_SUBST(BUILD_ARM_NEON)
 
 if test -n "$MOZ_ARCH"; then
   NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-arch=$MOZ_ARCH"
   NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-thumb=$MOZ_THUMB"
   NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-thumb-interwork=$MOZ_THUMB_INTERWORK"
   NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-fpu=$MOZ_FPU"
   NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-float-abi=$MOZ_FLOAT_ABI"
   NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-soft-float=$MOZ_SOFT_FLOAT"
--- a/media/webrtc/shared_libs.mk
+++ b/media/webrtc/shared_libs.mk
@@ -50,17 +50,17 @@ ifeq ($(CPU_ARCH), arm)
 ifeq (Android,$(OS_TARGET))
 # NEON detection on WebRTC is Android only. If WebRTC supports Linux/arm etc,
 # we should remove OS check
 # extra ARM libs
 WEBRTC_LIBS += \
   $(call EXPAND_LIBNAME_PATH,cpu_features_android,$(DEPTH)/media/webrtc/trunk/webrtc/system_wrappers/source/system_wrappers_cpu_features_android) \
   $(NULL)
 # neon for ARM
-ifeq ($(HAVE_ARM_NEON),1)
+ifeq ($(BUILD_ARM_NEON),1)
 WEBRTC_LIBS += \
   $(call EXPAND_LIBNAME_PATH,signal_processing_neon,$(DEPTH)/media/webrtc/trunk/webrtc/common_audio/common_audio_signal_processing_neon) \
   $(call EXPAND_LIBNAME_PATH,audio_processing_neon,$(DEPTH)/media/webrtc/trunk/webrtc/modules/modules_audio_processing_neon) \
   $(NULL)
 endif
 endif
 endif