diff --git a/tools/clang/scripts/package.py b/tools/clang/scripts/package.py
index ff28ba50..1b79037c 100755
--- a/tools/clang/scripts/package.py
+++ b/tools/clang/scripts/package.py
@@ -75,6 +75,9 @@
            log, fail_hard=False)
     TeeCmd(['svn', 'diff', os.path.join(LLVM_DIR, 'tools', 'clang')],
            log, fail_hard=False)
+    # TODO(thakis): compiler-rt is in projects/compiler-rt on Windows but
+    # llvm/compiler-rt elsewhere. So this diff call is currently only right on
+    # Windows.
     Tee('Diff in llvm/compiler-rt:\n', log)
     TeeCmd(['svn', 'stat', os.path.join(LLVM_DIR, 'projects', 'compiler-rt')],
            log, fail_hard=False)
@@ -120,6 +123,7 @@
           ]
   if sys.platform == 'win32':
     want.append('bin/clang-cl.exe')
+    want.append('bin/lld-link.exe')
   else:
     so_ext = 'dylib' if sys.platform == 'darwin' else 'so'
     want.extend(['bin/clang',
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py
index f695ad4..e8f9ebfa 100755
--- a/tools/clang/scripts/update.py
+++ b/tools/clang/scripts/update.py
@@ -28,7 +28,7 @@
 # Note: this revision is only used for Windows. Other platforms use update.sh.
 # TODO(thakis): Use the same revision on Windows and non-Windows.
 # TODO(thakis): Remove update.sh, use update.py everywhere.
-LLVM_WIN_REVISION = '239674'
+LLVM_WIN_REVISION = '245402'
 
 use_head_revision = 'LLVM_FORCE_HEAD_REVISION' in os.environ
 if use_head_revision:
@@ -60,7 +60,7 @@
     os.path.join(LLVM_DIR, '..', 'llvm-build-tools'))
 STAMP_FILE = os.path.join(LLVM_DIR, '..', 'llvm-build', 'cr_build_revision')
 BINUTILS_DIR = os.path.join(THIRD_PARTY_DIR, 'binutils')
-VERSION = '3.7.0'
+VERSION = '3.8.0'
 
 # URL for pre-built binaries.
 CDS_URL = 'https://commondatastorage.googleapis.com/chromium-browser-clang'
@@ -221,6 +221,7 @@
     '%(compiler_rt)s/test/tsan/signal_segv_handler.cc',
     '%(compiler_rt)s/lib/sanitizer_common/sanitizer_coverage_libcdep.cc',
     '%(compiler_rt)s/cmake/config-ix.cmake',
+    '%(compiler_rt)s/CMakeLists.txt',
     '%(compiler_rt)s/lib/ubsan/ubsan_platform.h',
     ]
   for f in files:
@@ -240,88 +241,12 @@
   # remove patches over time.
   assert sys.platform != 'win32'
 
