clang/arm: Push -no-integrated-as into the four targets that need it.

clang's integrated assembler does not support old-style ARM assembly,
but the assembly itself generates is always modern so it's ok to
use the integrated assembler for all .cc compilations.  Three projects
have old and crufty .S ARM asm files, so push -no-integrated-as into these
three projects.  We can then clean those up asynchronously, while this
change makes sure no other projects with old assembly make it into the
tree.

Depends on:
https://codereview.webrtc.org/1484103002/
https://codereview.webrtc.org/1486143002/
https://codereview.chromium.org/1485143002/
https://chromium-review.googlesource.com/#/c/315110/2

BUG=124610

Review URL: https://codereview.chromium.org/1484883002

Cr-Commit-Position: refs/heads/master@{#362584}
diff --git a/build/common.gypi b/build/common.gypi
index f7ff443..0ffcb8f 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -3996,13 +3996,6 @@
                       }],
                     ],
                   }],
-                  ['clang==1 and OS!="android"', {
-                    'cflags': [
-                      # We need to disable clang's builtin assembler as it can't
-                      # handle several asm files, crbug.com/124610
-                      '-no-integrated-as',
-                    ],
-                  }],
                   ['arm_tune!=""', {
                     'cflags': [
                       '-mtune=<(arm_tune)',
@@ -4116,11 +4109,6 @@
                           '-fno-caller-saves',
                           '-Wno-psabi',
                         ],
-                        'cflags': [
-                          # TODO(hans) Enable integrated-as (crbug.com/124610).
-                          '-no-integrated-as',
-                          '-B<(android_toolchain)',  # Else /usr/bin/as gets picked up.
-                        ],
                       }],
                       ['clang==1 and linux_use_bundled_gold==0', {
                         'ldflags': [
@@ -4244,9 +4232,6 @@
                     ],
                   }],
                   ['clang==1 and OS=="android"', {
-                    'cflags': [
-                      '-B<(android_toolchain)',  # Else /usr/bin/as gets picked up.
-                    ],
                     'ldflags': [
                       # Let clang find the ld in the NDK.
                       '--gcc-toolchain=<(android_toolchain)/..',
diff --git a/build/config/android/BUILD.gn b/build/config/android/BUILD.gn
index 570417b..cfbde79 100644
--- a/build/config/android/BUILD.gn
+++ b/build/config/android/BUILD.gn
@@ -33,9 +33,9 @@
   if (is_clang) {
     rebased_android_toolchain_root =
         rebase_path(android_toolchain_root, root_build_dir)
-    if (current_cpu == "arm" || current_cpu == "mipsel") {
+    if (current_cpu == "mipsel") {
       cflags += [
-        # TODO(hans) Enable integrated-as (crbug.com/124610).
+        # TODO(gordanac) Enable integrated-as.
         "-no-integrated-as",
         "-B${rebased_android_toolchain_root}/bin",  # Else /usr/bin/as gets picked up.
       ]
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 6923a32..08d10a4 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -588,13 +588,7 @@
         ]
       }
     } else if (current_cpu == "arm") {
-      if (is_clang) {
-        if (!is_android) {
-          # We need to disable clang's builtin assembler as it can't
-          # handle several asm files, crbug.com/124610
-          cflags += [ "-no-integrated-as" ]
-        }
-      } else {
+      if (!is_clang) {
         # Clang doesn't support these flags.
         cflags += [
           # The tree-sra optimization (scalar replacement for
diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn
index f4114d9..c0c5565 100644
--- a/third_party/boringssl/BUILD.gn
+++ b/third_party/boringssl/BUILD.gn
@@ -2,6 +2,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+import("//build/config/android/config.gni")
 import("//build/config/sanitizers/sanitizers.gni")
 
 # Config for us and everybody else depending on BoringSSL.
@@ -67,6 +68,17 @@
   # Also gets the include dirs from :openssl_config
   include_dirs = [ "src/include" ]
 
+  if (current_cpu == "arm" && is_clang) {
+    # TODO(hans) Enable integrated-as (crbug.com/124610).
+    asmflags = [ "-fno-integrated-as" ]
+    if (is_android) {
+      rebased_android_toolchain_root =
+          rebase_path(android_toolchain_root, root_build_dir)
+      # Else /usr/bin/as gets picked up.
+      asmflags += [ "-B${rebased_android_toolchain_root}/bin" ]
+    }
+  }
+
   if (is_msan) {
     defines += [ "OPENSSL_NO_ASM" ]
   } else if (current_cpu == "x64") {
diff --git a/third_party/boringssl/boringssl.gyp b/third_party/boringssl/boringssl.gyp
index 19456fc..80cc557 100644
--- a/third_party/boringssl/boringssl.gyp
+++ b/third_party/boringssl/boringssl.gyp
@@ -36,6 +36,16 @@
             }],
           ],
         }],
+        ['target_arch == "arm" and clang == 1', {
+          # TODO(hans) Enable integrated-as (crbug.com/124610).
+          'cflags': [ '-fno-integrated-as' ],
+          'conditions': [
+            ['OS == "android"', {
+              # Else /usr/bin/as gets picked up.
+              'cflags': [ '-B<(android_toolchain)' ],
+            }],
+          ],
+        }],
         ['target_arch == "arm64" and msan == 0', {
           'conditions': [
             ['OS == "linux" or OS == "android"', {
diff --git a/third_party/libvpx_new/BUILD.gn b/third_party/libvpx_new/BUILD.gn
index 94c8c4b..26aff0a 100644
--- a/third_party/libvpx_new/BUILD.gn
+++ b/third_party/libvpx_new/BUILD.gn
@@ -48,6 +48,17 @@
     "//third_party/libvpx_new/source/libvpx",
     "$root_gen_dir/third_party/libvpx_new",  # Provides vpx_rtcd.h.
   ]
+
+  if (current_cpu == "arm" && is_clang) {
+    # TODO(hans) Enable integrated-as (crbug.com/124610).
+    asmflags = [ "-fno-integrated-as" ]
+    if (is_android) {
+      rebased_android_toolchain_root =
+          rebase_path(android_toolchain_root, root_build_dir)
+      # Else /usr/bin/as gets picked up.
+      asmflags += [ "-B${rebased_android_toolchain_root}/bin" ]
+    }
+  }
 }
 
 # gn orders flags on a target before flags from configs. The default config
diff --git a/third_party/libvpx_new/libvpx.gyp b/third_party/libvpx_new/libvpx.gyp
index c9133618..0ecfdf6 100644
--- a/third_party/libvpx_new/libvpx.gyp
+++ b/third_party/libvpx_new/libvpx.gyp
@@ -48,6 +48,18 @@
     'shared_generated_dir': '<(SHARED_INTERMEDIATE_DIR)/third_party/libvpx_new',
   },
   'target_defaults': {
+    'conditions': [
+      ['target_arch=="arm" and clang==1', {
+        # TODO(hans) Enable integrated-as (crbug.com/124610).
+        'cflags': [ '-fno-integrated-as' ],
+        'conditions': [
+          ['OS == "android"', {
+            # Else /usr/bin/as gets picked up.
+            'cflags': [ '-B<(android_toolchain)' ],
+          }],
+        ],
+      }],
+    ],
     'target_conditions': [
       ['<(libvpx_build_vp9)==0', {
         'sources/': [ ['exclude', '(^|/)vp9/'], ],