Fix more compile failures caused by recent ARM toolchain upgrade.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3995
R=mcgrathr@chromium.org

Review URL: https://codereview.chromium.org/730193002
diff --git a/ports/cairo/build.sh b/ports/cairo/build.sh
index 42d6964..416d509 100644
--- a/ports/cairo/build.sh
+++ b/ports/cairo/build.sh
@@ -2,6 +2,13 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+# Workaround for arm-gcc bug:
+# https://code.google.com/p/nativeclient/issues/detail?id=3205
+# TODO(sbc): remove this once the issue is fixed
+if [ "${NACL_ARCH}" = "arm" ]; then
+  NACLPORTS_CPPFLAGS+=" -mfpu=vfp"
+fi
+
 EXECUTABLES="test/cairo-test-suite${NACL_EXEEXT}"
 
 # This is only necessary for pnacl
diff --git a/ports/cairo/nacl.patch b/ports/cairo/nacl.patch
index 7af6e97..82596e1 100644
--- a/ports/cairo/nacl.patch
+++ b/ports/cairo/nacl.patch
@@ -1,5 +1,5 @@
 diff --git a/configure b/configure
-index 0ceb5bf..55e6f97 100755
+index 0ceb5bf..4a94244 100755
 --- a/configure
 +++ b/configure
 @@ -2974,18 +2974,22 @@ $as_echo "/* confdefs.h */" > confdefs.h
@@ -25,7 +25,42 @@
  #define PACKAGE_STRING "$PACKAGE_STRING"
  _ACEOF
  