-  # Apply patch for tests failing with --disable-pthreads (llvm.org/PR11974)
-  clang_patches = [ r"""\
---- test/Index/crash-recovery-modules.m	(revision 202554)
-+++ test/Index/crash-recovery-modules.m	(working copy)
-@@ -12,6 +12,8 @@
- 
- // REQUIRES: crash-recovery
- // REQUIRES: shell
-+// XFAIL: *
-+//    (PR11974)
- 
- @import Crash;
-""", r"""\
---- unittests/libclang/LibclangTest.cpp (revision 215949)
-+++ unittests/libclang/LibclangTest.cpp (working copy)
-@@ -431,7 +431,7 @@
-   EXPECT_EQ(0U, clang_getNumDiagnostics(ClangTU));
- }
-
--TEST_F(LibclangReparseTest, ReparseWithModule) {
-+TEST_F(LibclangReparseTest, DISABLED_ReparseWithModule) {
-   const char *HeaderTop = "#ifndef H\n#define H\nstruct Foo { int bar;";
-   const char *HeaderBottom = "\n};\n#endif\n";
-   const char *MFile = "#include \"HeaderFile.h\"\nint main() {"
-"""
-      ]
-
-  # This Go bindings test doesn't work after bootstrap on Linux, PR21552.
-  llvm_patches = [ r"""\
---- test/Bindings/Go/go.test    (revision 223109)
-+++ test/Bindings/Go/go.test    (working copy)
-@@ -1,3 +1,3 @@
--; RUN: llvm-go test llvm.org/llvm/bindings/go/llvm
-+; RUN: true
- 
- ; REQUIRES: shell
-"""
-      ]
-
-  # The UBSan run-time, which is now bundled with the ASan run-time, doesn't
-  # work on Mac OS X 10.8 (PR23539).
-  compiler_rt_patches = [ r"""\
---- cmake/config-ix.cmake
-+++ cmake/config-ix.cmake
-@@ -319,7 +319,7 @@ else()
- endif()
- 
- if (COMPILER_RT_HAS_SANITIZER_COMMON AND UBSAN_SUPPORTED_ARCH AND
--    OS_NAME MATCHES "Darwin|Linux|FreeBSD")
-+    OS_NAME MATCHES "Linux|FreeBSD")
-   set(COMPILER_RT_HAS_UBSAN TRUE)
- else()
-   set(COMPILER_RT_HAS_UBSAN FALSE)
-diff --git a/lib/ubsan/ubsan_platform.h b/lib/ubsan/ubsan_platform.h
-index 8ba253b..d5dce8d 100644
---- lib/ubsan/ubsan_platform.h
-+++ lib/ubsan/ubsan_platform.h
-@@ -14,7 +14,7 @@
- #define UBSAN_PLATFORM_H
- 
- // Other platforms should be easy to add, and probably work as-is.
--#if (defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)) && \
-+#if (defined(__linux__) || defined(__FreeBSD__)) && \
-     (defined(__x86_64__) || defined(__i386__) || defined(__arm__) || \
-      defined(__aarch64__) || defined(__mips__) || defined(__powerpc64__))
- # define CAN_SANITIZE_UB 1
-"""
-      ]
-
-  for path, patches in [(LLVM_DIR, llvm_patches),
-                        (CLANG_DIR, clang_patches),
-                        (COMPILER_RT_DIR, compiler_rt_patches)]:
-    print 'Applying patches in', path
-    for patch in patches:
-      print patch
-      p = subprocess.Popen( ['patch', '-p0', '-d', path], stdin=subprocess.PIPE)
-      (stdout, stderr) = p.communicate(input=patch)
-      if p.returncode != 0:
-        raise RuntimeError('stdout %s, stderr %s' % (stdout, stderr))
+  # No patches.
 
 
 def DeleteChromeToolsShim():
+  OLD_SHIM_DIR = os.path.join(LLVM_DIR, 'tools', 'zzz-chrometools')
+  shutil.rmtree(OLD_SHIM_DIR, ignore_errors=True)
   shutil.rmtree(CHROME_TOOLS_SHIM_DIR, ignore_errors=True)
 
 
@@ -417,8 +342,13 @@
       try:
         DownloadUrl(cds_full_url, f)
         f.seek(0)
+        # TODO(thakis): Delete LLVM_BUILD_DIR before extracting.
         tarfile.open(mode='r:gz', fileobj=f).extractall(path=LLVM_BUILD_DIR)
         print 'clang %s unpacked' % PACKAGE_VERSION
+        # Download the gold plugin if requested to by an environment variable.
+        # This is used by the CFI ClusterFuzz bot.
+        if 'LLVM_DOWNLOAD_GOLD_PLUGIN' in os.environ:
+          RunCommand(['python', CHROMIUM_DIR+'/build/download_gold_plugin.py'])
         WriteStampFile(PACKAGE_VERSION)
         return 0
       except urllib2.HTTPError:
@@ -446,6 +376,23 @@
     ApplyLocalPatches()
 
   cc, cxx = None, None
+  libstdcpp = None
+  if args.gcc_toolchain:  # This option is only used on Linux.
+    # Use the specified gcc installation for building.
+    cc = os.path.join(args.gcc_toolchain, 'bin', 'gcc')
+    cxx = os.path.join(args.gcc_toolchain, 'bin', 'g++')
+
+    if not os.access(cc, os.X_OK):
+      print 'Invalid --gcc-toolchain: "%s"' % args.gcc_toolchain
+      print '"%s" does not appear to be valid.' % cc
+      return 1
+
+    # Set LD_LIBRARY_PATH to make auxiliary targets (tablegen, bootstrap
+    # compiler, etc.) find the .so.
+    libstdcpp = subprocess.check_output(
+        [cxx, '-print-file-name=libstdc++.so.6']).rstrip()
+    os.environ['LD_LIBRARY_PATH'] = os.path.dirname(libstdcpp)
+
   cflags = cxxflags = ldflags = []
 
   # LLVM uses C++11 starting in llvm 3.5. On Linux, this means libstdc++4.7+ is
