Merge "Upgrade Linux host toolchain from glibc 2.11 to 2.15"
diff --git a/build/tools/common-build-host-funcs.sh b/build/tools/common-build-host-funcs.sh
index f008007..a1bfed8 100644
--- a/build/tools/common-build-host-funcs.sh
+++ b/build/tools/common-build-host-funcs.sh
@@ -444,26 +444,17 @@
     # directory.
     case $1 in
         linux-x86)
-            # If possible, automatically use our custom toolchain to generate
-            # 32-bit executables that work on Ubuntu 8.04 and higher.
-            _bh_try_host_fullprefix "$(dirname $ANDROID_NDK_ROOT)/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" i686-linux
-            _bh_try_host_fullprefix "$(dirname $ANDROID_NDK_ROOT)/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.4.3" i686-linux
-            _bh_try_host_fullprefix "$(dirname $ANDROID_NDK_ROOT)/prebuilt/linux-x86/toolchain/i686-linux-glibc2.7-4.4.3" i686-linux
-            _bh_try_host_prefix i686-linux-gnu
-            _bh_try_host_prefix i686-linux
-            _bh_try_host_prefix x86_64-linux-gnu -m32
-            _bh_try_host_prefix x86_64-linux -m32
+            panic "Sorry, this script does not support building 32-bit Linux binaries."
             ;;
 
         linux-x86_64)
-            # If possible, automaticaly use our custom toolchain to generate
-            # 64-bit executables that work on Ubuntu 8.04 and higher.
-            _bh_try_host_fullprefix "$(dirname $ANDROID_NDK_ROOT)/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8" x86_64-linux
-            _bh_try_host_fullprefix "$(dirname $ANDROID_NDK_ROOT)/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" x86_64-linux
-            _bh_try_host_prefix x86_64-linux-gnu
-            _bh_try_host_prefix x84_64-linux
-            _bh_try_host_prefix i686-linux-gnu -m64
-            _bh_try_host_prefix i686-linux -m64
+            local LINUX_GLIBC_PREBUILT=x86_64-linux-glibc2.15-4.8
+            _bh_try_host_fullprefix "$(dirname $ANDROID_NDK_ROOT)/prebuilts/gcc/linux-x86/host/$LINUX_GLIBC_PREBUILT" x86_64-linux
+            if [ -z "$HOST_FULLPREFIX" ]; then
+                dump "Cannot find the x86_64 Linux-targeting compiler. Make sure the"
+                dump "$LINUX_GLIBC_PREBUILT prebuilt is checked out."
+                exit 1
+            fi
             ;;
 
         darwin-*)
diff --git a/build/tools/prebuilt-common.sh b/build/tools/prebuilt-common.sh
index 73b9405..37ab63b 100644
--- a/build/tools/prebuilt-common.sh
+++ b/build/tools/prebuilt-common.sh
@@ -811,7 +811,7 @@
     # generate wrappers for BUILD toolchain
     # this is required for mingw/darwin build to avoid tools canadian cross configuration issues
     # 32-bit BUILD toolchain
-    LEGACY_TOOLCHAIN_DIR="$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8"
+    LEGACY_TOOLCHAIN_DIR="$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8"
     $NDK_BUILDTOOLS_PATH/gen-toolchain-wrapper.sh --src-prefix=i386-linux-gnu- \
             --cflags="-m32" --cxxflags="-m32" --ldflags="-m elf_i386" --asflags="--32" \
             --dst-prefix="$LEGACY_TOOLCHAIN_DIR/bin/x86_64-linux-" "$CROSS_WRAP_DIR"
@@ -897,7 +897,7 @@
     if [ -z "$CC" ]; then
         LEGACY_TOOLCHAIN_DIR=
         if [ "$HOST_OS" = "linux" ]; then
-            LEGACY_TOOLCHAIN_DIR="$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/bin"
+            LEGACY_TOOLCHAIN_DIR="$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/bin"
             LEGACY_TOOLCHAIN_PREFIX="$LEGACY_TOOLCHAIN_DIR/x86_64-linux-"
         elif [ "$HOST_OS" = "darwin" ]; then
             LEGACY_TOOLCHAIN_DIR="$ANDROID_BUILD_TOP/prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1/bin"