-@@ -18805,10 +18809,10 @@ _ACEOF
+@@ -18160,31 +18164,10 @@ MAYBE_WARN="$MAYBE_WARN -erroff=E_ENUM_TYPE_MISMATCH_ARG \
+ 			-erroff=E_ENUM_TYPE_MISMATCH_OP"
+ 
+ 
++# Removed -flto flag as it seems to cause problems with the latest
++# version of our arm compiler:
++# https://code.google.com/p/nativeclient/issues/detail?id=3995
+ 
+-safe_MAYBE_WARN="$MAYBE_WARN"
+-MAYBE_WARN="$MAYBE_WARN -flto"
+-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-
+-int
+-main ()
+-{
+-
+-	int main(int argc, char **argv) { return 0; }
+-
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_link "$LINENO"; then :
+-
+-else
+-
+-	MAYBE_WARN="$safe_MAYBE_WARN"
+-
+-fi
+-rm -f core conftest.err conftest.$ac_objext \
+-    conftest$ac_exeext conftest.$ac_ext
+ 
+ MAYBE_WARN="$MAYBE_WARN -fno-strict-aliasing -fno-common"
+ 
+@@ -18805,10 +18788,10 @@ _ACEOF
  if ac_fn_c_try_compile "$LINENO"; then :
  
  
diff --git a/ports/libgit2/build.sh b/ports/libgit2/build.sh
index fa20232..1df2eba 100644
--- a/ports/libgit2/build.sh
+++ b/ports/libgit2/build.sh
@@ -4,15 +4,22 @@
 
 EXECUTABLES="libgit2_clar"
 
+# Workaround for arm-gcc bug:
+# https://code.google.com/p/nativeclient/issues/detail?id=3205
+# TODO(sbc): remove this once the issue is fixed
+if [ "${NACL_ARCH}" = "arm" ]; then
+  NACLPORTS_CPPFLAGS+=" -mfpu=vfp"
+fi
+
 if [ "${NACL_SHARED}" != "1" ]; then
   EXTRA_CMAKE_ARGS="-DBUILD_SHARED_LIBS=OFF"
 fi
 
 if [ "${NACL_LIBC}" = "newlib" ]; then
-  NACLPORTS_CPPFLAGS="-I${NACLPORTS_INCLUDE}/glibc-compat"
+  NACLPORTS_CPPFLAGS+=" -I${NACLPORTS_INCLUDE}/glibc-compat"
   # newlib headers generate a lot of char-subscript warnings
   # for macros such as tolower()
-  NACLPORTS_CPPFLAGS+=" -Wno-char-subscripts"
+  NACLPORTS_CPPFLAGS+=" -Wno-char-subscripts"S
   if [ "$NACL_ARCH" != "arm" ]; then
     # Our x86 version of gcc generates a lot of strict aliasing
     # warnings.
diff --git a/ports/libtommath/build.sh b/ports/libtommath/build.sh
index 487cab2..e1acc66 100644
--- a/ports/libtommath/build.sh
+++ b/ports/libtommath/build.sh
@@ -6,18 +6,26 @@
 MAKE_TARGETS=mtest
 EXECUTABLES=mtest/mtest${NACL_EXEEXT}
 
+# Workaround for arm-gcc bug:
+# https://code.google.com/p/nativeclient/issues/detail?id=3205
+# TODO(sbc): remove this once the issue is fixed
+if [ "${NACL_ARCH}" = "arm" ]; then
+  NACLPORTS_CPPFLAGS+=" -mfpu=vfp"
+fi
+
 BuildStep() {
   SetupCrossEnvironment
   DefaultBuildStep
 }
 
-#TestStep() {
+TestStep() {
   # To run tests, pipe mtest.nexe output into test.nexe input
   #   mtest/mtest.exe | test.nexe
   # However, this test is setup to run forever, so we don't run
   # it as part of the build.
   #RunSelLdrCommand mtest/mtest.nexe | RunSelLdrCommand test.nexe
-#}
+  return
+}
 
 InstallStep() {
   # copy libs and headers manually
diff --git a/ports/libyuv/build.sh b/ports/libyuv/build.sh
index 1a18597..bcea9c0 100644
--- a/ports/libyuv/build.sh
+++ b/ports/libyuv/build.sh
@@ -2,6 +2,17 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+# Workaround for arm-gcc bug:
+# https://code.google.com/p/nativeclient/issues/detail?id=3205
+# TODO(sbc): remove this once the issue is fixed
+if [ "${NACL_ARCH}" = "arm" ]; then
+  NACLPORTS_CPPFLAGS+=" -mfpu=vfp"
+fi
+
+if [ "${NACL_LIBC}" = "newlib" ]; then
+  NACLPORTS_CPPFLAGS+=" -I${NACLPORTS_INCLUDE}/glibc-compat"
+fi
+
 EXECUTABLES="convert libyuv_unittest"
 
 TestStep() {
diff --git a/ports/physfs/build.sh b/ports/physfs/build.sh
index 610cca5..4e2f5d2 100644
--- a/ports/physfs/build.sh
+++ b/ports/physfs/build.sh
@@ -8,6 +8,13 @@
 # library.
 BUILD_TEST=FALSE
 
+# Workaround for arm-gcc bug:
+# https://code.google.com/p/nativeclient/issues/detail?id=3205
+# TODO(sbc): remove this once the issue is fixed
+if [ "${NACL_ARCH}" = "arm" ]; then
+  NACLPORTS_CPPFLAGS+=" -mfpu=vfp"
+fi
+
 EXTRA_CMAKE_ARGS=" \
   -DPHYSFS_BUILD_SHARED=${BUILD_SHARED} \
   -DPHYSFS_BUILD_TEST=${BUILD_TEST} \
diff --git a/ports/python-static/build.sh b/ports/python-static/build.sh
index 581f3a7..fe4e517 100644
--- a/ports/python-static/build.sh
+++ b/ports/python-static/build.sh
@@ -4,6 +4,13 @@
 
 EXECUTABLES=python${NACL_EXEEXT}
 
+# Workaround for arm-gcc bug:
+# https://code.google.com/p/nativeclient/issues/detail?id=3205
+# TODO(sbc): remove this once the issue is fixed
+if [ "${NACL_ARCH}" = "arm" ]; then
+  NACLPORTS_CPPFLAGS+=" -mfpu=vfp"
+fi
+
 # Currently this package only builds on linux.
 # The build relies on certain host binaries and python's configure
 # requires us to set --build= as well as --host=.
diff --git a/ports/python/build.sh b/ports/python/build.sh
index 3ae7bb1..76d372d 100644
--- a/ports/python/build.sh
+++ b/ports/python/build.sh
@@ -8,6 +8,13 @@
 # requires us to set --build= as well as --host=.
 HOST_BUILD_DIR=${WORK_DIR}/build_host
 
+# Workaround for arm-gcc bug:
+# https://code.google.com/p/nativeclient/issues/detail?id=3205
+# TODO(sbc): remove this once the issue is fixed
+if [ "${NACL_ARCH}" = "arm" ]; then
+  NACLPORTS_CPPFLAGS+=" -mfpu=vfp"
+fi
+
 ConfigureStep() {
   # We pre-seed configure with certain results that it cannot determine
   # since we are doing a cross compile.  The $CONFIG_SITE file is sourced