@@ -491,6 +438,10 @@
     if args.run_tests:
       RunCommand(['ninja', 'check-all'], msvc_arch='x64')
     RunCommand(['ninja', 'install'], msvc_arch='x64')
+    if args.gcc_toolchain:
+      # Copy that gcc's stdlibc++.so.6 to the build dir, so the bootstrap
+      # compiler can start.
+      CopyFile(libstdcpp, os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'lib'))
 
     if sys.platform == 'win32':
       cc = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang-cl.exe')
@@ -502,6 +453,12 @@
     else:
       cc = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang')
       cxx = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang++')
+
+    if args.gcc_toolchain:
+      # Tell the bootstrap compiler to use a specific gcc prefix to search
+      # for standard library headers and shared object files.
+      cflags = ['--gcc-toolchain=' + args.gcc_toolchain]
+      cxxflags = ['--gcc-toolchain=' + args.gcc_toolchain]
     print 'Building final compiler'
 
   if sys.platform == 'darwin':
@@ -538,6 +495,18 @@
     os.symlink('libc++.1.dylib', 'libc++.dylib')
     ldflags += ['-stdlib=libc++', '-L' + libcxxbuild]
 
+    if args.bootstrap:
+      # Now that the libc++ headers have been installed and libc++.dylib is
+      # built, delete the libc++ checkout again so that it's not part of the
+      # main build below -- the libc++(abi) tests don't pass on OS X in
+      # bootstrap builds (http://llvm.org/PR24068)
+      RmTree(LIBCXX_DIR)
+      RmTree(LIBCXXABI_DIR)
+      cxxflags = ['-stdlib=libc++', '-nostdinc++',
+                  '-I' + os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR,
+                                      'include/c++/v1')
+                  ] + cflags
+
   # Build clang.
   binutils_incdir = ''
   if sys.platform.startswith('linux'):
@@ -577,6 +546,15 @@
   os.chdir(LLVM_BUILD_DIR)
   RunCommand(['cmake'] + cmake_args + [LLVM_DIR],
              msvc_arch='x64', env=deployment_env)
+
+  if args.gcc_toolchain:
+    # Copy in the right stdlibc++.so.6 so clang can start.
+    if not os.path.exists(os.path.join(LLVM_BUILD_DIR, 'lib')):
+      os.mkdir(os.path.join(LLVM_BUILD_DIR, 'lib'))
+    libstdcpp = subprocess.check_output(
+        [cxx] + cxxflags + ['-print-file-name=libstdc++.so.6']).rstrip()
+    CopyFile(libstdcpp, os.path.join(LLVM_BUILD_DIR, 'lib'))
+
   RunCommand(['ninja'], msvc_arch='x64')
 
   if args.tools:
@@ -607,7 +585,8 @@
       '-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags)]
   if sys.platform != 'win32':
     compiler_rt_args += ['-DLLVM_CONFIG_PATH=' +
-                         os.path.join(LLVM_BUILD_DIR, 'bin', 'llvm-config')]
+                         os.path.join(LLVM_BUILD_DIR, 'bin', 'llvm-config'),
+                        '-DSANITIZER_MIN_OSX_VERSION="10.7"']
   RunCommand(['cmake'] + compiler_rt_args + [LLVM_DIR],
               msvc_arch='x86', env=deployment_env)
   RunCommand(['ninja', 'compiler-rt'], msvc_arch='x86')
@@ -696,8 +675,13 @@
                       help="run only if the script thinks clang is needed")
   parser.add_argument('--force-local-build', action='store_true',
                       help="don't try to download prebuild binaries")
+  parser.add_argument('--gcc-toolchain', help='set the version for which gcc '
+                      'version be used for building; --gcc-toolchain=/opt/foo '
+                      'picks /opt/foo/bin/gcc')
   parser.add_argument('--print-revision', action='store_true',
                       help='print current clang revision and exit.')
+  parser.add_argument('--print-clang-version', action='store_true',
+                      help='print current clang version (e.g. x.y.z) and exit.')
   parser.add_argument('--run-tests', action='store_true',
                       help='run tests after building; only for local builds')
   parser.add_argument('--tools', nargs='*',
@@ -713,9 +697,6 @@
 
   args = parser.parse_args()
 
-  if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')):
-    print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).'
-    return 0
   if args.if_needed:
     is_clang_required = False
     # clang is always used on Mac and Linux.
