Generate 8.04-compatible Linux toolchain binaries whenever possible.

This patch forces our toolchain build script to look for our
i686-linux-glibc2.7-4.4.3 prebuilt toolchain, and use it, if found,
in order to generate Linux binaries that run on Ubuntu 8.04 and
higher.

+ document the 'asm' to '__asm__' change in development/ndk

Change-Id: I1f119439784fd8b5708e80f75f7c53b09ad8e1fa
diff --git a/build/tools/prebuilt-common.sh b/build/tools/prebuilt-common.sh
index e72b878..f00a0be 100644
--- a/build/tools/prebuilt-common.sh
+++ b/build/tools/prebuilt-common.sh
@@ -459,6 +459,22 @@
     # By default, assume host == build
     ABI_CONFIGURE_HOST="$ABI_CONFIGURE_BUILD"
 
+    # On Linux, detect our legacy-compatible toolchain when in the Android
+    # source tree, and use it to force the generation of glibc-2.7 compatible
+    # binaries.
+    #
+    # We only do this if the CC variable is not defined to a given value
+    # and the --mingw option is not used.
+    #
+    if [ "$HOST_OS" = "linux" -a -z "$CC" -a "$MINGW" != "yes" ]; then
+        LEGACY_TOOLCHAIN_DIR="$ANDROID_NDK_ROOT/../prebuilt/linux-x86/toolchain/i686-linux-glibc2.7-4.4.3"
+        if [ -d "$LEGACY_TOOLCHAIN_DIR" ] ; then
+            dump "Forcing generation of Linux binaries with legacy toolchain"
+            CC="$LEGACY_TOOLCHAIN_DIR/bin/i686-linux-gcc"
+            CXX="$LEGACY_TOOLCHAIN_DIR/bin/i686-linux-g++"
+        fi
+    fi
+
     # Force generation of 32-bit binaries on 64-bit systems
     CC=${CC:-gcc}
     CXX=${CXX:-g++}
diff --git a/docs/CHANGES.html b/docs/CHANGES.html
index 0d358e6..a5d9a4c 100644
--- a/docs/CHANGES.html
+++ b/docs/CHANGES.html
@@ -31,6 +31,12 @@
 - Fix a typo that prevented the cpufeatures library to work correctly
   with the new NDK toolchain.
 
+- Linux toolchain binaries now run on Ubuntu 8.04 or higher.
+  More specifically, the r5 binaries did require GLibc 2.11 on the host
+  system, and refused to run with previous releases due to an ABI mismatch
+  in the GNU C Library. The r5b binaries are generated with a special
+  toolchain that instead targets GLibc 2.7 or higher.
+
 OTHER FIXES & CHANGES:
 
 - ndk-build: Speed-up the Cygwin build by avoiding calling "cygpath -m"
@@ -61,6 +67,9 @@
 - <netinet/in6.h>: Add missing declaration for IN6_IS_ADDR_MC_NODELOCAL
   and IN6_IS_ADDR_MC_GLOBAL.
 
+- <asm/byteorder.>: Replaced 'asm' with '__asm__' to allow compilation
+  with -std=c99. See https://review.source.android.com/#change,20076
+
 -------------------------------------------------------------------------------
 android-ndk-r5