@@ -731,6 +712,9 @@
       is_clang_required = True
     if not is_clang_required:
       return 0
+    if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')):
+      print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).'
+      return 0
 
   global LLVM_WIN_REVISION, PACKAGE_VERSION
   if args.print_revision:
@@ -740,6 +724,10 @@
       print PACKAGE_VERSION
     return 0
 
+  if args.print_clang_version:
+    sys.stdout.write(VERSION)
+    return 0
+
   # Don't buffer stdout, so that print statements are immediately flushed.
   # Do this only after --print-revision has been handled, else we'll get
   # an error message when this script is run from gn for some reason.
diff --git a/tools/clang/scripts/update.sh b/tools/clang/scripts/update.sh
index 65b296f..854a66c 100755
--- a/tools/clang/scripts/update.sh
+++ b/tools/clang/scripts/update.sh
@@ -8,7 +8,7 @@
 # Do NOT CHANGE this if you don't know what you're doing -- see
 # https://code.google.com/p/chromium/wiki/UpdatingClang
 # Reverting problematic clang rolls is safe, though.
-CLANG_REVISION=239765
+CLANG_REVISION=245402
 
 # This is incremented when pushing a new build of Clang at the same revision.
 CLANG_SUB_REVISION=1
@@ -49,6 +49,9 @@
 if [[ -z "$GYP_GENERATORS" ]]; then
   GYP_GENERATORS=
 fi
+if [[ -z "$LLVM_DOWNLOAD_GOLD_PLUGIN" ]]; then
+  LLVM_DOWNLOAD_GOLD_PLUGIN=
+fi
 
 
 # Die if any command dies, error on undefined variable expansions.
@@ -267,6 +270,11 @@
     echo clang "${PACKAGE_VERSION}" unpacked
     echo "${PACKAGE_VERSION}" > "${STAMP_FILE}"
     rm -rf "${CDS_OUT_DIR}"
+    # Download the gold plugin if requested to by an environment variable.
+    # This is used by the CFI ClusterFuzz bot.
+    if [[ -n "${LLVM_DOWNLOAD_GOLD_PLUGIN}" ]]; then
+      ${THIS_DIR}/../../../build/download_gold_plugin.py
+    fi
     exit 0
   else
     echo Did not find prebuilt clang "${PACKAGE_VERSION}", building
@@ -317,6 +325,7 @@
       "${COMPILER_RT_DIR}/test/tsan/signal_segv_handler.cc" \
       "${COMPILER_RT_DIR}/lib/sanitizer_common/sanitizer_coverage_libcdep.cc" \
       "${COMPILER_RT_DIR}/cmake/config-ix.cmake" \
+      "${COMPILER_RT_DIR}/CMakeLists.txt" \
       "${COMPILER_RT_DIR}/lib/ubsan/ubsan_platform.h" \
       ; do
   if [[ -e "${i}" ]]; then
@@ -365,87 +374,8 @@
 fi
 
 if [[ -n "$with_patches" ]]; then
-
-  # Apply patch for tests failing with --disable-pthreads (llvm.org/PR11974)
-  pushd "${CLANG_DIR}"
-  cat << 'EOF' |
---- test/Index/crash-recovery-modules.m	(revision 202554)
-+++ test/Index/crash-recovery-modules.m	(working copy)
-@@ -12,6 +12,8 @@
- 
- // REQUIRES: crash-recovery
- // REQUIRES: shell
-+// XFAIL: *
-+//    (PR11974)
- 
- @import Crash;
-EOF
-patch -p0
-popd
-
-pushd "${CLANG_DIR}"
-cat << 'EOF' |
---- unittests/libclang/LibclangTest.cpp (revision 215949)
-+++ unittests/libclang/LibclangTest.cpp (working copy)
-@@ -431,7 +431,7 @@
-   EXPECT_EQ(0U, clang_getNumDiagnostics(ClangTU));
- }
-
--TEST_F(LibclangReparseTest, ReparseWithModule) {
-+TEST_F(LibclangReparseTest, DISABLED_ReparseWithModule) {
-   const char *HeaderTop = "#ifndef H\n#define H\nstruct Foo { int bar;";
-   const char *HeaderBottom = "\n};\n#endif\n";
-   const char *MFile = "#include \"HeaderFile.h\"\nint main() {"
-EOF
-  patch -p0
-  popd
-
-  # This Go bindings test doesn't work after the bootstrap build on Linux. (PR21552)
-  pushd "${LLVM_DIR}"
-  cat << 'EOF' |
---- test/Bindings/Go/go.test    (revision 223109)
-+++ test/Bindings/Go/go.test    (working copy)
-@@ -1,3 +1,3 @@
--; RUN: llvm-go test llvm.org/llvm/bindings/go/llvm
-+; RUN: true
- 
- ; REQUIRES: shell
-EOF
-  patch -p0
-  popd
-
-  # The UBSan run-time, which is now bundled with the ASan run-time, doesn't work
-  # on Mac OS X 10.8 (PR23539).
-  pushd "${COMPILER_RT_DIR}"
-  cat << 'EOF' |
---- cmake/config-ix.cmake
-+++ cmake/config-ix.cmake
-@@ -319,7 +319,7 @@ else()
- endif()
- 
- if (COMPILER_RT_HAS_SANITIZER_COMMON AND UBSAN_SUPPORTED_ARCH AND
--    OS_NAME MATCHES "Darwin|Linux|FreeBSD")
-+    OS_NAME MATCHES "Linux|FreeBSD")
-   set(COMPILER_RT_HAS_UBSAN TRUE)
- else()
-   set(COMPILER_RT_HAS_UBSAN FALSE)
-diff --git a/lib/ubsan/ubsan_platform.h b/lib/ubsan/ubsan_platform.h
-index 8ba253b..d5dce8d 100644
---- lib/ubsan/ubsan_platform.h
-+++ lib/ubsan/ubsan_platform.h
-@@ -14,7 +14,7 @@
- #define UBSAN_PLATFORM_H
- 
- // Other platforms should be easy to add, and probably work as-is.
--#if (defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)) && \
-+#if (defined(__linux__) || defined(__FreeBSD__)) && \
-     (defined(__x86_64__) || defined(__i386__) || defined(__arm__) || \
-      defined(__aarch64__) || defined(__mips__) || defined(__powerpc64__))
- # define CAN_SANITIZE_UB 1
-EOF
-  patch -p0
-  popd
-
+  # No patches.
+  true
 fi
 
 # Echo all commands.
@@ -526,7 +456,7 @@
 
   if [[ -n "${gcc_toolchain}" ]]; then
     # Tell the bootstrap compiler to use a specific gcc prefix to search
-    # for standard library headers and shared object file.
+    # for standard library headers and shared object files.
     CFLAGS="--gcc-toolchain=${gcc_toolchain}"
     CXXFLAGS="--gcc-toolchain=${gcc_toolchain}"
   fi
@@ -567,6 +497,16 @@
   ln -sf libc++.1.dylib libc++.dylib
   popd
   LDFLAGS+="-stdlib=libc++ -L${PWD}/libcxxbuild"
+
+  if [[ -n "${bootstrap}" ]]; then
+    # Now that the libc++ headers have been installed and libc++.dylib is built,
+    # delete the libc++ checkout again so that it's not part of the main
+    # build below -- the libc++(abi) tests don't pass on OS X in bootstrap
+    # builds (http://llvm.org/PR24068)
+    rm -rf "${ABS_LIBCXX_DIR}"
+    rm -rf "${ABS_LIBCXXABI_DIR}"
+    CXXFLAGS="-stdlib=libc++ -nostdinc++ -I${ABS_INSTALL_DIR}/include/c++/v1 ${CFLAGS}"
+  fi
 fi
 
 # Find the binutils include dir for the gold plugin.
@@ -649,6 +589,7 @@
     -DLLVM_ENABLE_THREADS=OFF \
     -DCMAKE_C_COMPILER="${CC}" \
     -DCMAKE_CXX_COMPILER="${CXX}" \
+    -DSANITIZER_MIN_OSX_VERSION="10.7" \
     -DLLVM_CONFIG_PATH="${ABS_LLVM_BUILD_DIR}/bin/llvm-config" \
     "${ABS_COMPILER_RT_DIR}"
 
@@ -673,35 +614,45 @@
   # Make a standalone Android toolchain.
   ${ANDROID_NDK_DIR}/build/tools/make-standalone-toolchain.sh \
       --platform=android-19 \
-      --install-dir="${LLVM_BUILD_DIR}/android-toolchain" \
+      --install-dir="${LLVM_BUILD_DIR}/android-toolchain-arm" \
       --system=linux-x86_64 \
       --stl=stlport \
       --toolchain=arm-linux-androideabi-4.9
 
-  # Android NDK r9d copies a broken unwind.h into the toolchain, see
-  # http://crbug.com/357890
-  rm -v "${LLVM_BUILD_DIR}"/android-toolchain/include/c++/*/unwind.h
+  # Do the same for x86.
+  ${ANDROID_NDK_DIR}/build/tools/make-standalone-toolchain.sh \
+      --platform=android-19 \
+      --install-dir="${LLVM_BUILD_DIR}/android-toolchain-i686" \
+      --system=linux-x86_64 \
+      --stl=stlport \
+      --toolchain=x86-4.9
 
-  # Build ASan runtime for Android in a separate build tree.
-  mkdir -p ${LLVM_BUILD_DIR}/android
-  pushd ${LLVM_BUILD_DIR}/android
-  rm -fv CMakeCache.txt
-  MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \
-      -DCMAKE_BUILD_TYPE=Release \
-      -DLLVM_ENABLE_ASSERTIONS=ON \
-      -DLLVM_ENABLE_THREADS=OFF \
-      -DCMAKE_C_COMPILER=${PWD}/../bin/clang \
-      -DCMAKE_CXX_COMPILER=${PWD}/../bin/clang++ \
-      -DLLVM_CONFIG_PATH=${PWD}/../bin/llvm-config \
-      -DCMAKE_C_FLAGS="--target=arm-linux-androideabi --sysroot=${PWD}/../android-toolchain/sysroot -B${PWD}/../android-toolchain" \
-      -DCMAKE_CXX_FLAGS="--target=arm-linux-androideabi --sysroot=${PWD}/../android-toolchain/sysroot -B${PWD}/../android-toolchain" \
-      -DANDROID=1 \
-      "${ABS_COMPILER_RT_DIR}"
-  ninja libclang_rt.asan-arm-android.so
+  for target_arch in "arm" "i686"; do
+    # Android NDK r9d copies a broken unwind.h into the toolchain, see
+    # http://crbug.com/357890
+    rm -v "${LLVM_BUILD_DIR}"/android-toolchain-${target_arch}/include/c++/*/unwind.h
 
-  # And copy it into the main build tree.
-  cp "$(find -name libclang_rt.asan-arm-android.so)" "${ABS_LLVM_CLANG_LIB_DIR}/lib/linux/"
-  popd
+    # Build ASan runtime for Android in a separate build tree.
+    mkdir -p ${LLVM_BUILD_DIR}/android-${target_arch}
+    pushd ${LLVM_BUILD_DIR}/android-${target_arch}
+    rm -fv CMakeCache.txt
+    MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \
+        -DCMAKE_BUILD_TYPE=Release \
+        -DLLVM_ENABLE_ASSERTIONS=ON \
+        -DLLVM_ENABLE_THREADS=OFF \
+        -DCMAKE_C_COMPILER=${PWD}/../bin/clang \
+        -DCMAKE_CXX_COMPILER=${PWD}/../bin/clang++ \
+        -DLLVM_CONFIG_PATH=${PWD}/../bin/llvm-config \
+        -DCMAKE_C_FLAGS="--target=${target_arch}-linux-androideabi --sysroot=${PWD}/../android-toolchain-${target_arch}/sysroot -B${PWD}/../android-toolchain-${target_arch}" \
+        -DCMAKE_CXX_FLAGS="--target=${target_arch}-linux-androideabi --sysroot=${PWD}/../android-toolchain-${target_arch}/sysroot -B${PWD}/../android-toolchain-${target_arch}" \
+        -DANDROID=1 \
+        "${ABS_COMPILER_RT_DIR}"
+    ninja libclang_rt.asan-${target_arch}-android.so
+
+    # And copy it into the main build tree.
+    cp "$(find -name libclang_rt.asan-${target_arch}-android.so)" "${ABS_LLVM_CLANG_LIB_DIR}/lib/linux/"
+    popd
+  done
 fi
 
 if [[ -n "$run_tests" || -n "${LLVM_FORCE_HEAD_REVISION:-''}" ]]; then